简体   繁体   English

如何从openstacksdk获取VNC URL

[英]How to get the VNC url from openstacksdk

As we know, the OpenStack provides the CLI to show the URL of the VNC console. 众所周知,OpenStack提供了CLI以显示VNC控制台的URL。

For example: 例如:

openstack console url show instance_name

Currently, I want to access the console via OpenStack Python SDK but I can't find any APIs to do it. 目前,我想通过OpenStack Python SDK访问控制台,但是找不到任何API可以做到这一点。

The question is how I can use OpenStack Python SDK to get the URL of the VNC console of an instance? 问题是如何使用OpenStack Python SDK获取实例的VNC控制台的URL?

If you run openstack --debug ... you will exactly what REST API requests the tool is making. 如果您运行openstack --debug ...您将确切知道该工具正在执行的REST API。 You can also check the api reference , which for recent versions of Nova suggests that you should use the server remote consoles api (and also describes deprecated APIs available in earlier releases). 您还可以查看api参考 ,对于Nova的最新版本,该参考建议您应该使用服务器远程控制台 api(并且还描述了早期版本中已弃用的API)。

If you're using the Python SDK, a simple search of the code reveals that server objects have a get_vnc_console method that will do what you want. 如果您使用的是Python SDK,则对代码的简单搜索就会显示服务器对象具有可实现所需功能的get_vnc_console方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM