'nova resize-revert' does not handle the deleted flavor

Bug #1091490 reported by Ken'ichi Ohmichi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Ken'ichi Ohmichi

Bug Description

'nova resize-revert' does not handle the deleted flavor,
and an exception happens in the case.

* How to reproduce the problem on DevStack:
  $ nova flavor-create sample 10 512 0 2
  $ nova boot --image cirros-0.3.0-x86_64-uec --flavor sample test01
  $ nova resize test01 m1.tiny
  $ nova flavor-delete 10
  $ nova resize-revert test01
  ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-b0d3e016-9608-4a87-a0cc-44dfe00b25a1)
  $

I feel it is better that 'nova resize-revert' prints a error reason like
"Previous flavor could not be found".

* The contents of nova.log
---
2012-12-15 01:10:07 22693 ERROR nova.manager [-] Error during ComputeManager.update_available_resource: Instance type 6 could not be found.
2012-12-15 01:10:07 22693 TRACE nova.manager Traceback (most recent call last):
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/manager.py", line 175, in periodic_tasks
2012-12-15 01:10:07 22693 TRACE nova.manager task(self, context)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/manager.py", line 3257, in update_available_resource2012-12-15 01:10:07 22693 TRACE nova.manager rt.update_available_resource(context)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/openstack/common/lockutils.py", line 228, in inner
2012-12-15 01:10:07 22693 TRACE nova.manager retval = f(*args, **kwargs)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 269, in update_available_resource
2012-12-15 01:10:07 22693 TRACE nova.manager self._update_usage_from_migrations(resources, migrations)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 452, in _update_usage_from_migrations
2012-12-15 01:10:07 22693 TRACE nova.manager self._update_usage_from_migration(resources, migration)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 416, in _update_usage_from_migration
2012-12-15 01:10:07 22693 TRACE nova.manager instance_type = instance_types.get_instance_type(itype)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/instance_types.py", line 157, in get_instance_type
2012-12-15 01:10:07 22693 TRACE nova.manager return db.instance_type_get(ctxt, instance_type_id)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/api.py", line 1271, in instance_type_get
2012-12-15 01:10:07 22693 TRACE nova.manager return IMPL.instance_type_get(context, id)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 127, in wrapper
2012-12-15 01:10:07 22693 TRACE nova.manager return f(*args, **kwargs)
2012-12-15 01:10:07 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 3641, in instance_type_get
2012-12-15 01:10:07 22693 TRACE nova.manager raise exception.InstanceTypeNotFound(instance_type_id=id)
2012-12-15 01:10:07 22693 TRACE nova.manager InstanceTypeNotFound: Instance type 6 could not be found.
2012-12-15 01:10:07 22693 TRACE nova.manager
[..]
2012-12-15 01:11:31 22693 AUDIT nova.compute.resource_tracker [-] Updating from migration 58d2088e-a771-4cd0-9964-8d83ce260dc3
2012-12-15 01:11:31 22693 ERROR nova.manager [-] Error during ComputeManager.update_available_resource: Instance type 6 could not be found.
2012-12-15 01:11:31 22693 TRACE nova.manager Traceback (most recent call last):
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/manager.py", line 175, in periodic_tasks
2012-12-15 01:11:31 22693 TRACE nova.manager task(self, context)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/manager.py", line 3257, in update_available_resource
2012-12-15 01:11:31 22693 TRACE nova.manager rt.update_available_resource(context)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/openstack/common/lockutils.py", line 228, in inner
2012-12-15 01:11:31 22693 TRACE nova.manager retval = f(*args, **kwargs)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 269, in update_available_resource
2012-12-15 01:11:31 22693 TRACE nova.manager self._update_usage_from_migrations(resources, migrations)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 452, in _update_usage_from_migrations
2012-12-15 01:11:31 22693 TRACE nova.manager self._update_usage_from_migration(resources, migration)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/resource_tracker.py", line 416, in _update_usage_from_migration
2012-12-15 01:11:31 22693 TRACE nova.manager instance_type = instance_types.get_instance_type(itype)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/compute/instance_types.py", line 157, in get_instance_type
2012-12-15 01:11:31 22693 TRACE nova.manager return db.instance_type_get(ctxt, instance_type_id)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/api.py", line 1271, in instance_type_get
2012-12-15 01:11:31 22693 TRACE nova.manager return IMPL.instance_type_get(context, id)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 127, in wrapper
2012-12-15 01:11:31 22693 TRACE nova.manager return f(*args, **kwargs)
2012-12-15 01:11:31 22693 TRACE nova.manager File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 3641, in instance_type_get
2012-12-15 01:11:31 22693 TRACE nova.manager raise exception.InstanceTypeNotFound(instance_type_id=id)
2012-12-15 01:11:31 22693 TRACE nova.manager InstanceTypeNotFound: Instance type 6 could not be found.
2012-12-15 01:11:31 22693 TRACE nova.manager

description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/18284

Changed in nova:
assignee: nobody → Ken'ichi Ohmichi (oomichi)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/18284
Committed: http://github.com/openstack/nova/commit/4e02fa1964f5de3a6ba345d858623f35b24beafd
Submitter: Jenkins
Branch: master

commit 4e02fa1964f5de3a6ba345d858623f35b24beafd
Author: Ken'ichi Ohmichi <email address hidden>
Date: Tue Jan 8 05:08:17 2013 +0900

    Add exception handler for previous deleted flavor.

    An exception happens if a previous flavor is deleted and
    'nova resize-revert' run, because 'nova resize-revert' does
    not handle the deleted flavor.
    And also we have the same problem in _update_usage_from_migration().
    This patch fixes the problems.

    How to reproduce the problem on DevStack:
      $ nova flavor-create sample 10 512 0 2
      $ nova boot --image cirros-0.3.0-x86_64-uec --flavor sample test01
      $ nova resize test01 m1.tiny
      $ nova flavor-delete 10
      $ nova resize-revert test01

    Before applying this patch:
      $ nova resize-revert test01
      ERROR: The server could not comply with the request since it is
      either malformed or otherwise incorrect. (HTTP 400) (Request-ID:
      req-b0d3e016-9608-4a87-a0cc-44dfe00b25a1)
      $

    After applying this patch:
      $ nova resize-revert test01
      ERROR: Flavor used by the instance could not be found. (HTTP 400)
      (Request-ID: req-ed4ce174-33f2-4258-b522-674a1023ea74)
      $

    Fixes bug 1091490

    Change-Id: I39dd23a7565ae66544e8bc2aa7ad3299eb61bfcc

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-2 → 2013.1
Revision history for this message
kaka (mingb1989) wrote :

https://review.openstack.org/18284
can fixed this bug ?

catch 'InstanceTypeNotFound' exception in '_action_revert_resize' , but can't revert instance

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.