target_iqn is referenced before assignment after exceptions in hyperv/volumeop.py attch_volume()

Bug #1233837 reported by Jay Bryant
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Jay Bryant
Havana
Fix Released
Medium
Jay Bryant

Bug Description

If a exception is encountered in _login_storage_target or _get_mounted_disk_from_lun target_iqn will be referenced in the exception handler before it is defined resulting in the following traceback:

c39117134492490cba81828d080895b5 1a26ee4f153e438c806203607a0d728e] Exception during message handling
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp Traceback (most recent call last):
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\openstack\common\rpc\amqp.py", line 461, in _process_data
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp **args)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\openstack\common\rpc\dispatcher.py", line 172, in dispatch
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\exception.py", line 90, in wrapped
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp payload)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\exception.py", line 73, in wrapped
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp return f(self, context, *args, **kw)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 249, in decorated_function
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp pass
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 235, in decorated_function
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp return function(self, context, *args, **kwargs)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 277, in decorated_function
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp e, sys.exc_info())
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 264, in decorated_function
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp return function(self, context, *args, **kwargs)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 3676, in attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp context, instance, mountpoint)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 3671, in attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp mountpoint, instance)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 3717, in _attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp connector)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\compute\manager.py", line 3707, in _attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp encryption=encryption)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\virt\hyperv\driver.py", line 72, in attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp instance['name'])
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp File "C:\Program Files (x86)\IBM\SmartCloud Entry\Hyper-V Agent\Python27\lib\site-packages\nova\virt\hyperv\volumeops.py", line 143, in attach_volume
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp self._volutils.logout_storage_target(target_iqn)
2013-10-01 16:06:19.993 5588 TRACE nova.openstack.common.rpc.amqp UnboundLocalError: local variable 'target_iqn' referenced before assignment

Tags: hyper-v
Jay Bryant (jsbryant)
Changed in nova:
assignee: nobody → Jay Bryant (jsbryant)
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/49259

Matt Riedemann (mriedem)
Changed in nova:
status: New → In Progress
tags: added: havana-rc-potential hyper-v
Thierry Carrez (ttx)
tags: added: havana-backport-potential
removed: havana-rc-potential
Mark McLoughlin (markmc)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/49259
Committed: http://github.com/openstack/nova/commit/9baa186ebb578205c513c94fc621e254f4c13a08
Submitter: Jenkins
Branch: master

commit 9baa186ebb578205c513c94fc621e254f4c13a08
Author: Jay S. Bryant <email address hidden>
Date: Tue Oct 1 15:59:34 2013 -0500

    hyperv: Initialize target_iqn in attach_volume

    The target_iqn is referenced before it is declared in the
    case that an exception is encountered in _login_storage_target
    or _get_mounted_disk_from_lun. This causes the exception path
    to cause an additional, misleading, traceback to be printed
    after an exception is encountered.

    This commit initializes target_iqn at the beginning of
    attach_volume to avoid the traceback.

    Change-Id: I1cdfb9dfa054ee4f4f6918d7bc49081ccaebab9d
    Close-Bug: 1233837

Matt Riedemann (mriedem)
Changed in nova:
status: In Progress → Fix Committed
milestone: none → icehouse-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/53885

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

Reviewed: https://review.openstack.org/53885
Committed: http://github.com/openstack/nova/commit/3432e99268456ad77c9abb0ea0af1ef5a18d2929
Submitter: Jenkins
Branch: stable/havana

commit 3432e99268456ad77c9abb0ea0af1ef5a18d2929
Author: Jay S. Bryant <email address hidden>
Date: Tue Oct 1 15:59:34 2013 -0500

    hyperv: Initialize target_iqn in attach_volume

    The target_iqn is referenced before it is declared in the
    case that an exception is encountered in _login_storage_target
    or _get_mounted_disk_from_lun. This causes the exception path
    to cause an additional, misleading, traceback to be printed
    after an exception is encountered.

    This commit initializes target_iqn at the beginning of
    attach_volume to avoid the traceback.

    Closes-Bug: 1233837
    Change-Id: I1cdfb9dfa054ee4f4f6918d7bc49081ccaebab9d
    (cherry picked from commit 9baa186ebb578205c513c94fc621e254f4c13a08)

Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Alan Pevec (apevec)
tags: removed: havana-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
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.