Fix type of 'node_whitelist' request parameter
authorChristos Stavrakakis <cstavr@grnet.gr>
Fri, 18 Jan 2013 14:44:13 +0000 (16:44 +0200)
committerGuido Trotter <ultrotter@google.com>
Fri, 18 Jan 2013 15:12:44 +0000 (16:12 +0100)
If opportunistic_locking is used, then 'node_whitelist' parameter passed
to the allocator is set to the LU's owned node locks. However, LU owned_locks
has type of 'set' while IReqInstanceAlloc expects type of
'ht.TMaybeListOf(ht.TNonEmptyString)'.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib.py

index cf4d902..afc801f 100644 (file)
@@ -10297,7 +10297,7 @@ class LUInstanceCreate(LogicalUnit):
     """
     if self.op.opportunistic_locking:
       # Only consider nodes for which a lock is held
-      node_whitelist = self.owned_locks(locking.LEVEL_NODE)
+      node_whitelist = list(self.owned_locks(locking.LEVEL_NODE))
     else:
       node_whitelist = None
 
@@ -11241,7 +11241,7 @@ class LUInstanceMultiAlloc(NoHooksLU):
 
     if self.op.opportunistic_locking:
       # Only consider nodes for which a lock is held
-      node_whitelist = self.owned_locks(locking.LEVEL_NODE)
+      node_whitelist = list(self.owned_locks(locking.LEVEL_NODE))
     else:
       node_whitelist = None