From 4606884cd31d12b7e961a0d8d4bae6c6709a1ddef0cde510cd1395ea2334dcdb Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 22 Jan 2014 17:33:16 +0000 Subject: [PATCH 1/3] Let guestfs-test require the main pkg to pull everything in OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=264 --- libguestfs.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/libguestfs.spec b/libguestfs.spec index 1f77c1c..ee1a587 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -336,6 +336,7 @@ Allows Ruby scripts to directly use libguestfs. Summary: Testcases for libguestfs License: GPL-2.0 Group: System/Filesystems +Requires: %{name} %description test This package contains testcases to verify libguestfs functionality. From 131e6872cdca882ee8fdf4ee9dfcfc9051094d77e87603d2d56437b99e3957a0 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jan 2014 16:54:07 +0000 Subject: [PATCH 2/3] - Disable ipv6 in the appliance because qemu usernet is ipv4 only OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=266 --- libguestfs.changes | 5 +++++ libguestfs.mkinitrd.boot.sh | 11 ++++++++++- libguestfs.mkinitrd.setup.sh | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libguestfs.changes b/libguestfs.changes index 77a53d7..a7bb74a 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jan 23 17:53:31 CET 2014 - ohering@suse.de + +- Disable ipv6 in the appliance because qemu usernet is ipv4 only + ------------------------------------------------------------------- Wed Jan 22 10:13:00 UTC 2014 - ohering@suse.com diff --git a/libguestfs.mkinitrd.boot.sh b/libguestfs.mkinitrd.boot.sh index 0924142..2362b95 100644 --- a/libguestfs.mkinitrd.boot.sh +++ b/libguestfs.mkinitrd.boot.sh @@ -81,7 +81,6 @@ #%udevmodules: nfsv2 #%udevmodules: nfsv3 #%udevmodules: nfsv4 -#%udevmodules: ipv6 # #%udevmodules: dm-crypt # @@ -237,6 +236,16 @@ for f in /sys/block/sd*/device/timeout; do if test -w $f ; then echo 300 > $f; f # https://access.redhat.com/site/solutions/5427 for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do if test -w $f ; then echo noop > $f; fi; done +# Disable ipv6 because host names resolve to ipv4 and ipv6 +# Resolver may prefer ipv6 and qemu usernet does only ipv4 +for f in /proc/sys/net/ipv6/conf/*/disable_ipv6 +do + if test -w $f + then + echo 1 > $f + fi +done + # Set up the network. ip addr add 127.0.0.1/8 brd + dev lo scope host ip link set dev lo up diff --git a/libguestfs.mkinitrd.setup.sh b/libguestfs.mkinitrd.setup.sh index 6a43584..39917c9 100644 --- a/libguestfs.mkinitrd.setup.sh +++ b/libguestfs.mkinitrd.setup.sh @@ -11,6 +11,10 @@ do cp $i $tmp_mnt$i done +# Disable ipv6 because host names resolve to ipv4 and ipv6 +# Resolver may prefer ipv6 and qemu usernet does only ipv4 +echo install ipv6 /bin/true >> $tmp_mnt/etc/modprobe.conf.local + # many guestfish commands need a mount point # in guestfsd the mount point defaults to /sysroot mkdir -vp $tmp_mnt/sysroot From 12c428215473b605bc163677f1da2b207abd1c4c0cf1c6df57b025fdd8114177 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jan 2014 22:34:34 +0000 Subject: [PATCH 3/3] Update test-tool to handle virtio-blk in 11.4 builds OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=267 --- ...force-virtio_blk-in-old-guest-kernel.patch | 75 ++++++++++++++++--- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/1000-force-virtio_blk-in-old-guest-kernel.patch b/1000-force-virtio_blk-in-old-guest-kernel.patch index aef3d1b..b53e120 100644 --- a/1000-force-virtio_blk-in-old-guest-kernel.patch +++ b/1000-force-virtio_blk-in-old-guest-kernel.patch @@ -1,4 +1,4 @@ -From 592819524390bc354d16940107e4c22ca41e48b9 Mon Sep 17 00:00:00 2001 +From 6ad9fa64944b23817e8fa642c81fc3ecc93a3464 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 3 Sep 2012 19:50:44 +0200 Subject: force virtio_blk in old guest kernel @@ -10,13 +10,14 @@ Signed-off-by: Olaf Hering src/handle.c | 16 ++++++++++++++++ src/inspect-fs-unix.c | 4 ++-- src/launch-direct.c | 2 ++ - 5 files changed, 26 insertions(+), 4 deletions(-) + test-tool/test-tool.c | 15 ++++++++++++--- + 6 files changed, 38 insertions(+), 7 deletions(-) diff --git a/fish/options.c b/fish/options.c -index 75d61ad..b0bcd09 100644 +index 770576b..6f143e1 100644 --- a/fish/options.c +++ b/fish/options.c -@@ -80,7 +80,10 @@ add_drives (struct drv *drv, char next_drive) +@@ -100,7 +100,10 @@ add_drives (struct drv *drv, char next_drive) { int r; struct guestfs_add_drive_opts_argv ad_optargs; @@ -28,7 +29,7 @@ index 75d61ad..b0bcd09 100644 if (next_drive > 'z') { fprintf (stderr, _("%s: too many drives added on the command line\n"), -@@ -94,7 +97,7 @@ add_drives (struct drv *drv, char next_drive) +@@ -114,7 +117,7 @@ add_drives (struct drv *drv, char next_drive) free (drv->device); drv->device = NULL; @@ -38,7 +39,7 @@ index 75d61ad..b0bcd09 100644 exit (EXIT_FAILURE); } diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h -index 5356920..2a9f9fe 100644 +index 8888603..d4f6e90 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -472,6 +472,7 @@ struct guestfs_h @@ -50,7 +51,7 @@ index 5356920..2a9f9fe 100644 /* Per-filesystem data stored for inspect_os. */ diff --git a/src/handle.c b/src/handle.c -index fa96d95..e1732d7 100644 +index fffe825..4633df6 100644 --- a/src/handle.c +++ b/src/handle.c @@ -237,6 +237,22 @@ parse_environment (guestfs_h *g, @@ -77,10 +78,10 @@ index fa96d95..e1732d7 100644 } diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c -index 8e0f135..83d23c7 100644 +index 93e035f..6d38bf8 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c -@@ -1407,7 +1407,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part, +@@ -1419,7 +1419,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part, return 0; /* Make the partition name and check it exists. */ @@ -89,7 +90,7 @@ index 8e0f135..83d23c7 100644 if (!is_partition (g, device)) { free (device); return 0; -@@ -1500,7 +1500,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map) +@@ -1512,7 +1512,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map) if (disk_i != -1 && disk_i <= 26 && slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ && part_i >= 0 && part_i < 26) { @@ -99,10 +100,10 @@ index 8e0f135..83d23c7 100644 } else if ((part = match1 (g, spec, re_diskbyid)) != NULL) { diff --git a/src/launch-direct.c b/src/launch-direct.c -index 070c649..a4c94e8 100644 +index f44cc20..d212b87 100644 --- a/src/launch-direct.c +++ b/src/launch-direct.c -@@ -1068,6 +1068,8 @@ qemu_supports_virtio_scsi (guestfs_h *g, struct backend_direct_data *data) +@@ -1066,6 +1066,8 @@ qemu_supports_virtio_scsi (guestfs_h *g, struct backend_direct_data *data) data->virtio_scsi = 3; } } @@ -111,3 +112,53 @@ index 070c649..a4c94e8 100644 return data->virtio_scsi == 1; } +diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c +index 3a35226..03565ac 100644 +--- a/test-tool/test-tool.c ++++ b/test-tool/test-tool.c +@@ -44,6 +44,14 @@ + + #define DEFAULT_TIMEOUT 600 + ++#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK ++static const char disk[] = "/dev/vda"; ++static const char part[] = "/dev/vda1"; ++#else ++static const char disk[] = "/dev/sda"; ++static const char part[] = "/dev/sda1"; ++#endif ++ + static int timeout = DEFAULT_TIMEOUT; + + static void set_qemu (guestfs_h *g, const char *path, int use_wrapper); +@@ -186,6 +194,7 @@ main (int argc, char *argv[]) + exit (EXIT_FAILURE); + } + guestfs_set_verbose (g, 1); ++ guestfs_set_trace (g, 1); + + if (qemu) + set_qemu (g, qemu, qemu_use_wrapper); +@@ -272,19 +281,19 @@ main (int argc, char *argv[]) + fflush (stdout); + + /* Create the filesystem and mount everything. */ +- if (guestfs_part_disk (g, "/dev/sda", "mbr") == -1) { ++ if (guestfs_part_disk (g, disk, "mbr") == -1) { + fprintf (stderr, + _("libguestfs-test-tool: failed to run part-disk\n")); + exit (EXIT_FAILURE); + } + +- if (guestfs_mkfs (g, "ext2", "/dev/sda1") == -1) { ++ if (guestfs_mkfs (g, "ext2", part) == -1) { + fprintf (stderr, + _("libguestfs-test-tool: failed to mkfs.ext2\n")); + exit (EXIT_FAILURE); + } + +- if (guestfs_mount (g, "/dev/sda1", "/") == -1) { ++ if (guestfs_mount (g, part, "/") == -1) { + fprintf (stderr, + _("libguestfs-test-tool: failed to mount /dev/sda1 on /\n")); + exit (EXIT_FAILURE);