Skip to content

Instantly share code, notes, and snippets.

@whitekid
Last active December 28, 2015 23:08
Show Gist options
  • Save whitekid/7576376 to your computer and use it in GitHub Desktop.
Save whitekid/7576376 to your computer and use it in GitHub Desktop.
fixed ip를 기준으로 해당 인스턴스 연결된 vip 찾아내기
from quantumclient.v2_0.client import Client
def get_vip_from_fixed_ip(fixed_ip):
client = Client(
username = app.config['USERNAME'],
password = app.config['PASSWORD'],
tenant_name = app.config['TENANT_NAME'],
auth_url = app.config['AUTH_URL']
)
members = client.list_members(address = fixed_ip)['members']
if not members: return None
pool_id = members[0]['pool_id']
pool = client.show_pool(pool_id)
vip_id = pool['pool']['vip_id']
vip_ref = client.show_vip(vip_id)
vip = vip_ref['vip']['address']
return vip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment