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

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



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

>> +/**
>> + * 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()?


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