libvirt: allow direct SPICE connections to qemu

This patch adds a new console type, "spice-direct", which provides
the connection information required to talk the native SPICE protocol
directly to qemu on the hypervisor. This is intended to be fronted
by a proxy which will handle authentication separately.

A new microversion is introduced which adds the type "spice-direct"
to the existing "spice" protocol.

An example request:

POST /servers/<uuid>/remote-consoles
{
  "remote_console": {
    "protocol": "spice",
    "type": "spice-direct"
  }
}

An example response:

{
  "remote_console": {
    "protocol": "spice",
    "type": "spice-direct",
    "url": "http://localhost:13200/nova?token=XXX";
  }
}

This token can then be used to lookup connection details for the
console using a request like this:

GET /os-console-auth-tokens/<consoletoken>

Which returns something like this:

{
  "console": {
    "instance_uuid": <uuid>,
    "host": <hypervisor>,
    "port": <a TCP port number>,
    "tls_port": <another TCP port number>,
    "internal_access_path": null
  }
}

APIImpact

Change-Id: I1e701cbabc0e2c435685e31465159eec09e3b1a0
This commit is contained in:
Michael Still
2025-02-22 08:25:38 +11:00
parent d8e95078cd
commit cbc263f6bc
25 changed files with 348 additions and 38 deletions
+9 -2
View File
@@ -5993,8 +5993,9 @@ remote_console_protocol:
remote_console_type:
description: |
The type of remote console. The valid values are ``novnc``,
``spice-html5``, ``serial``, and ``webmks``. The type
``webmks`` is added since Microversion ``2.8``.
``spice-html5``, ``spice-direct``, ``serial``, and ``webmks``. The type
``webmks`` was added in Microversion ``2.8``, and the type
``spice-direct`` was added in Microversion ``2.99``.
in: body
required: true
type: string
@@ -7102,6 +7103,12 @@ tenant_usages:
in: body
required: true
type: array
tls_port_number:
description: |
The port number of a port requiring a TLS connection.
in: body
required: false
type: integer
to_port:
description: |
The port at end of range.
@@ -40,6 +40,13 @@ Request
.. literalinclude:: ../../doc/api_samples/os-remote-consoles/v2.6/create-vnc-console-req.json
:language: javascript
**Example Get Remote spice-direct Console**
*``spice-direct`` consoles were added in microversion 2.99.*
.. literalinclude:: ../../doc/api_samples/os-remote-consoles/v2.99/create-spice-direct-console-req.json
:language: javascript
Response
--------
@@ -55,6 +62,12 @@ Response
.. literalinclude:: ../../doc/api_samples/os-remote-consoles/v2.6/create-vnc-console-resp.json
:language: javascript
**Example Get Remote spice-direct Console**
*``spice-direct`` consoles were added in microversion 2.99.*
.. literalinclude:: ../../doc/api_samples/os-remote-consoles/v2.99/create-spice-direct-console-resp.json
:language: javascript
Show Console Connection Information
===================================
@@ -90,9 +103,17 @@ Response
- instance_uuid: instance_id_body
- host: console_host
- port: port_number
- tls_port: tls_port_number
- internal_access_path: internal_access_path
**Example Show Console Authentication Token**
.. literalinclude:: ../../doc/api_samples/os-console-auth-tokens/v2.31/get-console-connect-info-get-resp.json
:language: javascript
**Example Console Connection Information for a spice-direct Console**
*``spice-direct`` consoles were added in microversion 2.99.*
.. literalinclude:: ../../doc/api_samples/os-console-auth-tokens/v2.99/get-console-connect-info-get-resp.json
:language: javascript