[Libguestfs] [PATCH 1/2] increase the default memory size to 768 MB
Richard W.M. Jones
rjones at redhat.com
Sun Jun 12 12:01:28 UTC 2016
On Sat, Jun 11, 2016 at 09:35:40PM +0100, Richard W.M. Jones wrote:
> On Sat, Jun 11, 2016 at 08:51:56PM +0300, Pavel Butsykin wrote:
> > The appliance memory size of 500 MB is insufficient in certain scenarios. In
> > partiuclar, semodule (which may be called by a guest tools uninstaller) often
> > triggers OOM (see https://bugzilla.redhat.com/426775)
> >
> > Increase it to 768 MB.
> >
> > Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
> > ---
> > src/guestfs-internal.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
> > index 03f1034..1d1b996 100644
> > --- a/src/guestfs-internal.h
> > +++ b/src/guestfs-internal.h
> > @@ -93,7 +93,7 @@
> >
> > /* The default and minimum memory size for most users. */
> > #ifndef DEFAULT_MEMSIZE
> > -# define DEFAULT_MEMSIZE 500
> > +# define DEFAULT_MEMSIZE 768
> > #endif
> > #ifndef MIN_MEMSIZE
> > # define MIN_MEMSIZE 128
>
> If only we had a more sensible way to allocate memory :-(
>
> Anyway, this patch needs to remove the earlier lines which set
> DEFAULT_MEMSIZE to 768 on __powerpc__ and __aarch64__.
When I thought about this a bit more, I think what you want is to just
increase the memory limit for virt-v2v. How about the attached?
(Only compile tested.)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
-------------- next part --------------
>From 31433059175c29ebc4009fca46a8a8fe0b258893 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
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
More information about the Libguestfs
mailing list