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:
<capabilities>
...
<guest>
<os_type>hvm</os_type>
...
<features>
<drivediscard/>
</features>
</guest>
</capabilities>
---
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
Please disregard this patch. Dan pointed out that it is possible to
read the hypervisor version using virConnectGetVersion.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top