The capabilities will have a <drivediscard/> feature if you are
allowed to use the qemu attribute:
<driver name='qemu' ... discard='unmap|ignore' />
The new capabilities XML looks like this:
<capabiltiies>
...
<guest>
<os_type>hvm</os_type>
...
<features>
<drivediscard/>
</features>
</guest>
</capabiltiies>
---
src/conf/capabilities.c | 3 ++-
src/qemu/qemu_capabilities.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index c1c4ab8..ff5912a 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -947,7 +947,8 @@ virCapabilitiesFormatXML(virCapsPtr caps)
STREQ(caps->guests[i]->features[j]->name,
"nonpae") ||
STREQ(caps->guests[i]->features[j]->name,
"ia64_be") ||
STREQ(caps->guests[i]->features[j]->name,
"cpuselection") ||
- STREQ(caps->guests[i]->features[j]->name,
"deviceboot")) {
+ STREQ(caps->guests[i]->features[j]->name,
"deviceboot") ||
+ STREQ(caps->guests[i]->features[j]->name,
"drivediscard")) {
virBufferAsprintf(&xml, " <%s/>\n",
caps->guests[i]->features[j]->name);
} else {
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cae25e0..b755fb2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -778,6 +778,10 @@ virQEMUCapsInitGuest(virCapsPtr caps,
!virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))
goto error;
+ if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_DRIVE_DISCARD) &&
+ !virCapabilitiesAddGuestFeature(guest, "drivediscard", 0, 0))
+ goto error;
+
if (virCapabilitiesAddGuestDomain(guest,
"qemu",
NULL,
--
1.8.5.3
Show replies by date
On Sun, Mar 09, 2014 at 04:53:59PM +0000, Richard W.M. Jones wrote:
<capabiltiies>
I'm going to post a v2 of this patch with spelling mistakes fixed.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v