@@ -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;
+}
@@ -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);
@@ -185,6 +185,7 @@ virDomainCapsCPUModelsGet;
virDomainCapsCPUModelsNew;
virDomainCapsCPUUsableTypeFromString;
virDomainCapsCPUUsableTypeToString;
+virDomainCapsDeviceDefValidate;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
virDomainCapsFormat;
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@redhat.com> --- src/conf/domain_capabilities.c | 40 ++++++++++++++++++++++++++++++++++ src/conf/domain_capabilities.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 45 insertions(+) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list