diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-02-10 00:26:24 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-02-10 00:26:24 +0000 |
commit | 911ea28ac4d7df4e51e9ba6bf0e577ea37edf47e (patch) | |
tree | 832934ad9eff04e46ed97f7716fa477272014d41 | |
parent | d8a02662fa18222c6bd179dd5c88f02814d14c0d (diff) | |
parent | ad101ce5bac1af60adeeb5be12ec30fbd00a624e (diff) | |
download | nova-911ea28ac4d7df4e51e9ba6bf0e577ea37edf47e.tar.gz nova-911ea28ac4d7df4e51e9ba6bf0e577ea37edf47e.tar.xz nova-911ea28ac4d7df4e51e9ba6bf0e577ea37edf47e.zip |
Merge "fix VM power state to be NOSTATE when instance not found"
-rwxr-xr-x | nova/compute/manager.py | 8 | ||||
-rw-r--r-- | nova/tests/compute/test_compute.py | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index bb4af94a6..504d16da2 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3371,7 +3371,7 @@ class ComputeManager(manager.SchedulerDependentManager): vm_instance = self.driver.get_info(db_instance) vm_power_state = vm_instance['state'] except exception.InstanceNotFound: - vm_power_state = power_state.SHUTDOWN + vm_power_state = power_state.NOSTATE # Note(maoy): the above get_info call might take a long time, # for example, because of a broken libvirt driver. # We re-query the DB to get the latest instance info to minimize @@ -3458,6 +3458,12 @@ class ComputeManager(manager.SchedulerDependentManager): # instrumentation is done. See bug 1097806 for details. LOG.warn(_("Instance is paused unexpectedly. Ignore."), instance=db_instance) + elif vm_power_state == power_state.NOSTATE: + # Occasionally, depending on the status of the hypervisor, + # which could be restarting for example, an instance may + # not be found. Therefore just log the condidtion. + LOG.warn(_("Instance is unexpectedly not found. Ignore."), + instance=db_instance) elif vm_state == vm_states.STOPPED: if vm_power_state not in (power_state.NOSTATE, power_state.SHUTDOWN, diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 442832553..a75ba00cc 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -2776,7 +2776,7 @@ class ComputeTestCase(BaseTestCase): instances = db.instance_get_all(self.context) LOG.info(_("After force-killing instances: %s"), instances) self.assertEqual(len(instances), 1) - self.assertEqual(task_states.POWERING_OFF, instances[0]['task_state']) + self.assertEqual(instances[0]['task_state'], None) def test_add_instance_fault(self): instance = self._create_fake_instance() |