}
}
+ if (def->panic &&
+ def->panic->model == VIR_DOMAIN_PANIC_MODEL_HYPERV) {
+ if (!have_cpu) {
+ virBufferAdd(&buf, default_model, -1);
+ have_cpu = true;
+ }
+
+ virBufferAddLit(&buf, ",hv_crash");
+ }
+
if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
if (!have_cpu) {
virBufferAdd(&buf, default_model, -1);
}
if (def->panic) {
- if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+ switch ((virDomainPanicModel) def->panic->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 (!ARCH_IS_X86(def->os.arch)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("only i686 and x86_64 guests support "
+ "panic device of model 'hyperv'"));
+ goto error;
+ }
+ 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 'hyperv'"));
+ goto error;
+ }
+ break;
+
+ case VIR_DOMAIN_PANIC_MODEL_PSERIES:
/* For pSeries guests, the firmware provides the same
* functionality as the pvpanic device. The address
* cannot be configured by the user */
+ if (!ARCH_IS_PPC64(def->os.arch) ||
+ !STRPREFIX(def->os.machine, "pseries")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("only pSeries guests support panic device "
+ "of model 'pseries'"));
+ goto error;
+ }
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 'pseries'"));
goto error;
}
- } else {
+ 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 "
"with ISA address type"));
goto error;
}
+
+ /* default model value was changed before in post parse */
+ case VIR_DOMAIN_PANIC_MODEL_DEFAULT:
+ case VIR_DOMAIN_PANIC_MODEL_LAST:
+ break;
}
}
if (virCPUDefAddFeature(cpu, feature, policy) < 0)
goto cleanup;
}
+ } else if (STREQ(tokens[i], "hv_crash")) {
+ virDomainPanicDefPtr panic;
+ if (VIR_ALLOC(panic) < 0)
+ goto cleanup;
+
+ panic->model = VIR_DOMAIN_PANIC_MODEL_HYPERV;
+ dom->panic = panic;
} else if (STRPREFIX(tokens[i], "hv_")) {
const char *token = tokens[i] + 3; /* "hv_" */
const char *feature, *value;
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='fdc' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ <panic model='isa'>
+ <address type='isa' iobase='0x505'/>
+ </panic>
+ </devices>
+</domain>
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <serial type='pty'>
+ <target port='0'/>
+ <address type='spapr-vio'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ <address type='spapr-vio'/>
+ </console>
+ <memballoon model='none'/>
+ <panic model='pseries'/>
+ </devices>
+</domain>