diff --git a/man/gnt-backup.sgml b/man/gnt-backup.sgml index fec40912f722986ed49549ce234f68d753dd8db2..da01af2346d2bc4e5056959c38caf4f25742cfb2 100644 --- a/man/gnt-backup.sgml +++ b/man/gnt-backup.sgml @@ -151,10 +151,19 @@ </para> <para> - The minimum disk specification is therefore <userinput>--disk - 0:size=20G</userinput>, and a three-disk instance can be - specified as <userinput>--disk 0:size=20G --disk 1:size=4G - --disk 2:size=100G</userinput>. + Alternatively, a single-disk instance can be created via the + <option>-s</option> option which takes a single argument, + the size of the disk. This is similar to the Ganeti 1.2 + version (but will only create one disk). + </para> + + <para> + The minimum disk specification is therefore + <userinput>--disk 0:size=20G</userinput> (or <userinput>-s + 20G</userinput> when using the <option>-s</option> option), + and a three-disk instance can be specified as + <userinput>--disk 0:size=20G --disk 1:size=4G --disk + 2:size=100G</userinput>. </para> <para> diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml index c6c511c038e8b80e7a41ed25c58b8b2685886a6d..d50fb658a5efc6ea81c8c874b6ec00e3aa1508ea 100644 --- a/man/gnt-instance.sgml +++ b/man/gnt-instance.sgml @@ -65,7 +65,18 @@ <cmdsynopsis> <command>add</command> <sbr> - <arg rep="repeat">--disk=<replaceable>N</replaceable>:size=<replaceable>VAL</replaceable><arg>,mode=<replaceable>ro|rw</replaceable></arg></arg> + <arg choice="req">-t<group choice="req"> + <arg>diskless</arg> + <arg>file</arg> + <arg>plain</arg> + <arg>drbd</arg> + </group></arg> + <sbr> + + <group choice="req"> + <arg rep="repeat">--disk=<replaceable>N</replaceable>:size=<replaceable>VAL</replaceable><arg>,mode=<replaceable>ro|rw</replaceable></arg></arg> + <arg>-s <replaceable>SIZE</replaceable></arg> + </group> <sbr> <group> <arg rep="repeat">--net=<replaceable>N</replaceable><arg rep="repeat">:options</arg></arg> @@ -85,14 +96,6 @@ </group></arg> <sbr> - <arg choice="req">-t<group choice="req"> - <arg>diskless</arg> - <arg>file</arg> - <arg>plain</arg> - <arg>drbd</arg> - </group></arg> - <sbr> - <group choice="req"> <arg>-n <replaceable>node<optional>:secondary-node</optional></replaceable></arg> <arg>--iallocator <replaceable>name</replaceable></arg> @@ -127,11 +130,20 @@ these suffixes map to mebibytes, gibibytes and tebibytes. </para> + <para> + Alternatively, a single-disk instance can be created via the + <option>-s</option> option which takes a single argument, + the size of the disk. This is similar to the Ganeti 1.2 + version (but will only create one disk). + </para> + <para> The minimum disk specification is therefore - <userinput>--disk 0:size=20G</userinput>, and a three-disk - instance can be specified as <userinput>--disk 0:size=20G - --disk 1:size=4G --disk 2:size=100G</userinput>. + <userinput>--disk 0:size=20G</userinput> (or <userinput>-s + 20G</userinput> when using the <option>-s</option> option), + and a three-disk instance can be specified as + <userinput>--disk 0:size=20G --disk 1:size=4G --disk + 2:size=100G</userinput>. </para> <para> diff --git a/scripts/gnt-backup b/scripts/gnt-backup index 774e69608bd7ce93f3282b54f18aee5a6bf050e0..c6ef4c971327fac633f659c9b42492031160546e 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -113,13 +113,18 @@ def ImportInstance(opts, args): nics = [{}] if opts.disk_template == constants.DT_DISKLESS: - if opts.disks: + if opts.disks or opts.sd_size is not None: raise errors.OpPrereqError("Diskless instance but disk" " information passed") disks = [] else: - if not opts.disks: + if not opts.disks and not opts.sd_size: raise errors.OpPrereqError("No disk information specified") + if opts.disks and opts.sd_size is not None: + raise errors.OpPrereqError("Please use either the '--disk' or" + " '-s' option") + if opts.sd_size is not None: + opts.disks = [(0, {"size": opts.sd_size})] try: disk_max = max(int(didx[0])+1 for didx in opts.disks) except ValueError, err: @@ -137,7 +142,7 @@ def ImportInstance(opts, args): disks[didx] = ddict utils.ForceDictType(opts.beparams, constants.BES_PARAMETER_TYPES) - utils.ForceDictType(opts.hvparams, constants.HVS_PARAMETER_TYPES) + utils.ForceDictType(hvparams, constants.HVS_PARAMETER_TYPES) op = opcodes.OpCreateInstance(instance_name=instance, disk_template=opts.disk_template, @@ -194,6 +199,10 @@ import_opts = [ default=[], dest="disks", action="append", type="identkeyval"), + cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a" + " single-disk configuration, when not using the --disk option," + " in MiB unless a suffix is used", + default=None, type="unit", metavar="<size>"), ikv_option("--net", help="NIC information", default=[], dest="nics", action="append", diff --git a/scripts/gnt-instance b/scripts/gnt-instance index a5c30c8b795d8559862d9894a4ac3444a93a975b..fd8a455fef4f8268231deb73a8ecf4350a64b5b2 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -332,13 +332,18 @@ def AddInstance(opts, args): nics = [{}] if opts.disk_template == constants.DT_DISKLESS: - if opts.disks: + if opts.disks or opts.sd_size is not None: raise errors.OpPrereqError("Diskless instance but disk" " information passed") disks = [] else: - if not opts.disks: + if not opts.disks and not opts.sd_size: raise errors.OpPrereqError("No disk information specified") + if opts.disks and opts.sd_size is not None: + raise errors.OpPrereqError("Please use either the '--disk' or" + " '-s' option") + if opts.sd_size is not None: + opts.disks = [(0, {"size": opts.sd_size})] try: disk_max = max(int(didx[0])+1 for didx in opts.disks) except ValueError, err: @@ -1276,6 +1281,10 @@ add_opts = [ make_option("-t", "--disk-template", dest="disk_template", help="Custom disk setup (diskless, file, plain or drbd)", default=None, metavar="TEMPL"), + cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a" + " single-disk configuration, when not using the --disk option," + " in MiB unless a suffix is used", + default=None, type="unit", metavar="<size>"), ikv_option("--disk", help="Disk information", default=[], dest="disks", action="append",