mirror of https://gitee.com/openkylin/libvirt.git
qemu: Move qemuDomainSupports* functions
Move qemuDomainSupportsNicdev and qemuDomainSupportsNetdev into qemu_domain.c and expose from there. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a1a1e44798
commit
a0824823b7
|
@ -153,35 +153,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,
|
||||
|
|
|
@ -4399,3 +4399,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);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* qemu_domain.h: QEMU domain private state
|
||||
*
|
||||
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2016 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -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__ */
|
||||
|
|
Loading…
Reference in New Issue