[PATCH 10/14] qemuBuildVMCoreInfoCommandLine: Generate via JSON

Peter Krempa pkrempa at redhat.com
Tue Oct 12 11:12:16 UTC 2021


While this device doesn't have any properties it must be converted to
use qemuBuildDeviceCommandlineFromJSON so that we can validate it in the
future.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_command.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 86affcdf6f..56bf17b6b4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10097,14 +10097,22 @@ qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd,

 static int
 qemuBuildVMCoreInfoCommandLine(virCommand *cmd,
-                               const virDomainDef *def)
+                               const virDomainDef *def,
+                               virQEMUCaps *qemuCaps)
 {
-    virTristateSwitch vmci = def->features[VIR_DOMAIN_FEATURE_VMCOREINFO];
+    g_autoptr(virJSONValue) props = NULL;

-    if (vmci != VIR_TRISTATE_SWITCH_ON)
+    if (def->features[VIR_DOMAIN_FEATURE_VMCOREINFO] != VIR_TRISTATE_SWITCH_ON)
         return 0;

-    virCommandAddArgList(cmd, "-device", "vmcoreinfo", NULL);
+    if (virJSONValueObjectCreate(&props,
+                                 "s:driver", "vmcoreinfo",
+                                 NULL) < 0)
+        return -1;
+
+    if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
+        return -1;
+
     return 0;
 }

@@ -10785,7 +10793,7 @@ qemuBuildCommandLine(virQEMUDriver *driver,
     if (qemuBuildNVRAMCommandLine(cmd, def) < 0)
         return NULL;

-    if (qemuBuildVMCoreInfoCommandLine(cmd, def) < 0)
+    if (qemuBuildVMCoreInfoCommandLine(cmd, def, qemuCaps) < 0)
         return NULL;

     if (qemuBuildSecCommandLine(vm, cmd, def->sec) < 0)
-- 
2.31.1




More information about the libvir-list mailing list