mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
nwfilter: Remove unnecessary UUID comparison bypass
Remove the unnecessary check as since commit id '46a811db07' it is not possible to add or alter a filter using the same name, but with a different UUID. NB: It's not required to provide a UUID for a filter by name, but if one is provided, then it must match the existing. If not provided, then one is generated during ParseXML processing. Reviewed-by: Laine Stump <laine@laine.org> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
39b933f197
commit
5866f48673
@ -287,18 +287,11 @@ virNWFilterObjTestUnassignDef(virNWFilterObjPtr obj)
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
virNWFilterDefEqual(const virNWFilterDef *def1,
|
virNWFilterDefEqual(const virNWFilterDef *def1,
|
||||||
virNWFilterDefPtr def2,
|
virNWFilterDefPtr def2)
|
||||||
bool cmpUUIDs)
|
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
unsigned char rem_uuid[VIR_UUID_BUFLEN];
|
char *xml1 = NULL;
|
||||||
char *xml1, *xml2 = NULL;
|
char *xml2 = NULL;
|
||||||
|
|
||||||
if (!cmpUUIDs) {
|
|
||||||
/* make sure the UUIDs are equal */
|
|
||||||
memcpy(rem_uuid, def2->uuid, sizeof(rem_uuid));
|
|
||||||
memcpy(def2->uuid, def1->uuid, sizeof(def2->uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(xml1 = virNWFilterDefFormat(def1)) ||
|
if (!(xml1 = virNWFilterDefFormat(def1)) ||
|
||||||
!(xml2 = virNWFilterDefFormat(def2)))
|
!(xml2 = virNWFilterDefFormat(def2)))
|
||||||
@ -307,9 +300,6 @@ virNWFilterDefEqual(const virNWFilterDef *def1,
|
|||||||
ret = STREQ(xml1, xml2);
|
ret = STREQ(xml1, xml2);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (!cmpUUIDs)
|
|
||||||
memcpy(def2->uuid, rem_uuid, sizeof(rem_uuid));
|
|
||||||
|
|
||||||
VIR_FREE(xml1);
|
VIR_FREE(xml1);
|
||||||
VIR_FREE(xml2);
|
VIR_FREE(xml2);
|
||||||
|
|
||||||
@ -360,7 +350,7 @@ virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
|
|||||||
if ((obj = virNWFilterObjListFindByName(nwfilters, def->name))) {
|
if ((obj = virNWFilterObjListFindByName(nwfilters, def->name))) {
|
||||||
|
|
||||||
objdef = obj->def;
|
objdef = obj->def;
|
||||||
if (virNWFilterDefEqual(def, objdef, false)) {
|
if (virNWFilterDefEqual(def, objdef)) {
|
||||||
virNWFilterDefFree(objdef);
|
virNWFilterDefFree(objdef);
|
||||||
obj->def = def;
|
obj->def = def;
|
||||||
return obj;
|
return obj;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user