[libvirt] [PATCH 2/2] network: better log message when network is inactive during reconnect

John Ferlan jferlan at redhat.com
Wed Apr 26 18:39:21 UTC 2017



On 04/25/2017 12:34 PM, Laine Stump wrote:
> If the network isn't active during networkNotifyActualDevice(), we
> would log an error message stating that the bridge device didn't
> exist. This patch adds a check to see if the network is active, making
> the logs more useful in the case that it isn't.
> 
> Partially resolves: https://bugzilla.redhat.com/1442700
> ---
>  src/network/bridge_driver.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index d2d8557..e06f81b 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -4676,6 +4676,13 @@ networkNotifyActualDevice(virDomainDefPtr dom,
>      }
>      netdef = network->def;
>  
> +    if (!virNetworkObjIsActive(network)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       _("network '%s' is not active"),
> +                       netdef->name);
> +        goto error;
> +    }
> +

/me wonders whether this should just a goto cleanup - IOW: if the
network isn't active, so what, why error. Once someone attempts to start
it, they'll get errors I assume...

Not that goto error or cleanup matters since commit id '4fee4e0' changed
the goto cleanup to goto error and added:

+
+error:
+    goto cleanup;

I guess I don't have the answer readily available in my head as to how
much of the subsequent code would be called at network start time?

John

>      /* if we're restarting libvirtd after an upgrade from a version
>       * that didn't save bridge name in actualNetDef for
>       * actualType==network, we need to copy it in so that it will be
> 




More information about the libvir-list mailing list