On Fri, Nov 13, 2015 at 20:16:36 +0300, Dmitry Andreev wrote: > Panic device type used depends on 'model' attribute. > > If no model is specified then device type depends on hypervisor > and guest arch. 'pseries' model is used for pSeries guest and > 'isa' model is used in other cases. > > XML: > <devices> > <panic model='hyperv'/> > </devices> > > QEMU command line: > qemu -cpu <cpu_model>,hv_crash > --- > src/qemu/qemu_command.c | 64 +++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 59 insertions(+), 5 deletions(-) > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index 792ada3..2d0cec0 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c ... > @@ -11150,17 +11160,49 @@ qemuBuildCommandLine(virConnectPtr conn, > } > > if (def->panic) { > - if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) { > - /* For pSeries guests, the firmware provides the same > - * functionality as the pvpanic device. The address > + virDomainPanicModel model = def->panic->model; > + > + if (model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) { > + if (ARCH_IS_PPC64(def->os.arch) && > + STRPREFIX(def->os.machine, "pseries")) > + model = VIR_DOMAIN_PANIC_MODEL_PSERIES; > + else > + model = VIR_DOMAIN_PANIC_MODEL_ISA; > + } This code should go in the post parse callback. > + > + switch (model) { > + case VIR_DOMAIN_PANIC_MODEL_HYPERV: > + /* Panic with model 'hyperv' is not a device, it should > + * be configured in cpu commandline. The address > * cannot be configured by the user */ > if (def->panic->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { > virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > _("setting the panic device address is not " > - "supported for pSeries guests")); > + "supported for model 'hyperv'")); > goto error; > } Should we also reject hyperv model if !ARCH_IS_X86 similarly to what we do for pseries model? Another big question is what happens if you try <panic model='hyperv'/> with QEMU < 2.5.0? Will it fail (that would be OK) or does QEMU just ignore the unknown CPU feature and starts anyway (not OK)? > - } else { > + break; > + > + case VIR_DOMAIN_PANIC_MODEL_PSERIES: > + if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) { > + /* For pSeries guests, the firmware provides the same > + * functionality as the pvpanic device. The address > + * cannot be configured by the user */ > + if (def->panic->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("setting the panic device address is not " > + "supported for model 'pseries'")); > + goto error; > + } > + } else { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("only pSeries guests support panic device " > + "with model 'pseries'")); > + goto error; > + } > + break; > + > + case VIR_DOMAIN_PANIC_MODEL_ISA: > if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PANIC)) { > virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > _("the QEMU binary does not support the " ... Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list