From: Richard W.M. Jones Date: Tue, 24 Mar 2015 17:28:03 +0000 (+0000) Subject: mclu boot: Add --size and --timezone options. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=c0d86b007d1dccfe41c1480479191024217769d5;p=mclu.git mclu boot: Add --size and --timezone options. --- diff --git a/mclu.pod b/mclu.pod index 570aef3..081d233 100644 --- a/mclu.pod +++ b/mclu.pod @@ -74,7 +74,16 @@ the same as using the C subcommand, but quicker. =item B<--memory nnG> Specify the amount of memory (RAM) to give this guest. You can use -a number followed by a unit, eg. C<--memory=4G> +a number followed by a unit, eg. C<--memory 4G> + +=item B<--size nnG> + +Specify the amount of disk space to give this guest. You can use +a number followed by a unit, eg. C<--size 20G> + +=item B<--timezone TZ> + +Specify the timezone, eg. C<--timezone Europe/London> =item B<--vcpus N> diff --git a/mclu_boot.ml b/mclu_boot.ml index adae6de..a253981 100644 --- a/mclu_boot.ml +++ b/mclu_boot.ml @@ -33,6 +33,14 @@ let set_memory s = eprintf "mclu: don't understand --memory parameter '%s' Try something like --memory 1G\n" s; exit 1 +let size = ref 0L (* 0 = default *) +let set_size s = + try size := bytes_of_human_size s + with Not_found -> + eprintf "mclu: don't understand --size parameter '%s' +Try something like --size 20G\n" s; + exit 1 +let timezone = ref "" (* "" = no timezone set *) let vcpus = ref 0 (* 0 = choose for me *) let open_console = ref false @@ -43,6 +51,8 @@ let get_arg_speclist () = Arg.align [ "--cpus", Arg.Set_int vcpus, "n Number of virtual CPUs"; "--memory", Arg.String set_memory, "nnG Amount of RAM to give guest"; "--ram", Arg.String set_memory, "nnG Amount of RAM to give guest"; + "--size", Arg.String set_size, "nnG Size of disk to give guest"; + "--timezone", Arg.Set_string timezone, "TZ Set timezone of guest"; "--vcpus", Arg.Set_int vcpus, "n Number of virtual CPUs"; "--viewer", Arg.Set open_viewer, " Open the graphical console"; ] @@ -250,12 +260,20 @@ base_image=%s \ format=%s \ name=%s \ output=%s \ +%s \ +%s \ %s build" (quote hostname) (quote template_info.Template.base_image) (* base_image *) format (* format *) name (* name *) (quote remote_image) (* output *) + (match !size with + | 0L -> "" + | size -> sprintf "size=%Ldb" size) (* size *) + (match !timezone with + | "" -> "" + | tz -> quote "timezone=" ^ tz) (* timezone *) remote_filename in if verbose then printf "%s\n%!" cmd; if Sys.command cmd <> 0 then ( diff --git a/templates/rawhide.template b/templates/rawhide.template index 8406f0f..ae9399d 100755 --- a/templates/rawhide.template +++ b/templates/rawhide.template @@ -10,7 +10,9 @@ case "$1" in # Build image. build) virt-builder "$base_image" --output "$output" --format "$format" \ + $size \ --hostname "$name" \ + $timezone \ --install fedora-repos-rawhide \ --update \ --root-password password:123456 \