Ask Your Question

Get OS type from vms, possibly with python connecting to vm console?

asked 2018-09-13 10:09:01 -0500

frantisek gravatar image

Most of my console.log files are empty (due to migrations) and I need to find out if vms are win or Linux. There is a lot of vms so I need to do it with python3 script. The only idea that came to me is to get a console message, something like Ubuntu 16.04.3 LTS server_name tty1 server_name login: that you would normally see on server console before authentication. I can get console url of server with nova.servers.get_vnc_console('<server_id>', 'novnc'). I thought that I will be able to connect with websocket-client but no luck so far (CERT_NONE in websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) seems not to apply, I get ValueError: empty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIRED). Has someone an idea how can I talk Python3 to vm console? Or is there a better way how to find out if server is running win/lin?

edit retag flag offensive close merge delete


You could look at the image or volume from which they were launched.

Bernd Bausch gravatar imageBernd Bausch ( 2018-09-21 05:00:18 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2018-09-21 08:08:22 -0500

frantisek gravatar image

I was informed that it is possible to get root volume type with parted for local disks and with rbd-nbd and parted for ceph volumes. Too bad script has to be run on hypervisors, it seems there is no API way (volume or image can be named regardless os).

edit flag offensive delete link more


There is no API for that. I think the philosophy is that OpenStack doesn't care what happens inside an instance. It manages instances, but not their content.

You should know the OS of an image. You could add metadata or tags when you create images.

Bernd Bausch gravatar imageBernd Bausch ( 2018-09-26 17:42:11 -0500 )edit

Sorry, but that is just you being lazy to think out of box.

frantisek gravatar imagefrantisek ( 2018-09-27 04:05:45 -0500 )edit

I didn’t create the API, and you are rude.

Bernd Bausch gravatar imageBernd Bausch ( 2018-09-27 06:36:51 -0500 )edit

I don't think "lazy to think out of box" qualifies as being rude, however if I hurt your feelings then please accept my appologies. Saying that there is philosophy that makes my question obsolete - well, why do you answer question if you don't want to think about it?

frantisek gravatar imagefrantisek ( 2018-09-27 08:45:43 -0500 )edit

I thought about it and shared the idea to solve your problem by looking at images. I informed you that there is no API, thought about the probable reason and shared that. That’s the kind of things people do when they discuss questions. I like to share my thoughts, that’s why I answered.

Bernd Bausch gravatar imageBernd Bausch ( 2018-09-27 09:16:57 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2018-09-13 10:09:01 -0500

Seen: 145 times

Last updated: Sep 21 '18