Re: [Openstack] Python API: Getting a list of floating ips?

2012-11-22 Thread Vishvananda Ishaya
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 l...@seas.harvard.edu 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 l...@seas.harvard.edu  |
 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@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


[Openstack] Python API: Getting a list of floating ips?

2012-11-21 Thread Lars Kellogg-Stedman
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 l...@seas.harvard.edu  |
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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp