diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-03-03 19:44:50 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-03-03 19:44:50 +0000 |
| commit | a9be29baefafd3d7f80a098cce7226c1db2c1834 (patch) | |
| tree | 51713f576dd66842820bc1e72d1567a7f39d3501 | |
| parent | 63dc5580289da71f5618204e81c9f4d6f2dceba2 (diff) | |
| parent | 10f43aa0bfc6d41282fc19fb4bacddb8bc85ddc5 (diff) | |
| download | nova-a9be29baefafd3d7f80a098cce7226c1db2c1834.tar.gz nova-a9be29baefafd3d7f80a098cce7226c1db2c1834.tar.xz nova-a9be29baefafd3d7f80a098cce7226c1db2c1834.zip | |
Merge "Fix target host variable from being overwritten"
| -rw-r--r-- | nova/compute/api.py | 6 | ||||
| -rw-r--r-- | nova/tests/compute/test_compute.py | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 27a9bed5c..bd2bafe33 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2455,10 +2455,10 @@ class API(base.Base): raising an exception. """ LOG.debug(_('vm evacuation scheduled')) - host = instance['host'] - service = self.db.service_get_by_compute_host(context, host) + inst_host = instance['host'] + service = self.db.service_get_by_compute_host(context, inst_host) if self.servicegroup_api.service_is_up(service): - msg = (_('Instance compute service state on %(host)s ' + msg = (_('Instance compute service state on %(inst_host)s ' 'expected to be down, but it was up.' ) % locals()) LOG.error(msg) diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 446553a8e..088332647 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -6403,8 +6403,14 @@ class ComputeAPITestCase(BaseTestCase): def fake_service_is_up(*args, **kwargs): return False + def fake_rebuild_instance(*args, **kwargs): + db.instance_update(self.context, instance_uuid, + {'host': kwargs['host']}) + self.stubs.Set(self.compute_api.servicegroup_api, 'service_is_up', fake_service_is_up) + self.stubs.Set(self.compute_api.compute_rpcapi, 'rebuild_instance', + fake_rebuild_instance) self.compute_api.evacuate(self.context.elevated(), instance, host='fake_dest_host', @@ -6413,6 +6419,7 @@ class ComputeAPITestCase(BaseTestCase): instance = db.instance_get_by_uuid(self.context, instance_uuid) self.assertEqual(instance['task_state'], task_states.REBUILDING) + self.assertEqual(instance['host'], 'fake_dest_host') db.instance_destroy(self.context, instance['uuid']) |
