From 5d51f836b0be9c08f9e154c352da74d61c7e8e53 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 11 Oct 2021 16:21:31 +0200 Subject: [PATCH] qemuBuildVMCoreInfoCommandLine: Generate via JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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)