From 85a3eb8a6d44e4501c00c9aeed0039ccaf29cdc5 Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Mon, 17 Mar 2014 16:19:44 +0100 Subject: [PATCH] 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 --- 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 aee03d7fcd..d2d9776e49 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -371,6 +371,12 @@ + + + + + + diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1e55121ade..1df7653eaf 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -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, -- 2.39.5