Comment 1 for bug 1081913

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

Hi,
I reproduced this bug, and it is easy only to avoid this bug by the following change:

--- a/nova/compute/resource_tracker.py
+++ b/nova/compute/resource_tracker.py
@@ -164,8 +164,6 @@ class ResourceTracker(object):
         # info that is needed via rpc so db access isn't required
         # here.
         old_instance_type_id = instance['instance_type_id']
- old_instance_type = instance_types.get_instance_type(
- old_instance_type_id)

         return db.migration_create(context.elevated(),
                 {'instance_uuid': instance['uuid'],
@@ -174,7 +172,7 @@ class ResourceTracker(object):
                  'dest_compute': self.host,
                  'dest_node': self.nodename,
                  'dest_host': self.driver.get_host_ip_addr(),
- 'old_instance_type_id': old_instance_type['id'],
+ 'old_instance_type_id': old_instance_type_id,
                  'new_instance_type_id': instance_type['id'],
                  'status': 'pre-migrating'})

but the above change is not complete, because old_instance_type is
necessary when 'nova resize-revert' command runs.

So I feel the original problem is that we can delete a flavor in use by 'nova flavor-delete'.