Commit 3ed23330 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

gnt-instance: Adding instance policy to migrate


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent b6aaf437
...@@ -847,7 +847,8 @@ def MigrateInstance(opts, args): ...@@ -847,7 +847,8 @@ def MigrateInstance(opts, args):
op = opcodes.OpInstanceMigrate(instance_name=instance_name, mode=mode, op = opcodes.OpInstanceMigrate(instance_name=instance_name, mode=mode,
cleanup=opts.cleanup, iallocator=iallocator, cleanup=opts.cleanup, iallocator=iallocator,
target_node=target_node, 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) SubmitOpCode(op, cl=cl, opts=opts)
return 0 return 0
...@@ -1446,7 +1447,8 @@ commands = { ...@@ -1446,7 +1447,8 @@ commands = {
"migrate": ( "migrate": (
MigrateInstance, ARGS_ONE_INSTANCE, MigrateInstance, ARGS_ONE_INSTANCE,
[FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT, DRY_RUN_OPT, [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" "[-f] <instance>", "Migrate instance to its secondary node"
" (only for mirrored instances)"), " (only for mirrored instances)"),
"move": ( "move": (
......
...@@ -7319,7 +7319,8 @@ class LUInstanceMigrate(LogicalUnit): ...@@ -7319,7 +7319,8 @@ class LUInstanceMigrate(LogicalUnit):
self._migrater = TLMigrateInstance(self, self.op.instance_name, self._migrater = TLMigrateInstance(self, self.op.instance_name,
cleanup=self.op.cleanup, cleanup=self.op.cleanup,
failover=False, failover=False,
fallback=self.op.allow_failover) fallback=self.op.allow_failover,
ignore_ipolicy=self.op.ignore_ipolicy)
self.tasklets = [self._migrater] self.tasklets = [self._migrater]
   
def DeclareLocks(self, level): def DeclareLocks(self, level):
......
...@@ -1262,6 +1262,7 @@ class OpInstanceMigrate(OpCode): ...@@ -1262,6 +1262,7 @@ class OpInstanceMigrate(OpCode):
_PMigrationMode, _PMigrationMode,
_PMigrationLive, _PMigrationLive,
_PMigrationTargetNode, _PMigrationTargetNode,
_PIgnoreIpolicy,
("cleanup", False, ht.TBool, ("cleanup", False, ht.TBool,
"Whether a previously failed migration should be cleaned up"), "Whether a previously failed migration should be cleaned up"),
("iallocator", None, ht.TMaybeString, ("iallocator", None, ht.TMaybeString,
......
...@@ -1420,7 +1420,7 @@ MIGRATE ...@@ -1420,7 +1420,7 @@ MIGRATE
**migrate** [-f] {--cleanup} {*instance*} **migrate** [-f] {--cleanup} {*instance*}
**migrate** [-f] [--allow-failover] [--non-live] **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 Migrate will move the instance to its secondary node without
shutdown. It only works for instances having the drbd8 disk template 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 ...@@ -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 instance is shut down). Please note that the fallback will not happen
during execution. If a migration fails during execution it still fails. 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):: Example (and expected output)::
# gnt-instance migrate instance1 # gnt-instance migrate instance1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment