[libvirt] [PATCH 1/3] vz: support type=bridge network interface type correctly

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Wed Sep 7 11:00:32 UTC 2016



On 05.09.2016 19:39, Maxim Nestratov wrote:
> Recently, libprlsdk got a separate flag PNA_BRIDGE corresponding to
> type=bridge libvirt network interfaces. Let's use it and get rid of
> all workarounds previously added to  support it.
> 
> Signed-off-by: Maxim Nestratov <mnestratov at virtuozzo.com>
> ---
>  src/vz/vz_sdk.c | 100 ++++++++------------------------------------------------
>  1 file changed, 14 insertions(+), 86 deletions(-)
> 
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index f2a5c96..933b222 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -1004,27 +1004,19 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool isCt)
>                         PARALLELS_DOMAIN_ROUTED_NETWORK_NAME) < 0)
>              goto cleanup;
>      } else {
> -        char *netid = NULL;
> -
> -        if (!(netid =
> +        char *netid =
>                prlsdkGetStringParamVar(PrlVmDevNet_GetVirtualNetworkId,
> -                                      netAdapter)))
> -            goto cleanup;
> +                                      netAdapter);
>  
> -        /*
> -         * We use VIR_DOMAIN_NET_TYPE_NETWORK for all network adapters
> -         * except those whose Virtual Network Id differ from Parallels
> -         * predefined ones such as PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME
> -         * and PARALLELS_DONAIN_ROUTED_NETWORK_NAME
> -         */
> -        if (STRNEQ(netid, PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME)) {
> +        if (emulatedType == PNA_BRIDGE) {
>              net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
> -            net->data.network.name = netid;
> +            if (netid)
> +                net->data.bridge.brname = netid;
>          } else {
>              net->type = VIR_DOMAIN_NET_TYPE_NETWORK;
> -            net->data.bridge.brname = netid;
> +            if (netid)
> +                net->data.network.name = netid;

not sure why check for not NULL here and above,

1.) now i see my mistake introduced in 3a82c04c, setting net->data need to be swapped)

>          }
> -

here is my usual pedantic comment

>      }
>  
>      if (!isCt) {

[snip]




More information about the libvir-list mailing list