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/conf/domain_conf.c b/src/conf/domain_conf.c index ff1c78ecd1..c03ca36ae0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -859,6 +859,7 @@ VIR_ENUM_IMPL(virDomainPanicModel, "pseries", "hyperv", "s390", + "pvpanic", ); VIR_ENUM_IMPL(virDomainVideoBackend, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e684edcf95..d2cbc200e7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2677,6 +2677,7 @@ typedef enum { VIR_DOMAIN_PANIC_MODEL_PSERIES, VIR_DOMAIN_PANIC_MODEL_HYPERV, VIR_DOMAIN_PANIC_MODEL_S390, + VIR_DOMAIN_PANIC_MODEL_PVPANIC, VIR_DOMAIN_PANIC_MODEL_LAST } virDomainPanicModel; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index a57dd212ab..ab4886b783 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -8289,6 +8289,7 @@ <value>pseries</value> <value>hyperv</value> <value>s390</value> + <value>pvpanic</value> </choice> </attribute> </optional> 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) { + if (qemuBuildDeviceAddressProps(props, def, &def->panics[i]->info) < 0) + 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")); + return -1; + } + + if (def->panics[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pvpanic is supported only " + "with PCI address type")); + 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