]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: export disk snapshot support in capabilities
authorFrancesco Romani <fromani@redhat.com>
Mon, 17 Mar 2014 15:19:44 +0000 (16:19 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 26 Mar 2014 12:41:25 +0000 (13:41 +0100)
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>
docs/schemas/capability.rng
src/qemu/qemu_capabilities.c

index aee03d7fcd5870d24fcfdbfb0a7d0bcdbcc24ca9..d2d9776e49448bb836b17176fe31f36870e73e38 100644 (file)
             <empty/>
           </element>
         </optional>
+        <optional>
+          <element name='disksnapshot'>
+            <ref name='featuretoggle'/>
+            <empty/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
index 1e55121adec2ac577c0c9f4dc777f4a35f56c547..1df7653eaf92caae80952e39d08b97d6ea2c9f63 100644 (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,