Format a JSON object with the device properties and then use qemuBuildDeviceCommandlineFromJSON to convert it to the standard commandline for now. The 'ioport' property of 'pvpanic' is a number in QEMU: ioport=<uint16> - (default: 1285) Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_command.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c9d98b8f1a..25859ee653 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10161,25 +10161,36 @@ qemuBuildVMCoreInfoCommandLine(virCommand *cmd, static int qemuBuildPanicCommandLine(virCommand *cmd, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { size_t i; for (i = 0; i < def->npanics; i++) { switch ((virDomainPanicModel) def->panics[i]->model) { - case VIR_DOMAIN_PANIC_MODEL_ISA: - switch (def->panics[i]->info.type) { - case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: - virCommandAddArg(cmd, "-device"); - virCommandAddArgFormat(cmd, "pvpanic,ioport=%d", - def->panics[i]->info.addr.isa.iobase); - break; + case VIR_DOMAIN_PANIC_MODEL_ISA: { + g_autoptr(virJSONValue) props = NULL; - case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE: - virCommandAddArgList(cmd, "-device", "pvpanic", NULL); - break; + if (virJSONValueObjectCreate(&props, + "s:driver", "pvpanic", + NULL) < 0) + return -1; + + /* pvpanic uses 'ioport' instead of 'iobase' so + * qemuBuildDeviceAddressProps can't be used */ + if (def->panics[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { + if (virJSONValueObjectAdd(props, + "u:ioport", def->panics[i]->info.addr.isa.iobase, + NULL) < 0) + return -1; } + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; + + break; + } + case VIR_DOMAIN_PANIC_MODEL_S390: case VIR_DOMAIN_PANIC_MODEL_HYPERV: case VIR_DOMAIN_PANIC_MODEL_PSERIES: @@ -10844,7 +10855,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildSeccompSandboxCommandLine(cmd, cfg, qemuCaps) < 0) return NULL; - if (qemuBuildPanicCommandLine(cmd, def) < 0) + if (qemuBuildPanicCommandLine(cmd, def, qemuCaps) < 0) return NULL; for (i = 0; i < def->nshmems; i++) { -- 2.31.1