简体   繁体   中英

How to get the VNC url from openstacksdk

As we know, the OpenStack provides the CLI to show the URL of the VNC console.

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.

The question is how I can use OpenStack Python SDK to get the URL of the VNC console of an instance?

If you run openstack --debug ... you will exactly what REST API requests the tool is making. 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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