From 9eadd4fdf4a76a9ea92790a6c4aa20d0aa32ef86 Mon Sep 17 00:00:00 2001 From: Wangpan Date: Thu, 6 Dec 2012 15:13:54 +0800 Subject: Fix revert resize failure with disk.local not found If we resize an instance from a flavor without ephemeral disk to a flavor with it, it resizes OK, but if we revert this resize, the instance fail to spawn with error disk.local not found. The reason is that the libvirt driver get the wrong resized flavor from instance, so the flavor info of instance should be updated before instance spawns. Fixes: bug #1086688 Change-Id: I2c54586803c60baab7f20297b309a8e6c4134d13 --- nova/compute/manager.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 7c33a8c8a..4e78e03e6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1720,16 +1720,21 @@ class ComputeManager(manager.SchedulerDependentManager): self._notify_about_instance_usage( context, instance, "resize.revert.start") + old_instance_type = migration['old_instance_type_id'] + instance_type = instance_types.get_instance_type(old_instance_type) + instance = self._instance_update(context, - instance['uuid'], - host=migration['source_compute'], - node=migration['source_node']) + instance['uuid'], + memory_mb=instance_type['memory_mb'], + vcpus=instance_type['vcpus'], + root_gb=instance_type['root_gb'], + ephemeral_gb=instance_type['ephemeral_gb'], + instance_type_id=instance_type['id'], + host=migration['source_compute'], + node=migration['source_node']) self.network_api.setup_networks_on_host(context, instance, migration['source_compute']) - old_instance_type = migration['old_instance_type_id'] - instance_type = instance_types.get_instance_type(old_instance_type) - bdms = self._get_instance_volume_bdms(context, instance['uuid']) block_device_info = self._get_instance_volume_block_device_info( context, instance['uuid']) @@ -1748,11 +1753,6 @@ class ComputeManager(manager.SchedulerDependentManager): # the 'old' VM already has the preferred attributes self._instance_update(context, instance['uuid'], - memory_mb=instance_type['memory_mb'], - vcpus=instance_type['vcpus'], - root_gb=instance_type['root_gb'], - ephemeral_gb=instance_type['ephemeral_gb'], - instance_type_id=instance_type['id'], launched_at=timeutils.utcnow(), expected_task_state=task_states. RESIZE_REVERTING) -- cgit