The esisting function is renamed and called from the new one, so
that even while we're in the process of implementing new checks
all the existing ones will be performed.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
Based on the reviewer's preference, this patch can be pushed on
its own or squashed into the next one.

 src/qemu/qemu_domain.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b1308e5a49..151d33aee3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4247,9 +4247,9 @@ qemuDomainDeviceDefValidateControllerSCSI(const 
virDomainControllerDef *controll
 
 
 static int
-qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef 
*controller,
-                                         const virDomainDef *def,
-                                         virQEMUCapsPtr qemuCaps)
+qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef 
*controller,
+                                            const virDomainDef *def,
+                                            virQEMUCapsPtr qemuCaps)
 {
     virDomainControllerModelPCI model = controller->model;
     const virDomainPCIControllerOpts *pciopts;
@@ -4526,6 +4526,33 @@ qemuDomainDeviceDefValidateControllerPCI(const 
virDomainControllerDef *controlle
 }
 
 
+static int
+qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
+                                         const virDomainDef *def,
+                                         virQEMUCapsPtr qemuCaps)
+
+{
+    const virDomainPCIControllerOpts *pciopts = &cont->opts.pciopts;
+    const char *model = virDomainControllerModelPCITypeToString(cont->model);
+    const char *modelName = 
virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
+
+    if (!model) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Unknown virDomainControllerModelPCI value: %d"),
+                       cont->model);
+        return -1;
+    }
+    if (!modelName) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Unknown virDomainControllerPCIModelName value: %d"),
+                       pciopts->modelName);
+        return -1;
+    }
+
+    return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
+}
+
+
 static int
 qemuDomainDeviceDefValidateControllerSATA(const virDomainControllerDef 
*controller,
                                           const virDomainDef *def,
-- 
2.14.3

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

Reply via email to