|
|
3e5111 |
From c3d1e1be0a0c972106fa25161777cf0a86c53d06 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <c3d1e1be0a0c972106fa25161777cf0a86c53d06@dist-git>
|
|
|
3e5111 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
Date: Wed, 19 Apr 2017 09:51:14 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: refactor qemuDomainMachine* functions
|
|
|
3e5111 |
|
|
|
3e5111 |
Introduce new wrapper functions without *Machine* in the function
|
|
|
3e5111 |
name that take the whole virDomainDef structure as argument and
|
|
|
3e5111 |
call the existing functions with *Machine* in the function name.
|
|
|
3e5111 |
|
|
|
3e5111 |
Change the arguments of existing functions to *machine* and *arch*
|
|
|
3e5111 |
because they don't need the whole virDomainDef structure and they
|
|
|
3e5111 |
could be used in places where we don't have virDomainDef.
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit ac97658d4fe5ce2b4f4949813ded6e2d77b07ee8)
|
|
|
3e5111 |
|
|
|
3e5111 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441964
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_alias.c | 4 +-
|
|
|
3e5111 |
src/qemu/qemu_capabilities.c | 10 ++--
|
|
|
3e5111 |
src/qemu/qemu_command.c | 42 ++++++-------
|
|
|
3e5111 |
src/qemu/qemu_domain.c | 131 ++++++++++++++++++++++++++++-------------
|
|
|
3e5111 |
src/qemu/qemu_domain.h | 28 ++++++---
|
|
|
3e5111 |
src/qemu/qemu_domain_address.c | 24 ++++----
|
|
|
3e5111 |
src/qemu/qemu_hotplug.c | 14 ++---
|
|
|
3e5111 |
src/qemu/qemu_parse_command.c | 8 +--
|
|
|
3e5111 |
8 files changed, 161 insertions(+), 100 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
|
|
|
3e5111 |
index 05e1293ef..914b2b94d 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_alias.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_alias.c
|
|
|
3e5111 |
@@ -152,14 +152,14 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
|
|
|
3e5111 |
* first (and currently only) IDE controller is an integrated
|
|
|
3e5111 |
* controller hardcoded with id "ide"
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
- if (qemuDomainMachineHasBuiltinIDE(domainDef) &&
|
|
|
3e5111 |
+ if (qemuDomainHasBuiltinIDE(domainDef) &&
|
|
|
3e5111 |
controller->idx == 0)
|
|
|
3e5111 |
return VIR_STRDUP(controller->info.alias, "ide");
|
|
|
3e5111 |
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
|
|
|
3e5111 |
/* for any Q35 machine, the first SATA controller is the
|
|
|
3e5111 |
* integrated one, and it too is hardcoded with id "ide"
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
- if (qemuDomainMachineIsQ35(domainDef) && controller->idx == 0)
|
|
|
3e5111 |
+ if (qemuDomainIsQ35(domainDef) && controller->idx == 0)
|
|
|
3e5111 |
return VIR_STRDUP(controller->info.alias, "ide");
|
|
|
3e5111 |
} else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
|
|
|
3e5111 |
/* first USB device is "usb", others are normal "usb%d" */
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
index a8125102c..b7c2c3705 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
@@ -2284,7 +2284,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
/* If 'virt' supports PCI, it supports multibus.
|
|
|
3e5111 |
* No extra conditions here for simplicity.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
- if (qemuDomainMachineIsVirt(def))
|
|
|
3e5111 |
+ if (qemuDomainIsVirt(def))
|
|
|
3e5111 |
return true;
|
|
|
3e5111 |
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
@@ -5333,7 +5333,7 @@ virQEMUCapsSupportsChardev(const virDomainDef *def,
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
|
|
|
3e5111 |
- if (!qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (!qemuDomainIsPSeries(def))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
/* only pseries need -device spapr-vty with -chardev */
|
|
|
3e5111 |
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
3e5111 |
@@ -5360,8 +5360,8 @@ virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainMachineIsI440FX(def) ||
|
|
|
3e5111 |
- qemuDomainMachineIsQ35(def) ||
|
|
|
3e5111 |
+ return qemuDomainIsI440FX(def) ||
|
|
|
3e5111 |
+ qemuDomainIsQ35(def) ||
|
|
|
3e5111 |
STREQ(def->os.machine, "isapc");
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -5373,7 +5373,7 @@ virQEMUCapsSupportsSMM(virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainMachineIsQ35(def);
|
|
|
3e5111 |
+ return qemuDomainIsQ35(def);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
3e5111 |
index 8ec4ec3a6..ff7f47e06 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_command.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_command.c
|
|
|
3e5111 |
@@ -1390,7 +1390,7 @@ qemuCheckCCWS390AddressSupport(const virDomainDef *def,
|
|
|
3e5111 |
const char *devicename)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
|
|
3e5111 |
- if (!qemuDomainMachineIsS390CCW(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsS390CCW(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
3e5111 |
_("cannot use CCW address type for device "
|
|
|
3e5111 |
"'%s' using machine type '%s'"),
|
|
|
3e5111 |
@@ -2294,7 +2294,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
|
|
|
3e5111 |
/* PowerPC pseries based VMs do not support floppy device */
|
|
|
3e5111 |
if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
|
|
3e5111 |
- qemuDomainMachineIsPSeries(def)) {
|
|
|
3e5111 |
+ qemuDomainIsPSeries(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("PowerPC pseries machines do not support floppy device"));
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
@@ -2345,7 +2345,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
disk->info.alias) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (!qemuDomainMachineNeedsFDC(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainNeedsFDC(def)) {
|
|
|
3e5111 |
virCommandAddArg(cmd, "-global");
|
|
|
3e5111 |
virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
@@ -2360,7 +2360,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
bootindex) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (!qemuDomainMachineNeedsFDC(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainNeedsFDC(def)) {
|
|
|
3e5111 |
virCommandAddArg(cmd, "-global");
|
|
|
3e5111 |
virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
@@ -3076,7 +3076,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
|
|
3e5111 |
* specified, or one with a single IDE contraller had multiple
|
|
|
3e5111 |
* ide controllers specified.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
- if (qemuDomainMachineHasBuiltinIDE(domainDef))
|
|
|
3e5111 |
+ if (qemuDomainHasBuiltinIDE(domainDef))
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("Only a single IDE controller is supported "
|
|
|
3e5111 |
"for this machine type"));
|
|
|
3e5111 |
@@ -3174,18 +3174,18 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
|
|
|
3e5111 |
/* first SATA controller on Q35 machines is implicit */
|
|
|
3e5111 |
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
|
|
|
3e5111 |
- cont->idx == 0 && qemuDomainMachineIsQ35(def))
|
|
|
3e5111 |
+ cont->idx == 0 && qemuDomainIsQ35(def))
|
|
|
3e5111 |
continue;
|
|
|
3e5111 |
|
|
|
3e5111 |
/* first IDE controller is implicit on various machines */
|
|
|
3e5111 |
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
|
|
3e5111 |
- cont->idx == 0 && qemuDomainMachineHasBuiltinIDE(def))
|
|
|
3e5111 |
+ cont->idx == 0 && qemuDomainHasBuiltinIDE(def))
|
|
|
3e5111 |
continue;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
|
|
3e5111 |
cont->model == -1 &&
|
|
|
3e5111 |
- !qemuDomainMachineIsQ35(def) &&
|
|
|
3e5111 |
- !qemuDomainMachineIsVirt(def)) {
|
|
|
3e5111 |
+ !qemuDomainIsQ35(def) &&
|
|
|
3e5111 |
+ !qemuDomainIsVirt(def)) {
|
|
|
3e5111 |
|
|
|
3e5111 |
/* An appropriate default USB controller model should already
|
|
|
3e5111 |
* have been selected in qemuDomainDeviceDefPostParse(); if
|
|
|
3e5111 |
@@ -3222,8 +3222,8 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
* not to add one either. Add a legacy USB controller, unless we're
|
|
|
3e5111 |
* creating a kind of guest we want to keep legacy-free */
|
|
|
3e5111 |
if (usbcontroller == 0 &&
|
|
|
3e5111 |
- !qemuDomainMachineIsQ35(def) &&
|
|
|
3e5111 |
- !qemuDomainMachineIsVirt(def) &&
|
|
|
3e5111 |
+ !qemuDomainIsQ35(def) &&
|
|
|
3e5111 |
+ !qemuDomainIsVirt(def) &&
|
|
|
3e5111 |
!ARCH_IS_S390(def->os.arch))
|
|
|
3e5111 |
virCommandAddArg(cmd, "-usb");
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -4104,7 +4104,7 @@ qemuBuildNVRAMCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
if (!def->nvram)
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def)) {
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def)) {
|
|
|
3e5111 |
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("nvram device is not supported by "
|
|
|
3e5111 |
@@ -6484,7 +6484,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
if (def->pm.s3) {
|
|
|
3e5111 |
const char *pm_object = "PIIX4_PM";
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsQ35(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsQ35(def) &&
|
|
|
3e5111 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3)) {
|
|
|
3e5111 |
pm_object = "ICH9-LPC";
|
|
|
3e5111 |
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) {
|
|
|
3e5111 |
@@ -6501,7 +6501,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
if (def->pm.s4) {
|
|
|
3e5111 |
const char *pm_object = "PIIX4_PM";
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsQ35(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsQ35(def) &&
|
|
|
3e5111 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4)) {
|
|
|
3e5111 |
pm_object = "ICH9-LPC";
|
|
|
3e5111 |
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) {
|
|
|
3e5111 |
@@ -6686,7 +6686,7 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
virDomainIOMMUModelTypeToString(def->iommu->model));
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
- if (!qemuDomainMachineIsQ35(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsQ35(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
3e5111 |
_("IOMMU device: '%s' is only supported with "
|
|
|
3e5111 |
"Q35 machines"),
|
|
|
3e5111 |
@@ -6720,13 +6720,13 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
|
|
|
3e5111 |
hoststr = "i440FX-pcihost";
|
|
|
3e5111 |
cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
|
|
|
3e5111 |
- machine = qemuDomainMachineIsI440FX(def);
|
|
|
3e5111 |
+ machine = qemuDomainIsI440FX(def);
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
|
|
|
3e5111 |
hoststr = "q35-pcihost";
|
|
|
3e5111 |
cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
|
|
|
3e5111 |
- machine = qemuDomainMachineIsQ35(def);
|
|
|
3e5111 |
+ machine = qemuDomainIsQ35(def);
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
default:
|
|
|
3e5111 |
@@ -7332,7 +7332,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
|
|
|
3e5111 |
if (def->gic_version != VIR_GIC_VERSION_NONE) {
|
|
|
3e5111 |
- if (!qemuDomainMachineIsVirt(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsVirt(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("gic-version option is available "
|
|
|
3e5111 |
"only for ARM virt machine"));
|
|
|
3e5111 |
@@ -7361,7 +7361,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) {
|
|
|
3e5111 |
switch (def->iommu->model) {
|
|
|
3e5111 |
case VIR_DOMAIN_IOMMU_MODEL_INTEL:
|
|
|
3e5111 |
- if (!qemuDomainMachineIsQ35(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsQ35(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
3e5111 |
_("IOMMU device: '%s' is only supported with "
|
|
|
3e5111 |
"Q35 machines"),
|
|
|
3e5111 |
@@ -9624,7 +9624,7 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
/* For pSeries guests, the firmware provides the same
|
|
|
3e5111 |
* functionality as the pvpanic device. The address
|
|
|
3e5111 |
* cannot be configured by the user */
|
|
|
3e5111 |
- if (!qemuDomainMachineIsPSeries(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsPSeries(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("only pSeries guests support panic device "
|
|
|
3e5111 |
"of model 'pseries'"));
|
|
|
3e5111 |
@@ -10050,7 +10050,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
|
|
|
3e5111 |
{
|
|
|
3e5111 |
virBuffer cmd = VIR_BUFFER_INITIALIZER;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def)) {
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def)) {
|
|
|
3e5111 |
if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
3e5111 |
serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
|
|
|
3e5111 |
virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
index f383a6cf2..3150e8760 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
@@ -2334,7 +2334,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
|
|
3e5111 |
addDefaultUSB = false;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
- if (qemuDomainMachineIsQ35(def)) {
|
|
|
3e5111 |
+ if (qemuDomainIsQ35(def)) {
|
|
|
3e5111 |
addPCIeRoot = true;
|
|
|
3e5111 |
addImplicitSATA = true;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -2351,7 +2351,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
|
|
3e5111 |
addDefaultUSB = false;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
- if (qemuDomainMachineIsI440FX(def))
|
|
|
3e5111 |
+ if (qemuDomainIsI440FX(def))
|
|
|
3e5111 |
addPCIRoot = true;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -2359,7 +2359,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
|
|
3e5111 |
case VIR_ARCH_AARCH64:
|
|
|
3e5111 |
addDefaultUSB = false;
|
|
|
3e5111 |
addDefaultMemballoon = false;
|
|
|
3e5111 |
- if (qemuDomainMachineIsVirt(def))
|
|
|
3e5111 |
+ if (qemuDomainIsVirt(def))
|
|
|
3e5111 |
addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -2371,7 +2371,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
|
|
3e5111 |
/* For pSeries guests, the firmware provides the same
|
|
|
3e5111 |
* functionality as the pvpanic device, so automatically
|
|
|
3e5111 |
* add the definition if not already present */
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def))
|
|
|
3e5111 |
addPanicDevice = true;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -2521,7 +2521,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
|
|
|
3e5111 |
* was not included in the domain XML, we need to choose a suitable
|
|
|
3e5111 |
* GIC version ourselves */
|
|
|
3e5111 |
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT &&
|
|
|
3e5111 |
- qemuDomainMachineIsVirt(def)) {
|
|
|
3e5111 |
+ qemuDomainIsVirt(def)) {
|
|
|
3e5111 |
|
|
|
3e5111 |
VIR_DEBUG("Looking for usable GIC version in domain capabilities");
|
|
|
3e5111 |
for (version = VIR_GIC_VERSION_LAST - 1;
|
|
|
3e5111 |
@@ -2909,7 +2909,7 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|
|
3e5111 |
/* These are the QEMU implementation limitations. But we
|
|
|
3e5111 |
* have to live with them for now. */
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (!qemuDomainMachineIsQ35(def)) {
|
|
|
3e5111 |
+ if (!qemuDomainIsQ35(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("Secure boot is supported with q35 machine types only"));
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
@@ -3008,7 +3008,7 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
|
|
|
3e5111 |
if (STREQ(def->os.machine, "versatilepb"))
|
|
|
3e5111 |
return "smc91c111";
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsVirt(def))
|
|
|
3e5111 |
+ if (qemuDomainIsVirt(def))
|
|
|
3e5111 |
return "virtio";
|
|
|
3e5111 |
|
|
|
3e5111 |
/* Incomplete. vexpress (and a few others) use this, but not all
|
|
|
3e5111 |
@@ -3167,14 +3167,14 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
|
|
|
3e5111 |
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
|
|
|
3e5111 |
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS &&
|
|
|
3e5111 |
- !qemuDomainMachineIsI440FX(def)) {
|
|
|
3e5111 |
+ !qemuDomainIsI440FX(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("pci-expander-bus controllers are only supported "
|
|
|
3e5111 |
"on 440fx-based machinetypes"));
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS &&
|
|
|
3e5111 |
- !qemuDomainMachineIsQ35(def)) {
|
|
|
3e5111 |
+ !qemuDomainIsQ35(def)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
_("pcie-expander-bus controllers are only supported "
|
|
|
3e5111 |
"on q35-based machinetypes"));
|
|
|
3e5111 |
@@ -3329,7 +3329,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (dev->type == VIR_DOMAIN_DEVICE_PANIC &&
|
|
|
3e5111 |
dev->data.panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def))
|
|
|
3e5111 |
dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
|
|
|
3e5111 |
else if (ARCH_IS_S390(def->os.arch))
|
|
|
3e5111 |
dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
|
|
|
3e5111 |
@@ -4016,7 +4016,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
|
|
3e5111 |
* because other architectures and machine types were introduced
|
|
|
3e5111 |
* when libvirt already supported <controller type='usb'/>.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
- if (ARCH_IS_X86(def->os.arch) && qemuDomainMachineIsI440FX(def) &&
|
|
|
3e5111 |
+ if (ARCH_IS_X86(def->os.arch) && qemuDomainIsI440FX(def) &&
|
|
|
3e5111 |
usb && usb->idx == 0 &&
|
|
|
3e5111 |
(usb->model == -1 ||
|
|
|
3e5111 |
usb->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI)) {
|
|
|
3e5111 |
@@ -5849,26 +5849,40 @@ qemuFindAgentConfig(virDomainDefPtr def)
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineIsQ35(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainIsQ35(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- return (STRPREFIX(def->os.machine, "pc-q35") ||
|
|
|
3e5111 |
- STREQ(def->os.machine, "q35"));
|
|
|
3e5111 |
+ return qemuDomainMachineIsQ35(def->os.machine);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineIsI440FX(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainMachineIsQ35(const char *machine)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- return (STREQ(def->os.machine, "pc") ||
|
|
|
3e5111 |
- STRPREFIX(def->os.machine, "pc-0.") ||
|
|
|
3e5111 |
- STRPREFIX(def->os.machine, "pc-1.") ||
|
|
|
3e5111 |
- STRPREFIX(def->os.machine, "pc-i440") ||
|
|
|
3e5111 |
- STRPREFIX(def->os.machine, "rhel"));
|
|
|
3e5111 |
+ return (STRPREFIX(machine, "pc-q35") ||
|
|
|
3e5111 |
+ STREQ(machine, "q35"));
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineHasPCIRoot(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainIsI440FX(const virDomainDef *def)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ return qemuDomainMachineIsI440FX(def->os.machine);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainMachineIsI440FX(const char *machine)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ return (STREQ(machine, "pc") ||
|
|
|
3e5111 |
+ STRPREFIX(machine, "pc-0.") ||
|
|
|
3e5111 |
+ STRPREFIX(machine, "pc-1.") ||
|
|
|
3e5111 |
+ STRPREFIX(machine, "pc-i440") ||
|
|
|
3e5111 |
+ STRPREFIX(machine, "rhel"));
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainHasPCIRoot(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -5883,7 +5897,7 @@ qemuDomainMachineHasPCIRoot(const virDomainDef *def)
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineHasPCIeRoot(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainHasPCIeRoot(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -5898,9 +5912,16 @@ qemuDomainMachineHasPCIeRoot(const virDomainDef *def)
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineNeedsFDC(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainNeedsFDC(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- char *p = STRSKIP(def->os.machine, "pc-q35-");
|
|
|
3e5111 |
+ return qemuDomainMachineNeedsFDC(def->os.machine);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainMachineNeedsFDC(const char *machine)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ const char *p = STRSKIP(machine, "pc-q35-");
|
|
|
3e5111 |
|
|
|
3e5111 |
if (p) {
|
|
|
3e5111 |
if (STRPREFIX(p, "1.") ||
|
|
|
3e5111 |
@@ -5919,21 +5940,36 @@ qemuDomainMachineNeedsFDC(const virDomainDef *def)
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineIsS390CCW(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainIsS390CCW(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- return STRPREFIX(def->os.machine, "s390-ccw");
|
|
|
3e5111 |
+ return qemuDomainMachineIsS390CCW(def->os.machine);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineIsVirt(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainMachineIsS390CCW(const char *machine)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- if (def->os.arch != VIR_ARCH_ARMV7L &&
|
|
|
3e5111 |
- def->os.arch != VIR_ARCH_AARCH64)
|
|
|
3e5111 |
+ return STRPREFIX(machine, "s390-ccw");
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainIsVirt(const virDomainDef *def)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ return qemuDomainMachineIsVirt(def->os.machine, def->os.arch);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainMachineIsVirt(const char *machine,
|
|
|
3e5111 |
+ const virArch arch)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ if (arch != VIR_ARCH_ARMV7L &&
|
|
|
3e5111 |
+ arch != VIR_ARCH_AARCH64)
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (STRNEQ(def->os.machine, "virt") &&
|
|
|
3e5111 |
- !STRPREFIX(def->os.machine, "virt-"))
|
|
|
3e5111 |
+ if (STRNEQ(machine, "virt") &&
|
|
|
3e5111 |
+ !STRPREFIX(machine, "virt-"))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
return true;
|
|
|
3e5111 |
@@ -5941,13 +5977,21 @@ qemuDomainMachineIsVirt(const virDomainDef *def)
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineIsPSeries(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainIsPSeries(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- if (!ARCH_IS_PPC64(def->os.arch))
|
|
|
3e5111 |
+ return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainMachineIsPSeries(const char *machine,
|
|
|
3e5111 |
+ const virArch arch)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ if (!ARCH_IS_PPC64(arch))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (STRNEQ(def->os.machine, "pseries") &&
|
|
|
3e5111 |
- !STRPREFIX(def->os.machine, "pseries-"))
|
|
|
3e5111 |
+ if (STRNEQ(machine, "pseries") &&
|
|
|
3e5111 |
+ !STRPREFIX(machine, "pseries-"))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
return true;
|
|
|
3e5111 |
@@ -6149,12 +6193,19 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
bool
|
|
|
3e5111 |
-qemuDomainMachineHasBuiltinIDE(const virDomainDef *def)
|
|
|
3e5111 |
+qemuDomainHasBuiltinIDE(const virDomainDef *def)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- return qemuDomainMachineIsI440FX(def) ||
|
|
|
3e5111 |
- STREQ(def->os.machine, "malta") ||
|
|
|
3e5111 |
- STREQ(def->os.machine, "sun4u") ||
|
|
|
3e5111 |
- STREQ(def->os.machine, "g3beige");
|
|
|
3e5111 |
+ return qemuDomainMachineHasBuiltinIDE(def->os.machine);
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool
|
|
|
3e5111 |
+qemuDomainMachineHasBuiltinIDE(const char *machine)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ return qemuDomainMachineIsI440FX(machine) ||
|
|
|
3e5111 |
+ STREQ(machine, "malta") ||
|
|
|
3e5111 |
+ STREQ(machine, "sun4u") ||
|
|
|
3e5111 |
+ STREQ(machine, "g3beige");
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
3e5111 |
index 91573ff06..0e32bb9ea 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.h
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.h
|
|
|
3e5111 |
@@ -677,15 +677,25 @@ void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
|
|
|
3e5111 |
|
|
|
3e5111 |
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
|
|
|
3e5111 |
|
|
|
3e5111 |
-bool qemuDomainMachineIsQ35(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineIsI440FX(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineHasPCIRoot(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineHasPCIeRoot(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineIsVirt(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineIsPSeries(const virDomainDef *def);
|
|
|
3e5111 |
-bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainIsQ35(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainIsI440FX(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainHasPCIRoot(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainHasPCIeRoot(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainNeedsFDC(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainIsS390CCW(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainIsVirt(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainIsPSeries(const virDomainDef *def);
|
|
|
3e5111 |
+bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+bool qemuDomainMachineIsQ35(const char *machine);
|
|
|
3e5111 |
+bool qemuDomainMachineIsI440FX(const char *machine);
|
|
|
3e5111 |
+bool qemuDomainMachineNeedsFDC(const char *machine);
|
|
|
3e5111 |
+bool qemuDomainMachineIsS390CCW(const char *machine);
|
|
|
3e5111 |
+bool qemuDomainMachineIsVirt(const char *machine,
|
|
|
3e5111 |
+ const virArch arch);
|
|
|
3e5111 |
+bool qemuDomainMachineIsPSeries(const char *machine,
|
|
|
3e5111 |
+ const virArch arch);
|
|
|
3e5111 |
+bool qemuDomainMachineHasBuiltinIDE(const char *machine);
|
|
|
3e5111 |
|
|
|
3e5111 |
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm);
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
index 22d8bf67d..064d05079 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
@@ -88,7 +88,7 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def)) {
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def)) {
|
|
|
3e5111 |
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
|
|
|
3e5111 |
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
|
|
|
3e5111 |
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
|
|
|
3e5111 |
@@ -245,7 +245,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
|
|
3e5111 |
|
|
|
3e5111 |
for (i = 0; i < def->nserials; i++) {
|
|
|
3e5111 |
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
|
|
3e5111 |
- qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ qemuDomainIsPSeries(def))
|
|
|
3e5111 |
def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
|
|
3e5111 |
if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info,
|
|
|
3e5111 |
VIO_ADDR_SERIAL) < 0)
|
|
|
3e5111 |
@@ -253,7 +253,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
if (def->nvram) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def))
|
|
|
3e5111 |
def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
|
|
3e5111 |
if (qemuDomainAssignSpaprVIOAddress(def, &def->nvram->info,
|
|
|
3e5111 |
VIO_ADDR_NVRAM) < 0)
|
|
|
3e5111 |
@@ -375,7 +375,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
|
|
3e5111 |
int ret = -1;
|
|
|
3e5111 |
virDomainCCWAddressSetPtr addrs = NULL;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(def) &&
|
|
|
3e5111 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
|
|
3e5111 |
qemuDomainPrimeVirtioDeviceAddresses(
|
|
|
3e5111 |
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
|
|
3e5111 |
@@ -445,13 +445,13 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
|
|
|
3e5111 |
return;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!(STRPREFIX(def->os.machine, "vexpress-") ||
|
|
|
3e5111 |
- qemuDomainMachineIsVirt(def)))
|
|
|
3e5111 |
+ qemuDomainIsVirt(def)))
|
|
|
3e5111 |
return;
|
|
|
3e5111 |
|
|
|
3e5111 |
/* We use virtio-mmio by default on mach-virt guests only if they already
|
|
|
3e5111 |
* have at least one virtio-mmio device: in all other cases, we prefer
|
|
|
3e5111 |
* virtio-pci */
|
|
|
3e5111 |
- if (qemuDomainMachineHasPCIeRoot(def) &&
|
|
|
3e5111 |
+ if (qemuDomainHasPCIeRoot(def) &&
|
|
|
3e5111 |
!qemuDomainHasVirtioMMIODevices(def)) {
|
|
|
3e5111 |
qemuDomainPrimeVirtioDeviceAddresses(def,
|
|
|
3e5111 |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);
|
|
|
3e5111 |
@@ -826,7 +826,7 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomainDefPtr def,
|
|
|
3e5111 |
|
|
|
3e5111 |
data->driver = driver;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineHasPCIeRoot(def)) {
|
|
|
3e5111 |
+ if (qemuDomainHasPCIeRoot(def)) {
|
|
|
3e5111 |
data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
|
|
|
3e5111 |
VIR_PCI_CONNECT_HOTPLUGGABLE);
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
@@ -1479,12 +1479,12 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
|
|
|
3e5111 |
virQEMUCapsPtr qemuCaps,
|
|
|
3e5111 |
virDomainPCIAddressSetPtr addrs)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- if (qemuDomainMachineIsI440FX(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsI440FX(def) &&
|
|
|
3e5111 |
qemuDomainValidateDevicePCISlotsPIIX3(def, qemuCaps, addrs) < 0) {
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsQ35(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsQ35(def) &&
|
|
|
3e5111 |
qemuDomainValidateDevicePCISlotsQ35(def, qemuCaps, addrs) < 0) {
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
@@ -1845,7 +1845,7 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
|
|
|
3e5111 |
if (STREQ(def->os.machine, "versatilepb"))
|
|
|
3e5111 |
return true;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsVirt(def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsVirt(def) &&
|
|
|
3e5111 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
|
|
|
3e5111 |
return true;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -2024,7 +2024,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
|
|
3e5111 |
* all *actual* devices.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineHasPCIRoot(def)) {
|
|
|
3e5111 |
+ if (qemuDomainHasPCIRoot(def)) {
|
|
|
3e5111 |
/* This is a dummy info used to reserve a slot for a
|
|
|
3e5111 |
* legacy PCI device that doesn't exist, but may in the
|
|
|
3e5111 |
* future, e.g. if another device is hotplugged into the
|
|
|
3e5111 |
@@ -2066,7 +2066,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (max_idx <= 0 &&
|
|
|
3e5111 |
addrs->nbuses > max_idx + 1 &&
|
|
|
3e5111 |
- qemuDomainMachineHasPCIeRoot(def)) {
|
|
|
3e5111 |
+ qemuDomainHasPCIeRoot(def)) {
|
|
|
3e5111 |
virDomainDeviceInfo info = {
|
|
|
3e5111 |
.pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
|
|
|
3e5111 |
VIR_PCI_CONNECT_TYPE_PCIE_DEVICE)
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
index a6dac6f09..37b8d455c 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
@@ -329,7 +329,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
|
|
|
3e5111 |
qemuDomainSecretInfoPtr encinfo;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!disk->info.type) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
|
|
|
3e5111 |
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
|
|
3e5111 |
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
|
|
3e5111 |
@@ -497,7 +497,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
|
|
|
3e5111 |
controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
|
|
3e5111 |
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
|
|
3e5111 |
@@ -1141,7 +1141,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
|
|
3e5111 |
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
|
|
3e5111 |
if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def)))
|
|
|
3e5111 |
@@ -2079,7 +2079,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
|
|
3e5111 |
rng->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
|
|
3e5111 |
} else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
|
|
|
3e5111 |
@@ -2620,7 +2620,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
|
|
|
3e5111 |
hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
@@ -4447,7 +4447,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
|
|
3e5111 |
if (!virDomainDeviceAddressIsValid(&detach->info,
|
|
|
3e5111 |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
|
|
|
3e5111 |
@@ -5007,7 +5007,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainNetGetActualHostdev(detach));
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
- if (qemuDomainMachineIsS390CCW(vm->def) &&
|
|
|
3e5111 |
+ if (qemuDomainIsS390CCW(vm->def) &&
|
|
|
3e5111 |
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
|
|
3e5111 |
if (!virDomainDeviceAddressIsValid(&detach->info,
|
|
|
3e5111 |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
|
|
|
3e5111 |
index fc176c168..af9063c02 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_parse_command.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_parse_command.c
|
|
|
3e5111 |
@@ -654,7 +654,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|
|
3e5111 |
if (VIR_ALLOC(def->src) < 0)
|
|
|
3e5111 |
goto error;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(dom))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(dom))
|
|
|
3e5111 |
def->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
|
|
3e5111 |
else
|
|
|
3e5111 |
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
|
|
3e5111 |
@@ -746,7 +746,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|
|
3e5111 |
} else if (STREQ(keywords[i], "if")) {
|
|
|
3e5111 |
if (STREQ(values[i], "ide")) {
|
|
|
3e5111 |
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(dom)) {
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(dom)) {
|
|
|
3e5111 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
3e5111 |
_("pseries systems do not support ide devices '%s'"), val);
|
|
|
3e5111 |
goto error;
|
|
|
3e5111 |
@@ -1950,7 +1950,7 @@ qemuParseCommandLine(virCapsPtr caps,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
if (STREQ(arg, "-cdrom")) {
|
|
|
3e5111 |
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def))
|
|
|
3e5111 |
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
|
|
3e5111 |
if (VIR_STRDUP(disk->dst, "hdc") < 0)
|
|
|
3e5111 |
goto error;
|
|
|
3e5111 |
@@ -1965,7 +1965,7 @@ qemuParseCommandLine(virCapsPtr caps,
|
|
|
3e5111 |
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
|
|
3e5111 |
else
|
|
|
3e5111 |
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
|
|
3e5111 |
- if (qemuDomainMachineIsPSeries(def))
|
|
|
3e5111 |
+ if (qemuDomainIsPSeries(def))
|
|
|
3e5111 |
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
if (VIR_STRDUP(disk->dst, arg + 1) < 0)
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|