UnboundLocalError: local variable 'domain' referenced before assignment

Bug #1326998 reported by Sam Morrison
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Hans Lindgren
Icehouse
Fix Released
Undecided
Unassigned

Bug Description

Get this sometimes when an instance fails to build

2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] Traceback (most recent call last):
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1311, in _build_instance
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] set_access_ip=set_access_ip)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 399, in decorated_function
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] return function(self, context, *args, **kwargs)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1723, in _spawn
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] LOG.exception(_('Instance failed to spawn'), instance=instance)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] six.reraise(self.type_, self.value, self.tb)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1720, in _spawn
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] block_device_info)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2253, in spawn
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] block_device_info)
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 3651, in _create_domain_and_network
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] domain.destroy()
2014-06-06 09:43:39.055 19328 TRACE nova.compute.utils [instance: d46aad17-c75d-4734-abdb-9b768a40c330] UnboundLocalError: local variable 'domain' referenced before assignment

Revision history for this message
Hans Lindgren (hanlind) wrote :
Changed in nova:
assignee: nobody → Hans Lindgren (hanlind)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 5a98983e87e5020626db2e319f7b00ae547ae8e1
Author: Hans Lindgren <email address hidden>
Date: Sun Jun 8 22:46:46 2014 +0200

    Make sure domain exists before referencing it

    Before calling domain.destroy() in the exception handler for a failed
    create attempt, make sure domain was created prior to when the
    exception was thrown.

    Change-Id: I3b7c5afce7f3bacce1b444c245b035334962ff7c
    Closes-Bug: #1326998

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Matt Riedemann (mriedem) wrote :
tags: added: icehouse-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/105840

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/105840
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=da777f1ac7364bab6895193eb160823adc64cb80
Submitter: Jenkins
Branch: stable/icehouse

commit da777f1ac7364bab6895193eb160823adc64cb80
Author: Hans Lindgren <email address hidden>
Date: Sun Jun 8 22:46:46 2014 +0200

    Make sure domain exists before referencing it

    Before calling domain.destroy() in the exception handler for a failed
    create attempt, make sure domain was created prior to when the
    exception was thrown.

    Conflicts:
            nova/virt/libvirt/driver.py

    Change-Id: I3b7c5afce7f3bacce1b444c245b035334962ff7c
    Closes-Bug: #1326998
    (cherry picked from commit 5a98983e87e5020626db2e319f7b00ae547ae8e1)

tags: added: in-stable-icehouse
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Chuck Short (zulcss)
tags: removed: icehouse-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.