Merge lp:~ed-leafe/nova/lp820963 into lp:~hudson-openstack/nova/trunk

Proposed by Ed Leafe
Status: Merged
Approved by: Rick Harris
Approved revision: 1366
Merged at revision: 1368
Proposed branch: lp:~ed-leafe/nova/lp820963
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 18 lines (+3/-4)
1 file modified
nova/virt/xenapi_conn.py (+3/-4)
To merge this branch: bzr merge lp:~ed-leafe/nova/lp820963
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Dan Prince (community) Approve
Jason Kölker (community) Approve
Josh Kearney (community) Approve
Review via email: mp+70448@code.launchpad.net

Description of the change

Found a case where an UnboundLocalError would be raised in xenapi_conn.py's wait_for_task() method. This fixes the problem by moving the definition of the unbound name outside of the conditional.

To post a comment you must log in.
Revision history for this message
Josh Kearney (jk0) wrote :

LGTM

review: Approve
Revision history for this message
Jason Kölker (jason-koelker) wrote :

Is bueno.

review: Approve
Revision history for this message
Dan Prince (dan-prince) wrote :

Looks good.

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

lgtm, thanks for the fix Ed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/virt/xenapi_conn.py'
2--- nova/virt/xenapi_conn.py 2011-08-02 17:33:04 +0000
3+++ nova/virt/xenapi_conn.py 2011-08-04 15:09:26 +0000
4@@ -394,11 +394,10 @@
5 try:
6 name = self._session.xenapi.task.get_name_label(task)
7 status = self._session.xenapi.task.get_status(task)
8+ # Ensure action is never > 255
9+ action = dict(action=name[:255], error=None)
10 if id:
11- action = dict(
12- instance_id=int(id),
13- action=name[0:255], # Ensure action is never > 255
14- error=None)
15+ action["instance_id"] = int(id)
16 if status == "pending":
17 return
18 elif status == "success":