From edd8433ad0dee9b622610eb447672227bd6164d5aa332a7c9861bf18acfbde7e Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 3 Sep 2012 18:00:34 +0000 Subject: [PATCH] add patch to force virtio_blk or virtio_scsi via environment variable OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=64 --- ...force-virtio_blk-in-old-guest-kernel.patch | 55 +++++++++++++++++++ libguestfs-1.19.37.patch | 16 ------ libguestfs.spec | 4 +- 3 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 0001-force-virtio_blk-in-old-guest-kernel.patch delete mode 100644 libguestfs-1.19.37.patch diff --git a/0001-force-virtio_blk-in-old-guest-kernel.patch b/0001-force-virtio_blk-in-old-guest-kernel.patch new file mode 100644 index 0000000..83a1447 --- /dev/null +++ b/0001-force-virtio_blk-in-old-guest-kernel.patch @@ -0,0 +1,55 @@ +From e823035a30944ba71b9d8e60b30a650425dc9711 Mon Sep 17 00:00:00 2001 +From: Olaf Hering +Date: Mon, 3 Sep 2012 19:50:44 +0200 +Subject: [PATCH] force virtio_blk in old guest kernel + +Signed-off-by: Olaf Hering +--- + src/launch-appliance.c | 24 ++++++++++++++++++++++++ + 1 Datei geändert, 24 Zeilen hinzugefügt(+) + +diff --git a/src/launch-appliance.c b/src/launch-appliance.c +index 328cd19..796c268 100644 +--- a/src/launch-appliance.c ++++ b/src/launch-appliance.c +@@ -881,6 +881,28 @@ is_openable (guestfs_h *g, const char *path, int flags) + return 1; + } + ++/* ++ * Currently virtio_scsi is forced if qemu in the host supports this ++ * feature. This test does however not take the capabilities of the started ++ * guest into account. As a result no disks will be found if the guest ++ * kernel is older than 3.4. ++ */ ++static void qemu_force_virtio_blk(guestfs_h *g) ++{ ++#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK ++ static const char env_string[] = "GUESTFS_QEMU_NO_VIRTIO_BLK"; ++ char *p = getenv(env_string); ++ if (p) { ++ if (g->verbose) ++ guestfs___print_timestamped_message (g, "SuSE: %s in environment, preserving virtio-scsi setting.", env_string); ++ } else { ++ if (g->verbose) ++ guestfs___print_timestamped_message (g, "SuSE: %s not in environment, preventing virtio-scsi usage in old guest kernel.", env_string); ++ g->app.virtio_scsi = 2; ++ } ++#endif ++} ++ + /* Returns 1 = use virtio-scsi, or 0 = use virtio-blk. */ + static int + qemu_supports_virtio_scsi (guestfs_h *g) +@@ -903,6 +925,8 @@ qemu_supports_virtio_scsi (guestfs_h *g) + g->app.virtio_scsi = 3; + } + ++ qemu_force_virtio_blk(g); ++ + return g->app.virtio_scsi == 1; + } + +-- +1.7.11.5 + diff --git a/libguestfs-1.19.37.patch b/libguestfs-1.19.37.patch deleted file mode 100644 index 0d267f2..0000000 --- a/libguestfs-1.19.37.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- - src/launch-appliance.c | 1 + - 1 file changed, 1 insertion(+) - -Index: libguestfs-1.19.37/src/launch-appliance.c -=================================================================== ---- libguestfs-1.19.37.orig/src/launch-appliance.c -+++ libguestfs-1.19.37/src/launch-appliance.c -@@ -885,6 +885,7 @@ is_openable (guestfs_h *g, const char *p - static int - qemu_supports_virtio_scsi (guestfs_h *g) - { -+ return 0; - int r; - - /* g->app.virtio_scsi has these values: diff --git a/libguestfs.spec b/libguestfs.spec index 7770140..ed164d2 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -149,8 +149,8 @@ License: LGPL-2.1 Group: System/Filesystems Version: 1.19.37 Release: 0 -Patch0: libguestfs-1.19.37.patch Patch5: libguestfs-1.13.14-ruby.patch +Patch100: 0001-force-virtio_blk-in-old-guest-kernel.patch Source0: %{name}-%{version}.tar.gz Source10: libguestfs.mkinitrd.boot.sh Source11: libguestfs.mkinitrd.setup.sh @@ -309,8 +309,8 @@ virtual machines. %prep %setup -q -%patch0 -p1 %patch5 -p1 +%patch100 -p1 %build # disable qemu test.