Ignore offline node errors when removing disks
authorAgata Murawska <agatamurawska@google.com>
Mon, 9 Jul 2012 09:00:53 +0000 (11:00 +0200)
committerAgata Murawska <agatamurawska@google.com>
Wed, 11 Jul 2012 12:21:03 +0000 (14:21 +0200)
When we delete DRBD disks from some instance, we do not want to get
errors due to nodes other than that instance's primary being offline.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenĂ© Nussbaumer <rn@google.com>

lib/cmdlib.py

index dde940d..a1d6754 100644 (file)
@@ -9015,11 +9015,12 @@ def _RemoveDisks(lu, instance, target_node=None, ignore_failures=False):
       edata = device.ComputeNodeTree(instance.primary_node)
     for node, disk in edata:
       lu.cfg.SetDiskID(disk, node)
-      msg = lu.rpc.call_blockdev_remove(node, disk).fail_msg
-      if msg:
+      result = lu.rpc.call_blockdev_remove(node, disk)
+      if result.fail_msg:
         lu.LogWarning("Could not remove disk %s on node %s,"
-                      " continuing anyway: %s", idx, node, msg)
-        all_result = False
+                      " continuing anyway: %s", idx, node, result.fail_msg)
+        if not (result.offline and node != instance.primary_node):
+          all_result = False
 
     # if this is a DRBD disk, return its port to the pool
     if device.dev_type in constants.LDS_DRBD: