libxl: Tell qemu to use raw format when using a tapdisk
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 9 Dec 2014 14:04:19 +0000 (14:04 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 16 Dec 2014 12:47:41 +0000 (12:47 +0000)
At the moment libxl unconditinally passes the underlying file format
to qemu in the device string.  However, when tapdisk is in use,
tapdisk handles the underlying format and presents qemu with
effectively a raw disk.  When qemu looks at the tapdisk block device
and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at
the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file
format.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[ ijc -- nuked extra blank line ]

tools/libxl/libxl_dm.c

index b25b57446379c885cd6cb46eff81e31e8d146395..c2b0487c0ed2348972ce0820a3bb7e034d3db1f9 100644 (file)
@@ -797,11 +797,13 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
 
                 /*
                  * Explicit sd disks are passed through as is.