Re: [PATCH 1/3] util: new function virNetDevOpenvswitchInterfaceGetMaster()

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

 



On 07/02/2018 02:11 AM, Michal Prívozník wrote:
> On 07/02/2018 01:46 AM, Laine Stump wrote:
>> +    virNetDevOpenvswitchAddTimeout(cmd);
>> +    virCommandAddArgList(cmd, "iface-to-br", ifname, NULL);
>> +    virCommandSetOutputBuffer(cmd, master);
>> +
>> +    if (virCommandRun(cmd, &exitstatus) < 0) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                       _("Unable to run command to get OVS master for "
>> +                         "interface %s"), ifname);
>> +        goto cleanup;
>> +    }
>> +
>> +    /* non-0 exit code just means that the interface has no master in OVS */
>> +    if (exitstatus != 0)
>> +        VIR_FREE(*master);
> A-ha! We indeed need to do this. I was under impression that just like
> other functions of ours if they fail no allocation is done. But this is
> different so we need to call VIR_FREE().

Right. If ovs-vsctl is run and returns non-0, there still might have
been some sort of output to stdout (or there might not have been, but I
don't want to rely on it).

--
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]

  Powered by Linux