Improve network support in launch-node.py

Currently launch-node.py doesn't allow to specify network label
and floating IP pool name, using the defaults from nova-network.

This patch allows to specify network label to attach instance to,
and floating IP pool from which floating IPs could be assigned.

Change-Id: I46024bc1c217f99f19717aeb04d424a01440203a
This commit is contained in:
Dmitry Teselkin
2014-10-16 22:03:38 +04:00
parent 7fff4e7e93
commit 4c7c93252d
2 changed files with 18 additions and 7 deletions

View File

@@ -88,13 +88,13 @@ def get_flavor(client, min_ram):
return flavors[0]
def get_public_ip(server, version=4):
def get_public_ip(server, version=4, floating_ip_pool=None):
if 'os-floating-ips' in get_extensions(server.manager.api):
for addr in server.manager.api.floating_ips.list():
if addr.instance_id == server.id:
return addr.ip
# We don't have one - so add one please
new_ip = server.manager.api.floating_ips.create()
new_ip = server.manager.api.floating_ips.create(pool=floating_ip_pool)
server.add_floating_ip(new_ip)
for addr in server.manager.api.floating_ips.list():
if addr.instance_id == server.id: