Revision b6e82a65 scripts/gnt-instance

b/scripts/gnt-instance
448 448
  """
449 449
  instance_name = args[0]
450 450
  new_2ndary = opts.new_secondary
451
  iallocator = opts.iallocator
451 452
  if opts.disks is None:
452 453
    disks = ["sda", "sdb"]
453 454
  else:
......
456 457
    mode = constants.REPLACE_DISK_ALL
457 458
  elif opts.on_primary: # only on primary:
458 459
    mode = constants.REPLACE_DISK_PRI
459
    if new_2ndary is not None:
460
    if new_2ndary is not None or iallocator is not None:
460 461
      raise errors.OpPrereqError("Can't change secondary node on primary disk"
461 462
                                 " replacement")
462
  elif opts.on_secondary is not None: # only on secondary
463
  elif opts.on_secondary is not None or iallocator is not None:
464
    # only on secondary
463 465
    mode = constants.REPLACE_DISK_SEC
464 466

  
465 467
  op = opcodes.OpReplaceDisks(instance_name=args[0], disks=disks,
466
                              remote_node=new_2ndary, mode=mode)
468
                              remote_node=new_2ndary, mode=mode,
469
                              iallocator=iallocator)
467 470
  SubmitOpCode(op)
468 471
  return 0
469 472

  
......
841 844
                                 help=("Comma-separated list of disks"
842 845
                                       " to replace (e.g. sda) (optional,"
843 846
                                       " defaults to all disks")),
847
                     make_option("--iallocator", metavar="<NAME>",
848
                                 help="Select new secondary for the instance"
849
                                 " automatically using the"
850
                                 " <NAME> iallocator plugin (enables"
851
                                 " secondary node replacement)",
852
                                 default=None, type="string"),
844 853
                     ],
845 854
                    "[-s|-p|-n NODE] <instance>",
846 855
                    "Replaces all disks for the instance"),

Also available in: Unified diff