Revision c0e4a2c3 scripts/gnt-instance

b/scripts/gnt-instance
332 332
    nics = [{}]
333 333

  
334 334
  if opts.disk_template == constants.DT_DISKLESS:
335
    if opts.disks:
335
    if opts.disks or opts.sd_size is not None:
336 336
      raise errors.OpPrereqError("Diskless instance but disk"
337 337
                                 " information passed")
338 338
    disks = []
339 339
  else:
340
    if not opts.disks:
340
    if not opts.disks and not opts.sd_size:
341 341
      raise errors.OpPrereqError("No disk information specified")
342
    if opts.disks and opts.sd_size is not None:
343
      raise errors.OpPrereqError("Please use either the '--disk' or"
344
                                 " '-s' option")
345
    if opts.sd_size is not None:
346
      opts.disks = [(0, {"size": opts.sd_size})]
342 347
    try:
343 348
      disk_max = max(int(didx[0])+1 for didx in opts.disks)
344 349
    except ValueError, err:
......
1276 1281
  make_option("-t", "--disk-template", dest="disk_template",
1277 1282
              help="Custom disk setup (diskless, file, plain or drbd)",
1278 1283
              default=None, metavar="TEMPL"),
1284
  cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a"
1285
             " single-disk configuration, when not using the --disk option,"
1286
             " in MiB unless a suffix is used",
1287
             default=None, type="unit", metavar="<size>"),
1279 1288
  ikv_option("--disk", help="Disk information",
1280 1289
             default=[], dest="disks",
1281 1290
             action="append",

Also available in: Unified diff