Instance doesn't have a task state

Bug #1287945 reported by Arnaud Legendre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Arnaud Legendre

Bug Description

I am getting with the latest version of the trunk:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/poll.py", line 97, in wait
    readers.get(fileno, noop).cb(fileno)
  File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
    result = function(*args, **kwargs)
  File "/opt/stack/nova/nova/openstack/common/service.py", line 480, in run_service
    service.start()
  File "/opt/stack/nova/nova/service.py", line 180, in start
    self.manager.init_host()
  File "/opt/stack/nova/nova/compute/manager.py", line 824, in init_host
    self._init_instance(context, instance)
  File "/opt/stack/nova/nova/compute/manager.py", line 684, in _init_instance
    if instance.task_state == task_states.DELETING:
AttributeError: 'dict' object has no attribute 'task_state'
Removing descriptor: 6
2014-03-04 13:59:14.304 ERROR nova.openstack.common.threadgroup [-] 'dict' object has no attribute 'task_state'
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup Traceback (most recent call last):
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/threadgroup.py", line 117, in wait
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup x.wait()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/threadgroup.py", line 49, in wait
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup return self.thread.wait()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 168, in wait
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup return self._exit_event.wait()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup return hubs.get_hub().switch()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 187, in switch
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup return self.greenlet.switch()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup result = function(*args, **kwargs)
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/service.py", line 480, in run_service
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup service.start()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/service.py", line 180, in start
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup self.manager.init_host()
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/compute/manager.py", line 824, in init_host
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup self._init_instance(context, instance)
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/compute/manager.py", line 684, in _init_instance
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup if instance.task_state == task_states.DELETING:
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup AttributeError: 'dict' object has no attribute 'task_state'
2014-03-04 13:59:14.304 TRACE nova.openstack.common.threadgroup

I get this exception when creating a snapshot, put a breakpoint in the virt layer (in this case vmware_images/snapshot), stop nova-cpu, restart nova-cpu, delete the snapshot.
nova-cpu crashes.

Changed in nova:
assignee: nobody → Arnaud Legendre (arnaudleg)
description: updated
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/78820

Changed in nova:
status: New → In Progress
Changed in nova:
milestone: none → icehouse-rc1
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/78820
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=bb83f1a743150779e190705d2875a2319720c60c
Submitter: Jenkins
Branch: master

commit bb83f1a743150779e190705d2875a2319720c60c
Author: Arnaud Legendre <email address hidden>
Date: Thu Mar 6 15:57:37 2014 -0800

    Use instance object instead of _instance_update()

    Currently, if a user takes a snapshot of a VM, stops nova-cpu
    before the snapshot operation is finished, and restart nova-cpu:
    nova-cpu will crash with the error:
    AttributeError: 'dict' object has no attribute 'task_state'
    This happens because the _instance_update() method returns a dict
    and not an Instance object.

    This patch fixes the issue by not using _instance_update()
    in the compute manager which is returning a dict and using
    the instance object instead.

    Change-Id: I3af0b09aeff7790b147a684f7c90af17d8ee7ae2
    Closes-Bug: #1287945

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
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.