openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #18859
Re: Python API: Getting a list of floating ips?
This is an unfortunate consequence of floating ips not being in the original spec for the api and being added in the extension. I do believe the ordering is consistent, but you are probably safer to do a client.floating_ips.list() and filtering the resulting objects based on instance_id. Something like:
print [ip for ip in client.floating_ips.list() where ip.instance_id == server.id]
Vish
On Nov 21, 2012, at 6:01 PM, Lars Kellogg-Stedman <lars@xxxxxxxxxxxxxxxx> wrote:
> Using the Python API, what's the best of getting a list of floating
> ips assigned to an instance? The Server.addresses dictionary contains
> *both* fixed and floating ips, and doesn't appear to differentiate
> between them. E.g:
>
> srvr = client.servers.find(name='myinstance')
> print srvr.addresses
> {u'fixed_0': [{u'addr': u'172.16.10.31', u'version': 4},
> {u'addr': u'10.243.28.46', u'version': 4}]}
>
> Do I just assume that the first address in the list is the fixed
> address?
>
> --
> Lars Kellogg-Stedman <lars@xxxxxxxxxxxxxxxx> |
> Senior Technologist | http://ac.seas.harvard.edu/
> Academic Computing | http://code.seas.harvard.edu/
> Harvard School of Engineering |
> and Applied Sciences |
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp
References