I guess we can't do #2 because the resource tracker actually makes decisions based on the instance.vm_state:
https://github.com/openstack/nova/blob/8e0b98f54ec382fbebc2fcd83f4b951a3cc40c33/nova/compute/resource_tracker.py#L840 ALLOW_RESOURCE_REMOVAL = [DELETED, SHELVED_OFFLOADED] So we have to set the vm_state before calling the resource tracker which has to happen before nulling out the instance.host and instance.node values. I'll add the semaphore to shelve_instance in the compute manager though, that should fix this race. ** No longer affects: tempest ** Also affects: nova/mitaka Importance: Undecided Status: New ** Changed in: nova/mitaka Status: New => Confirmed ** Changed in: nova/mitaka Importance: Undecided => Medium -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1611008 Title: ServersNegativeTestJSON.test_suspend_server_invalid_state fails with "NovaException: Unable to find host for Instance" Status in OpenStack Compute (nova): Triaged Status in OpenStack Compute (nova) mitaka series: Confirmed Bug description: Seen here: http://logs.openstack.org/91/327191/22/check/gate-tempest-dsvm-full- ubuntu- xenial/6a11005/logs/screen-n-api.txt.gz?level=TRACE#_2016-08-06_23_42_20_711 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions [req-86f8ef99-a9e4-49f0-8258-a0f40dea4a51 tempest-ServersNegativeTestJSON-16764714 tempest-ServersNegativeTestJSON-16764714] Unexpected exception in API method 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions Traceback (most recent call last): 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/api/openstack/extensions.py", line 338, in wrapped 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions return f(*args, **kwargs) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/api/openstack/compute/suspend_server.py", line 41, in _suspend 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions self.compute_api.suspend(context, server) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/api.py", line 164, in inner 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions return function(self, context, instance, *args, **kwargs) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/api.py", line 171, in _wrapped 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions return fn(self, context, instance, *args, **kwargs) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/api.py", line 145, in inner 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions return f(self, context, instance, *args, **kw) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/api.py", line 2782, in suspend 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions self.compute_rpcapi.suspend_instance(context, instance) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/rpcapi.py", line 953, in suspend_instance 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions server=_compute_host(None, instance), version=version) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions File "/opt/stack/new/nova/nova/compute/rpcapi.py", line 53, in _compute_host 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions 'Instance %s') % instance.uuid) 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions NovaException: Unable to find host for Instance 480c8b6f-ab2d-4a49-8344-a3a679b01472 2016-08-06 23:42:20.711 10592 ERROR nova.api.openstack.extensions http://logstash.openstack.org/#dashboard/file/logstash.json?query=message%3A%5C%22NovaException%3A%20Unable%20to%20find%20host%20for%20Instance%5C%22%20AND%20tags%3A%5C%22screen-n-api.txt%5C%22&from=7d There are 4 hits in 7 days, check and gate, all failures, all on the master branch. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1611008/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

