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

Pino Toscano ptoscano at redhat.com
Wed May 16 12:14:51 UTC 2018


On Wednesday, 16 May 2018 13:51:20 CEST Richard W.M. Jones wrote:
> ---
>  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);

This is OK.

> 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 ();

I don't see how this changes the situation, given that the handle
here is used only to get the information of the kernel running in the
appliance.  I guess should rather be done to the handle created in the
test_mid subroutine?

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180516/81b1fcd3/attachment.sig>


More information about the Libguestfs mailing list