This is an entrypoint to validate a virDomainDeviceDef against
values filled into virDomainCaps.
Currently it's just a stub
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/conf/domain_capabilities.c | 40 ++++++++++++++++++++++++++++++++++
src/conf/domain_capabilities.h | 4 ++++
src/libvirt_private.syms | 1 +
3 files changed, 45 insertions(+)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 03757ba8cd..aef5703df6 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -20,6 +20,7 @@
#include <config.h>
+#include "device_conf.h"
#include "domain_capabilities.h"
#include "domain_conf.h"
#include "viralloc.h"
@@ -656,3 +657,42 @@ virDomainCapsFormat(virDomainCapsPtr const caps)
virBufferCheckError(&buf);
return virBufferContentAndReset(&buf);
}
+
+
+int
+virDomainCapsDeviceDefValidate(virDomainCapsPtr const caps ATTRIBUTE_UNUSED,
+ const virDomainDeviceDef *dev,
+ const virDomainDef *def ATTRIBUTE_UNUSED)
+{
+ switch ((virDomainDeviceType) dev->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ case VIR_DOMAIN_DEVICE_NET:
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ case VIR_DOMAIN_DEVICE_CHR:
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
+ case VIR_DOMAIN_DEVICE_RNG:
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ case VIR_DOMAIN_DEVICE_VIDEO:
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ case VIR_DOMAIN_DEVICE_INPUT:
+ case VIR_DOMAIN_DEVICE_SHMEM:
+ case VIR_DOMAIN_DEVICE_LEASE:
+ case VIR_DOMAIN_DEVICE_FS:
+ case VIR_DOMAIN_DEVICE_SOUND:
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ case VIR_DOMAIN_DEVICE_HUB:
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
+ case VIR_DOMAIN_DEVICE_TPM:
+ case VIR_DOMAIN_DEVICE_PANIC:
+ case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_NONE:
+ case VIR_DOMAIN_DEVICE_LAST:
+ break;
+ }
+
+ return 0;
+}
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 052191d284..ffce2c2964 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -223,6 +223,10 @@ void virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum);
char * virDomainCapsFormat(virDomainCapsPtr const caps);
+int virDomainCapsDeviceDefValidate(virDomainCapsPtr const caps,
+ const virDomainDeviceDef *dev,
+ const virDomainDef *def);
+
void
virSEVCapabilitiesFree(virSEVCapability *capabilities);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 212adf53c1..231b487ab0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -185,6 +185,7 @@ virDomainCapsCPUModelsGet;
virDomainCapsCPUModelsNew;
virDomainCapsCPUUsableTypeFromString;
virDomainCapsCPUUsableTypeToString;
+virDomainCapsDeviceDefValidate;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
virDomainCapsFormat;
--
2.21.0