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

Eric Blake eblake at redhat.com
Tue Oct 23 14:56:56 UTC 2012


On 10/23/2012 06:15 AM, Michal Privoznik wrote:
>>> +    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()?

virAsprintf() would require a temporary variable.  Easiest would be:

cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "set", "Interface",
ifname, NULL);
virCommandAddArgFormat(cmd, "external_ids:PortData=%s", migrate);

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121023/69ddbeee/attachment-0001.sig>


More information about the libvir-list mailing list