Re: [PATCHv4 2/3] openvswitch: Add utility functions for getting and setting Open vSwitch per-port data

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

 



On 23.10.2012 14:07, Michal Privoznik wrote:
> On 22.10.2012 23:30, Laine Stump wrote:
>> From: Kyle Mestery <kmestery@xxxxxxxxx>

>> +/**
>> + * virNetDevOpenvswitchSetMigrateData:
>> + * @migrate: the data which was transferred during migration
>> + * @ifname: the name of the interface the data is associated with
>> + *
>> + * Repopulates OVS per-port data on destination host
>> + *
>> + * Returns 0 in case of success or -1 in case of failure
>> + */
>> +int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname)
>> +{
>> +    virCommandPtr cmd = NULL;
>> +    int ret = 0;
>> +    virBufferPtr buf;
>> +
>> +    if (VIR_ALLOC(buf) < 0) {
>> +        ret = -1;
>> +        goto error;
>> +    }
> 
> I think we miss virReportOOMError() in here.
> 
>> +
>> +    virBufferAsprintf(buf, "external_ids:PortData=%s", migrate);
> 
> 
>> +
>> +    cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "set", "Interface", ifname,
>> +                               virBufferCurrentContent(buf), NULL);
> 
> Again, if we ran OOM virBuffer* will return NULL. It should be checked.

Now that I am re-thinking this again, virBuffer is a bit overkill. What
about bare virAsprintf()?

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