[Libguestfs] [PATCH] Fix swapon_label test

Richard W.M. Jones rjones at redhat.com
Wed Aug 5 08:45:21 UTC 2009


On Wed, Aug 05, 2009 at 09:35:43AM +0100, Matthew Booth wrote:
> The swapon label test has a side-effect, in that it creates a new partition.
> This causes the later failure of the list_partitions test.
> 
> This change causes the swapon_label test to scrub /dev/sdb after the test, and
> then re-read the partition table.
> ---
>  src/generator.ml |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/src/generator.ml b/src/generator.ml
> index 9ef99bd..fe538a6 100755
> --- a/src/generator.ml
> +++ b/src/generator.ml
> @@ -3254,7 +3254,9 @@ This command disables the libguestfs appliance swap on file.");
>        [["sfdiskM"; "/dev/sdb"; ","];
>         ["mkswap_L"; "swapit"; "/dev/sdb1"];
>         ["swapon_label"; "swapit"];
> -       ["swapoff_label"; "swapit"]])],
> +       ["swapoff_label"; "swapit"];
> +       ["scrub_device"; "/dev/sdb"];

Probably better to use "zero" instead of "scrub_device"..  "zero" just
writes zeroes over the first few blocks, whereas "scrub_device" does
an intensive multi-pass scrub.

Patch looks good otherwise.  Strange that it didn't give an error for
me, but there you go.

Rich.

> +       ["blockdev_rereadpt"; "/dev/sdb"]])],
>     "enable swap on labelled swap partition",
>     "\
>  This command enables swap to a labelled swap partition.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list