Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1383342 - [RFE] API ticket support in graphics devices
[RFE] API ticket support in graphics devices
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
4.0.3
Unspecified Unspecified
unspecified Severity high (vote)
: ovirt-4.1.0-alpha
: 4.1.0.2
Assigned To: Martin Betak
Israel Pinto
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-10 08:45 EDT by Filip Krepinsky
Modified: 2017-02-06 03:08 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
This feature allows you to request a console ticket for a specific graphics device via the REST API. The existing endpoint, /api/vms/{vmId}/ticket, defaulted to SPICE in scenarios when SPICE+VNC was configured as the graphics protocol, making it impossible to request a VNC ticket. Now, a ticket action has been added to the /api/vms/{vmId}/graphicsconsoles/{consoleId} resource, making it possible to request a ticket for a specific console. This specific endpoint is now preferred, and the pre-existing per-VM endpoint is considered deprecated.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-02-01 09:38:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
michal.skrivanek: ovirt‑4.1?
ipinto: testing_plan_complete+
rule-engine: planning_ack?
michal.skrivanek: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)
vdsm.log (838 bytes, text/plain)
2016-10-10 08:45 EDT, Filip Krepinsky
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 67143 None None None 2016-11-23 05:16 EST
oVirt gerrit 67174 None None None 2016-11-23 05:17 EST

  None (edit)
Description Filip Krepinsky 2016-10-10 08:45:51 EDT
Created attachment 1208863 [details]
vdsm.log

Description of problem:
It is not possible to connect to VNC with /api/vms/{vmId}/ticket if VNC + SPICE is enabled.

It works if we set vm's console protocols to standalone VNC.
It also works if we setup VNC + SPICE and connect with a password from vv file.

Version-Release number of selected component (if applicable):
4.0.0 and 4.0.3

Steps to Reproduce:
1. set vm's console protocols to VNC + SPICE
2. get vv file for VNC
3. get /api/vms/{vmId}/ticket
4. rewrite vv file's password with the ticket
5. connect 

Actual results:
Authentication failed
Comment 1 Juan Hernández 2016-10-11 08:03:01 EDT
This should probably work, but I wonder why do you need to replace the password that is inside the .vv file? I'd suggest to avoid doing that.
Comment 2 Michal Skrivanek 2016-10-12 06:04:44 EDT
Filipe, I also do not quite understand what are you trying to do and what exactly fails. Can you please add a bit more details?
Comment 3 Michal Skrivanek 2016-10-12 07:32:24 EDT
after offline discussion we want to add a proper ticketing support for multiple graphics
The current vms/<id>/ticket is a legacy one always preferring SPICE. It should be made obsolete in favor of this new per-graphics API
Comment 4 Filip Krepinsky 2016-10-12 08:05:52 EDT
(In reply to Juan Hernández from comment #1)
> This should probably work, but I wonder why do you need to replace the
> password that is inside the .vv file? I'd suggest to avoid doing that.

I made an secondary example with .vv file, but in our use case in moVirt we are not using it. We are just getting the ticket + separately console's address and port from the API. I think the problem should be the same.
Comment 5 Juan Hernández 2016-10-12 12:47:09 EDT
OK, please make sure to document this behaviour in the sepcification of the existing "ticket" operation. I mean here:

  https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/VmService.java#L657-L690

It should contain something like this:

  /**
   * ...
   *
   * [IMPORTANT]
   * ====
   * If the virtual machine is configured to support only one graphics protocol
   * then the generated authentication token will be valid for that protocol.
   * But if the virtual machine is configured to support multiple protocols,
   * VNC and SPICE, then the authentication token will only be valid for
   * the SPICE protocol.
   *
   * In order to obtain an authentication token for a specific protocol, for
   * example for VNC, use the `ticket` method of the <<services/graphics_console,
   * service>> that manages the graphics consoles of the virtual machine, sending
   * a request like this:
   *
   * ....
   * POST /ovirt-engine/api/vms/123/graphicsconsoles/564E43/ticket
   * ....
   * ====
   */
  interface Ticket {
    ...
  }

This is assuming that we will add an "ticket" method to the graphics console service:

  https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/GraphicsConsoleService.java

This new method should, if possible, behave like the existing "ticket" method, but should return authentication tokens valid for the specific protocol.

This is my understanding, please feel free to correct me.
Comment 6 Sandro Bonazzola 2016-12-12 08:57:26 EST
The fix for this issue should be included in oVirt 4.1.0 beta 1 released on December 1st. If not included please move back to modified.
Comment 7 Israel Pinto 2017-01-11 08:54:14 EST
Verify: 
Engine:
oVirt Engine Version: 4.2.0-0.0.master.20170104114928.git5490b36.el7.centos
Host:
OS Version:RHEL - 7.3 - 7.el7
Kernel Version:3.10.0 - 514.el7.bug1404060_20.x86_64
KVM Version:2.6.0 - 28.el7_3.3
LIBVIRT Version:libvirt-2.0.0-10.el7_3.2
VDSM Version:vdsm-4.20.0-128.git7001c0a.el7.centos
SPICE Version:0.12.4 - 19.el7

Steps:
1. Create VM and set the console option to: VNS + SPICE 
2. Run VM and connect to VNC session 
3. Via REST send POST request:
    https://{engine FQDN}/ovirt-engine/api/vms/{VM-id}/graphicsconsoles/{consoleId}/ticket 
    with empty action: <action/>
    expect response returns the ticket info:
    <action>
    <ticket>
        <expiry>{int value}</expiry>
        <value>{string value}</value>
    </ticket>
    </action>
4. Retest with SPICE session.

Results:
In spice and vnc the ticket info (expiry and value) returns.

Note You need to log in before you can comment on or make changes to this bug.