On 3/23/21 3:50 PM, Laine Stump wrote:
This function returns true if the domain has any interfaces that are
type='vdpa'.
Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 3 +++
src/libvirt_private.syms | 1 +
3 files changed, 18 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f071bf93d0..736e9de3c8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -32500,6 +32500,20 @@ virDomainDefHasMdevHostdev(const virDomainDef *def)
}
+bool
+virDomainDefHasVDPANet(const virDomainDef *def)
+{
+ size_t i;
+
+ for (i = 0; i < def->nnets; i++) {
+ if (virDomainNetGetActualType(def->nets[i]) == VIR_DOMAIN_NET_TYPE_VDPA)
+ return true;
+ }
+
+ return false;
+}
+
+
bool
virDomainDefHasOldStyleUEFI(const virDomainDef *def)
{
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index da32016b01..aa15184821 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -4061,6 +4061,9 @@ virDomainDefHasVFIOHostdev(const virDomainDef *def);
bool
virDomainDefHasMdevHostdev(const virDomainDef *def);
+bool
+virDomainDefHasVDPANet(const virDomainDef *def);
+
bool
virDomainDefHasOldStyleUEFI(const virDomainDef *def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 526dcee11a..1bf8165520 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -332,6 +332,7 @@ virDomainDefHasOldStyleROUEFI;
virDomainDefHasOldStyleUEFI;
virDomainDefHasUSB;
virDomainDefHasVcpusOffline;
+virDomainDefHasVDPANet;
virDomainDefHasVFIOHostdev;
virDomainDefLifecycleActionAllowed;
virDomainDefMaybeAddController;