On Wed, Oct 30, 2013 at 05:00:40PM +0100, Ján Tomko wrote:
On 10/30/2013 04:24 PM, Daniel P. Berrange wrote:
> On Wed, Oct 30, 2013 at 04:20:10PM +0100, Ján Tomko wrote:
>> If the port range is full, virPortAllocatorAcquire will
>> return 0 and set the port to 0, leaving the error reporting
>> to the caller.
>>
>> This didn't happen when allocating ports for QEMU's VNC (introduced
>> along with the virPortAllocator in dfb1022), VNC WebSockets and
>> NBD migration (introduced with these features in f1ad8d2 and 86d90b3)
>> ---
>> src/qemu/qemu_migration.c | 14 ++++++++++----
>> src/qemu/qemu_process.c | 10 ++++++++++
>> 2 files changed, 20 insertions(+), 4 deletions(-)
>>
>
> AFAIK, all callers have to report an error message if port == 0. As we
> see from these missing error reports, this is fragile. Lets just make
> virPortAllocatorAcquire() return -1 if the ports are exhausted and
> report an error itself. This removes the chance that the caller will
> forget.
It will also remove the specific error message. It might be helpful to tell
the user which port range is exhausted.
Could you pass the "name" into the constructor of virPortAllocator
object, so it is available when reporting errors ?
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|