[libvirt] [PATCH v2 13/13] nwfilter: Move save of config until after successful assign
John Ferlan
jferlan at redhat.com
Tue Apr 25 19:30:33 UTC 2017
Only save the config when using a generated UUID if we were able to
create an object for the def. There could have been "other reasons"
for the assignment to fail, so saving the config could be incorrect.
Signed-off-by: John Ferlan <jferlan at redhat.com>
---
src/conf/virnwfilterobj.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index c1d2042..8c9da13 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -501,14 +501,14 @@ virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters,
goto error;
}
+ if (!(obj = virNWFilterObjListAssignDef(nwfilters, def)))
+ goto error;
+
/* We generated a UUID, make it permanent by saving the config to disk */
if (!def->uuid_specified &&
virNWFilterSaveConfig(configDir, def) < 0)
goto error;
- if (!(obj = virNWFilterObjListAssignDef(nwfilters, def)))
- goto error;
-
VIR_FREE(configFile);
return obj;
--
2.9.3
More information about the libvir-list
mailing list