On Fri, Apr 24, 2015 at 02:51:50PM +0200, Maros Zatko wrote:
@@ -1605,6 +1607,10 @@ construct_libvirt_xml_disk_driver_qemu (guestfs_h *g, break; }
+ if (data->qemu_version < 2001000) { + detect_zeroes = false; + } + start_element ("driver") { attribute ("name", "qemu"); attribute ("type", format); @@ -1613,6 +1619,8 @@ construct_libvirt_xml_disk_driver_qemu (guestfs_h *g, attribute ("discard", "unmap"); if (copyonread) attribute ("copy_on_read", "on"); + if (detect_zeroes) + attribute ("detect_zeroes", "on"); } end_element ();
return 0;
To make the code less fragile, reduce long-range dependencies. Combine these two hunks into one: if (detect_zeroes && data->qemu_version < ...) { ... } Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org