Public bug reported:

Error occured when migrate instance after delete flavor.

Reproduce step :

1. create flavor A
2. boot instance using flavor A
3. delete flavor A
4. migrate instance (ex : nova migrate [instance_uuid])
5. Error occured

Error Log :
==========================================================================
nova-compute.log
   File "/opt/openstack/src/nova/nova/conductor/manager.py", line 422, in 
_object_dispatch
     return getattr(target, method)(*args, **kwargs)

   File "/opt/openstack/src/nova/nova/objects/base.py", line 163, in wrapper
     result = fn(cls, context, *args, **kwargs)

   File "/opt/openstack/src/nova/nova/objects/flavor.py", line 132, in get_by_id
     db_flavor = db.flavor_get(context, id)

   File "/opt/openstack/src/nova/nova/db/api.py", line 1479, in flavor_get
     return IMPL.flavor_get(context, id)

   File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 233, in 
wrapper
     return f(*args, **kwargs)

   File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 4732, in 
flavor_get
     raise exception.FlavorNotFound(flavor_id=id)

 FlavorNotFound: Flavor 8 could not be found.
==========================================================================

This Error is occured when resize_instance method is called as below code:
/opt/openstack/src/nova/nova/compute/manager.py

    def resize_instance(self, context, instance, image,
                        reservations, migration, instance_type,
                        clean_shutdown=True):
....
            if (not instance_type or
                not isinstance(instance_type, objects.Flavor)):
                instance_type = objects.Flavor.get_by_id(
                    context, migration['new_instance_type_id'])
....

context parameter has this data:
{'domain': None, 'project_name': u'admin', 'project_domain': None, 'timestamp': 
'2016-06-14T04:34:50.759410', 'auth_token': 
u'457802dc378442a6ac4a5b952587927e', 'remote_address': u'10.10.10.5, 
'quota_class': None, 'resource_uuid': None, 'is_admin': True, 'user': 
u'694df2010229405e966aafc16a30784f', 'service_catalog': [{u'endpoints': 
[{u'adminURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volumev2', u'name': u'cinderv2'}, {u'endpoints': [{u'adminURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volume', u'name': u'cinder'}], 'tenant': u'9b7ce4df5e1549058687d82e31d127b1', 
'read_only': False, 'project_id': u'9b7ce4df5e1549058687d82e31d127b1', 
'user_id': u'694df2010229405e966aafc16a30784f', 'show_deleted': False, 'roles': 
[u'admin'], 'user_identity': '694df2010229405e966aafc16a30784f 
9b7ce4df5e1549058687d82e31d127b1 - - -', 'read_deleted': 'no', 'request_id': 
u'req-59dca904-6384-4ca0-b696-5731c80198d7', 'instance_lock_checked': False, 
'user_domain': None, 'user_name': u'admin'}

When objects.Flavor.get_by_id method is called, error is occurred because the 
default value of read_deleted is "no".
So, I think context.read_deleted attribute should be set to "yes" before 
objects.Flavor.get_by_id method is called.

I've tested this using stable/kilo and I think liberty, mitaka has same
problem.

Thanks.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: migrate nova

** Tags added: migrate

** Description changed:

  Error occured when migrate instance after delete flavor.
  
  Reproduce step :
  
  1. create flavor A
  2. boot instance using flavor A
  3. delete flavor A
  4. migrate instance (ex : nova migrate [instance_uuid])
  5. Error occured
  
  Error Log :
- 
=============================================================================================
+ ==========================================================================
  nova-compute.log
-    File "/opt/openstack/src/nova/nova/conductor/manager.py", line 422, in 
_object_dispatch
-      return getattr(target, method)(*args, **kwargs)
+    File "/opt/openstack/src/nova/nova/conductor/manager.py", line 422, in 
_object_dispatch
+      return getattr(target, method)(*args, **kwargs)
  
-    File "/opt/openstack/src/nova/nova/objects/base.py", line 163, in wrapper
-      result = fn(cls, context, *args, **kwargs)
+    File "/opt/openstack/src/nova/nova/objects/base.py", line 163, in wrapper
+      result = fn(cls, context, *args, **kwargs)
  
-    File "/opt/openstack/src/nova/nova/objects/flavor.py", line 132, in 
get_by_id
-      db_flavor = db.flavor_get(context, id)
+    File "/opt/openstack/src/nova/nova/objects/flavor.py", line 132, in 
get_by_id
+      db_flavor = db.flavor_get(context, id)
  
-    File "/opt/openstack/src/nova/nova/db/api.py", line 1479, in flavor_get
-      return IMPL.flavor_get(context, id)
+    File "/opt/openstack/src/nova/nova/db/api.py", line 1479, in flavor_get
+      return IMPL.flavor_get(context, id)
  
-    File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 233, in 
wrapper
-      return f(*args, **kwargs)
+    File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 233, in 
wrapper
+      return f(*args, **kwargs)
  
-    File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 4732, in 
flavor_get
-      raise exception.FlavorNotFound(flavor_id=id)
+    File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 4732, in 
flavor_get
+      raise exception.FlavorNotFound(flavor_id=id)
  
-  FlavorNotFound: Flavor 8 could not be found.
- 
=============================================================================================
+  FlavorNotFound: Flavor 8 could not be found.
+ ==========================================================================
  
  This Error is occured when resize_instance method is called as below code:
  /opt/openstack/src/nova/nova/compute/manager.py
  
-     def resize_instance(self, context, instance, image,
-                         reservations, migration, instance_type,
-                         clean_shutdown=True):
+     def resize_instance(self, context, instance, image,
+                         reservations, migration, instance_type,
+                         clean_shutdown=True):
  ....
-             if (not instance_type or
-                 not isinstance(instance_type, objects.Flavor)):
-                 instance_type = objects.Flavor.get_by_id(
-                     context, migration['new_instance_type_id'])
+             if (not instance_type or
+                 not isinstance(instance_type, objects.Flavor)):
+                 instance_type = objects.Flavor.get_by_id(
+                     context, migration['new_instance_type_id'])
  ....
  
  context parameter has this data:
  {'domain': None, 'project_name': u'admin', 'project_domain': None, 
'timestamp': '2016-06-14T04:34:50.759410', 'auth_token': 
u'457802dc378442a6ac4a5b952587927e', 'remote_address': u'10.10.10.5, 
'quota_class': None, 'resource_uuid': None, 'is_admin': True, 'user': 
u'694df2010229405e966aafc16a30784f', 'service_catalog': [{u'endpoints': 
[{u'adminURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'region': u'RegionOne', u'internalURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1'}], 
u'type': u'volumev2', u'name': u'cinderv2'}, {u'endpoints': [{u'adminURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'region': u'RegionOne', u'internalURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1'}], 
u'type': u'volume', u'name': u'cinder'}], 'tenant': 
u'9b7ce4df5e1549058687d82e31d127b1', 'read_only': False, 'project_id': 
u'9b7ce4df5e1549058687d82e31d127b1', 'user_id': 
u'694df2010229405e966aafc16a30784f', 'show_deleted': False, 'roles': 
[u'admin'], 'user_identity': '694df2010229405e966aafc16a30784f 
9b7ce4df5e1549058687d82e31d127b1 - - -', 'read_deleted': 'no', 'request_id': 
u'req-59dca904-6384-4ca0-b696-5731c80198d7', 'instance_lock_checked': False, 
'user_domain': None, 'user_name': u'admin'}
  
  When objects.Flavor.get_by_id method is called, error is occurred because the 
default value of read_deleted is "no".
  So, I think context.read_deleted attribute should be set to "yes" before 
objects.Flavor.get_by_id method is called.
  
  I've tested this using stable/kilo and I think liberty, mitaka has same
  problem.
  
  Thanks.

** Description changed:

  Error occured when migrate instance after delete flavor.
  
  Reproduce step :
  
  1. create flavor A
  2. boot instance using flavor A
  3. delete flavor A
  4. migrate instance (ex : nova migrate [instance_uuid])
  5. Error occured
  
  Error Log :
  ==========================================================================
  nova-compute.log
     File "/opt/openstack/src/nova/nova/conductor/manager.py", line 422, in 
_object_dispatch
       return getattr(target, method)(*args, **kwargs)
  
     File "/opt/openstack/src/nova/nova/objects/base.py", line 163, in wrapper
       result = fn(cls, context, *args, **kwargs)
  
     File "/opt/openstack/src/nova/nova/objects/flavor.py", line 132, in 
get_by_id
       db_flavor = db.flavor_get(context, id)
  
     File "/opt/openstack/src/nova/nova/db/api.py", line 1479, in flavor_get
       return IMPL.flavor_get(context, id)
  
     File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 233, in 
wrapper
       return f(*args, **kwargs)
  
     File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 4732, in 
flavor_get
       raise exception.FlavorNotFound(flavor_id=id)
  
   FlavorNotFound: Flavor 8 could not be found.
  ==========================================================================
  
  This Error is occured when resize_instance method is called as below code:
  /opt/openstack/src/nova/nova/compute/manager.py
  
      def resize_instance(self, context, instance, image,
                          reservations, migration, instance_type,
                          clean_shutdown=True):
  ....
              if (not instance_type or
                  not isinstance(instance_type, objects.Flavor)):
                  instance_type = objects.Flavor.get_by_id(
                      context, migration['new_instance_type_id'])
  ....
  
  context parameter has this data:
- {'domain': None, 'project_name': u'admin', 'project_domain': None, 
'timestamp': '2016-06-14T04:34:50.759410', 'auth_token': 
u'457802dc378442a6ac4a5b952587927e', 'remote_address': u'10.10.10.5, 
'quota_class': None, 'resource_uuid': None, 'is_admin': True, 'user': 
u'694df2010229405e966aafc16a30784f', 'service_catalog': [{u'endpoints': 
[{u'adminURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'region': u'RegionOne', u'internalURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.iwilab.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1'}], 
u'type': u'volumev2', u'name': u'cinderv2'}, {u'endpoints': [{u'adminURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'region': u'RegionOne', u'internalURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.iwilab.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1'}], 
u'type': u'volume', u'name': u'cinder'}], 'tenant': 
u'9b7ce4df5e1549058687d82e31d127b1', 'read_only': False, 'project_id': 
u'9b7ce4df5e1549058687d82e31d127b1', 'user_id': 
u'694df2010229405e966aafc16a30784f', 'show_deleted': False, 'roles': 
[u'admin'], 'user_identity': '694df2010229405e966aafc16a30784f 
9b7ce4df5e1549058687d82e31d127b1 - - -', 'read_deleted': 'no', 'request_id': 
u'req-59dca904-6384-4ca0-b696-5731c80198d7', 'instance_lock_checked': False, 
'user_domain': None, 'user_name': u'admin'}
+ {'domain': None, 'project_name': u'admin', 'project_domain': None, 
'timestamp': '2016-06-14T04:34:50.759410', 'auth_token': 
u'457802dc378442a6ac4a5b952587927e', 'remote_address': u'10.10.10.5, 
'quota_class': None, 'resource_uuid': None, 'is_admin': True, 'user': 
u'694df2010229405e966aafc16a30784f', 'service_catalog': [{u'endpoints': 
[{u'adminURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volumev2', u'name': u'cinderv2'}, {u'endpoints': [{u'adminURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volume', u'name': u'cinder'}], 'tenant': u'9b7ce4df5e1549058687d82e31d127b1', 
'read_only': False, 'project_id': u'9b7ce4df5e1549058687d82e31d127b1', 
'user_id': u'694df2010229405e966aafc16a30784f', 'show_deleted': False, 'roles': 
[u'admin'], 'user_identity': '694df2010229405e966aafc16a30784f 
9b7ce4df5e1549058687d82e31d127b1 - - -', 'read_deleted': 'no', 'request_id': 
u'req-59dca904-6384-4ca0-b696-5731c80198d7', 'instance_lock_checked': False, 
'user_domain': None, 'user_name': u'admin'}
  
  When objects.Flavor.get_by_id method is called, error is occurred because the 
default value of read_deleted is "no".
  So, I think context.read_deleted attribute should be set to "yes" before 
objects.Flavor.get_by_id method is called.
  
  I've tested this using stable/kilo and I think liberty, mitaka has same
  problem.
  
  Thanks.

** Tags added: nova

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1592253

Title:
  Bug: migrate instance after delete flavor

Status in OpenStack Compute (nova):
  New

Bug description:
  Error occured when migrate instance after delete flavor.

  Reproduce step :

  1. create flavor A
  2. boot instance using flavor A
  3. delete flavor A
  4. migrate instance (ex : nova migrate [instance_uuid])
  5. Error occured

  Error Log :
  ==========================================================================
  nova-compute.log
     File "/opt/openstack/src/nova/nova/conductor/manager.py", line 422, in 
_object_dispatch
       return getattr(target, method)(*args, **kwargs)

     File "/opt/openstack/src/nova/nova/objects/base.py", line 163, in wrapper
       result = fn(cls, context, *args, **kwargs)

     File "/opt/openstack/src/nova/nova/objects/flavor.py", line 132, in 
get_by_id
       db_flavor = db.flavor_get(context, id)

     File "/opt/openstack/src/nova/nova/db/api.py", line 1479, in flavor_get
       return IMPL.flavor_get(context, id)

     File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 233, in 
wrapper
       return f(*args, **kwargs)

     File "/opt/openstack/src/nova/nova/db/sqlalchemy/api.py", line 4732, in 
flavor_get
       raise exception.FlavorNotFound(flavor_id=id)

   FlavorNotFound: Flavor 8 could not be found.
  ==========================================================================

  This Error is occured when resize_instance method is called as below code:
  /opt/openstack/src/nova/nova/compute/manager.py

      def resize_instance(self, context, instance, image,
                          reservations, migration, instance_type,
                          clean_shutdown=True):
  ....
              if (not instance_type or
                  not isinstance(instance_type, objects.Flavor)):
                  instance_type = objects.Flavor.get_by_id(
                      context, migration['new_instance_type_id'])
  ....

  context parameter has this data:
  {'domain': None, 'project_name': u'admin', 'project_domain': None, 
'timestamp': '2016-06-14T04:34:50.759410', 'auth_token': 
u'457802dc378442a6ac4a5b952587927e', 'remote_address': u'10.10.10.5, 
'quota_class': None, 'resource_uuid': None, 'is_admin': True, 'user': 
u'694df2010229405e966aafc16a30784f', 'service_catalog': [{u'endpoints': 
[{u'adminURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v2/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volumev2', u'name': u'cinderv2'}, {u'endpoints': [{u'adminURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', u'region': 
u'RegionOne', u'internalURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1', 
u'publicURL': 
u'https://devel-api.com:8776/v1/9b7ce4df5e1549058687d82e31d127b1'}], u'type': 
u'volume', u'name': u'cinder'}], 'tenant': u'9b7ce4df5e1549058687d82e31d127b1', 
'read_only': False, 'project_id': u'9b7ce4df5e1549058687d82e31d127b1', 
'user_id': u'694df2010229405e966aafc16a30784f', 'show_deleted': False, 'roles': 
[u'admin'], 'user_identity': '694df2010229405e966aafc16a30784f 
9b7ce4df5e1549058687d82e31d127b1 - - -', 'read_deleted': 'no', 'request_id': 
u'req-59dca904-6384-4ca0-b696-5731c80198d7', 'instance_lock_checked': False, 
'user_domain': None, 'user_name': u'admin'}

  When objects.Flavor.get_by_id method is called, error is occurred because the 
default value of read_deleted is "no".
  So, I think context.read_deleted attribute should be set to "yes" before 
objects.Flavor.get_by_id method is called.

  I've tested this using stable/kilo and I think liberty, mitaka has
  same problem.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1592253/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to