Parser checks for per-domain seclabel duplicates, so it would be nice if
it checked for per-device seclabel duplicates the same way

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1165485
---
 src/conf/domain_conf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a36dace..c43aded 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5323,6 +5323,15 @@ 
virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
                     break;
                 }
             }
+
+            /* check for duplicate seclabels */
+            for (j = 0; j < i; j++) {
+                if (STREQ_NULLABLE(model, seclabels[j]->model)) {
+                    virReportError(VIR_ERR_XML_DETAIL,
+                                   _("seclabel for model %s is already 
provided"), model);
+                    goto error;
+                }
+            }
             seclabels[i]->model = model;
         }
 
-- 
1.9.3

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

Reply via email to