TLReplaceDisks: Refuse changing secondary for specific disks
authorMichael Hanselmann <hansmi@google.com>
Thu, 13 Aug 2009 11:45:17 +0000 (13:45 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 13 Aug 2009 11:49:41 +0000 (13:49 +0200)
We move all disks anyway.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/cmdlib.py

index 4bd2a8f..1c07c1f 100644 (file)
@@ -5883,10 +5883,11 @@ class TLReplaceDisks(Tasklet):
       raise errors.OpPrereqError("The specified node is already the"
                                  " secondary node of the instance.")
 
-    if self.mode == constants.REPLACE_DISK_AUTO:
-      if self.disks:
-        raise errors.OpPrereqError("Cannot specify disks to be replaced")
+    if self.disks and self.mode in (constants.REPLACE_DISK_AUTO,
+                                    constants.REPLACE_DISK_CHG):
+      raise errors.OpPrereqError("Cannot specify disks to be replaced")
 
+    if self.mode == constants.REPLACE_DISK_AUTO:
       faulty_primary = self._FindFaultyDisks(self.instance.primary_node)
       faulty_secondary = self._FindFaultyDisks(secondary_node)