Parallelize LURemoveExport
authorGuido Trotter <ultrotter@google.com>
Thu, 11 Sep 2008 09:44:58 +0000 (09:44 +0000)
committerGuido Trotter <ultrotter@google.com>
Thu, 11 Sep 2008 09:44:58 +0000 (09:44 +0000)
Reviewed-by: imsnah

lib/cmdlib.py

index 81ecc05..633d8e5 100644 (file)
@@ -4788,6 +4788,14 @@ class LURemoveExport(NoHooksLU):
 
   """
   _OP_REQP = ["instance_name"]
+  REQ_BGL = False
+
+  def ExpandNames(self):
+    self.needed_locks = {}
+    # We need all nodes to be locked in order for RemoveExport to work, but we
+    # don't need to lock the instance itself, as nothing will happen to it (and
+    # we can remove exports also for a removed instance)
+    self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET
 
   def CheckPrereq(self):
     """Check prerequisites.
@@ -4806,7 +4814,7 @@ class LURemoveExport(NoHooksLU):
       fqdn_warn = True
       instance_name = self.op.instance_name
 
-    exportlist = rpc.call_export_list(self.cfg.GetNodeList())
+    exportlist = rpc.call_export_list(self.acquired_locks[locking.LEVEL_NODE])
     found = False
     for node in exportlist:
       if instance_name in exportlist[node]: