Use the new dry-run mode in cmdlib
authorIustin Pop <iustin@google.com>
Mon, 9 May 2011 15:06:34 +0000 (17:06 +0200)
committerIustin Pop <iustin@google.com>
Tue, 10 May 2011 14:37:52 +0000 (16:37 +0200)
This will hopefully detect potential LVM (or any other storage, when
they implement it) issues before committing changes just on some
nodes.

Unfortunately due to the dry_run opcode handling, we can't integrate
this into the usual handling (as we need to activate the disks before
doing any tests, which belongs in Exec not in CheckPrereq).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib.py

index b8f423f..7ba8630 100644 (file)
@@ -9517,6 +9517,14 @@ class LUInstanceGrowDisk(LogicalUnit):
     if not disks_ok:
       raise errors.OpExecError("Cannot activate block device to grow")
 
+    # First run all grow ops in dry-run mode
+    for node in instance.all_nodes:
+      self.cfg.SetDiskID(disk, node)
+      result = self.rpc.call_blockdev_grow(node, disk, self.op.amount, True)
+      result.Raise("Grow request failed to node %s" % node)
+
+    # We know that (as far as we can test) operations across different
+    # nodes will succeed, time to run it for real
     for node in instance.all_nodes:
       self.cfg.SetDiskID(disk, node)
       result = self.rpc.call_blockdev_grow(node, disk, self.op.amount, False)