>From 31433059175c29ebc4009fca46a8a8fe0b258893 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 12 Jun 2016 12:58:57 +0100 Subject: [PATCH] v2v: Allocate extra 256MB to the guestfs appliance during conversion. The 'semodule' command, called by the guest tools uninstaller, will run out of memory with the default of 512MB (https://bugzilla.redhat.com/426775). Thanks: Pavel Butsykin --- mllib/common_utils.ml | 3 ++- mllib/common_utils.mli | 10 ++++++++-- v2v/v2v.ml | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index dfffae3..21c89f7 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -392,11 +392,12 @@ let debug fs = (* Common function to create a new Guestfs handle, with common options * (e.g. debug, tracing) already set. *) -let open_guestfs ?identifier () = +let open_guestfs ?identifier ?(extramem = 0) () = let g = new Guestfs.guestfs () in if trace () then g#set_trace true; if verbose () then g#set_verbose true; may g#set_identifier identifier; + if extramem > 0 then g#set_memsize (g#get_memsize () + extramem); g (* All the OCaml virt-* programs use this wrapper to catch exceptions diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 3fcb602..3a2d721 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -198,9 +198,15 @@ val debug : ('a, unit, string, unit) format4 -> 'a the command line. As with libguestfs debugging messages, it is sent to [stderr]. *) -val open_guestfs : ?identifier:string -> unit -> Guestfs.guestfs +val open_guestfs : ?identifier:string -> ?extramem:int -> unit -> + Guestfs.guestfs (** Common function to create a new Guestfs handle, with common options - (e.g. debug, tracing) already set. *) + (e.g. debug, tracing) already set. + + The optional [?identifier] parameter sets the handle identifier. + + The optional [?extramem] parameter increases the memory size + allocated to the appliance (note: in addition to the default). *) val run_main_and_handle_errors : (unit -> unit) -> unit (** Common function for handling pretty-printing exceptions. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index fe81df5..df832ee 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -60,7 +60,7 @@ let rec main () = | In_place -> message (f_"Opening the source VM") ); - let g = open_guestfs ~identifier:"v2v" () in + let g = open_guestfs ~identifier:"v2v" ~extramem:256 () in g#set_network true; (match conversion_mode with | Copying (overlays, _) -> populate_overlays g overlays -- 2.7.4