]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildVMCoreInfoCommandLine: Generate via JSON
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 Oct 2021 14:21:31 +0000 (16:21 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 18:54:53 +0000 (20:54 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index 86affcdf6f453f9d256394a85cc96d6b146dd605..56bf17b6b408f86738d9f71cfb8ab33bdb643381 100644 (file)
@@ -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)