[PATCH] conf: Add more checks for VDS interface parameters

Martin Kletzander posted 1 patch 1 year, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e67e6617a4306a3411cf3dc6a5c3673681d17cca.1661863428.git.mkletzan@redhat.com
src/conf/domain_conf.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
[PATCH] conf: Add more checks for VDS interface parameters
Posted by Martin Kletzander 1 year, 8 months ago
Add some checks that commit 0225483adce9 forgot to include.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 src/conf/domain_conf.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6950f7ec1d8f..970cc85ded6c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9336,6 +9336,27 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
             goto error;
         }
 
+        if (!portid) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("Missing source portid for interface type '%s'"),
+                           virDomainNetTypeToString(def->type));
+            goto error;
+        }
+
+        if (!connectionid) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("Missing source connectionid for interface type '%s'"),
+                           virDomainNetTypeToString(def->type));
+            goto error;
+        }
+
+        if (!portgroup) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("Missing source portgroup for interface type '%s'"),
+                           virDomainNetTypeToString(def->type));
+            goto error;
+        }
+
         if (virUUIDParse(switchid, def->data.vds.switch_id) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to parse switchid '%s'"), switchid);
-- 
2.37.2
Re: [PATCH] conf: Add more checks for VDS interface parameters
Posted by Daniel P. Berrangé 1 year, 8 months ago
On Tue, Aug 30, 2022 at 02:43:48PM +0200, Martin Kletzander wrote:
> Add some checks that commit 0225483adce9 forgot to include.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  src/conf/domain_conf.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|