[PATCH 1/8] network: Do not update network ports for inactive networks

Martin Kletzander posted 8 patches 1 month, 1 week ago
[PATCH 1/8] network: Do not update network ports for inactive networks
Posted by Martin Kletzander 1 month, 1 week ago
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>
---
 src/network/bridge_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 915211d1b590..5b510a222cd2 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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)) {
-- 
2.46.0
Re: [PATCH 1/8] network: Do not update network ports for inactive networks
Posted by Laine Stump 4 weeks, 1 day ago
On 9/3/24 10:36 AM, Martin Kletzander wrote:
> 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.
> 

(which normally wouldn't happen, *except* when a network's bridge device 
has disappeared causing us to mark the network inactive *during* 
networkUpdate state. Yep.)

> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>

Reviewed-by: Laine Stump <laine@redhat.com>

> ---
>   src/network/bridge_driver.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 915211d1b590..5b510a222cd2 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -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)) {