[libvirt] [PATCH] libxl: fix domxml-to-native wrong output for qcow2 format

Bamvor Jian Zhang bjzhang at suse.com
Thu Jun 12 06:00:09 UTC 2014


e.g. for these following disk configuration in libvirt.
      <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/xen/images/001/disk0.qcow2'/>
      <target dev='hdc'/>

without this patch, it will be
    "qemu:/var/lib/xen/images/001/disk0.qcow2,hdc,w"
but it should be(if with this patch)
    "qcow2:/var/lib/xen/images/001/disk0.qcow2,hdc,w"

Signed-off-by: Bamvor Jian Zhang <bjzhang at suse.com>
---
 src/xenxs/xen_xm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b2db97d..29835b4 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1209,7 +1209,10 @@ xenFormatXMDisk(virConfValuePtr list,
                 type = "aio";
             else
                 type = virStorageFileFormatTypeToString(format);
-            virBufferAsprintf(&buf, "%s:", driver);
+            if (!STREQ(type, "qcow2"))
+                virBufferAsprintf(&buf, "%s:", driver);
+            else
+                virBufferAsprintf(&buf, "%s:", type);
             if (STREQ(driver, "tap"))
                 virBufferAsprintf(&buf, "%s:", type);
         } else {
-- 
1.8.1.4




More information about the libvir-list mailing list