[one-users] Xen driver and automatic VNC port generation

Tiago Batista tiagosbatista at gmail.com
Fri Oct 8 03:30:55 PDT 2010


It does work as long as it is opennebula generating the port numbers
(with 5900 as the base) and it does work for static port assignments:

the template

GRAPHICS =[type="vnc", passwd="qwerty", port="5900"]

translates to "vncdisplay=0" that is translated by xen back to 5900...

and the template

GRAPHICS =[type="vnc", passwd="qwerty"]

translates to "vncdisplay=vmId" that is translated by xen back to
5900+vmid as intended

The current code translates port 5900 to vncdisplay 5900, xen then
adds another 5900, ending up listening on port 11800 while openebula
claims the port to be 5900! So, I am just offsetting the 5900 that is
going to be added by xen on the next step!

What is the situation where opennebula is not the generator of the
port number? I have tested it successfully with and without port
numbers on the template, and I think of no usecase where this fails as
long as VNC_BASE_PORT=5900...

Tiago




On Thu, Oct 7, 2010 at 10:51 PM, Ruben S. Montero <rubensm at dacya.ucm.es> wrote:
>
> Hi
> Yes this is a Xen specific bug. vncdisplay sets the port by adding 5900. That is already done by OpenNebula (e.g. to use it with KVM).
> So your solution seems fine for the port generation but, if the port is not generated by OpenNebula we will be substracting 5900...
> Thanks for the feedback!
> Ruben
> On Wed, Oct 6, 2010 at 5:17 PM, Tiago Batista <tiagosbatista at gmail.com> wrote:
>>
>> Hello all
>>
>> I am using Centos, and to be honnest I am not sure if this is platform specific, but the standard port generation code for xen does not work here (both 2.0 beta 1 and rc1)
>>
>> The following patch solves it but forces the base port in oned.conf to be set to 5900 if using the xen driver.
>>
>> I rememmber reading somewhere that the port number is 5900 + vnc  display number... In this case I used the generated port number to calculate the display number, but given that the port number is calculated from the VM id, I expect that there should be a cleaner way to do this!
>>
>> Anyway.... This solves my problem!
>>
>>
>> --- one-2.0-beta1/src/vmm/XenDriver.cc    2010-07-27 15:34:04.000000000 +0100
>> +++ one-2.0-beta1_mod/src/vmm/XenDriver.cc    2010-09-21 10:07:32.000000000 +0100
>> @@ -364,12 +364,10 @@
>>                  {
>>                      file << ",vnclisten=" << listen;
>>                  }
>> -
>>                  if ( !port.empty() )
>>                  {
>> -                    file << ",vncdisplay=" << port;
>> +                    file << ",vncdisplay=" << (atoi(port.c_str())-5900);
>>                  }
>> -
>>                  if ( !passwd.empty() )
>>                  {
>>                      file << ",vncpasswd=" << passwd;
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>
>
>
> --
> Dr. Ruben Santiago Montero
> Associate Professor (Profesor Titular), Complutense University of Madrid
>
> URL: http://dsa-research.org/doku.php?id=people:ruben
> Weblog: http://blog.dsa-research.org/?author=7



More information about the Users mailing list