qemu: export disk snapshot support in capabilities

This patch adds an element to QEMU's capability XML, to
show if the underlying QEMU binary supports the live disk
snapshotting or not.
This allows any client to know ahead of time if the feature
is available.

Without this information available, the only way to check
for the snapshot support is to request one and check for
errors.

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani 2014-03-17 16:19:44 +01:00 committed by Michal Privoznik
parent 97814d8ab3
commit 85a3eb8a6d
2 changed files with 13 additions and 0 deletions

View File

@ -371,6 +371,12 @@
<empty/>
</element>
</optional>
<optional>
<element name='disksnapshot'>
<ref name='featuretoggle'/>
<empty/>
</element>
</optional>
</interleave>
</element>
</define>

View File

@ -702,6 +702,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
virQEMUCapsPtr qemubinCaps = NULL;
virQEMUCapsPtr kvmbinCaps = NULL;
int ret = -1;
bool hasdisksnapshot = false;
/* Check for existence of base emulator, or alternate base
* which can be used with magic cpu choice
@ -789,6 +790,12 @@ virQEMUCapsInitGuest(virCapsPtr caps,
!virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))
goto error;
if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_DISK_SNAPSHOT))
hasdisksnapshot = true;
if (!virCapabilitiesAddGuestFeature(guest, "disksnapshot", hasdisksnapshot, 0))
goto error;
if (virCapabilitiesAddGuestDomain(guest,
"qemu",
NULL,