On Wed, Feb 08, 2023 at 12:49:01 +0100, Kristina Hanicova wrote: > This patch introduces optional device pvpanic-pci, validates it's > address and generates command line. > > Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> > --- > src/conf/domain_conf.c | 1 + > src/conf/domain_conf.h | 1 + > src/conf/schemas/domaincommon.rng | 1 + > src/qemu/qemu_command.c | 19 +++++++++++++++++++ > src/qemu/qemu_validate.c | 16 ++++++++++++++++ > 5 files changed, 38 insertions(+) > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index 90dc6b5434..64fee74671 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -9557,6 +9557,25 @@ qemuBuildPanicCommandLine(virCommand *cmd, > break; > } > > + case VIR_DOMAIN_PANIC_MODEL_PVPANIC: { > + g_autoptr(virJSONValue) props = NULL; > + > + if (virJSONValueObjectAdd(&props, > + "s:driver", "pvpanic-pci", > + NULL) < 0) > + return -1; > + > + if (def->panics[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { This check doesn't make much sense ... > + if (qemuBuildDeviceAddressProps(props, def, &def->panics[i]->info) < 0) ... as this does the correct thing for _NONE ... > + return -1; > + } > + > + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, def, qemuCaps) < 0) > + return -1; > + > + break; > + } > + > case VIR_DOMAIN_PANIC_MODEL_S390: > case VIR_DOMAIN_PANIC_MODEL_HYPERV: > case VIR_DOMAIN_PANIC_MODEL_PSERIES: > diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c > index c8c289ebb4..87adaaebdc 100644 > --- a/src/qemu/qemu_validate.c > +++ b/src/qemu/qemu_validate.c > @@ -1146,6 +1146,22 @@ qemuValidateDomainDefPanic(const virDomainDef *def, > } > break; > > + case VIR_DOMAIN_PANIC_MODEL_PVPANIC: > + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PANIC_PCI)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("the QEMU binary does not support the " > + "PCI pvpanic device")); Please no linebreaks in error messages. > + return -1; > + } > + > + if (def->panics[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { ... and you also force the correct type here. > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("pvpanic is supported only " > + "with PCI address type")); Same as above. > + return -1; > + } > + break; > + > /* default model value was changed before in post parse */ > case VIR_DOMAIN_PANIC_MODEL_DEFAULT: > case VIR_DOMAIN_PANIC_MODEL_LAST: > -- > 2.39.1 >