提交 ac97658d 编写于 作者: P Pavel Hrdina

qemu: refactor qemuDomainMachine* functions

Introduce new wrapper functions without *Machine* in the function
name that take the whole virDomainDef structure as argument and
call the existing functions with *Machine* in the function name.

Change the arguments of existing functions to *machine* and *arch*
because they don't need the whole virDomainDef structure and they
could be used in places where we don't have virDomainDef.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 41e9f54d
...@@ -152,14 +152,14 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef, ...@@ -152,14 +152,14 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
* first (and currently only) IDE controller is an integrated * first (and currently only) IDE controller is an integrated
* controller hardcoded with id "ide" * controller hardcoded with id "ide"
*/ */
if (qemuDomainMachineHasBuiltinIDE(domainDef) && if (qemuDomainHasBuiltinIDE(domainDef) &&
controller->idx == 0) controller->idx == 0)
return VIR_STRDUP(controller->info.alias, "ide"); return VIR_STRDUP(controller->info.alias, "ide");
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) { } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
/* for any Q35 machine, the first SATA controller is the /* for any Q35 machine, the first SATA controller is the
* integrated one, and it too is hardcoded with id "ide" * integrated one, and it too is hardcoded with id "ide"
*/ */
if (qemuDomainMachineIsQ35(domainDef) && controller->idx == 0) if (qemuDomainIsQ35(domainDef) && controller->idx == 0)
return VIR_STRDUP(controller->info.alias, "ide"); return VIR_STRDUP(controller->info.alias, "ide");
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) { } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
/* first USB device is "usb", others are normal "usb%d" */ /* first USB device is "usb", others are normal "usb%d" */
......
...@@ -2315,7 +2315,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, ...@@ -2315,7 +2315,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
/* If 'virt' supports PCI, it supports multibus. /* If 'virt' supports PCI, it supports multibus.
* No extra conditions here for simplicity. * No extra conditions here for simplicity.
*/ */
if (qemuDomainMachineIsVirt(def)) if (qemuDomainIsVirt(def))
return true; return true;
return false; return false;
...@@ -5369,7 +5369,7 @@ virQEMUCapsSupportsChardev(const virDomainDef *def, ...@@ -5369,7 +5369,7 @@ virQEMUCapsSupportsChardev(const virDomainDef *def,
return false; return false;
if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) { if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
if (!qemuDomainMachineIsPSeries(def)) if (!qemuDomainIsPSeries(def))
return false; return false;
/* only pseries need -device spapr-vty with -chardev */ /* only pseries need -device spapr-vty with -chardev */
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
...@@ -5396,8 +5396,8 @@ virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, ...@@ -5396,8 +5396,8 @@ virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT)) if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT))
return false; return false;
return qemuDomainMachineIsI440FX(def) || return qemuDomainIsI440FX(def) ||
qemuDomainMachineIsQ35(def) || qemuDomainIsQ35(def) ||
STREQ(def->os.machine, "isapc"); STREQ(def->os.machine, "isapc");
} }
...@@ -5409,7 +5409,7 @@ virQEMUCapsSupportsSMM(virQEMUCapsPtr qemuCaps, ...@@ -5409,7 +5409,7 @@ virQEMUCapsSupportsSMM(virQEMUCapsPtr qemuCaps,
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT)) if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT))
return false; return false;
return qemuDomainMachineIsQ35(def); return qemuDomainIsQ35(def);
} }
......
...@@ -1390,7 +1390,7 @@ qemuCheckCCWS390AddressSupport(const virDomainDef *def, ...@@ -1390,7 +1390,7 @@ qemuCheckCCWS390AddressSupport(const virDomainDef *def,
const char *devicename) const char *devicename)
{ {
if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
if (!qemuDomainMachineIsS390CCW(def)) { if (!qemuDomainIsS390CCW(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("cannot use CCW address type for device " _("cannot use CCW address type for device "
"'%s' using machine type '%s'"), "'%s' using machine type '%s'"),
...@@ -2294,7 +2294,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, ...@@ -2294,7 +2294,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
/* PowerPC pseries based VMs do not support floppy device */ /* PowerPC pseries based VMs do not support floppy device */
if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
qemuDomainMachineIsPSeries(def)) { qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("PowerPC pseries machines do not support floppy device")); _("PowerPC pseries machines do not support floppy device"));
return -1; return -1;
...@@ -2345,7 +2345,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, ...@@ -2345,7 +2345,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
disk->info.alias) < 0) disk->info.alias) < 0)
return -1; return -1;
if (!qemuDomainMachineNeedsFDC(def)) { if (!qemuDomainNeedsFDC(def)) {
virCommandAddArg(cmd, "-global"); virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr); virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
} else { } else {
...@@ -2360,7 +2360,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, ...@@ -2360,7 +2360,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
bootindex) < 0) bootindex) < 0)
return -1; return -1;
if (!qemuDomainMachineNeedsFDC(def)) { if (!qemuDomainNeedsFDC(def)) {
virCommandAddArg(cmd, "-global"); virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr); virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
} else { } else {
...@@ -3076,7 +3076,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, ...@@ -3076,7 +3076,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
* specified, or one with a single IDE contraller had multiple * specified, or one with a single IDE contraller had multiple
* ide controllers specified. * ide controllers specified.
*/ */
if (qemuDomainMachineHasBuiltinIDE(domainDef)) if (qemuDomainHasBuiltinIDE(domainDef))
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only a single IDE controller is supported " _("Only a single IDE controller is supported "
"for this machine type")); "for this machine type"));
...@@ -3174,18 +3174,18 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, ...@@ -3174,18 +3174,18 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
/* first SATA controller on Q35 machines is implicit */ /* first SATA controller on Q35 machines is implicit */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
cont->idx == 0 && qemuDomainMachineIsQ35(def)) cont->idx == 0 && qemuDomainIsQ35(def))
continue; continue;
/* first IDE controller is implicit on various machines */ /* first IDE controller is implicit on various machines */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
cont->idx == 0 && qemuDomainMachineHasBuiltinIDE(def)) cont->idx == 0 && qemuDomainHasBuiltinIDE(def))
continue; continue;
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == -1 && cont->model == -1 &&
!qemuDomainMachineIsQ35(def) && !qemuDomainIsQ35(def) &&
!qemuDomainMachineIsVirt(def)) { !qemuDomainIsVirt(def)) {
/* An appropriate default USB controller model should already /* An appropriate default USB controller model should already
* have been selected in qemuDomainDeviceDefPostParse(); if * have been selected in qemuDomainDeviceDefPostParse(); if
...@@ -3222,8 +3222,8 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, ...@@ -3222,8 +3222,8 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* not to add one either. Add a legacy USB controller, unless we're * not to add one either. Add a legacy USB controller, unless we're
* creating a kind of guest we want to keep legacy-free */ * creating a kind of guest we want to keep legacy-free */
if (usbcontroller == 0 && if (usbcontroller == 0 &&
!qemuDomainMachineIsQ35(def) && !qemuDomainIsQ35(def) &&
!qemuDomainMachineIsVirt(def) && !qemuDomainIsVirt(def) &&
!ARCH_IS_S390(def->os.arch)) !ARCH_IS_S390(def->os.arch))
virCommandAddArg(cmd, "-usb"); virCommandAddArg(cmd, "-usb");
...@@ -4104,7 +4104,7 @@ qemuBuildNVRAMCommandLine(virCommandPtr cmd, ...@@ -4104,7 +4104,7 @@ qemuBuildNVRAMCommandLine(virCommandPtr cmd,
if (!def->nvram) if (!def->nvram)
return 0; return 0;
if (qemuDomainMachineIsPSeries(def)) { if (qemuDomainIsPSeries(def)) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("nvram device is not supported by " _("nvram device is not supported by "
...@@ -6487,7 +6487,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd, ...@@ -6487,7 +6487,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
if (def->pm.s3) { if (def->pm.s3) {
const char *pm_object = "PIIX4_PM"; const char *pm_object = "PIIX4_PM";
if (qemuDomainMachineIsQ35(def) && if (qemuDomainIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3)) {
pm_object = "ICH9-LPC"; pm_object = "ICH9-LPC";
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) { } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) {
...@@ -6504,7 +6504,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd, ...@@ -6504,7 +6504,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
if (def->pm.s4) { if (def->pm.s4) {
const char *pm_object = "PIIX4_PM"; const char *pm_object = "PIIX4_PM";
if (qemuDomainMachineIsQ35(def) && if (qemuDomainIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4)) {
pm_object = "ICH9-LPC"; pm_object = "ICH9-LPC";
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) { } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) {
...@@ -6693,7 +6693,7 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, ...@@ -6693,7 +6693,7 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
virDomainIOMMUModelTypeToString(iommu->model)); virDomainIOMMUModelTypeToString(iommu->model));
return -1; return -1;
} }
if (!qemuDomainMachineIsQ35(def)) { if (!qemuDomainIsQ35(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOMMU device: '%s' is only supported with " _("IOMMU device: '%s' is only supported with "
"Q35 machines"), "Q35 machines"),
...@@ -6732,13 +6732,13 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd, ...@@ -6732,13 +6732,13 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
hoststr = "i440FX-pcihost"; hoststr = "i440FX-pcihost";
cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
machine = qemuDomainMachineIsI440FX(def); machine = qemuDomainIsI440FX(def);
break; break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
hoststr = "q35-pcihost"; hoststr = "q35-pcihost";
cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE); cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
machine = qemuDomainMachineIsQ35(def); machine = qemuDomainIsQ35(def);
break; break;
default: default:
...@@ -7323,7 +7323,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, ...@@ -7323,7 +7323,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) { if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
if (def->gic_version != VIR_GIC_VERSION_NONE) { if (def->gic_version != VIR_GIC_VERSION_NONE) {
if (!qemuDomainMachineIsVirt(def)) { if (!qemuDomainIsVirt(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("gic-version option is available " _("gic-version option is available "
"only for ARM virt machine")); "only for ARM virt machine"));
...@@ -7352,7 +7352,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, ...@@ -7352,7 +7352,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) {
switch (def->iommu->model) { switch (def->iommu->model) {
case VIR_DOMAIN_IOMMU_MODEL_INTEL: case VIR_DOMAIN_IOMMU_MODEL_INTEL:
if (!qemuDomainMachineIsQ35(def)) { if (!qemuDomainIsQ35(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOMMU device: '%s' is only supported with " _("IOMMU device: '%s' is only supported with "
"Q35 machines"), "Q35 machines"),
...@@ -9615,7 +9615,7 @@ qemuBuildPanicCommandLine(virCommandPtr cmd, ...@@ -9615,7 +9615,7 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
/* For pSeries guests, the firmware provides the same /* For pSeries guests, the firmware provides the same
* functionality as the pvpanic device. The address * functionality as the pvpanic device. The address
* cannot be configured by the user */ * cannot be configured by the user */
if (!qemuDomainMachineIsPSeries(def)) { if (!qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("only pSeries guests support panic device " _("only pSeries guests support panic device "
"of model 'pseries'")); "of model 'pseries'"));
...@@ -10041,7 +10041,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, ...@@ -10041,7 +10041,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
{ {
virBuffer cmd = VIR_BUFFER_INITIALIZER; virBuffer cmd = VIR_BUFFER_INITIALIZER;
if (qemuDomainMachineIsPSeries(def)) { if (qemuDomainIsPSeries(def)) {
if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
......
...@@ -2365,7 +2365,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, ...@@ -2365,7 +2365,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
addDefaultUSB = false; addDefaultUSB = false;
break; break;
} }
if (qemuDomainMachineIsQ35(def)) { if (qemuDomainIsQ35(def)) {
addPCIeRoot = true; addPCIeRoot = true;
addImplicitSATA = true; addImplicitSATA = true;
...@@ -2382,7 +2382,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, ...@@ -2382,7 +2382,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
addDefaultUSB = false; addDefaultUSB = false;
break; break;
} }
if (qemuDomainMachineIsI440FX(def)) if (qemuDomainIsI440FX(def))
addPCIRoot = true; addPCIRoot = true;
break; break;
...@@ -2390,7 +2390,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, ...@@ -2390,7 +2390,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
case VIR_ARCH_AARCH64: case VIR_ARCH_AARCH64:
addDefaultUSB = false; addDefaultUSB = false;
addDefaultMemballoon = false; addDefaultMemballoon = false;
if (qemuDomainMachineIsVirt(def)) if (qemuDomainIsVirt(def))
addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX); addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
break; break;
...@@ -2402,7 +2402,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, ...@@ -2402,7 +2402,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
/* For pSeries guests, the firmware provides the same /* For pSeries guests, the firmware provides the same
* functionality as the pvpanic device, so automatically * functionality as the pvpanic device, so automatically
* add the definition if not already present */ * add the definition if not already present */
if (qemuDomainMachineIsPSeries(def)) if (qemuDomainIsPSeries(def))
addPanicDevice = true; addPanicDevice = true;
break; break;
...@@ -2552,7 +2552,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def, ...@@ -2552,7 +2552,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
* was not included in the domain XML, we need to choose a suitable * was not included in the domain XML, we need to choose a suitable
* GIC version ourselves */ * GIC version ourselves */
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT && if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT &&
qemuDomainMachineIsVirt(def)) { qemuDomainIsVirt(def)) {
VIR_DEBUG("Looking for usable GIC version in domain capabilities"); VIR_DEBUG("Looking for usable GIC version in domain capabilities");
for (version = VIR_GIC_VERSION_LAST - 1; for (version = VIR_GIC_VERSION_LAST - 1;
...@@ -2940,7 +2940,7 @@ qemuDomainDefValidate(const virDomainDef *def, ...@@ -2940,7 +2940,7 @@ qemuDomainDefValidate(const virDomainDef *def,
/* These are the QEMU implementation limitations. But we /* These are the QEMU implementation limitations. But we
* have to live with them for now. */ * have to live with them for now. */
if (!qemuDomainMachineIsQ35(def)) { if (!qemuDomainIsQ35(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Secure boot is supported with q35 machine types only")); _("Secure boot is supported with q35 machine types only"));
goto cleanup; goto cleanup;
...@@ -3039,7 +3039,7 @@ qemuDomainDefaultNetModel(const virDomainDef *def, ...@@ -3039,7 +3039,7 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
if (STREQ(def->os.machine, "versatilepb")) if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111"; return "smc91c111";
if (qemuDomainMachineIsVirt(def)) if (qemuDomainIsVirt(def))
return "virtio"; return "virtio";
/* Incomplete. vexpress (and a few others) use this, but not all /* Incomplete. vexpress (and a few others) use this, but not all
...@@ -3198,14 +3198,14 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, ...@@ -3198,14 +3198,14 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
case VIR_DOMAIN_CONTROLLER_TYPE_PCI: case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS && if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS &&
!qemuDomainMachineIsI440FX(def)) { !qemuDomainIsI440FX(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("pci-expander-bus controllers are only supported " _("pci-expander-bus controllers are only supported "
"on 440fx-based machinetypes")); "on 440fx-based machinetypes"));
return -1; return -1;
} }
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS && if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS &&
!qemuDomainMachineIsQ35(def)) { !qemuDomainIsQ35(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("pcie-expander-bus controllers are only supported " _("pcie-expander-bus controllers are only supported "
"on q35-based machinetypes")); "on q35-based machinetypes"));
...@@ -3360,7 +3360,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, ...@@ -3360,7 +3360,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_PANIC && if (dev->type == VIR_DOMAIN_DEVICE_PANIC &&
dev->data.panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) { dev->data.panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) {
if (qemuDomainMachineIsPSeries(def)) if (qemuDomainIsPSeries(def))
dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES; dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
else if (ARCH_IS_S390(def->os.arch)) else if (ARCH_IS_S390(def->os.arch))
dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_S390; dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
...@@ -4047,7 +4047,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver, ...@@ -4047,7 +4047,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
* because other architectures and machine types were introduced * because other architectures and machine types were introduced
* when libvirt already supported <controller type='usb'/>. * when libvirt already supported <controller type='usb'/>.
*/ */
if (ARCH_IS_X86(def->os.arch) && qemuDomainMachineIsI440FX(def) && if (ARCH_IS_X86(def->os.arch) && qemuDomainIsI440FX(def) &&
usb && usb->idx == 0 && usb && usb->idx == 0 &&
(usb->model == -1 || (usb->model == -1 ||
usb->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI)) { usb->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI)) {
...@@ -5855,26 +5855,40 @@ qemuFindAgentConfig(virDomainDefPtr def) ...@@ -5855,26 +5855,40 @@ qemuFindAgentConfig(virDomainDefPtr def)
bool bool
qemuDomainMachineIsQ35(const virDomainDef *def) qemuDomainIsQ35(const virDomainDef *def)
{ {
return (STRPREFIX(def->os.machine, "pc-q35") || return qemuDomainMachineIsQ35(def->os.machine);
STREQ(def->os.machine, "q35"));
} }
bool bool
qemuDomainMachineIsI440FX(const virDomainDef *def) qemuDomainMachineIsQ35(const char *machine)
{ {
return (STREQ(def->os.machine, "pc") || return (STRPREFIX(machine, "pc-q35") ||
STRPREFIX(def->os.machine, "pc-0.") || STREQ(machine, "q35"));
STRPREFIX(def->os.machine, "pc-1.") ||
STRPREFIX(def->os.machine, "pc-i440") ||
STRPREFIX(def->os.machine, "rhel"));
} }
bool bool
qemuDomainMachineHasPCIRoot(const virDomainDef *def) qemuDomainIsI440FX(const virDomainDef *def)
{
return qemuDomainMachineIsI440FX(def->os.machine);
}
bool
qemuDomainMachineIsI440FX(const char *machine)
{
return (STREQ(machine, "pc") ||
STRPREFIX(machine, "pc-0.") ||
STRPREFIX(machine, "pc-1.") ||
STRPREFIX(machine, "pc-i440") ||
STRPREFIX(machine, "rhel"));
}
bool
qemuDomainHasPCIRoot(const virDomainDef *def)
{ {
int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0); int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
...@@ -5889,7 +5903,7 @@ qemuDomainMachineHasPCIRoot(const virDomainDef *def) ...@@ -5889,7 +5903,7 @@ qemuDomainMachineHasPCIRoot(const virDomainDef *def)
bool bool
qemuDomainMachineHasPCIeRoot(const virDomainDef *def) qemuDomainHasPCIeRoot(const virDomainDef *def)
{ {
int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0); int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
...@@ -5904,9 +5918,16 @@ qemuDomainMachineHasPCIeRoot(const virDomainDef *def) ...@@ -5904,9 +5918,16 @@ qemuDomainMachineHasPCIeRoot(const virDomainDef *def)
bool bool
qemuDomainMachineNeedsFDC(const virDomainDef *def) qemuDomainNeedsFDC(const virDomainDef *def)
{ {
char *p = STRSKIP(def->os.machine, "pc-q35-"); return qemuDomainMachineNeedsFDC(def->os.machine);
}
bool
qemuDomainMachineNeedsFDC(const char *machine)
{
const char *p = STRSKIP(machine, "pc-q35-");
if (p) { if (p) {
if (STRPREFIX(p, "1.") || if (STRPREFIX(p, "1.") ||
...@@ -5922,21 +5943,36 @@ qemuDomainMachineNeedsFDC(const virDomainDef *def) ...@@ -5922,21 +5943,36 @@ qemuDomainMachineNeedsFDC(const virDomainDef *def)
bool bool
qemuDomainMachineIsS390CCW(const virDomainDef *def) qemuDomainIsS390CCW(const virDomainDef *def)
{ {
return STRPREFIX(def->os.machine, "s390-ccw"); return qemuDomainMachineIsS390CCW(def->os.machine);
} }
bool bool
qemuDomainMachineIsVirt(const virDomainDef *def) qemuDomainMachineIsS390CCW(const char *machine)
{ {
if (def->os.arch != VIR_ARCH_ARMV7L && return STRPREFIX(machine, "s390-ccw");
def->os.arch != VIR_ARCH_AARCH64) }
bool
qemuDomainIsVirt(const virDomainDef *def)
{
return qemuDomainMachineIsVirt(def->os.machine, def->os.arch);
}
bool
qemuDomainMachineIsVirt(const char *machine,
const virArch arch)
{
if (arch != VIR_ARCH_ARMV7L &&
arch != VIR_ARCH_AARCH64)
return false; return false;
if (STRNEQ(def->os.machine, "virt") && if (STRNEQ(machine, "virt") &&
!STRPREFIX(def->os.machine, "virt-")) !STRPREFIX(machine, "virt-"))
return false; return false;
return true; return true;
...@@ -5944,13 +5980,21 @@ qemuDomainMachineIsVirt(const virDomainDef *def) ...@@ -5944,13 +5980,21 @@ qemuDomainMachineIsVirt(const virDomainDef *def)
bool bool
qemuDomainMachineIsPSeries(const virDomainDef *def) qemuDomainIsPSeries(const virDomainDef *def)
{ {
if (!ARCH_IS_PPC64(def->os.arch)) return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
}
bool
qemuDomainMachineIsPSeries(const char *machine,
const virArch arch)
{
if (!ARCH_IS_PPC64(arch))
return false; return false;
if (STRNEQ(def->os.machine, "pseries") && if (STRNEQ(machine, "pseries") &&
!STRPREFIX(def->os.machine, "pseries-")) !STRPREFIX(machine, "pseries-"))
return false; return false;
return true; return true;
...@@ -6152,12 +6196,19 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def, ...@@ -6152,12 +6196,19 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
bool bool
qemuDomainMachineHasBuiltinIDE(const virDomainDef *def) qemuDomainHasBuiltinIDE(const virDomainDef *def)
{
return qemuDomainMachineHasBuiltinIDE(def->os.machine);
}
bool
qemuDomainMachineHasBuiltinIDE(const char *machine)
{ {
return qemuDomainMachineIsI440FX(def) || return qemuDomainMachineIsI440FX(machine) ||
STREQ(def->os.machine, "malta") || STREQ(machine, "malta") ||
STREQ(def->os.machine, "sun4u") || STREQ(machine, "sun4u") ||
STREQ(def->os.machine, "g3beige"); STREQ(machine, "g3beige");
} }
......
...@@ -675,15 +675,25 @@ void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, ...@@ -675,15 +675,25 @@ void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def); virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
bool qemuDomainMachineIsQ35(const virDomainDef *def); bool qemuDomainIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def); bool qemuDomainIsI440FX(const virDomainDef *def);
bool qemuDomainMachineHasPCIRoot(const virDomainDef *def); bool qemuDomainHasPCIRoot(const virDomainDef *def);
bool qemuDomainMachineHasPCIeRoot(const virDomainDef *def); bool qemuDomainHasPCIeRoot(const virDomainDef *def);
bool qemuDomainMachineNeedsFDC(const virDomainDef *def); bool qemuDomainNeedsFDC(const virDomainDef *def);
bool qemuDomainMachineIsS390CCW(const virDomainDef *def); bool qemuDomainIsS390CCW(const virDomainDef *def);
bool qemuDomainMachineIsVirt(const virDomainDef *def); bool qemuDomainIsVirt(const virDomainDef *def);
bool qemuDomainMachineIsPSeries(const virDomainDef *def); bool qemuDomainIsPSeries(const virDomainDef *def);
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def); bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
bool qemuDomainMachineIsQ35(const char *machine);
bool qemuDomainMachineIsI440FX(const char *machine);
bool qemuDomainMachineNeedsFDC(const char *machine);
bool qemuDomainMachineIsS390CCW(const char *machine);
bool qemuDomainMachineIsVirt(const char *machine,
const virArch arch);
bool qemuDomainMachineIsPSeries(const char *machine,
const virArch arch);
bool qemuDomainMachineHasBuiltinIDE(const char *machine);
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver, int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
virDomainObjPtr vm); virDomainObjPtr vm);
......
...@@ -88,7 +88,7 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def, ...@@ -88,7 +88,7 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
return -1; return -1;
} }
} else { } else {
if (qemuDomainMachineIsPSeries(def)) { if (qemuDomainIsPSeries(def)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI; *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC; *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
...@@ -245,7 +245,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, ...@@ -245,7 +245,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
for (i = 0; i < def->nserials; i++) { for (i = 0; i < def->nserials; i++) {
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
qemuDomainMachineIsPSeries(def)) qemuDomainIsPSeries(def))
def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info, if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info,
VIO_ADDR_SERIAL) < 0) VIO_ADDR_SERIAL) < 0)
...@@ -253,7 +253,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, ...@@ -253,7 +253,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
} }
if (def->nvram) { if (def->nvram) {
if (qemuDomainMachineIsPSeries(def)) if (qemuDomainIsPSeries(def))
def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
if (qemuDomainAssignSpaprVIOAddress(def, &def->nvram->info, if (qemuDomainAssignSpaprVIOAddress(def, &def->nvram->info,
VIO_ADDR_NVRAM) < 0) VIO_ADDR_NVRAM) < 0)
...@@ -375,7 +375,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, ...@@ -375,7 +375,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
int ret = -1; int ret = -1;
virDomainCCWAddressSetPtr addrs = NULL; virDomainCCWAddressSetPtr addrs = NULL;
if (qemuDomainMachineIsS390CCW(def) && if (qemuDomainIsS390CCW(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
qemuDomainPrimeVirtioDeviceAddresses( qemuDomainPrimeVirtioDeviceAddresses(
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW); def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
...@@ -445,13 +445,13 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def, ...@@ -445,13 +445,13 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
return; return;
if (!(STRPREFIX(def->os.machine, "vexpress-") || if (!(STRPREFIX(def->os.machine, "vexpress-") ||
qemuDomainMachineIsVirt(def))) qemuDomainIsVirt(def)))
return; return;
/* We use virtio-mmio by default on mach-virt guests only if they already /* We use virtio-mmio by default on mach-virt guests only if they already
* have at least one virtio-mmio device: in all other cases, we prefer * have at least one virtio-mmio device: in all other cases, we prefer
* virtio-pci */ * virtio-pci */
if (qemuDomainMachineHasPCIeRoot(def) && if (qemuDomainHasPCIeRoot(def) &&
!qemuDomainHasVirtioMMIODevices(def)) { !qemuDomainHasVirtioMMIODevices(def)) {
qemuDomainPrimeVirtioDeviceAddresses(def, qemuDomainPrimeVirtioDeviceAddresses(def,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI); VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);
...@@ -826,7 +826,7 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomainDefPtr def, ...@@ -826,7 +826,7 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomainDefPtr def,
data->driver = driver; data->driver = driver;
if (qemuDomainMachineHasPCIeRoot(def)) { if (qemuDomainHasPCIeRoot(def)) {
data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE | data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
VIR_PCI_CONNECT_HOTPLUGGABLE); VIR_PCI_CONNECT_HOTPLUGGABLE);
} else { } else {
...@@ -1479,12 +1479,12 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def, ...@@ -1479,12 +1479,12 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virDomainPCIAddressSetPtr addrs) virDomainPCIAddressSetPtr addrs)
{ {
if (qemuDomainMachineIsI440FX(def) && if (qemuDomainIsI440FX(def) &&
qemuDomainValidateDevicePCISlotsPIIX3(def, qemuCaps, addrs) < 0) { qemuDomainValidateDevicePCISlotsPIIX3(def, qemuCaps, addrs) < 0) {
return -1; return -1;
} }
if (qemuDomainMachineIsQ35(def) && if (qemuDomainIsQ35(def) &&
qemuDomainValidateDevicePCISlotsQ35(def, qemuCaps, addrs) < 0) { qemuDomainValidateDevicePCISlotsQ35(def, qemuCaps, addrs) < 0) {
return -1; return -1;
} }
...@@ -1845,7 +1845,7 @@ qemuDomainSupportsPCI(virDomainDefPtr def, ...@@ -1845,7 +1845,7 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
if (STREQ(def->os.machine, "versatilepb")) if (STREQ(def->os.machine, "versatilepb"))
return true; return true;
if (qemuDomainMachineIsVirt(def) && if (qemuDomainIsVirt(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX)) virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
return true; return true;
...@@ -2024,7 +2024,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, ...@@ -2024,7 +2024,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
* all *actual* devices. * all *actual* devices.
*/ */
if (qemuDomainMachineHasPCIRoot(def)) { if (qemuDomainHasPCIRoot(def)) {
/* This is a dummy info used to reserve a slot for a /* This is a dummy info used to reserve a slot for a
* legacy PCI device that doesn't exist, but may in the * legacy PCI device that doesn't exist, but may in the
* future, e.g. if another device is hotplugged into the * future, e.g. if another device is hotplugged into the
...@@ -2066,7 +2066,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, ...@@ -2066,7 +2066,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
if (max_idx <= 0 && if (max_idx <= 0 &&
addrs->nbuses > max_idx + 1 && addrs->nbuses > max_idx + 1 &&
qemuDomainMachineHasPCIeRoot(def)) { qemuDomainHasPCIeRoot(def)) {
virDomainDeviceInfo info = { virDomainDeviceInfo info = {
.pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE | .pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) VIR_PCI_CONNECT_TYPE_PCIE_DEVICE)
......
...@@ -329,7 +329,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn, ...@@ -329,7 +329,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
qemuDomainSecretInfoPtr encinfo; qemuDomainSecretInfoPtr encinfo;
if (!disk->info.type) { if (!disk->info.type) {
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
...@@ -497,7 +497,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, ...@@ -497,7 +497,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
} }
if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
...@@ -1141,7 +1141,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, ...@@ -1141,7 +1141,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) { virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def))) if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def)))
...@@ -2079,7 +2079,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn, ...@@ -2079,7 +2079,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
goto cleanup; goto cleanup;
if (rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { if (rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) { virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
rng->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; rng->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
} else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) { } else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
...@@ -2620,7 +2620,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver, ...@@ -2620,7 +2620,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
} }
...@@ -4447,7 +4447,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver, ...@@ -4447,7 +4447,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) { virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
if (!virDomainDeviceAddressIsValid(&detach->info, if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
...@@ -5007,7 +5007,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, ...@@ -5007,7 +5007,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
virDomainNetGetActualHostdev(detach)); virDomainNetGetActualHostdev(detach));
goto cleanup; goto cleanup;
} }
if (qemuDomainMachineIsS390CCW(vm->def) && if (qemuDomainIsS390CCW(vm->def) &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) { virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
if (!virDomainDeviceAddressIsValid(&detach->info, if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
......
...@@ -654,7 +654,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, ...@@ -654,7 +654,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (VIR_ALLOC(def->src) < 0) if (VIR_ALLOC(def->src) < 0)
goto error; goto error;
if (qemuDomainMachineIsPSeries(dom)) if (qemuDomainIsPSeries(dom))
def->bus = VIR_DOMAIN_DISK_BUS_SCSI; def->bus = VIR_DOMAIN_DISK_BUS_SCSI;
else else
def->bus = VIR_DOMAIN_DISK_BUS_IDE; def->bus = VIR_DOMAIN_DISK_BUS_IDE;
...@@ -746,7 +746,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, ...@@ -746,7 +746,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STREQ(keywords[i], "if")) { } else if (STREQ(keywords[i], "if")) {
if (STREQ(values[i], "ide")) { if (STREQ(values[i], "ide")) {
def->bus = VIR_DOMAIN_DISK_BUS_IDE; def->bus = VIR_DOMAIN_DISK_BUS_IDE;
if (qemuDomainMachineIsPSeries(dom)) { if (qemuDomainIsPSeries(dom)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("pseries systems do not support ide devices '%s'"), val); _("pseries systems do not support ide devices '%s'"), val);
goto error; goto error;
...@@ -1950,7 +1950,7 @@ qemuParseCommandLine(virCapsPtr caps, ...@@ -1950,7 +1950,7 @@ qemuParseCommandLine(virCapsPtr caps,
} }
if (STREQ(arg, "-cdrom")) { if (STREQ(arg, "-cdrom")) {
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM; disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
if (qemuDomainMachineIsPSeries(def)) if (qemuDomainIsPSeries(def))
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
if (VIR_STRDUP(disk->dst, "hdc") < 0) if (VIR_STRDUP(disk->dst, "hdc") < 0)
goto error; goto error;
...@@ -1965,7 +1965,7 @@ qemuParseCommandLine(virCapsPtr caps, ...@@ -1965,7 +1965,7 @@ qemuParseCommandLine(virCapsPtr caps,
disk->bus = VIR_DOMAIN_DISK_BUS_IDE; disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
else else
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
if (qemuDomainMachineIsPSeries(def)) if (qemuDomainIsPSeries(def))
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI; disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
} }
if (VIR_STRDUP(disk->dst, arg + 1) < 0) if (VIR_STRDUP(disk->dst, arg + 1) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册