From 3ed2333041a4ea42c7f3187b89c59482b3f2aad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Tue, 13 Dec 2011 10:31:04 +0100 Subject: [PATCH] gnt-instance: Adding instance policy to migrate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/client/gnt_instance.py | 6 ++++-- lib/cmdlib.py | 3 ++- lib/opcodes.py | 1 + man/gnt-instance.rst | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py index 044f5c0fb..12f7189e6 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 8d7f2ba92..e80981b41 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 13074fe89..8b90db6af 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 3363d46f8..4ca5c41a5 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 -- GitLab