6.268.3. remoteviewerconnectionfile POST
生成与 remote-viewer 客户端兼容的 文件。
使用以下请求为图形控制台生成远程查看器连接文件:请注意,只有在虚拟机正在运行时,此操作才会生成 文件。
POST /ovirt-engine/api/vms/123/graphicsconsoles/456/remoteviewerconnectionfile
remoteviewerconnectionfile 操作不执行任何特定于操作的参数,因此请求正文应包含空 操作 :
<action/>
响应中包含 文件,可用于 remote-viewer 客户端。
<action>
<remote_viewer_connection_file>
[virt-viewer]
type=spice
host=192.168.1.101
port=-1
password=123456789
delete-this-file=1
fullscreen=0
toggle-fullscreen=shift+f11
release-cursor=shift+f12
secure-attention=ctrl+alt+end
tls-port=5900
enable-smartcard=0
enable-usb-autoshare=0
usb-filter=null
tls-ciphers=DEFAULT
host-subject=O=local,CN=example.com
ca=...
</remote_viewer_connection_file>
</action>
例如,要获取远程查看器连接文件的内容并将其保存到临时文件中,用户可以按如下方式使用 oVirt Python SDK:
# Find the virtual machine:
vm = vms_service.list(search='name=myvm')[0]
# Locate the service that manages the virtual machine, as that is where
# the locators are defined:
vm_service = vms_service.vm_service(vm.id)
# Find the graphic console of the virtual machine:
graphics_consoles_service = vm_service.graphics_consoles_service()
graphics_console = graphics_consoles_service.list()[0]
# Generate the remote viewer connection file:
console_service = graphics_consoles_service.console_service(graphics_console.id)
remote_viewer_connection_file = console_service.remote_viewer_connection_file()
# Write the content to file "/tmp/remote_viewer_connection_file.vv"
path = "/tmp/remote_viewer_connection_file.vv"
with open(path, "w") as f:
f.write(remote_viewer_connection_file)
当您创建远程 viewer 连接文件时,您可以连接到虚拟机图形控制台,如下所示:
#!/bin/sh -ex
remote-viewer --ovirt-ca-file=/etc/pki/ovirt-engine/ca.pem /tmp/remote_viewer_connection_file.vv
| 名称 | 类型 | 方向 | 概述 |
|---|---|---|---|
|
| out |
包含与 |
6.268.3.1. remote_viewer_connection_file 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
包含与 remote-viewer 客户端兼容的 文件。
用户可以使用此属性的内容创建 文件,该文件可以传递到 remote-viewer 客户端以连接到虚拟机图形控制台。