qemuDomainMachineIsVirt is renamed to virDomainMachineIsVirt and moved
from qemu_domain_addr.c to domain_addr.c
All these functions are being moved because they don't depend on
qemu, so they have the potential to be reused for more hypervisors.
---
src/conf/domain_addr.c | 15 +++++++++++++++
src/conf/domain_addr.h | 3 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_command.c | 4 ++--
src/qemu/qemu_domain.c | 24 ++++--------------------
src/qemu/qemu_domain.h | 1 -
src/qemu/qemu_domain_address.c | 6 +++---
8 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 32943e8..3a9c44d 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -2217,3 +2217,18 @@ virDomainAssignDevicePCISlots(virDomainDefPtr def,
error:
return -1;
}
+
+
+bool
+virDomainMachineIsVirt(const virDomainDef *def)
+{
+ if (def->os.arch != VIR_ARCH_ARMV7L &&
+ def->os.arch != VIR_ARCH_AARCH64)
+ return false;
+
+ if (STRNEQ(def->os.machine, "virt") &&
+ !STRPREFIX(def->os.machine, "virt-"))
+ return false;
+
+ return true;
+}
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index a1e572b..7ecdac3 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -282,4 +282,7 @@ virDomainAssignDevicePCISlots(virDomainDefPtr def,
bool virtioMMIOEnabled)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+bool
+virDomainMachineIsVirt(const virDomainDef *def);
+
#endif /* __DOMAIN_ADDR_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 66144fd..e02f453 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -97,6 +97,7 @@ virDomainCollectPCIAddress;
virDomainGetBlkioParametersAssignFromDef;
virDomainMachineIsI440FX;
virDomainMachineIsQ35;
+virDomainMachineIsVirt;
virDomainPCIAddressAsString;
virDomainPCIAddressBusSetModel;
virDomainPCIAddressEnsureAddr;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6989a87..464262d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2179,7 +2179,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
/* If 'virt' supports PCI, it supports multibus.
* No extra conditions here for simplicity.
*/
- if (qemuDomainMachineIsVirt(def))
+ if (virDomainMachineIsVirt(def))
return true;
return false;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 24295bd..512c926 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2870,7 +2870,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
if (usbcontroller == 0 &&
!virDomainMachineIsQ35(def) &&
- !qemuDomainMachineIsVirt(def) &&
+ !virDomainMachineIsVirt(def) &&
!ARCH_IS_S390(def->os.arch))
virCommandAddArg(cmd, "-usb");
@@ -6855,7 +6855,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
if (def->gic_version != VIR_GIC_VERSION_NONE) {
- if (!qemuDomainMachineIsVirt(def)) {
+ if (!virDomainMachineIsVirt(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 8c23157..6270c8e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1957,7 +1957,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
case VIR_ARCH_AARCH64:
addDefaultUSB = false;
addDefaultMemballoon = false;
- if (qemuDomainMachineIsVirt(def))
+ if (virDomainMachineIsVirt(def))
addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
break;
@@ -2056,7 +2056,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
* be able to have a pure virtio-mmio topology
*/
if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1) < 0
&&
- !qemuDomainMachineIsVirt(def) &&
+ !virDomainMachineIsVirt(def) &&
!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
goto cleanup;
@@ -2131,7 +2131,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
* was not included in the domain XML, we need to choose a suitable
* GIC version ourselves */
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT
&&
- qemuDomainMachineIsVirt(def)) {
+ virDomainMachineIsVirt(def)) {
VIR_DEBUG("Looking for usable GIC version in domain capabilities");
for (version = VIR_GIC_VERSION_LAST - 1;
@@ -2334,7 +2334,7 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
- if (qemuDomainMachineIsVirt(def))
+ if (virDomainMachineIsVirt(def))
return "virtio";
/* Incomplete. vexpress (and a few others) use this, but not all
@@ -5015,22 +5015,6 @@ qemuDomainMachineIsS390CCW(const virDomainDef *def)
return STRPREFIX(def->os.machine, "s390-ccw");
}
-
-bool
-qemuDomainMachineIsVirt(const virDomainDef *def)
-{
- if (def->os.arch != VIR_ARCH_ARMV7L &&
- def->os.arch != VIR_ARCH_AARCH64)
- return false;
-
- if (STRNEQ(def->os.machine, "virt") &&
- !STRPREFIX(def->os.machine, "virt-"))
- return false;
-
- return true;
-}
-
-
bool
qemuDomainMachineIsPSeries(const virDomainDef *def)
{
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 81086d9..99f265e 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -624,7 +624,6 @@ virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
-bool qemuDomainMachineIsVirt(const virDomainDef *def);
bool qemuDomainMachineIsPSeries(const virDomainDef *def);
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index a0bc752..be790ec 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -350,7 +350,7 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
return;
if (!(STRPREFIX(def->os.machine, "vexpress-") ||
- qemuDomainMachineIsVirt(def)))
+ virDomainMachineIsVirt(def)))
return;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
@@ -370,7 +370,7 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
if (STREQ(def->os.machine, "versatilepb"))
return true;
- if (qemuDomainMachineIsVirt(def) &&
+ if (virDomainMachineIsVirt(def) &&
gpexEnabled)
return true;
@@ -509,7 +509,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
* a dmi-to-pci-bridge to an otherwise PCI-free topology
*/
if (!buses_reserved &&
- !qemuDomainMachineIsVirt(def) &&
+ !virDomainMachineIsVirt(def) &&
virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
goto cleanup;
--
2.7.4 (Apple Git-66)