Console Access Through API


#1

Is there a way to access the remote console of a VM without having access to the ManageIQ console (possibly through the API or a link etc).

We are looking to give users console access but without access to the ManageIQ console and are looking for ways of doing this.

Matt


#2

This is interesting. @martin_povolny How do we get the console? Is it just a URL? Is this something we could expose via the REST API? cc @abellotti


#3

@Fryguy: we need to expose those calls in the API.


#4

@martinpovolny @abellotti Please put this on your TODO list.


#5

@martinpovolny what are we exposing ? are these URLs or something else ?
If URLs, we can alway go through the API for authentication (or not) via something like /api/vms/:id/console and response with a redirect. If it’s something else we’ll need further investigation.


#6

I am interested in this feature; can I get an update on the progress of this RFE?


#7

This should now be exposed, on /api/vm/:id, with the request_console action…

If you’re interested in how to actually use it, ManageIQ/manageiq-ui-self_service#39 is using that functionality to expose consoles in the Self Service UI.


#8

@himdel

I’m still not clear about the usage. Here’s what I did,

  1. Created task

    POST /api/vms/58000000000240/ -d '{"action": "request_console", "resource": {"protocol": "vnc"}}'
    

    Response:

    {"success":true,"message":"VM id:58000000000240 name:'psachin-cpu-8' requesting console","task_id":58000000001232,"task_href":"https://cfme/api/tasks/58000000001232","href":"https://cfme/api/vms/58000000000240"}
    
  2. Retrive task’s result

    GET /api/tasks/58000000001232
    

    Response:

    {"href":"https://cfme/api/tasks/58000000001232","id":58000000001232,"name":"VM id:58000000000240 name:'psachin-cpu-8' requesting console","state":"Finished","status":"Ok","message":"Task completed successfully","userid":"admin","created_on":"2017-07-27T11:34:07Z","updated_on":"2017-07-27T11:34:09Z"}
    

What are values of results.url, & results.secret you are referring to in function OpenVnc() and/or OpenSpice()?


#9

GET /api/tasks/58000000001232

@psachin, you also need ?attributes=task_results

(Code ref)


#10

Wonderful!!

GET /api/tasks/58000000001232?attributes=task_results

Response:

{"href":"https://cfme/api/tasks/58000000001232","id":58000000001232,"name":"VM id:58000000000240 name:'psachin-cpu-8' requesting console","state":"Finished","status":"Ok","message":"Task completed successfully","userid":"admin","created_on":"2017-07-27T11:34:07Z","updated_on":"2017-07-27T11:34:09Z","task_results":{"url":"ws/console/389be6075288d237d09c5543a1b96e65","secret":"oJDiBeBS","proto":"vnc"}}

Console (https)URL:

/bower_components/no-vnc/vnc_auto.html' + host + port + url + secret + true_color=1 + encrypt=1

https://cfme/bower_components/no-vnc/vnc_auto.html?host=cfme&port=3000&path=ws/console/389be6075288d237d09c5543a1b96e65&password=oJDiBeBS&true_color=1&encrypt=1