can not delete an instance when resizing

Bug #1689289 reported by 赵明俊
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Undecided
Unassigned

Bug Description

Description
===========

When an instance task state is RESIZE_MIGRATED or RESIZE_FINISH, delete the instance will hint an error,
I found some problems with the code, because my flavor contains vram and instance at a special task state, a TypeError or an AttributeError will throw out.

Delete when instance at resize_migrated task state, AttributeError will throw out.
Delete when instance at resize_finish task state, TypeError will throw out.

Steps to reproduce
==================
1.create an instance use flavor1,names server1
2.resize it but not resize confirm.
3.delete the instance quickly.
4.you can run " nova resize service1 flavor2 && sleep 2.0 && nova delete server1 ".

Just delete the instance quickly

When resize an instance, its task state will go through None => resize_migrating => resize_migrated => resize_finish => None, the purpose of sleep is to catch the target state,resize_migrated or resize_finish.

Environment
===========

RDO Newton
DevStack (master=pike)

Logs & Configs
==============

 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 338, in wrapped
     return f(*args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 914, in delete
     self._delete(req.environ['nova.context'], req, id)
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 768, in _delete
     self.compute_api.delete(context, instance)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 166, in inner
     return function(self, context, instance, *args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 173, in _wrapped
     return fn(self, context, instance, *args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 147, in inner
     return f(self, context, instance, *args, **kw)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 2048, in delete
     self._delete_instance(context, instance)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 2039, in _delete_instance
     task_state=task_states.DELETING)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1815, in _delete
     quotas.rollback()
   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
     self.force_reraise()
   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1735, in _delete
     project_id, user_id)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1878, in _create_reservations
     instance_memory_mb = old_flavor.memory_mb + vram_mb
 TypeError: unsupported operand type(s) for +: 'int' and 'unicode'

OR

Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 338, in wrapped
     return f(*args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 914, in delete
     self._delete(req.environ['nova.context'], req, id)
   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 768, in _delete
     self.compute_api.delete(context, instance)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 166, in inner
     return function(self, context, instance, *args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 173, in _wrapped
     return fn(self, context, instance, *args, **kwargs)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 147, in inner
     return f(self, context, instance, *args, **kw)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 2048, in delete
     self._delete_instance(context, instance)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 2039, in _delete_instance
     task_state=task_states.DELETING)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1815, in _delete
     quotas.rollback()
   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
     self.force_reraise()
   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1735, in _delete
     project_id, user_id)
   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1876, in _create_reservations
     instance_vcpus = old_flavor.vcpus
 AttributeError: 'NoneType' object has no attribute 'vcpus'

赵明俊 (falseuser)
Changed in nova:
assignee: nobody → 赵明俊 (falseuser)
赵明俊 (falseuser)
description: updated
赵明俊 (falseuser)
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/463466

Changed in nova:
status: New → In Progress
赵明俊 (falseuser)
tags: added: api
赵明俊 (falseuser)
tags: added: compute
removed: api
Revision history for this message
Sean Dague (sdague) wrote :

Automatically discovered version newton in description. If this is incorrect, please update the description to include 'nova version: ...'

tags: added: openstack-version.newton
Changed in nova:
status: In Progress → Confirmed
assignee: 赵明俊 (falseuser) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Balazs Gibizer (<email address hidden>) on branch: master
Review: https://review.opendev.org/463466
Reason: This is a pretty old patch in merge conflict. Feel free to restore it (or ask gibi on irc to restore it) if you still working on it.

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.