Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/virnetworkobj.c | 1 +
src/network/bridge_driver.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index ae26f6fab1..ce39ab5250 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -846,6 +846,7 @@ virNetworkObjSaveStatus(const char *statusDir,
int flags = 0;
g_autofree char *xml = NULL;
+ VIR_DEBUG("Writing network status to disk");
if (!(xml = virNetworkObjFormat(obj, xmlopt, flags)))
return -1;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 9f876d7418..1b831f9a36 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1687,6 +1687,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj,
g_autoptr(virNetworkDriverConfig) cfg =
virNetworkDriverGetConfig(networkGetDriver());
VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
virNetworkDef *def = virNetworkObjGetDef(obj);
+ bool saveStatus = false;
if (virNetworkObjIsActive(obj)) {
switch ((virNetworkForwardType) def->forward.type) {
@@ -1702,6 +1703,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj,
ignore_value(networkAddFirewallRules(def,
virNetworkObjGetFwRemovalPtr(obj),
cfg->firewallBackend));
+ saveStatus = true;
break;
case VIR_NETWORK_FORWARD_OPEN:
@@ -1719,6 +1721,11 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj,
}
}
+ if (saveStatus) {
+ ignore_value(virNetworkObjSaveStatus(cfg->stateDir, obj,
+ network_driver->xmlopt));
+ }
+
return 0;
}
@@ -2336,7 +2343,6 @@ networkStartNetwork(virNetworkDriverState *driver,
/* Persist the live configuration now that anything autogenerated
* is setup.
*/
- VIR_DEBUG("Writing network status to disk");
if (virNetworkObjSaveStatus(cfg->stateDir,
obj, network_driver->xmlopt) < 0)
goto cleanup;
--
2.39.2