[Libguestfs] [PATCH] tests: Increase appliance memory when testing 256+ disks.

Richard W.M. Jones rjones at redhat.com
Wed May 16 11:51:20 UTC 2018


---
 tests/disks/test-add-disks.c | 9 +++++++++
 utils/max-disks/max-disks.pl | 1 +
 2 files changed, 10 insertions(+)

diff --git a/tests/disks/test-add-disks.c b/tests/disks/test-add-disks.c
index a7365d1d1..f3eb87bb4 100644
--- a/tests/disks/test-add-disks.c
+++ b/tests/disks/test-add-disks.c
@@ -98,6 +98,7 @@ main (int argc, char *argv[])
   guestfs_h *g;
   char *tmpdir;
   ssize_t n = -1; /* -1: not set  0: max  > 0: specific value */
+  int m;
 
   g = guestfs_create ();
   if (g == NULL)
@@ -158,6 +159,14 @@ main (int argc, char *argv[])
   }
   ndisks = n;
 
+  /* Increase memory available to the appliance.  On x86 the default
+   * is not enough to both detect and partition 256 disks.
+   */
+  m = guestfs_get_memsize (g);
+  if (m == -1 ||
+      guestfs_set_memsize (g, m * 20 / 5) == -1)
+    error (EXIT_FAILURE, 0, "get or set memsize failed");
+
   tmpdir = guestfs_get_cachedir (g);
   if (tmpdir == NULL)
     exit (EXIT_FAILURE);
diff --git a/utils/max-disks/max-disks.pl b/utils/max-disks/max-disks.pl
index f7fe5bca2..714357fbb 100755
--- a/utils/max-disks/max-disks.pl
+++ b/utils/max-disks/max-disks.pl
@@ -41,6 +41,7 @@ my $mid = 1024;
 
 # Get the kernel under test.
 my $g = Sys::Guestfs->new ();
+$g->set_memsize ($g->get_memsize () * 20 / 5);
 $g->launch ();
 my %kernel = $g->utsname;
 $g->close ();
-- 
2.15.1




More information about the Libguestfs mailing list