[Users] novnc console button/ticket via REST-API?

Juan Hernandez jhernand at redhat.com
Tue Jan 21 12:15:26 UTC 2014


On 01/21/2014 12:22 PM, Michal Skrivanek wrote:
> 
> On Jan 21, 2014, at 11:48 , Sven Kieske <S.Kieske at 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 at 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 at 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.

-- 
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.



More information about the Users mailing list