Ask Your Question
0

Show (first) VM fixed IP only with OSC

asked 2020-02-07 06:10:59 -0600

panticz gravatar image

Is there a way to show only (possibly the first) fixed IP from a VM without having to parse those from the CLI output?

# openstack server show d82ca1de-1fcd-4ca6-84db-84891ec37796 -c addresses -f value | cut -d "=" -f2 | cut -d "," -f1
10.0.1.9

# openstack server show d82ca1de-1fcd-4ca6-84db-84891ec37796 -c addresses
+-----------+------------------+
| Field     | Value            |
+-----------+------------------+
| addresses | foo-net=10.0.1.9 |
+-----------+------------------+

# openstack port list --server d82ca1de-1fcd-4ca6-84db-84891ec37796
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------+--------+
| ID                                   | Name | MAC Address       | Fixed IP Addresses                                                      | Status |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------+--------+
| e9a5eed0-4967-49be-8f76-7764123ff721 |      | fa:16:3e:4a:69:90 | ip_address='10.0.1.9', subnet_id='edfaa7fc-7490-4417-8088-99e651e72b3f' | ACTIVE |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------+--------+
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-02-07 19:07:20 -0600

You could use an API and parse the information from the JSON data that it sends. Or use the SDK. Frankly, I think the CLI is the easiest approach.

edit flag offensive delete link more

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: 2020-02-07 06:10:59 -0600

Seen: 17 times

Last updated: Feb 07