Resize instance should consider deleted flavor

Bug #1081913 reported by Jiang Yong
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Triaged
Critical
Unassigned

Bug Description

Resize a instance associated with a deleted flavor will get a error:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/openstack/common/rpc/amqp.py", line 275, in _process_data
    rval = self.proxy.dispatch(ctxt, version, method, **args)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/openstack/common/rpc/dispatcher.py", line 145, in dispatch
    return getattr(proxyobj, method)(ctxt, **kwargs)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/exception.py", line 117, in wrapped
    temp_level, payload)
  File "/usr/lib64/python2.6/contextlib.py", line 23, in __exit__
    self.gen.next()
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/exception.py", line 92, in wrapped
    return f(*args, **kw)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/manager.py", line 181, in decorated_function
    pass
  File "/usr/lib64/python2.6/contextlib.py", line 23, in __exit__
    self.gen.next()
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/manager.py", line 167, in decorated_function
    return function(self, context, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/manager.py", line 202, in decorated_function
    kwargs['instance']['uuid'], e, sys.exc_info())
  File "/usr/lib64/python2.6/contextlib.py", line 23, in __exit__
    self.gen.next()
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/manager.py", line 196, in decorated_function
    return function(self, context, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/manager.py", line 1562, in prep_resize
    old_instance_type_id)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/compute/instance_types.py", line 139, in get_instance_type
    return db.instance_type_get(ctxt, instance_type_id)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/db/api.py", line 1443, in instance_type_get
    return IMPL.instance_type_get(context, id)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 129, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 3979, in instance_type_get
    raise exception.InstanceTypeNotFound(instance_type_id=id)
InstanceTypeNotFound: Instance type 19 could not be found.

Michael Still (mikal)
Changed in nova:
status: New → Triaged
importance: Undecided → Critical
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'.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.