[placement] Train upgrade warning

melanie witt melwittt at gmail.com
Wed Nov 4 17:08:50 UTC 2020

On 11/4/20 08:54, Seth Tunstall wrote:
> Hello,
> In case it helps anyone else searching for this in future: Melanie's 
> suggestion to clean out the orphaned consumers worked perfectly in my 
> situation.
> The last two I had were apparently left over from the original build of 
> this environment. I brute-force cleaned them out of the DB manually:
> DELETE FROM nova_cell0.block_device_mapping WHERE 
> nova_cell0.block_device_mapping.instance_uuid IN (SELECT uuid FROM 
> nova_api.consumers WHERE nova_api.consumers.uuid NOT IN (SELECT 
> nova_api.allocations.consumer_id FROM nova_api.allocations));


> Caveat: I am not intimately familiar with how the ORM handles these DB 
> tables, I may have done something stupid here.

Hm, sorry, this isn't what I was suggesting you do ... I was making a 
guess that you might have instances with 'deleted' != 0 in your 
nova_cell0 database and that if so, they needed to be archived using 
'nova-manage db archive_deleted_rows' and then that might take care of 
removing their corresponding nova_api.instance_mappings which would make 
the manual cleanup find more rows (the rows that were being complained 

What you did is "OK" (not harmful) if the nova_cell0.instances records 
associated with those records were 'deleted' column != 0. But there's 
likely more cruft rows left behind that will never be removed. 
nova-manage db archive_deleted_rows should be used whenever possible 
because it knows how to remove all the things.

> I tried to run:
> nova-manage db archive_deleted_rows --verbose --until-complete --all-cells
> but nova-db-manage complained that it didn't recognise --no-cells

This is with the train code? --all-cells was added in train [1]. If you 
are running with code prior to train, you have to pass a nova config 
file to the nova-manage command that has its [api_database]connection 
set to the nova_api database connection url and the [database]connection 
set to the nova_cell0 database. Example:

nova-manage --config-file <nova.conf pointing at nova_cell0> db 
archive_deleted_rows ...


[1] https://docs.openstack.org/nova/train/cli/nova-manage.html#nova-database

More information about the openstack-discuss mailing list