xenapi sync_power_states peridodic task can traceback when instance not found

Bug #1226756 reported by Andrew Laski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Andrew Laski

Bug Description

When an instance is not found on the hypervisor during the sync_power_states periodic task, possibly because it's being resized/migrated, there's a traceback in the compute logs.

2013-09-10 17:46:27.736 32525 ERROR nova.openstack.common.periodic_task [-] Error during ComputeManager._sync_power_states: Could not find VM with name instance-00ab07fd-b5b0-44cb-8b62-9df838c7f468
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task Traceback (most recent call last):
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task File "/opt/rackstack/410.23/nova/lib/python2.6/site-packages/nova/openstack/common/periodic_task.py", line 180, in run_periodic_tasks
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task task(self, context)
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task File "/opt/rackstack/410.23/nova/lib/python2.6/site-packages/nova/compute/manager.py", line 4623, in _sync_power_states
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task vm_instance = self.driver.get_info(db_instance)
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task File "/opt/rackstack/410.23/nova/lib/python2.6/site-packages/nova/virt/xenapi/driver.py", line 318, in get_info
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task return self._vmops.get_info(instance)
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task File "/opt/rackstack/410.23/nova/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 1488, in get_info
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task vm_ref = vm_ref or self._get_vm_opaque_ref(instance)
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task File "/opt/rackstack/410.23/nova/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 800, in _get_vm_opaque_ref
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task instance['name'])
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task NotFound: Could not find VM with name instance-00ab07fd-b5b0-44cb-8b62-9df838c7f468
2013-09-10 17:46:27.736 32525 TRACE nova.openstack.common.periodic_task

This is happening because the xenapi raises a NotFound exception but the sync_power_states task is expecting an InstanceNotFound exception. NotFound is a general exception and InstanceNotFound is a more specific one so it would be better to raise InstanceNotFound and catch NotFound. But for this case it should be ok to just raise InstanceNotFound.

Andrew Laski (alaski)
Changed in nova:
assignee: nobody → Andrew Laski (alaski)
importance: Undecided → Low
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/47012

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/47012
Committed: http://github.com/openstack/nova/commit/983d815a80039d1f4e0d735c3041882833ecc488
Submitter: Jenkins
Branch: master

commit 983d815a80039d1f4e0d735c3041882833ecc488
Author: Andrew Laski <email address hidden>
Date: Tue Sep 17 15:14:56 2013 -0400

    XenAPI raise InstanceNotFound in _get_vm_opaque_ref

    If _get_vm_opaque_ref doesn't find an instance it should raise a
    specific InstanceNotFound exception rather than the general NotFound
    exception. Callers of this method may try to catch InstanceNotFound or
    NotFound and now both will work.

    This fix will prevent a traceback during the _sync_power_states periodic
    task which is expecting an InstanceNotFound exception.

    Change-Id: Ia28fe33d69520806dab878c843fe435e018a20de
    Closes-Bug: 1226756

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