Ask Your Question
0

List servers - Instance's json

asked 2018-08-07 09:57:29 -0600

Darth-OpenStack gravatar image

updated 2018-08-07 10:58:35 -0600

Hello to everyone , as we know Openstack's Compute API only supports JSON request and response formats and in my network topology i have 2 instances beta_vm1 and beta_vm2. My goal here is to list(find) their specs or some of their info in json format, i dont want just to see the result of the search :

 openstack server list

The thing that i want is the json file of each vm , or at least the path to the json files cause i want to use their information for my python script.

Thank you in advance !

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-08-07 10:18:34 -0600

updated 2018-08-07 10:22:17 -0600

Try openstack server show beta_vm1 -f json. Or for all instances:

for s in $(openstack server list -c ID -f value)
do
    openstack server show $s -f json
done

Or use the OpenStack SDK or the API.

I am not aware of any filesystem file that stores server details.

edit flag offensive delete link more

Comments

Really thank you Bernd, one more question cause im a little new with python utilization for openstack. The code lines for all instances need to be in a .py file without importing something?

Darth-OpenStack gravatar imageDarth-OpenStack ( 2018-08-07 12:53:53 -0600 )edit

I already have source the credentials from the rc file and create a python env as the link say (https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04 (https://www.digitalocean.com/communit...)) but gives me error all the time.

Darth-OpenStack gravatar imageDarth-OpenStack ( 2018-08-07 12:55:26 -0600 )edit
1

One or more .py files, and you canimport modules. A primer for writing application code based on OpenStack: https://developer.openstack.org/first....

You could share your code and error messages on this site.

Bernd Bausch gravatar imageBernd Bausch ( 2018-08-07 17:01:12 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2018-08-07 09:57:29 -0600

Seen: 74 times

Last updated: Aug 07