]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor: Add API for checking CPU migratable property
authorJiri Denemark <jdenemar@redhat.com>
Wed, 15 Jul 2020 20:33:07 +0000 (22:33 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 21 Jul 2020 13:40:01 +0000 (15:40 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h

index 2c66397f8b2490dd30f4f6c5a87313c64a0b10c8..637361d24d922a184ad93d03c9283ff565d48fd7 100644 (file)
@@ -4526,6 +4526,24 @@ qemuMonitorGetJobInfo(qemuMonitorPtr mon,
 }
 
 
+/* qemuMonitorGetCPUMigratable:
+ *
+ * Get the migratable property of the CPU object.
+ *
+ * Returns -1 on error,
+ *          1 when the property is not supported,
+ *          0 on success (@migratable is set accordingly).
+ */
+int
+qemuMonitorGetCPUMigratable(qemuMonitorPtr mon,
+                            bool *migratable)
+{
+    QEMU_CHECK_MONITOR(mon);
+
+    return qemuMonitorJSONGetCPUMigratable(mon, migratable);
+}
+
+
 int
 qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
                                 const char *node,
index 50a337715dffff9d8a71395600b222dac3ff708b..1c1b0c9b8962621cefe2c9930f29bc82f5c9f8cb 100644 (file)
@@ -1377,6 +1377,10 @@ int qemuMonitorGetJobInfo(qemuMonitorPtr mon,
                           qemuMonitorJobInfoPtr **jobs,
                           size_t *njobs);
 
+int
+qemuMonitorGetCPUMigratable(qemuMonitorPtr mon,
+                            bool *migratable);
+
 int
 qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
                                 const char *node,
index d808c4b55b60fee1d6e1e87a0dca0b31069d28cf..83f169e31b9046d324aa435c0b6f8e08545aa062 100644 (file)
@@ -9388,3 +9388,30 @@ qemuMonitorJSONGetJobInfo(qemuMonitorPtr mon,
 
     return 0;
 }
+
+
+int
+qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon,
+                                bool *migratable)
+{
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
+
+    if (!(cmd = qemuMonitorJSONMakeCommand("qom-get",
+                                           "s:path", QOM_CPU_PATH,
+                                           "s:property", "migratable",
+                                           NULL)))
+        return -1;
+
+    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+        return -1;
+
+    if (qemuMonitorJSONHasError(reply, "GenericError"))
+        return 1;
+
+    if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_BOOLEAN) < 0)
+        return -1;
+
+    return virJSONValueGetBoolean(virJSONValueObjectGet(reply, "return"),
+                                  migratable);
+}
index 83c5e25ca5706d452d9075ed3c0935de9815966f..84fea25983dfbddd3dc5548abdd4cde92d80e95d 100644 (file)
@@ -690,3 +690,7 @@ int qemuMonitorJSONSetDBusVMStateIdList(qemuMonitorPtr mon,
                                         const char *vmstatepath,
                                         const char **list)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+
+int
+qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon,
+                                bool *migratable);