[libvirt] [PATCH 1/3] snapshot: add qemu capability for 'transaction' command

Eric Blake eblake at redhat.com
Fri Mar 16 22:05:52 UTC 2012


We need a capability bit to gracefully error out if some of the
additions in future patches can't be implemented by the running qemu.

* src/qemu/qemu_capabilities.h (QEMU_CAPS_TRANSACTION): New cap.
* src/qemu/qemu_capabilities.c (qemuCaps): Name it.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONCheckCommands): Set
it.
---

I haven't yet decided if I need to check for 'block-mirror' as an
independent capability, but that can be a later patch.

 src/qemu/qemu_capabilities.c |    1 +
 src/qemu/qemu_capabilities.h |    1 +
 src/qemu/qemu_monitor_json.c |    3 +++
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ace5011..0e09d6d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -155,6 +155,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "system_wakeup",
               "scsi-disk.channel",
               "scsi-block",
+              "transaction",
     );

 struct qemu_feature_flags {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 62b4270..78cdbe0 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -123,6 +123,7 @@ enum qemuCapsFlags {
     QEMU_CAPS_WAKEUP             = 86, /* system_wakeup monitor command */
     QEMU_CAPS_SCSI_DISK_CHANNEL  = 87, /* Is scsi-disk.channel available? */
     QEMU_CAPS_SCSI_BLOCK         = 88, /* -device scsi-block */
+    QEMU_CAPS_TRANSACTION        = 89, /* transaction monitor command */

     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index ce68e69..4dd6924 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -884,6 +884,9 @@ qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,

         if (STREQ(name, "system_wakeup"))
             qemuCapsSet(qemuCaps, QEMU_CAPS_WAKEUP);
+
+        if (STREQ(name, "transaction"))
+            qemuCapsSet(qemuCaps, QEMU_CAPS_TRANSACTION);
     }

     ret = 0;
-- 
1.7.7.6




More information about the libvir-list mailing list