Revision e9c487be

b/lib/cli.py
51 51
  "ALLOCATABLE_OPT",
52 52
  "ALLOC_POLICY_OPT",
53 53
  "ALL_OPT",
54
  "ALLOW_FAILOVER_OPT",
54 55
  "AUTO_PROMOTE_OPT",
55 56
  "AUTO_REPLACE_OPT",
56 57
  "BACKEND_OPT",
......
758 759
                                help="Ignore the consistency of the disks on"
759 760
                                " the secondary")
760 761

  
762
ALLOW_FAILOVER_OPT = cli_option("--allow-failover",
763
                                dest="allow_failover",
764
                                action="store_true", default=False,
765
                                help="If migration is not possible fallback to"
766
                                     " failover")
767

  
761 768
NONLIVE_OPT = cli_option("--non-live", dest="live",
762 769
                         default=True, action="store_false",
763 770
                         help="Do a non-live migration (this usually means"
b/lib/client/gnt_instance.py
829 829

  
830 830
  op = opcodes.OpInstanceMigrate(instance_name=instance_name, mode=mode,
831 831
                                 cleanup=opts.cleanup, iallocator=iallocator,
832
                                 target_node=target_node)
832
                                 target_node=target_node,
833
                                 allow_failover=opts.allow_failover)
833 834
  SubmitOpCode(op, cl=cl, opts=opts)
834 835
  return 0
835 836

  
......
1365 1366
  'migrate': (
1366 1367
    MigrateInstance, ARGS_ONE_INSTANCE,
1367 1368
    [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT, DRY_RUN_OPT,
1368
     PRIORITY_OPT, DST_NODE_OPT, IALLOCATOR_OPT],
1369
     PRIORITY_OPT, DST_NODE_OPT, IALLOCATOR_OPT, ALLOW_FAILOVER_OPT],
1369 1370
    "[-f] <instance>", "Migrate instance to its secondary node"
1370 1371
    " (only for mirrored instances)"),
1371 1372
  'move': (
b/man/gnt-instance.rst
1219 1219

  
1220 1220
**migrate** [-f] {--cleanup} {*instance*}
1221 1221

  
1222
**migrate** [-f] [--non-live] [--migration-mode=live\|non-live]
1223
{*instance*}
1222
**migrate** [-f] [--allow-failover] [--non-live]
1223
[--migration-mode=live\|non-live] {*instance*}
1224 1224

  
1225 1225
Migrate will move the instance to its secondary node without
1226 1226
shutdown. It only works for instances having the drbd8 disk
......
1252 1252

  
1253 1253
The option ``-f`` will skip the prompting for confirmation.
1254 1254

  
1255
If ``--allow-failover`` is specified it tries to fallback to failover if
1256
it already can determine that a migration wont work (i.e. if the
1257
instance is shutdown). Please note that the fallback will not happen
1258
during execution. If a migration fails during execution it still fails.
1259

  
1255 1260
Example (and expected output)::
1256 1261

  
1257 1262
    # gnt-instance migrate instance1
b/qa/qa_instance.py
177 177
  AssertCommand(cmd)
178 178
  # ... and back
179 179
  AssertCommand(cmd)
180
  AssertCommand(["gnt-instance", "shutdown", instance["name"]])
181
  AssertCommand(cmd, fail=True)
182
  AssertCommand(["gnt-instance", "migrate", "--force", "--allow-failover",
183
                 instance["name"]])
184
  AssertCommand(["gnt-instance", "start", instance["name"]])
185
  AssertCommand(cmd)
180 186

  
181 187

  
182 188
def TestInstanceInfo(instance):

Also available in: Unified diff