summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-08-04 16:09:26 +0000
committerTarmac <>2011-08-04 16:09:26 +0000
commit78a39b2ed793ad59e59cf75756fefb09def49f1f (patch)
treeda2a4f47e046ce86b41f578d1124e5e69b93d529
parentfdf1fd0e06b88603811a4a324ba5e070245afcdd (diff)
parent05243e858f1bf51264302b96b84b3dfd4de11725 (diff)
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.
-rw-r--r--nova/virt/xenapi_conn.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index 39afbd650..8ddbbd33a 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -394,11 +394,10 @@ class XenAPISession(object):
try:
name = self._session.xenapi.task.get_name_label(task)
status = self._session.xenapi.task.get_status(task)
+ # Ensure action is never > 255
+ action = dict(action=name[:255], error=None)
if id:
- action = dict(
- instance_id=int(id),
- action=name[0:255], # Ensure action is never > 255
- error=None)
+ action["instance_id"] = int(id)
if status == "pending":
return
elif status == "success":