network: Do not update network ports for inactive networks

The semantic does not change since inside networkUpdatePort() (well,
networkNotifyPort, for which the former is a wrapper) exits for inactive
networks, but with an error we can easily avoid with this patch.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Martin Kletzander 2024-09-03 10:34:55 +02:00
parent 02b57caf5e
commit 97ed0574ea

View File

@ -489,7 +489,8 @@ networkUpdateState(virNetworkObj *obj,
return -1;
}
virNetworkObjPortForEach(obj, networkUpdatePort, obj);
if (virNetworkObjIsActive(obj))
virNetworkObjPortForEach(obj, networkUpdatePort, obj);
/* Try and read dnsmasq pids of active networks */
if (virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) {