|
|
4bf3775 |
From 4d47befa91da660e97cb71a63a362b85c9cc7fa4 Mon Sep 17 00:00:00 2001
|
|
|
384b531 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
384b531 |
Date: Tue, 29 Oct 2013 19:23:33 +0000
|
|
|
384b531 |
Subject: [PATCH] builder: Add -m/--memsize and --smp command line options.
|
|
|
384b531 |
|
|
|
384b531 |
(cherry picked from commit 42e445f98692c6344baafaab1da10e821288ac0a)
|
|
|
384b531 |
---
|
|
|
384b531 |
builder/builder.ml | 6 ++++--
|
|
|
384b531 |
builder/cmdline.ml | 15 +++++++++++++--
|
|
|
384b531 |
builder/virt-builder.pod | 22 ++++++++++++++++------
|
|
|
384b531 |
3 files changed, 33 insertions(+), 10 deletions(-)
|
|
|
384b531 |
|
|
|
384b531 |
diff --git a/builder/builder.ml b/builder/builder.ml
|
|
|
bf9044c |
index f247cd2..2437d56 100644
|
|
|
384b531 |
--- a/builder/builder.ml
|
|
|
384b531 |
+++ b/builder/builder.ml
|
|
|
bf9044c |
@@ -38,9 +38,9 @@ let main () =
|
|
|
384b531 |
(* Command line argument parsing - see cmdline.ml. *)
|
|
|
384b531 |
let mode, arg,
|
|
|
384b531 |
attach, cache, check_signature, curl, debug, delete, edit, fingerprint,
|
|
|
384b531 |
- firstboot, run, format, gpg, hostname, install, list_long, mkdirs,
|
|
|
384b531 |
+ firstboot, run, format, gpg, hostname, install, list_long, memsize, mkdirs,
|
|
|
384b531 |
network, output, password_crypto, quiet, root_password, scrub,
|
|
|
384b531 |
- scrub_logfile, size, source, sync, upload, writes =
|
|
|
384b531 |
+ scrub_logfile, size, smp, source, sync, upload, writes =
|
|
|
384b531 |
parse_cmdline () in
|
|
|
384b531 |
|
|
|
384b531 |
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
|
|
|
bf9044c |
@@ -400,6 +400,8 @@ let main () =
|
|
|
384b531 |
let g = new G.guestfs () in
|
|
|
384b531 |
if debug then g#set_trace true;
|
|
|
384b531 |
|
|
|
384b531 |
+ (match memsize with None -> () | Some memsize -> g#set_memsize memsize);
|
|
|
384b531 |
+ (match smp with None -> () | Some smp -> g#set_smp smp);
|
|
|
384b531 |
g#set_network network;
|
|
|
384b531 |
|
|
|
384b531 |
(* The output disk is being created, so use cache=unsafe here. *)
|
|
|
384b531 |
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
|
|
|
51fb412 |
index 28a1643..97ccd89 100644
|
|
|
384b531 |
--- a/builder/cmdline.ml
|
|
|
384b531 |
+++ b/builder/cmdline.ml
|
|
|
384b531 |
@@ -120,6 +120,9 @@ let parse_cmdline () =
|
|
|
384b531 |
|
|
|
384b531 |
let list_long = ref false in
|
|
|
384b531 |
|
|
|
384b531 |
+ let memsize = ref None in
|
|
|
384b531 |
+ let set_memsize arg = memsize := Some arg in
|
|
|
384b531 |
+
|
|
|
384b531 |
let mkdirs = ref [] in
|
|
|
384b531 |
let add_mkdir arg = mkdirs := arg :: !mkdirs in
|
|
|
384b531 |
|
|
|
384b531 |
@@ -160,6 +163,9 @@ let parse_cmdline () =
|
|
|
384b531 |
let size = ref None in
|
|
|
384b531 |
let set_size arg = size := Some (parse_size ~prog arg) in
|
|
|
384b531 |
|
|
|
384b531 |
+ let smp = ref None in
|
|
|
384b531 |
+ let set_smp arg = smp := Some arg in
|
|
|
384b531 |
+
|
|
|
384b531 |
let source =
|
|
|
384b531 |
try Sys.getenv "VIRT_BUILDER_SOURCE"
|
|
|
384b531 |
with Not_found -> "http://libguestfs.org/download/builder/index.asc" in
|
|
|
384b531 |
@@ -234,6 +240,8 @@ let parse_cmdline () =
|
|
|
384b531 |
"--long", Arg.Set list_long, ditto;
|
|
|
384b531 |
"--no-logfile", Arg.Set scrub_logfile, " " ^ s_"Scrub build log file";
|
|
|
384b531 |
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
|
|
|
384b531 |
+ "-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
|
|
|
384b531 |
+ "--memsize", Arg.Int set_memsize, "mb" ^ ditto;
|
|
|
384b531 |
"--mkdir", Arg.String add_mkdir, "dir" ^ " " ^ s_"Create directory";
|
|
|
384b531 |
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
|
|
|
384b531 |
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
|
|
|
384b531 |
@@ -251,6 +259,7 @@ let parse_cmdline () =
|
|
|
384b531 |
"--run-command", Arg.String add_run_cmd, "cmd+args" ^ " " ^ s_"Run command in disk image";
|
|
|
384b531 |
"--scrub", Arg.String add_scrub, "name" ^ " " ^ s_"Scrub a file";
|
|
|
384b531 |
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
|
|
|
384b531 |
+ "--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
|
|
|
384b531 |
"--source", Arg.Set_string source, "URL" ^ " " ^ s_"Set source URL";
|
|
|
384b531 |
"--no-sync", Arg.Clear sync, " " ^ s_"Do not fsync output file on exit";
|
|
|
384b531 |
"--upload", Arg.String add_upload, "file:dest" ^ " " ^ s_"Upload file to dest";
|
|
|
384b531 |
@@ -300,6 +309,7 @@ read the man page virt-builder(1).
|
|
|
384b531 |
let hostname = !hostname in
|
|
|
51fb412 |
let install = List.rev !install in
|
|
|
384b531 |
let list_long = !list_long in
|
|
|
384b531 |
+ let memsize = !memsize in
|
|
|
384b531 |
let mkdirs = List.rev !mkdirs in
|
|
|
384b531 |
let network = !network in
|
|
|
384b531 |
let output = match !output with "" -> None | s -> Some s in
|
|
|
384b531 |
@@ -309,6 +319,7 @@ read the man page virt-builder(1).
|
|
|
384b531 |
let scrub = List.rev !scrub in
|
|
|
384b531 |
let scrub_logfile = !scrub_logfile in
|
|
|
384b531 |
let size = !size in
|
|
|
384b531 |
+ let smp = !smp in
|
|
|
384b531 |
let source = !source in
|
|
|
384b531 |
let sync = !sync in
|
|
|
384b531 |
let upload = List.rev !upload in
|
|
|
384b531 |
@@ -366,6 +377,6 @@ read the man page virt-builder(1).
|
|
|
384b531 |
|
|
|
384b531 |
mode, arg,
|
|
|
384b531 |
attach, cache, check_signature, curl, debug, delete, edit, fingerprint,
|
|
|
384b531 |
- firstboot, run, format, gpg, hostname, install, list_long, mkdirs,
|
|
|
384b531 |
+ firstboot, run, format, gpg, hostname, install, list_long, memsize, mkdirs,
|
|
|
384b531 |
network, output, password_crypto, quiet, root_password, scrub,
|
|
|
384b531 |
- scrub_logfile, size, source, sync, upload, writes
|
|
|
384b531 |
+ scrub_logfile, size, smp, source, sync, upload, writes
|
|
|
384b531 |
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
|
|
|
bf9044c |
index cd20043..66ed030 100644
|
|
|
384b531 |
--- a/builder/virt-builder.pod
|
|
|
384b531 |
+++ b/builder/virt-builder.pod
|
|
|
384b531 |
@@ -366,6 +366,18 @@ the image was built, use this option.
|
|
|
384b531 |
|
|
|
384b531 |
See also: L</LOG FILE>.
|
|
|
384b531 |
|
|
|
384b531 |
+=item B<-m> MB
|
|
|
384b531 |
+
|
|
|
384b531 |
+=item B<--memsize> MB
|
|
|
384b531 |
+
|
|
|
384b531 |
+Change the amount of memory allocated to I<--run> scripts. Increase
|
|
|
384b531 |
+this if you find that I<--run> scripts or the I<--install> option are
|
|
|
384b531 |
+running out of memory.
|
|
|
384b531 |
+
|
|
|
384b531 |
+The default can be found with this command:
|
|
|
384b531 |
+
|
|
|
384b531 |
+ guestfish get-memsize
|
|
|
384b531 |
+
|
|
|
384b531 |
=item B<--mkdir> DIR
|
|
|
384b531 |
|
|
|
384b531 |
Create a directory in the guest.
|
|
|
51fb412 |
@@ -544,6 +556,10 @@ used.
|
|
|
51fb412 |
To specify size in bytes, the number must be followed by the lowercase
|
|
|
51fb412 |
letter I, eg: S<C<--size 10737418240b>>.
|
|
|
384b531 |
|
|
|
384b531 |
+=item B<--smp> N
|
|
|
384b531 |
+
|
|
|
384b531 |
+Enable N E<ge> 2 virtual CPUs for I<--run> scripts to use.
|
|
|
384b531 |
+
|
|
|
384b531 |
=item B<--source> URL
|
|
|
384b531 |
|
|
|
384b531 |
Set the source URL to look for templates. If not specified it
|
|
|
bf9044c |
@@ -1438,12 +1454,6 @@ are actually interpreted by L<curl(1)>, not virt-builder.
|
|
|
384b531 |
|
|
|
384b531 |
Used to determine the location of the template cache. See L</CACHING>.
|
|
|
384b531 |
|
|
|
384b531 |
-=item C<LIBGUESTFS_MEMSIZE>
|
|
|
384b531 |
-
|
|
|
384b531 |
-The size (in megabytes) of the appliance. The default can be found
|
|
|
384b531 |
-using the command S<C<guestfish get-memsize>>. Increase this if you
|
|
|
384b531 |
-find that I<--run> scripts are running out of memory.
|
|
|
384b531 |
-
|
|
|
384b531 |
=item C<VIRT_BUILDER_FINGERPRINT>
|
|
|
384b531 |
|
|
|
384b531 |
Set the default value for the GPG signature fingerprint (see
|
|
|
384b531 |
--
|
|
|
4bf3775 |
1.8.5.3
|
|
|
384b531 |
|