Openstack instance ip_address
How can i get the fixed ip_address of an openstcak instance using python sdk ?
First time here? Check out the FAQ!
find_server as documented in the openstacksdk API reference.
EDIT: find_server() returns a server object that only has the links populated. After this, you use get_server() to get all the details.
import openstack;
conn = openstack.connect(
CONNECTION DETAILS
)
server = conn.compute.find_server(YOUR SERVER NAME)
server = conn.compute.get_server(server)
print(str(server))
for addrinfo in server.addresses['private']:
print("{} ipv{} address {}\n".format(addrinfo['OS-EXT-IPS:type'],addrinfo['version'],addrinfo['addr']))
I get the following result, which includes both static and floating IPs:
openstack.compute.v2.server.Server(OS-EXT-STS:task_state=None, addresses={u'private': [{u'OS-EXT-IPS-MAC:mac_addr': u'fa:16:3e:47:41:56', u'version': 4, u'addr': u'10.0.0.25', u'OS-EXT-IPS:type': u'fixed'}, {u'OS-EXT-IPS-MAC:mac_addr': u'fa:16:3e:47:41:56', u'version': 4, u'addr': u'172.24.4.2', u'OS-EXT-IPS:type': u'floating'}]}, ....
fixed ipv4 address 10.0.0.25
floating ipv4 address 172.24.4.2
As far as I understand it, it's a field in the Server object.
Instructions how to set that field when launching an instance. Reading the field should not be harder.
"opensttack server list" display like the table that contain all server details.I need the ip_address associated to networks for each instance. How can i get it ?
+------+-------+--------+----------+--------+
ID |Name |Status| Networks| Image
+------+-------+--------+-----------+-----
I have never tried it, but why don’t you just print the server object returned by find_server() to find out?
Asked: 2019-01-12 06:33:49 -0500
Seen: 167 times
Last updated: Jan 15 '19
Instance is not taking correct DNS servers
Creating Windows 7 template to upload to Grizzly
Cannot install instance on openstack/xenserver.
I can ping private IP. but I can't ping floating ip
Ubuntu Instance launch problem
How can change horizon to show mac-address in instances table
Which network does openstack use to transfer data during live migration?
unable to create instance in a single node controller
build of instance aborted: image is unacceptable: unable to convert image to raw in openstack stein