[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v1 2/2] qemu-nbd: convert to use th
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v1 2/2] qemu-nbd: convert to use the QAPI SocketAddress object |
Date: |
Wed, 16 Sep 2015 08:24:39 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
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
signature.asc
Description: OpenPGP digital signature