Re: [PATCH v4 2/2] network_conf: check if bridge exists on host for user created bridges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 25, 2015 at 07:35:12PM +0530, Shivaprasad G Bhat wrote:
> virNetworkBridgeInUse() doesn't check if the bridge is manually created
> outside of libvirt. Check if the bridge actually exist on host using the
> virNetDevExists().
> 
> Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>
> ---
>  src/conf/network_conf.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index b334b64..8e9f3ac 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -3294,6 +3294,7 @@ int virNetworkBridgeInUse(virNetworkObjListPtr nets,
>                            const char *bridge,
>                            const char *skipname)
>  {
> +    int ret;
>      virNetworkObjPtr obj;
>      struct virNetworkBridgeInUseHelperData data = {bridge, skipname};
>  
> @@ -3301,7 +3302,12 @@ int virNetworkBridgeInUse(virNetworkObjListPtr nets,
>      obj = virHashSearch(nets->objs, virNetworkBridgeInUseHelper, &data);
>      virObjectUnlock(nets);
>  
> -    return obj != NULL;
> +    if (obj)
> +        ret = 1;
> +    else /* Bridge might have been created by a user manually outside libvirt */
> +        ret = virNetDevExists(bridge) ? 1 : 0;

I don't think we should parse the network differently based on the host
state. The existing check only looks at existing configs.

Can this be checked in networkValidate instead?

Jan

> +
> +    return ret;
>  }
>  
>  char *virNetworkAllocateBridge(virNetworkObjListPtr nets,
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]