SHA256
1
0
forked from pool/libguestfs
libguestfs/0001-force-virtio_blk-in-old-guest-kernel.patch

56 lines
1.7 KiB
Diff

From e823035a30944ba71b9d8e60b30a650425dc9711 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Mon, 3 Sep 2012 19:50:44 +0200
Subject: [PATCH] force virtio_blk in old guest kernel
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
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