[libvirt] [PATCH v3 7/8] util: Check for duplicated id in virStorageSourceParseRBDColonString

John Ferlan jferlan at redhat.com
Tue Feb 12 14:19:05 UTC 2019


If we find multiple "id=" strings during processing, then we need
to force an error since we cannot have multiple <auth>'s defined
for a single source volume.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/util/virstoragefile.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5a8e5667f5..8d85d9dac4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2840,6 +2840,11 @@ virStorageSourceParseRBDColonString(const char *rbdstr,
 
         if (STRPREFIX(p, "id=")) {
             /* formulate authdef for src->auth */
+            if (src->auth) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("duplicate 'id' found in '%s'"), src->path);
+                return -1;
+            }
             if (VIR_ALLOC(authdef) < 0)
                 return -1;
 
-- 
2.20.1




More information about the libvir-list mailing list