gnt-instance: Adding instance policy to migrate
authorRené Nussbaumer <rn@google.com>
Tue, 13 Dec 2011 09:31:04 +0000 (10:31 +0100)
committerRené Nussbaumer <rn@google.com>
Fri, 6 Jan 2012 12:46:18 +0000 (13:46 +0100)
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/client/gnt_instance.py
lib/cmdlib.py
lib/opcodes.py
man/gnt-instance.rst

index 044f5c0..12f7189 100644 (file)
@@ -847,7 +847,8 @@ def MigrateInstance(opts, args):
   op = opcodes.OpInstanceMigrate(instance_name=instance_name, mode=mode,
                                  cleanup=opts.cleanup, iallocator=iallocator,
                                  target_node=target_node,
-                                 allow_failover=opts.allow_failover)
+                                 allow_failover=opts.allow_failover,
+                                 ignore_ipolicy=opts.ignore_ipolicy)
   SubmitOpCode(op, cl=cl, opts=opts)
   return 0
 
@@ -1446,7 +1447,8 @@ commands = {
   "migrate": (
     MigrateInstance, ARGS_ONE_INSTANCE,
     [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT, DRY_RUN_OPT,
-     PRIORITY_OPT, DST_NODE_OPT, IALLOCATOR_OPT, ALLOW_FAILOVER_OPT],
+     PRIORITY_OPT, DST_NODE_OPT, IALLOCATOR_OPT, ALLOW_FAILOVER_OPT,
+     IGNORE_IPOLICY_OPT],
     "[-f] <instance>", "Migrate instance to its secondary node"
     " (only for mirrored instances)"),
   "move": (
index 8d7f2ba..e80981b 100644 (file)
@@ -7319,7 +7319,8 @@ class LUInstanceMigrate(LogicalUnit):
     self._migrater = TLMigrateInstance(self, self.op.instance_name,
                                        cleanup=self.op.cleanup,
                                        failover=False,
-                                       fallback=self.op.allow_failover)
+                                       fallback=self.op.allow_failover,
+                                       ignore_ipolicy=self.op.ignore_ipolicy)
     self.tasklets = [self._migrater]
 
   def DeclareLocks(self, level):
index 13074fe..8b90db6 100644 (file)
@@ -1262,6 +1262,7 @@ class OpInstanceMigrate(OpCode):
     _PMigrationMode,
     _PMigrationLive,
     _PMigrationTargetNode,
+    _PIgnoreIpolicy,
     ("cleanup", False, ht.TBool,
      "Whether a previously failed migration should be cleaned up"),
     ("iallocator", None, ht.TMaybeString,
index 3363d46..4ca5c41 100644 (file)
@@ -1420,7 +1420,7 @@ MIGRATE
 **migrate** [-f] {--cleanup} {*instance*}
 
 **migrate** [-f] [--allow-failover] [--non-live]
-[--migration-mode=live\|non-live] {*instance*}
+[--migration-mode=live\|non-live] [--ignore-ipolicy] {*instance*}
 
 Migrate will move the instance to its secondary node without
 shutdown. It only works for instances having the drbd8 disk template
@@ -1456,6 +1456,9 @@ it already can determine that a migration won't work (e.g. if the
 instance is shut down). Please note that the fallback will not happen
 during execution. If a migration fails during execution it still fails.
 
+If ``--ignore-ipolicy`` is given any instance policy violations occuring
+during this operation are ignored.
+
 Example (and expected output)::
 
     # gnt-instance migrate instance1