Move qemuDomainSupportsNicdev and qemuDomainSupportsNetdev into qemu_domain.c and expose from there. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_command.c | 29 ----------------------------- src/qemu/qemu_domain.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 9 +++++++++ 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4ed3349..d02d7cb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -152,35 +152,6 @@ VIR_ENUM_IMPL(qemuNumaPolicy, VIR_DOMAIN_NUMATUNE_MEM_LAST, "preferred", "interleave"); -static bool -qemuDomainSupportsNicdev(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, - virDomainNetDefPtr net) -{ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return false; - - /* non-virtio ARM nics require legacy -net nic */ - if (((def->os.arch == VIR_ARCH_ARMV7L) || - (def->os.arch == VIR_ARCH_AARCH64)) && - net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO && - net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) - return false; - - return true; -} - -static bool -qemuDomainSupportsNetdev(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, - virDomainNetDefPtr net) -{ - if (!qemuDomainSupportsNicdev(def, qemuCaps, net)) - return false; - return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV); -} - - static int qemuBuildObjectCommandLinePropsInternal(const char *key, const virJSONValue *value, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 495c76b..686c9e4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4366,3 +4366,32 @@ qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, priv->vcpupids = cpupids; return ncpupids; } + + +bool +qemuDomainSupportsNicdev(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + virDomainNetDefPtr net) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) + return false; + + /* non-virtio ARM nics require legacy -net nic */ + if (((def->os.arch == VIR_ARCH_ARMV7L) || + (def->os.arch == VIR_ARCH_AARCH64)) && + net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO && + net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + return false; + + return true; +} + +bool +qemuDomainSupportsNetdev(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + virDomainNetDefPtr net) +{ + if (!qemuDomainSupportsNicdev(def, qemuCaps, net)) + return false; + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV); +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 285af8c..95b2e9d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -513,4 +513,13 @@ pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpu); int qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob); +bool qemuDomainSupportsNicdev(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + virDomainNetDefPtr net); + +bool qemuDomainSupportsNetdev(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + virDomainNetDefPtr net); + + #endif /* __QEMU_DOMAIN_H__ */ -- 2.5.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list