diff mbox series

[6/7] qemu: domain: Call virDomainCapsDeviceDefValidate

Message ID ff9ce0f5a6d30f2d19b23f11e7994dbeae157405.1554419814.git.crobinso@redhat.com
State Accepted
Commit b66ca0220abb8f2e9afbbd9174da5de32da25347
Headers show
Series qemu: use domCaps for validation | expand

Commit Message

Cole Robinson April 4, 2019, 11:37 p.m. UTC
Fill in virDomainCaps at Validate time and use it to call
virDomainCapsDeviceDefValidate

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/qemu/qemu_domain.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f0bf1aa4fe..6da27a79b0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -41,6 +41,7 @@ 
 #include "viruuid.h"
 #include "virfile.h"
 #include "domain_addr.h"
+#include "domain_capabilities.h"
 #include "domain_event.h"
 #include "virtime.h"
 #include "virnetdevopenvswitch.h"
@@ -6119,14 +6120,24 @@  qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
     int ret = 0;
     virQEMUDriverPtr driver = opaque;
     virQEMUCapsPtr qemuCaps = NULL;
+    virDomainCapsPtr domCaps = NULL;
 
     if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
                                             def->emulator)))
         return -1;
 
+    if (!(domCaps = virQEMUDriverGetDomainCapabilities(driver, qemuCaps,
+                                                       def->os.machine,
+                                                       def->os.arch,
+                                                       def->virtType)))
+        goto cleanup;
+
     if ((ret = qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0)
         goto cleanup;
 
+    if (virDomainCapsDeviceDefValidate(domCaps, dev, def) < 0)
+        goto cleanup;
+
     switch ((virDomainDeviceType)dev->type) {
     case VIR_DOMAIN_DEVICE_NET:
         ret = qemuDomainDeviceDefValidateNetwork(dev->data.net);
@@ -6207,6 +6218,7 @@  qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
 
  cleanup:
     virObjectUnref(qemuCaps);
+    virObjectUnref(domCaps);
     return ret;
 }