[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/4] qemu: export disk snapshot support in capabilities



This patch add an element to QEMU's capability XML, to
show if the underlying QEMU binary supports the live disk
snapshotting or not.
This allow 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>
---
 docs/schemas/capability.rng  | 6 ++++++
 src/qemu/qemu_capabilities.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index aee03d7..d2d9776 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -371,6 +371,12 @@
             <empty/>
           </element>
         </optional>
+        <optional>
+          <element name='disksnapshot'>
+            <ref name='featuretoggle'/>
+            <empty/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0538115..923b2a3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -687,6 +687,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
@@ -774,6 +775,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,
-- 
1.8.4.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]