[PATCH v3 03/12] qemu: Move CCW S390 Address check to controller def validate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move the call to qemuDomainCheckCCWS390AddressSupport from
qemuBuildControllerDevStr to qemuDomainDeviceDefValidateController.

This means we will get the qemuCaps from the driver opaque
variable passed to qemuDomainDeviceDefValidate.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c |  4 ----
 src/qemu/qemu_domain.c  | 20 +++++++++++++++++---
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ffa89aa4a..894c3f323 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2662,10 +2662,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
 
     *devstr = NULL;
 
-    if (!qemuDomainCheckCCWS390AddressSupport(domainDef, def->info, qemuCaps,
-                                              "controller"))
-        return -1;
-
     if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
         if ((qemuDomainSetSCSIControllerModel(domainDef, qemuCaps, &model)) < 0)
             return -1;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 877a0a322..8d966156d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3893,8 +3893,14 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk)
 
 
 static int
-qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller)
+qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
+                                      const virDomainDef *def,
+                                      virQEMUCapsPtr qemuCaps)
 {
+    if (!qemuDomainCheckCCWS390AddressSupport(def, controller->info, qemuCaps,
+                                              "controller"))
+        return -1;
+
     switch ((virDomainControllerType) controller->type) {
     case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
     case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
@@ -3915,9 +3921,15 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller)
 static int
 qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
                             const virDomainDef *def,
-                            void *opaque ATTRIBUTE_UNUSED)
+                            void *opaque)
 {
     int ret = 0;
+    virQEMUDriverPtr driver = opaque;
+    virQEMUCapsPtr qemuCaps = NULL;
+
+    if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
+                                            def->emulator)))
+        return -1;
 
     switch ((virDomainDeviceType) dev->type) {
     case VIR_DOMAIN_DEVICE_NET:
@@ -3957,7 +3969,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
         break;
 
     case VIR_DOMAIN_DEVICE_CONTROLLER:
-        ret = qemuDomainDeviceDefValidateController(dev->data.controller);
+        ret = qemuDomainDeviceDefValidateController(dev->data.controller, def,
+                                                    qemuCaps);
         break;
 
     case VIR_DOMAIN_DEVICE_LEASE:
@@ -3978,6 +3991,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
         break;
     }
 
+    virObjectUnref(qemuCaps);
     return ret;
 }
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux