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

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Mon Oct 24 06:46:15 UTC 2016



On 21.10.2016 18:20, Maxim Nestratov wrote:
> 07-Sep-16 14:00, Nikolay Shirokovskiy пишет:
> 
>>
>> 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,
> 
> Assuming that I fix this and below, I have your ACK on the first two patches, right?
> 
> Maxim

Yes. 

I just realized you removed NULL check on PrlVmDevNet_GetVirtualNetworkId. NULL is not a error case?

Nikolay




More information about the libvir-list mailing list