On 09/16/2015 08:13 AM, Daniel P. Berrange wrote:
> On Wed, Sep 16, 2015 at 08:08:35AM -0600, Eric Blake wrote:
>> On 09/16/2015 07:52 AM, Daniel P. Berrange wrote:
>>> The qemu-nbd program currently uses a QemuOpts objects
>>> when setting up sockets. Switch it over to use the
>>> QAPI SocketAddress objects instead.
>>>

>>> +        if (port) {
>>> +            saddr->inet->port = g_strdup(port);
>>> +        } else  {
>>> +            saddr->inet->port = g_strdup_printf("%d", NBD_DEFAULT_PORT);
>>
>> The qapi type is gross for requiring port as a string. But we have plans
>> to clean that up, not a showstopper for this patch.
> 
> On the contrary - QAPI is correct in requiring this, as it lets you
> provide a service name (as defined in /etc/services) instead of a
> numeric port, and getaddrinfo() will look that up and convert to
> numeric format.

What it SHOULD be doing it taking an 'alternate' that allows both a
string (for getaddrinfo lookup) and an int (for direct port usage),
rather than overloading a string for both uses.  But as I said, that
should be a future cleanup, affecting more uses of the qapi type than
just this patch.

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to