Permalink
Browse files

Merge "Update port binding when unshelve instance"

  • Loading branch information...
2 parents 4fad258 + 4f81855 commit 740fa022091d3ae6a206c64f0d8d086fc2d6feaf Jenkins committed with openstack-gerrit Jul 21, 2014
Showing with 13 additions and 1 deletion.
  1. +3 −1 nova/compute/manager.py
  2. +10 −0 nova/tests/compute/test_shelve.py
View
@@ -4010,7 +4010,6 @@ def _unshelve_instance(self, context, instance, image, filter_properties,
instance.task_state = task_states.SPAWNING
instance.save()
- network_info = self._get_instance_nw_info(context, instance)
bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(
context, instance.uuid)
block_device_info = self._prep_block_device(context, instance, bdms)
@@ -4028,6 +4027,9 @@ def _unshelve_instance(self, context, instance, image, filter_properties,
shelved_image_ref = instance.image_ref
instance.image_ref = image['id']
+ self.network_api.migrate_instance_finish(context, instance,
+ {'source_compute': '', 'dest_compute': self.host})
+ network_info = self._get_instance_nw_info(context, instance)
try:
with rt.instance_claim(context, instance, limits):
self.driver.spawn(context, instance, image, injected_files=[],
@@ -194,6 +194,8 @@ def test_unshelve(self):
self.mox.StubOutWithMock(self.compute, '_get_power_state')
self.mox.StubOutWithMock(self.rt, 'instance_claim')
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
+ self.mox.StubOutWithMock(self.compute.network_api,
+ 'migrate_instance_finish')
self.deleted_image_id = None
@@ -218,6 +220,9 @@ def fake_claim(context, instance, limits):
mox.IgnoreArg()).AndReturn('fake_bdm')
db_instance['key_data'] = None
db_instance['auto_disk_config'] = None
+ self.compute.network_api.migrate_instance_finish(
+ self.context, instance, {'source_compute': '',
+ 'dest_compute': self.compute.host})
self.compute.driver.spawn(self.context, instance, image,
injected_files=[], admin_password=None,
network_info=[],
@@ -276,6 +281,8 @@ def test_unshelve_volume_backed(self):
self.mox.StubOutWithMock(self.compute, '_get_power_state')
self.mox.StubOutWithMock(self.rt, 'instance_claim')
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
+ self.mox.StubOutWithMock(self.compute.network_api,
+ 'migrate_instance_finish')
self.compute._notify_about_instance_usage(self.context, instance,
'unshelve.start')
@@ -288,6 +295,9 @@ def test_unshelve_volume_backed(self):
mox.IgnoreArg()).AndReturn('fake_bdm')
db_instance['key_data'] = None
db_instance['auto_disk_config'] = None
+ self.compute.network_api.migrate_instance_finish(
+ self.context, instance, {'source_compute': '',
+ 'dest_compute': self.compute.host})
self.rt.instance_claim(self.context, instance, limits).AndReturn(
claims.Claim(db_instance, self.rt, _fake_resources()))
self.compute.driver.spawn(self.context, instance, None,

0 comments on commit 740fa02

Please sign in to comment.