Use it everywhere except for virQEMUCapsFillDomainFeatureGICCaps.
---
src/qemu/qemu_capabilities.c | 3 +--
src/qemu/qemu_command.c | 3 +--
src/qemu/qemu_domain.c | 18 +++++++++++-------
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_domain_address.c | 6 ++----
5 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 677b06f..c081e84 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2184,8 +2184,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
/* If 'virt' supports PCI, it supports multibus.
* No extra conditions here for simplicity.
*/
- if (STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-"))
+ if (qemuDomainMachineIsVirt(def))
return true;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bd564db..bcc0e63 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6807,8 +6807,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
if (def->gic_version != VIR_GIC_VERSION_NONE) {
if ((def->os.arch != VIR_ARCH_ARMV7L &&
def->os.arch != VIR_ARCH_AARCH64) ||
- (STRNEQ(def->os.machine, "virt") &&
- !STRPREFIX(def->os.machine, "virt-"))) {
+ !qemuDomainMachineIsVirt(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("gic-version option is available "
"only for ARM virt machine"));
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9519334..53682c1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1761,10 +1761,8 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
case VIR_ARCH_AARCH64:
addDefaultUSB = false;
addDefaultMemballoon = false;
- if (STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-")) {
+ if (qemuDomainMachineIsVirt(def))
addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
- }
break;
case VIR_ARCH_PPC64:
@@ -1906,8 +1904,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def)
switch (def->os.arch) {
case VIR_ARCH_ARMV7L:
case VIR_ARCH_AARCH64:
- if (STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-")) {
+ if (qemuDomainMachineIsVirt(def)) {
/* GIC is always available to ARM virt machines */
def->features[VIR_DOMAIN_FEATURE_GIC] = VIR_TRISTATE_SWITCH_ON;
}
@@ -2039,8 +2036,7 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
- if (STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-"))
+ if (qemuDomainMachineIsVirt(def))
return "virtio";
/* Incomplete. vexpress (and a few others) use this, but not all
@@ -4653,6 +4649,14 @@ qemuDomainMachineIsS390CCW(const virDomainDef *def)
}
+bool
+qemuDomainMachineIsVirt(const virDomainDef *def)
+{
+ return STREQ(def->os.machine, "virt") ||
+ STRPREFIX(def->os.machine, "virt-");
+}
+
+
static bool
qemuCheckMemoryDimmConflict(const virDomainDef *def,
const virDomainMemoryDef *mem)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 63f98ba..95f821c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -584,6 +584,7 @@ bool qemuDomainMachineIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
+bool qemuDomainMachineIsVirt(const virDomainDef *def);
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index b3220a5..9c8c262 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -407,8 +407,7 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
return;
if (!(STRPREFIX(def->os.machine, "vexpress-") ||
- STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-")))
+ qemuDomainMachineIsVirt(def)))
return;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
@@ -1342,8 +1341,7 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
if (STREQ(def->os.machine, "versatilepb"))
return true;
- if ((STREQ(def->os.machine, "virt") ||
- STRPREFIX(def->os.machine, "virt-")) &&
+ if (qemuDomainMachineIsVirt(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
return true;
--
2.7.3