diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 544a65078aa955de4a055f5ada21ea3edc669c56..3f90f65d1fbe4f45c119fa5f89817e77e457bc9c 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2658,6 +2658,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) } uuid = virXPathString("string(./uuid)", ctxt); + ret->uuid_specified = (uuid != NULL); if (uuid == NULL) { if (virUUIDGenerate(ret->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3178,6 +3179,11 @@ virNWFilterLoadConfig(virNWFilterObjListPtr nwfilters, 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 (!(nwfilter = virNWFilterObjAssignDef(nwfilters, def))) goto error; diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h index 823cfa430d00998dcbd3c001c65e2b1d74666fe7..ea3cd5cd74360982cd0225adf324f424f0112311 100644 --- a/src/conf/nwfilter_conf.h +++ b/src/conf/nwfilter_conf.h @@ -536,6 +536,7 @@ typedef virNWFilterDef *virNWFilterDefPtr; struct _virNWFilterDef { char *name; unsigned char uuid[VIR_UUID_BUFLEN]; + bool uuid_specified; char *chainsuffix; virNWFilterChainPriority chainPriority;