On Jan 21, 2014, at 13:15 , Juan Hernandez <jhernand(a)redhat.com> wrote:
On 01/21/2014 12:22 PM, Michal Skrivanek wrote:
>
> On Jan 21, 2014, at 11:48 , Sven Kieske <S.Kieske(a)mittwald.de> wrote:
>
>> Hi,
>>
>> we are quite impressed of the novnc console
>> option to get access to the vms.
>>
>> however, we want to implement our own
>> userportal. So is it possible
>> to create the novnc ticket / open a vnc
>> session with the vm event via REST-API?
>>
>> If yes how?
>
> setting the ticket is a VM's action "ticket"
> after that you can spawn your client and connect to the desired host/port you get
from VM display's address, secureport
>
> Thanks,
> michal
>
>>
>> If not, how could this be achieved?
>>
To get the ticket for the VNC display you need to do the following:
curl \
-k \
-X POST \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d "
<action/>
" \
-u admin@internal:****** \
https://whatever/api/vms/your_vm_id/ticket
That will return something like this:
<action>
<ticket>
<value>IKWW7PpFZhjP</value>
<expiry>7200</expiry>
</ticket>
<vm href="..." id="...">
...
</vm>
<status>
<state>complete</state>
</status>
</action>
The ticket.value is the password for the VNC display. To connect to the
display you will need also to get the host and port number from the VM
details:
curl \
-k \
-H "Accept: application/xml" \
-u admin@internal:****** \
https://whatever/api/vms/your_vm_id
This will return the following:
<vm href="..." id="...">
...
<display>
<type>vnc</type>
<address>192.168.122.20</address>
<port>5900</port>
...
</display>
...
</vm>
The the ticket.value, vm.display.address and vm.display.port you can
complete the VNC connection.
minor note: the secure port is the one to be used as by default the host will refuse the
plaintext connection
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.