From fe2253088ff51b51e2586f27a9408a38655170e3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 26 Jul 2012 18:25:06 +0100 Subject: appliance: Add '-drive detect-zero=on' flag if qemu supports it. NB: The patch to implement this feature in qemu is not upstream, and may never make it upstream. However this is so useful for virt-sparsify that I decided to add this to libguestfs while we see what qemu decides to do. --- src/launch-appliance.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/launch-appliance.c b/src/launch-appliance.c index 328cd196..bad9cb70 100644 --- a/src/launch-appliance.c +++ b/src/launch-appliance.c @@ -942,11 +942,12 @@ qemu_drive_param (guestfs_h *g, const struct drive *drv, size_t index) else iface = "virtio"; - snprintf (&r[i], len-i, "%s%s%s%s,id=hd%zu,if=%s", + snprintf (&r[i], len-i, "%s%s%s%s%s,id=hd%zu,if=%s", drv->readonly ? ",snapshot=on" : "", drv->use_cache_none ? ",cache=none" : "", drv->format ? ",format=" : "", drv->format ? drv->format : "", + qemu_supports (g, "detect-zero") ? ",detect-zero=on" : "", index, iface); -- cgit