[libvirt] [PATCH 1/2 v3] Fix virDomainChrDefParseTargetXML() to parse the target port if available

Michal Novotny minovotn at redhat.com
Mon Feb 21 16:05:46 UTC 2011


On 02/21/2011 05:01 PM, Eric Blake wrote:
> On 02/21/2011 02:38 AM, Michal Novotny wrote:
>> [snip]
>>> We've got other code in domain_conf.c that assigns ports
>>> to the first available slot; for example, look near line 5628 at how
>>> virtio-serial ports are assigned using maxport and traversal of all
>>> previously assigned ports.
>>>
>> Is the code correct there?
>>
>> The code is:
>>
>>          if (chr->info.type ==
>> VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL&&
>>              chr->info.addr.vioserial.port == 0) {
>>              int maxport = 0;
> virtio-serial has to start at port 1 (not 0, which is reserved), so
> maxport starts at 0...
>
>>              chr->info.addr.vioserial.port = maxport + 1;
> and the assignment guarantees 1 or greater.  But serial and parallel
> support port 0, so start maxport at -1  instead of 0, to reuse the same
> logic.
>
Oh, ok, I was thinking whether it's a bug in virtio driver or not. 
Thanks for clarification it has to start at 1 :)

Thanks,
Michal

-- 
Michal Novotny<minovotn at redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat




More information about the libvir-list mailing list