Revision 05d47e33 scripts/gnt-instance

b/scripts/gnt-instance
826 826
      disks = [int(i) for i in opts.disks.split(",")]
827 827
    except ValueError, err:
828 828
      raise errors.OpPrereqError("Invalid disk index passed: %s" % str(err))
829
  cnt = [opts.on_primary, opts.on_secondary,
829
  cnt = [opts.on_primary, opts.on_secondary, opts.auto,
830 830
         new_2ndary is not None, iallocator is not None].count(True)
831 831
  if cnt != 1:
832
    raise errors.OpPrereqError("One and only one of the -p, -s, -n and -i"
832
    raise errors.OpPrereqError("One and only one of the -p, -s, -a, -n and -i"
833 833
                               " options must be passed")
834 834
  elif opts.on_primary:
835 835
    mode = constants.REPLACE_DISK_PRI
836 836
  elif opts.on_secondary:
837 837
    mode = constants.REPLACE_DISK_SEC
838
  elif opts.auto:
839
    mode = constants.REPLACE_DISK_AUTO
840
    if disks:
841
      raise errors.OpPrereqError("Cannot specify disks when using automatic"
842
                                 " mode")
838 843
  elif new_2ndary is not None or iallocator is not None:
839 844
    # replace secondary
840 845
    mode = constants.REPLACE_DISK_CHG
......
1463 1468
                                 default=False, action="store_true",
1464 1469
                                 help=("Replace the disk(s) on the secondary"
1465 1470
                                       " node (only for the drbd template)")),
1471
                     make_option("-a", "--auto", dest="auto",
1472
                                 default=False, action="store_true",
1473
                                 help=("Automatically replace faulty disks"
1474
                                       " (only for the drbd template)")),
1466 1475
                     make_option("--disks", dest="disks", default=None,
1467 1476
                                 help="Comma-separated list of disks"
1468 1477
                                 " indices to replace (e.g. 0,2) (optional,"

Also available in: Unified diff