]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Do not allow changing the UUID of a nwfilter
authorHu Jianwei <jiahu@redhat.com>
Mon, 7 Jul 2014 13:55:16 +0000 (15:55 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 7 Jul 2014 13:55:16 +0000 (15:55 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1077009

src/conf/nwfilter_conf.c

index 0f633da5df8cf4934367c7cd2b895ea9417904e2..52f24e42a04dc13382456a100538993b665976da 100644 (file)
@@ -3058,6 +3058,17 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
             return NULL;
         }
         virNWFilterObjUnlock(nwfilter);
+    } else {
+        nwfilter = virNWFilterObjFindByName(nwfilters, def->name);
+        if (nwfilter) {
+            char uuidstr[VIR_UUID_STRING_BUFLEN];
+            virUUIDFormat(nwfilter->def->uuid, uuidstr);
+            virReportError(VIR_ERR_OPERATION_FAILED,
+                           _("filter '%s' already exists with uuid %s"),
+                           def->name, uuidstr);
+            virNWFilterObjUnlock(nwfilter);
+            return NULL;
+        }
     }
 
     if (virNWFilterDefLoopDetect(nwfilters, def) < 0) {