diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py index 044f5c0fbee899316433db74bbb76cdc8f168897..12f7189e69568b035ca9bf81d96ee86a1b2fa173 100644 --- a/lib/client/gnt_instance.py +++ b/lib/client/gnt_instance.py @@ -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": ( diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 8d7f2ba920073128d1d6b6be71ee1e8d5144ced0..e80981b4148b216c6d22cbc32da4891e84e81eaf 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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): diff --git a/lib/opcodes.py b/lib/opcodes.py index 13074fe892351fe7ae690d2ef5779c3ff1e90ddb..8b90db6af342e1b592650353c1d7a260cbb34070 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -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, diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index 3363d46f80a43fca6d29b9fa7539802169896691..4ca5c41a5f37f219ecf1fb1b0aa6ba0eb2a93d1e 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -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