First time here? Check out the FAQ!
![]() | 1 | initial version |
find_server as documented in the openstacksdk API reference.
![]() | 2 | No.2 Revision |
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))
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'}]}, ....
![]() | 3 | No.3 Revision |
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("{} - {}\n".format(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'}]}, ....
4 - 10.0.0.25
4 - 172.24.4.2
![]() | 4 | No.4 Revision |
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("{} - {}\n".format(addrinfo['version'],addrinfo['addr']))
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'}]}, ....
4 - fixed ipv4 address 10.0.0.25
4 - floating ipv4 address 172.24.4.2