Generated code for 'set_memsize'/'get_memsize' calls.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 30 Jun 2009 10:17:06 +0000 (11:17 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 30 Jun 2009 12:10:44 +0000 (13:10 +0100)
17 files changed:
capitests/tests.c
fish/cmds.c
fish/completion.c
guestfish-actions.pod
guestfs-actions.pod
haskell/Guestfs.hs
java/com/redhat/et/libguestfs/GuestFS.java
java/com_redhat_et_libguestfs_GuestFS.c
ocaml/guestfs.ml
ocaml/guestfs.mli
ocaml/guestfs_c_actions.c
perl/Guestfs.xs
perl/lib/Sys/Guestfs.pm
python/guestfs-py.c
python/guestfs.py
ruby/ext/guestfs/_guestfs.c
src/guestfs-actions.h

index f1a450b..c8686a1 100644 (file)
@@ -109,6 +109,8 @@ static void no_test_warnings (void)
   fprintf (stderr, "warning: \"guestfs_set_busy\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_set_ready\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_end_busy\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_set_busy\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_set_ready\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_end_busy\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_memsize\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_memsize\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_ll\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_pvs_full\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_vgs_full\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_ll\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_pvs_full\" has no tests\n");
   fprintf (stderr, "warning: \"guestfs_vgs_full\" has no tests\n");
index a23fe2d..b2b6513 100644 (file)
@@ -83,6 +83,7 @@ void list_commands (void)
   printf ("%-20s %s\n", "get-autosync", "get autosync mode");
   printf ("%-20s %s\n", "get-e2label", "get the ext2/3/4 filesystem label");
   printf ("%-20s %s\n", "get-e2uuid", "get the ext2/3/4 filesystem UUID");
   printf ("%-20s %s\n", "get-autosync", "get autosync mode");
   printf ("%-20s %s\n", "get-e2label", "get the ext2/3/4 filesystem label");
   printf ("%-20s %s\n", "get-e2uuid", "get the ext2/3/4 filesystem UUID");
+  printf ("%-20s %s\n", "get-memsize", "get memory allocated to the qemu subprocess");
   printf ("%-20s %s\n", "get-path", "get the search path");
   printf ("%-20s %s\n", "get-qemu", "get the qemu binary");
   printf ("%-20s %s\n", "get-state", "get the current state");
   printf ("%-20s %s\n", "get-path", "get the search path");
   printf ("%-20s %s\n", "get-qemu", "get the qemu binary");
   printf ("%-20s %s\n", "get-state", "get the current state");
@@ -145,6 +146,7 @@ void list_commands (void)
   printf ("%-20s %s\n", "set-autosync", "set autosync mode");
   printf ("%-20s %s\n", "set-e2label", "set the ext2/3/4 filesystem label");
   printf ("%-20s %s\n", "set-e2uuid", "set the ext2/3/4 filesystem UUID");
   printf ("%-20s %s\n", "set-autosync", "set autosync mode");
   printf ("%-20s %s\n", "set-e2label", "set the ext2/3/4 filesystem label");
   printf ("%-20s %s\n", "set-e2uuid", "set the ext2/3/4 filesystem UUID");
+  printf ("%-20s %s\n", "set-memsize", "set memory allocated to the qemu subprocess");
   printf ("%-20s %s\n", "set-path", "set the search path");
   printf ("%-20s %s\n", "set-qemu", "set the qemu binary");
   printf ("%-20s %s\n", "set-verbose", "set verbose mode");
   printf ("%-20s %s\n", "set-path", "set the search path");
   printf ("%-20s %s\n", "set-qemu", "set the qemu binary");
   printf ("%-20s %s\n", "set-verbose", "set verbose mode");
@@ -252,6 +254,12 @@ void display_command (const char *cmd)
   if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
     pod2text ("get-state - get the current state", " get-state\n\nThis returns the current state as an opaque integer.  This is\nonly useful for printing debug and internal error messages.\n\nFor more information on states, see L<guestfs(3)>.");
   else
   if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
     pod2text ("get-state - get the current state", " get-state\n\nThis returns the current state as an opaque integer.  This is\nonly useful for printing debug and internal error messages.\n\nFor more information on states, see L<guestfs(3)>.");
   else
+  if (strcasecmp (cmd, "set_memsize") == 0 || strcasecmp (cmd, "set-memsize") == 0 || strcasecmp (cmd, "memsize") == 0)
+    pod2text ("set-memsize - set memory allocated to the qemu subprocess", " set-memsize <memsize>\n\nThis sets the memory size in megabytes allocated to the\nqemu subprocess.  This only has any effect if called before\nC<launch>.\n\nYou can also change this by setting the environment\nvariable C<LIBGUESTFS_MEMSIZE> before the handle is\ncreated.\n\nFor more information on the architecture of libguestfs,\nsee L<guestfs(3)>.\n\nYou can use 'memsize' as an alias for this command.");
+  else
+  if (strcasecmp (cmd, "get_memsize") == 0 || strcasecmp (cmd, "get-memsize") == 0)
+    pod2text ("get-memsize - get memory allocated to the qemu subprocess", " get-memsize\n\nThis gets the memory size in megabytes allocated to the\nqemu subprocess.\n\nIf C<set_memsize> was not called\non this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,\nthen this returns the compiled-in default value for memsize.\n\nFor more information on the architecture of libguestfs,\nsee L<guestfs(3)>.");
+  else
   if (strcasecmp (cmd, "mount") == 0)
     pod2text ("mount - mount a guest disk at a position in the filesystem", " mount <device> <mountpoint>\n\nMount a guest disk at a position in the filesystem.  Block devices\nare named C</dev/sda>, C</dev/sdb> and so on, as they were added to\nthe guest.  If those block devices contain partitions, they will have\nthe usual names (eg. C</dev/sda1>).  Also LVM C</dev/VG/LV>-style\nnames can be used.\n\nThe rules are the same as for L<mount(2)>:  A filesystem must\nfirst be mounted on C</> before others can be mounted.  Other\nfilesystems can only be mounted on directories which already\nexist.\n\nThe mounted filesystem is writable, if we have sufficient permissions\non the underlying device.\n\nThe filesystem options C<sync> and C<noatime> are set with this\ncall, in order to improve reliability.");
   else
   if (strcasecmp (cmd, "mount") == 0)
     pod2text ("mount - mount a guest disk at a position in the filesystem", " mount <device> <mountpoint>\n\nMount a guest disk at a position in the filesystem.  Block devices\nare named C</dev/sda>, C</dev/sdb> and so on, as they were added to\nthe guest.  If those block devices contain partitions, they will have\nthe usual names (eg. C</dev/sda1>).  Also LVM C</dev/VG/LV>-style\nnames can be used.\n\nThe rules are the same as for L<mount(2)>:  A filesystem must\nfirst be mounted on C</> before others can be mounted.  Other\nfilesystems can only be mounted on directories which already\nexist.\n\nThe mounted filesystem is writable, if we have sufficient permissions\non the underlying device.\n\nThe filesystem options C<sync> and C<noatime> are set with this\ncall, in order to improve reliability.");
   else
@@ -1077,6 +1085,34 @@ static int run_get_state (const char *cmd, int argc, char *argv[])
   return 0;
 }
 
   return 0;
 }
 
+static int run_set_memsize (const char *cmd, int argc, char *argv[])
+{
+  int r;
+  int memsize;
+  if (argc != 1) {
+    fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+    fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+    return -1;
+  }
+  memsize = atoi (argv[0]);
+  r = guestfs_set_memsize (g, memsize);
+  return r;
+}
+
+static int run_get_memsize (const char *cmd, int argc, char *argv[])
+{
+  int r;
+  if (argc != 0) {
+    fprintf (stderr, "%s should have 0 parameter(s)\n", cmd);
+    fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+    return -1;
+  }
+  r = guestfs_get_memsize (g);
+  if (r == -1) return -1;
+  printf ("%d\n", r);
+  return 0;
+}
+
 static int run_mount (const char *cmd, int argc, char *argv[])
 {
   int r;
 static int run_mount (const char *cmd, int argc, char *argv[])
 {
   int r;
@@ -3246,6 +3282,12 @@ int run_action (const char *cmd, int argc, char *argv[])
   if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
     return run_get_state (cmd, argc, argv);
   else
   if (strcasecmp (cmd, "get_state") == 0 || strcasecmp (cmd, "get-state") == 0)
     return run_get_state (cmd, argc, argv);
   else
+  if (strcasecmp (cmd, "set_memsize") == 0 || strcasecmp (cmd, "set-memsize") == 0 || strcasecmp (cmd, "memsize") == 0)
+    return run_set_memsize (cmd, argc, argv);
+  else
+  if (strcasecmp (cmd, "get_memsize") == 0 || strcasecmp (cmd, "get-memsize") == 0)
+    return run_get_memsize (cmd, argc, argv);
+  else
   if (strcasecmp (cmd, "mount") == 0)
     return run_mount (cmd, argc, argv);
   else
   if (strcasecmp (cmd, "mount") == 0)
     return run_mount (cmd, argc, argv);
   else
index 4a247e1..3cd133b 100644 (file)
@@ -65,6 +65,9 @@ static const char *const commands[] = {
   "is-launching",
   "is-busy",
   "get-state",
   "is-launching",
   "is-busy",
   "get-state",
+  "set-memsize",
+  "memsize",
+  "get-memsize",
   "mount",
   "sync",
   "touch",
   "mount",
   "sync",
   "touch",
index 99519fc..986284e 100644 (file)
@@ -685,6 +685,20 @@ C<device>.
 This returns the ext2/3/4 filesystem UUID of the filesystem on
 C<device>.
 
 This returns the ext2/3/4 filesystem UUID of the filesystem on
 C<device>.
 
+=head2 get-memsize
+
+ get-memsize
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<set-memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
 =head2 get-path
 
  get-path
 =head2 get-path
 
  get-path
@@ -1303,6 +1317,21 @@ L<tune2fs(8)> manpage.
 You can use either C<tune2fs-l> or C<get-e2uuid>
 to return the existing UUID of a filesystem.
 
 You can use either C<tune2fs-l> or C<get-e2uuid>
 to return the existing UUID of a filesystem.
 
+=head2 set-memsize | memsize
+
+ set-memsize memsize
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess.  This only has any effect if called before
+C<launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
 =head2 set-path | path
 
  set-path path
 =head2 set-path | path
 
  set-path path
index aade37b..1225dcc 100644 (file)
@@ -885,6 +885,22 @@ C<device>.
 This function returns a string, or NULL on error.
 I<The caller must free the returned string after use>.
 
 This function returns a string, or NULL on error.
 I<The caller must free the returned string after use>.
 
+=head2 guestfs_get_memsize
+
+ int guestfs_get_memsize (guestfs_h *handle);
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<guestfs_set_memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
+On error this function returns -1.
+
 =head2 guestfs_get_path
 
  const char *guestfs_get_path (guestfs_h *handle);
 =head2 guestfs_get_path
 
  const char *guestfs_get_path (guestfs_h *handle);
@@ -1737,6 +1753,24 @@ to return the existing UUID of a filesystem.
 
 This function returns 0 on success or -1 on error.
 
 
 This function returns 0 on success or -1 on error.
 
+=head2 guestfs_set_memsize
+
+ int guestfs_set_memsize (guestfs_h *handle,
+               int memsize);
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess.  This only has any effect if called before
+C<guestfs_launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
+This function returns 0 on success or -1 on error.
+
 =head2 guestfs_set_path
 
  int guestfs_set_path (guestfs_h *handle,
 =head2 guestfs_set_path
 
  int guestfs_set_path (guestfs_h *handle,
index adf416f..3148450 100644 (file)
@@ -45,6 +45,8 @@ module Guestfs (
   set_busy,
   set_ready,
   end_busy,
   set_busy,
   set_ready,
   end_busy,
+  set_memsize,
+  get_memsize,
   mount,
   sync,
   touch,
   mount,
   sync,
   touch,
@@ -427,6 +429,30 @@ end_busy h = do
       fail err
     else return ()
 
       fail err
     else return ()
 
+foreign import ccall unsafe "guestfs_set_memsize" c_set_memsize
+  :: GuestfsP -> CInt -> IO (CInt)
+
+set_memsize :: GuestfsH -> Int -> IO ()
+set_memsize h memsize = do
+  r <- withForeignPtr h (\p -> c_set_memsize p (fromIntegral memsize))
+  if (r == -1)
+    then do
+      err <- last_error h
+      fail err
+    else return ()
+
+foreign import ccall unsafe "guestfs_get_memsize" c_get_memsize
+  :: GuestfsP -> IO (CInt)
+
+get_memsize :: GuestfsH -> IO (Int)
+get_memsize h = do
+  r <- withForeignPtr h (\p -> c_get_memsize p)
+  if (r == -1)
+    then do
+      err <- last_error h
+      fail err
+    else return (fromIntegral r)
+
 foreign import ccall unsafe "guestfs_mount" c_mount
   :: GuestfsP -> CString -> CString -> IO (CInt)
 
 foreign import ccall unsafe "guestfs_mount" c_mount
   :: GuestfsP -> CString -> CString -> IO (CInt)
 
index c5d4364..1e13b3a 100644 (file)
@@ -908,6 +908,57 @@ public HashMap<String,String> test0rhashtableerr ()
     throws LibGuestFSException;
 
   /**
     throws LibGuestFSException;
 
   /**
+   * set memory allocated to the qemu subprocess
+   * <p>
+   * This sets the memory size in megabytes allocated to the
+   * qemu subprocess. This only has any effect if called
+   * before "g.launch".
+   * <p>
+   * You can also change this by setting the environment
+   * variable "LIBGUESTFS_MEMSIZE" before the handle is
+   * created.
+   * <p>
+   * For more information on the architecture of libguestfs,
+   * see guestfs(3).
+   * <p>
+   * @throws LibGuestFSException
+   */
+  public void set_memsize (int memsize)
+    throws LibGuestFSException
+  {
+    if (g == 0)
+      throw new LibGuestFSException ("set_memsize: handle is closed");
+    _set_memsize (g, memsize);
+  }
+  private native void _set_memsize (long g, int memsize)
+    throws LibGuestFSException;
+
+  /**
+   * get memory allocated to the qemu subprocess
+   * <p>
+   * This gets the memory size in megabytes allocated to the
+   * qemu subprocess.
+   * <p>
+   * If "g.set_memsize" was not called on this handle, and if
+   * "LIBGUESTFS_MEMSIZE" was not set, then this returns the
+   * compiled-in default value for memsize.
+   * <p>
+   * For more information on the architecture of libguestfs,
+   * see guestfs(3).
+   * <p>
+   * @throws LibGuestFSException
+   */
+  public int get_memsize ()
+    throws LibGuestFSException
+  {
+    if (g == 0)
+      throw new LibGuestFSException ("get_memsize: handle is closed");
+    return _get_memsize (g);
+  }
+  private native int _get_memsize (long g)
+    throws LibGuestFSException;
+
+  /**
    * mount a guest disk at a position in the filesystem
    * <p>
    * Mount a guest disk at a position in the filesystem.
    * mount a guest disk at a position in the filesystem
    * <p>
    * Mount a guest disk at a position in the filesystem.
index 43cad68..df16102 100644 (file)
@@ -1402,6 +1402,37 @@ Java_com_redhat_et_libguestfs_GuestFS__1end_1busy
 }
 
 JNIEXPORT void JNICALL
 }
 
 JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1set_1memsize
+  (JNIEnv *env, jobject obj, jlong jg, jint jmemsize)
+{
+  guestfs_h *g = (guestfs_h *) (long) jg;
+  int r;
+  int memsize;
+
+  memsize = jmemsize;
+  r = guestfs_set_memsize (g, memsize);
+  if (r == -1) {
+    throw_exception (env, guestfs_last_error (g));
+    return ;
+  }
+}
+
+JNIEXPORT jint JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1get_1memsize
+  (JNIEnv *env, jobject obj, jlong jg)
+{
+  guestfs_h *g = (guestfs_h *) (long) jg;
+  int r;
+
+  r = guestfs_get_memsize (g);
+  if (r == -1) {
+    throw_exception (env, guestfs_last_error (g));
+    return 0;
+  }
+  return (jint) r;
+}
+
+JNIEXPORT void JNICALL
 Java_com_redhat_et_libguestfs_GuestFS__1mount
   (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jmountpoint)
 {
 Java_com_redhat_et_libguestfs_GuestFS__1mount
   (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jmountpoint)
 {
index c64e257..027f0e9 100644 (file)
@@ -167,6 +167,8 @@ external get_state : t -> int = "ocaml_guestfs_get_state"
 external set_busy : t -> unit = "ocaml_guestfs_set_busy"
 external set_ready : t -> unit = "ocaml_guestfs_set_ready"
 external end_busy : t -> unit = "ocaml_guestfs_end_busy"
 external set_busy : t -> unit = "ocaml_guestfs_set_busy"
 external set_ready : t -> unit = "ocaml_guestfs_set_ready"
 external end_busy : t -> unit = "ocaml_guestfs_end_busy"
+external set_memsize : t -> int -> unit = "ocaml_guestfs_set_memsize"
+external get_memsize : t -> int = "ocaml_guestfs_get_memsize"
 external mount : t -> string -> string -> unit = "ocaml_guestfs_mount"
 external sync : t -> unit = "ocaml_guestfs_sync"
 external touch : t -> string -> unit = "ocaml_guestfs_touch"
 external mount : t -> string -> string -> unit = "ocaml_guestfs_mount"
 external sync : t -> unit = "ocaml_guestfs_sync"
 external touch : t -> string -> unit = "ocaml_guestfs_touch"
index dc09056..ef6a142 100644 (file)
@@ -280,6 +280,12 @@ val set_ready : t -> unit
 val end_busy : t -> unit
 (** leave the busy state *)
 
 val end_busy : t -> unit
 (** leave the busy state *)
 
+val set_memsize : t -> int -> unit
+(** set memory allocated to the qemu subprocess *)
+
+val get_memsize : t -> int
+(** get memory allocated to the qemu subprocess *)
+
 val mount : t -> string -> string -> unit
 (** mount a guest disk at a position in the filesystem *)
 
 val mount : t -> string -> string -> unit
 (** mount a guest disk at a position in the filesystem *)
 
index 3eedbda..6e937f4 100644 (file)
@@ -1543,6 +1543,51 @@ ocaml_guestfs_end_busy (value gv)
 }
 
 CAMLprim value
 }
 
 CAMLprim value
+ocaml_guestfs_set_memsize (value gv, value memsizev)
+{
+  CAMLparam2 (gv, memsizev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_memsize: used handle after closing it");
+
+  int memsize = Int_val (memsizev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_memsize (g, memsize);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_memsize");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_memsize (value gv)
+{
+  CAMLparam1 (gv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("get_memsize: used handle after closing it");
+
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_get_memsize (g);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "get_memsize");
+
+  rv = Val_int (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
 {
   CAMLparam3 (gv, devicev, mountpointv);
 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
 {
   CAMLparam3 (gv, devicev, mountpointv);
index e1da744..9c8b459 100644 (file)
@@ -962,6 +962,30 @@ PREINIT:
         croak ("end_busy: %s", guestfs_last_error (g));
 
 void
         croak ("end_busy: %s", guestfs_last_error (g));
 
 void
+set_memsize (g, memsize)
+      guestfs_h *g;
+      int memsize;
+PREINIT:
+      int r;
+ PPCODE:
+      r = guestfs_set_memsize (g, memsize);
+      if (r == -1)
+        croak ("set_memsize: %s", guestfs_last_error (g));
+
+SV *
+get_memsize (g)
+      guestfs_h *g;
+PREINIT:
+      int memsize;
+   CODE:
+      memsize = guestfs_get_memsize (g);
+      if (memsize == -1)
+        croak ("get_memsize: %s", guestfs_last_error (g));
+      RETVAL = newSViv (memsize);
+ OUTPUT:
+      RETVAL
+
+void
 mount (g, device, mountpoint)
       guestfs_h *g;
       char *device;
 mount (g, device, mountpoint)
       guestfs_h *g;
       char *device;
index de16bd0..5f8cef4 100644 (file)
@@ -680,6 +680,18 @@ C<device>.
 This returns the ext2/3/4 filesystem UUID of the filesystem on
 C<device>.
 
 This returns the ext2/3/4 filesystem UUID of the filesystem on
 C<device>.
 
+=item $memsize = $h->get_memsize ();
+
+This gets the memory size in megabytes allocated to the
+qemu subprocess.
+
+If C<$h-E<gt>set_memsize> was not called
+on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
+then this returns the compiled-in default value for memsize.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
 =item $path = $h->get_path ();
 
 Return the current search path.
 =item $path = $h->get_path ();
 
 Return the current search path.
@@ -1181,6 +1193,19 @@ L<tune2fs(8)> manpage.
 You can use either C<$h-E<gt>tune2fs_l> or C<$h-E<gt>get_e2uuid>
 to return the existing UUID of a filesystem.
 
 You can use either C<$h-E<gt>tune2fs_l> or C<$h-E<gt>get_e2uuid>
 to return the existing UUID of a filesystem.
 
+=item $h->set_memsize ($memsize);
+
+This sets the memory size in megabytes allocated to the
+qemu subprocess.  This only has any effect if called before
+C<$h-E<gt>launch>.
+
+You can also change this by setting the environment
+variable C<LIBGUESTFS_MEMSIZE> before the handle is
+created.
+
+For more information on the architecture of libguestfs,
+see L<guestfs(3)>.
+
 =item $h->set_path ($path);
 
 Set the path that libguestfs searches for kernel and initrd.img.
 =item $h->set_path ($path);
 
 Set the path that libguestfs searches for kernel and initrd.img.
index 340beeb..bf27d0d 100644 (file)
@@ -1657,6 +1657,54 @@ py_guestfs_end_busy (PyObject *self, PyObject *args)
 }
 
 static PyObject *
 }
 
 static PyObject *
+py_guestfs_set_memsize (PyObject *self, PyObject *args)
+{
+  PyObject *py_g;
+  guestfs_h *g;
+  PyObject *py_r;
+  int r;
+  int memsize;
+
+  if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_set_memsize",
+                         &py_g, &memsize))
+    return NULL;
+  g = get_handle (py_g);
+
+  r = guestfs_set_memsize (g, memsize);
+  if (r == -1) {
+    PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+    return NULL;
+  }
+
+  Py_INCREF (Py_None);
+  py_r = Py_None;
+  return py_r;
+}
+
+static PyObject *
+py_guestfs_get_memsize (PyObject *self, PyObject *args)
+{
+  PyObject *py_g;
+  guestfs_h *g;
+  PyObject *py_r;
+  int r;
+
+  if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_memsize",
+                         &py_g))
+    return NULL;
+  g = get_handle (py_g);
+
+  r = guestfs_get_memsize (g);
+  if (r == -1) {
+    PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+    return NULL;
+  }
+
+  py_r = PyInt_FromLong ((long) r);
+  return py_r;
+}
+
+static PyObject *
 py_guestfs_mount (PyObject *self, PyObject *args)
 {
   PyObject *py_g;
 py_guestfs_mount (PyObject *self, PyObject *args)
 {
   PyObject *py_g;
@@ -5060,6 +5108,8 @@ static PyMethodDef methods[] = {
   { (char *) "set_busy", py_guestfs_set_busy, METH_VARARGS, NULL },
   { (char *) "set_ready", py_guestfs_set_ready, METH_VARARGS, NULL },
   { (char *) "end_busy", py_guestfs_end_busy, METH_VARARGS, NULL },
   { (char *) "set_busy", py_guestfs_set_busy, METH_VARARGS, NULL },
   { (char *) "set_ready", py_guestfs_set_ready, METH_VARARGS, NULL },
   { (char *) "end_busy", py_guestfs_end_busy, METH_VARARGS, NULL },
+  { (char *) "set_memsize", py_guestfs_set_memsize, METH_VARARGS, NULL },
+  { (char *) "get_memsize", py_guestfs_get_memsize, METH_VARARGS, NULL },
   { (char *) "mount", py_guestfs_mount, METH_VARARGS, NULL },
   { (char *) "sync", py_guestfs_sync, METH_VARARGS, NULL },
   { (char *) "touch", py_guestfs_touch, METH_VARARGS, NULL },
   { (char *) "mount", py_guestfs_mount, METH_VARARGS, NULL },
   { (char *) "sync", py_guestfs_sync, METH_VARARGS, NULL },
   { (char *) "touch", py_guestfs_touch, METH_VARARGS, NULL },
index aa3572b..d334a91 100644 (file)
@@ -415,6 +415,33 @@ class GuestFS:
         """
         return libguestfsmod.end_busy (self._o)
 
         """
         return libguestfsmod.end_busy (self._o)
 
+    def set_memsize (self, memsize):
+        u"""This sets the memory size in megabytes allocated to the
+        qemu subprocess. This only has any effect if called
+        before "g.launch".
+        
+        You can also change this by setting the environment
+        variable "LIBGUESTFS_MEMSIZE" before the handle is
+        created.
+        
+        For more information on the architecture of libguestfs,
+        see guestfs(3).
+        """
+        return libguestfsmod.set_memsize (self._o, memsize)
+
+    def get_memsize (self):
+        u"""This gets the memory size in megabytes allocated to the
+        qemu subprocess.
+        
+        If "g.set_memsize" was not called on this handle, and if
+        "LIBGUESTFS_MEMSIZE" was not set, then this returns the
+        compiled-in default value for memsize.
+        
+        For more information on the architecture of libguestfs,
+        see guestfs(3).
+        """
+        return libguestfsmod.get_memsize (self._o)
+
     def mount (self, device, mountpoint):
         u"""Mount a guest disk at a position in the filesystem.
         Block devices are named "/dev/sda", "/dev/sdb" and so
     def mount (self, device, mountpoint):
         u"""Mount a guest disk at a position in the filesystem.
         Block devices are named "/dev/sda", "/dev/sdb" and so
index 28f9968..9ac8e25 100644 (file)
@@ -1329,6 +1329,41 @@ static VALUE ruby_guestfs_end_busy (VALUE gv)
   return Qnil;
 }
 
   return Qnil;
 }
 
+static VALUE ruby_guestfs_set_memsize (VALUE gv, VALUE memsizev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "set_memsize");
+
+  int memsize = NUM2INT (memsizev);
+
+  int r;
+
+  r = guestfs_set_memsize (g, memsize);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_get_memsize (VALUE gv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "get_memsize");
+
+
+  int r;
+
+  r = guestfs_get_memsize (g);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return INT2NUM (r);
+}
+
 static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
 {
   guestfs_h *g;
 static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
 {
   guestfs_h *g;
@@ -4828,6 +4863,10 @@ void Init__guestfs ()
         ruby_guestfs_set_ready, 0);
   rb_define_method (c_guestfs, "end_busy",
         ruby_guestfs_end_busy, 0);
         ruby_guestfs_set_ready, 0);
   rb_define_method (c_guestfs, "end_busy",
         ruby_guestfs_end_busy, 0);
+  rb_define_method (c_guestfs, "set_memsize",
+        ruby_guestfs_set_memsize, 1);
+  rb_define_method (c_guestfs, "get_memsize",
+        ruby_guestfs_get_memsize, 0);
   rb_define_method (c_guestfs, "mount",
         ruby_guestfs_mount, 2);
   rb_define_method (c_guestfs, "sync",
   rb_define_method (c_guestfs, "mount",
         ruby_guestfs_mount, 2);
   rb_define_method (c_guestfs, "sync",
index c6d2933..80727ae 100644 (file)
@@ -71,6 +71,8 @@ extern int guestfs_get_state (guestfs_h *handle);
 extern int guestfs_set_busy (guestfs_h *handle);
 extern int guestfs_set_ready (guestfs_h *handle);
 extern int guestfs_end_busy (guestfs_h *handle);
 extern int guestfs_set_busy (guestfs_h *handle);
 extern int guestfs_set_ready (guestfs_h *handle);
 extern int guestfs_end_busy (guestfs_h *handle);
+extern int guestfs_set_memsize (guestfs_h *handle, int memsize);
+extern int guestfs_get_memsize (guestfs_h *handle);
 extern int guestfs_mount (guestfs_h *handle, const char *device, const char *mountpoint);
 extern int guestfs_sync (guestfs_h *handle);
 extern int guestfs_touch (guestfs_h *handle, const char *path);
 extern int guestfs_mount (guestfs_h *handle, const char *device, const char *mountpoint);
 extern int guestfs_sync (guestfs_h *handle);
 extern int guestfs_touch (guestfs_h *handle, const char *path);