File libxl-domxml-to-native.patch of Package libvirt.11411
From 92c476cbe47009c43ebb4a3076a17347c8eea238 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@suse.com>
Date: Thu, 12 Jun 2014 15:28:48 -0600
Subject: [PATCH] libxl: fix domxml-to-native with qemu disk driver
Disk config containing <driver name='qemu'.../> is converted to
the native config containg "qemu:/path/to/disk", which is not
understood by xm or xl.
This patch maps 'qemu' to 'tap'. In xl, tap is mapped to the qemu
backend (aka qdisk), making this change essentially a no-op. In
the xm stack, one could argue that mapping qemu to tap isn't too
insane, since much of the blktap userspace code was originally
based on qemu.
While at it, noticed that 'driver' wasn't being honored in
xenFormatXMDisk, so change the logic a bit to honor a
user-specified driver.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
src/xenxs/xen_xm.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
Index: libvirt-1.2.5/src/xenxs/xen_xm.c
===================================================================
--- libvirt-1.2.5.orig/src/xenxs/xen_xm.c
+++ libvirt-1.2.5/src/xenxs/xen_xm.c
@@ -1210,17 +1210,28 @@ xenFormatXMDisk(virConfValuePtr list,
int format = virDomainDiskGetFormat(disk);
const char *driver = virDomainDiskGetDriver(disk);
- if (src) {
- if (format) {
- const char *type;
+ /*
+ * In pre-libxl Xen, 'tap' provided the qemu driver functionality.
+ * In libxl Xen, qemu (aka qdisk) is in fact used. For backwards
+ * compatibility, tap == qdisk in libxl Xen, so it is safe to use
+ * 'tap' in libxl tool.
+ */
+ if (STREQ_NULLABLE(driver, "qemu"))
+ driver = "tap";
- if (format == VIR_STORAGE_FILE_RAW)
- type = "aio";
- else
- type = virStorageFileFormatTypeToString(format);
+ if (src) {
+ if (driver) {
virBufferAsprintf(&buf, "%s:", driver);
- if (STREQ(driver, "tap"))
- virBufferAsprintf(&buf, "%s:", type);
+ if (format) {
+ const char *type;
+
+ if (format == VIR_STORAGE_FILE_RAW)
+ type = "aio";
+ else
+ type = virStorageFileFormatTypeToString(format);
+ if (STREQ(driver, "tap"))
+ virBufferAsprintf(&buf, "%s:", type);
+ }
} else {
switch (virDomainDiskGetType(disk)) {
case VIR_STORAGE_TYPE_FILE: