Migrate DHCP host info during resize
Update instance host to migration_ref['dest_compute'] before
update_dhcp to make its DHCP host info will be written in dhcp-hostsfile.
Make similiar change in finish_revert_resize.
Fixes bug 1065440
Change-Id: I9d3e0ebf8512f98f2943999e7ad95bc58f2bf585
(cherry picked from commit 9ea41fc80b
)
This commit is contained in:
parent
a0e18d637f
commit
65a2d0a3ce
@ -1477,6 +1477,12 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
self._notify_about_instance_usage(
|
||||
context, instance, "resize.revert.start")
|
||||
|
||||
instance = self._instance_update(context,
|
||||
instance['uuid'],
|
||||
host=migration_ref['source_compute'])
|
||||
self.network_api.setup_networks_on_host(context, instance,
|
||||
migration_ref['source_compute'])
|
||||
|
||||
old_instance_type = migration_ref['old_instance_type_id']
|
||||
instance_type = instance_types.get_instance_type(old_instance_type)
|
||||
|
||||
@ -1499,7 +1505,6 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
self._instance_update(context,
|
||||
instance['uuid'],
|
||||
memory_mb=instance_type['memory_mb'],
|
||||
host=migration_ref['source_compute'],
|
||||
vcpus=instance_type['vcpus'],
|
||||
root_gb=instance_type['root_gb'],
|
||||
ephemeral_gb=instance_type['ephemeral_gb'],
|
||||
@ -1631,6 +1636,7 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
{'status': 'post-migrating'})
|
||||
|
||||
self._instance_update(context, instance['uuid'],
|
||||
host=migration_ref['dest_compute'],
|
||||
task_state=task_states.RESIZE_MIGRATED,
|
||||
expected_task_state=task_states.
|
||||
RESIZE_MIGRATING)
|
||||
@ -1693,7 +1699,6 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
instance = self._instance_update(context,
|
||||
instance['uuid'],
|
||||
vm_state=vm_states.RESIZED,
|
||||
host=migration_ref['dest_compute'],
|
||||
launched_at=timeutils.utcnow(),
|
||||
task_state=None,
|
||||
expected_task_state=task_states.
|
||||
|
@ -1859,8 +1859,8 @@ class ComputeTestCase(BaseTestCase):
|
||||
migration_id=migration_ref['id'],
|
||||
image={})
|
||||
inst = db.instance_get_by_uuid(self.context, new_instance['uuid'])
|
||||
# NOTE(vish): removed check of dest_compute because it doesn't
|
||||
# happen until finish_resize in folsom
|
||||
self.assertEqual(migration_ref['dest_compute'], inst['host'])
|
||||
|
||||
self.compute.terminate_instance(self.context,
|
||||
instance=jsonutils.to_primitive(inst))
|
||||
|
||||
@ -1921,6 +1921,15 @@ class ComputeTestCase(BaseTestCase):
|
||||
self.compute.revert_resize(context,
|
||||
migration_id=migration_ref['id'], instance=rpcinst,
|
||||
reservations=reservations)
|
||||
|
||||
def fake_setup_networks_on_host(cls, ctxt, instance, host):
|
||||
self.assertEqual(host, migration_ref['source_compute'])
|
||||
inst = db.instance_get_by_uuid(ctxt, instance['uuid'])
|
||||
self.assertEqual(host, inst['host'])
|
||||
|
||||
self.stubs.Set(network_api.API, 'setup_networks_on_host',
|
||||
fake_setup_networks_on_host)
|
||||
|
||||
self.compute.finish_revert_resize(context,
|
||||
migration_id=migration_ref['id'], instance=rpcinst,
|
||||
reservations=reservations)
|
||||
|
Loading…
Reference in New Issue
Block a user