Revision c0e4a2c3 scripts/gnt-backup

b/scripts/gnt-backup
113 113
    nics = [{}]
114 114

  
115 115
  if opts.disk_template == constants.DT_DISKLESS:
116
    if opts.disks:
116
    if opts.disks or opts.sd_size is not None:
117 117
      raise errors.OpPrereqError("Diskless instance but disk"
118 118
                                 " information passed")
119 119
    disks = []
120 120
  else:
121
    if not opts.disks:
121
    if not opts.disks and not opts.sd_size:
122 122
      raise errors.OpPrereqError("No disk information specified")
123
    if opts.disks and opts.sd_size is not None:
124
      raise errors.OpPrereqError("Please use either the '--disk' or"
125
                                 " '-s' option")
126
    if opts.sd_size is not None:
127
      opts.disks = [(0, {"size": opts.sd_size})]
123 128
    try:
124 129
      disk_max = max(int(didx[0])+1 for didx in opts.disks)
125 130
    except ValueError, err:
......
137 142
      disks[didx] = ddict
138 143

  
139 144
  utils.ForceDictType(opts.beparams, constants.BES_PARAMETER_TYPES)
140
  utils.ForceDictType(opts.hvparams, constants.HVS_PARAMETER_TYPES)
145
  utils.ForceDictType(hvparams, constants.HVS_PARAMETER_TYPES)
141 146

  
142 147
  op = opcodes.OpCreateInstance(instance_name=instance,
143 148
                                disk_template=opts.disk_template,
......
194 199
             default=[], dest="disks",
195 200
             action="append",
196 201
             type="identkeyval"),
202
  cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a"
203
             " single-disk configuration, when not using the --disk option,"
204
             " in MiB unless a suffix is used",
205
             default=None, type="unit", metavar="<size>"),
197 206
  ikv_option("--net", help="NIC information",
198 207
             default=[], dest="nics",
199 208
             action="append",

Also available in: Unified diff