gnt-node: Add instance policy to migrate
authorRené Nussbaumer <rn@google.com>
Tue, 13 Dec 2011 09:35:40 +0000 (10:35 +0100)
committerRené Nussbaumer <rn@google.com>
Fri, 6 Jan 2012 12:47:24 +0000 (13:47 +0100)
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/client/gnt_node.py
lib/cmdlib.py
lib/opcodes.py
man/gnt-node.rst

index f2fa3f7..9fff35f 100644 (file)
@@ -426,7 +426,8 @@ def MigrateNode(opts, args):
 
   op = opcodes.OpNodeMigrate(node_name=args[0], mode=mode,
                              iallocator=opts.iallocator,
-                             target_node=opts.dst_node)
+                             target_node=opts.dst_node,
+                             ignore_ipolicy=opts.ignore_ipolicy)
 
   result = SubmitOpCode(op, cl=cl, opts=opts)
 
@@ -899,7 +900,7 @@ commands = {
   "migrate": (
     MigrateNode, ARGS_ONE_NODE,
     [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, DST_NODE_OPT,
-     IALLOCATOR_OPT, PRIORITY_OPT],
+     IALLOCATOR_OPT, PRIORITY_OPT, IGNORE_IPOLICY_OPT],
     "[-f] <node>",
     "Migrate all the primary instance on a node away from it"
     " (only for instances of type drbd)"),
index 38fb083..b1f6f55 100644 (file)
@@ -7612,7 +7612,8 @@ class LUNodeMigrate(LogicalUnit):
                                  mode=self.op.mode,
                                  live=self.op.live,
                                  iallocator=self.op.iallocator,
-                                 target_node=self.op.target_node)]
+                                 target_node=self.op.target_node,
+                                 ignore_ipolicy=self.op.ignore_ipolicy)]
       for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)
       ]
 
index 3f6a845..eb6a4de 100644 (file)
@@ -1046,6 +1046,7 @@ class OpNodeMigrate(OpCode):
     _PMigrationMode,
     _PMigrationLive,
     _PMigrationTargetNode,
+    _PIgnoreIpolicy,
     ("iallocator", None, ht.TMaybeString,
      "Iallocator for deciding the target node for shared-storage instances"),
     ]
index 70a3a47..15b663c 100644 (file)
@@ -238,7 +238,7 @@ MIGRATE
 ~~~~~~~
 
 **migrate** [-f] [--non-live] [--migration-mode=live\|non-live]
-{*node*}
+[--ignore-ipolicy] {*node*}
 
 This command will migrate all instances having the given node as
 primary to their secondary nodes. This works only for instances
@@ -248,6 +248,9 @@ As for the **gnt-instance migrate** command, the options
 ``--no-live`` and ``--migration-mode`` can be given to influence
 the migration type.
 
+If ``--ignore-ipolicy`` is given any instance policy violations occuring
+during this operation are ignored.
+
 Example::
 
     # gnt-node migrate node1.example.com