From 446e3b2cac7469c6fdf46e3a916a729c9da8cb41 Mon Sep 17 00:00:00 2001 From: Andy Bavier Date: Fri, 22 Jun 2012 10:58:58 -0400 Subject: [PATCH] Use floating_ip in element Users can't login to an instance using the fixed_ip address of an instance since it is on a private network. Instead, export the floating_ip addresses assigned to the instance. --- sfa/openstack/osaggregate.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sfa/openstack/osaggregate.py b/sfa/openstack/osaggregate.py index 493c7080..5d96c511 100644 --- a/sfa/openstack/osaggregate.py +++ b/sfa/openstack/osaggregate.py @@ -113,6 +113,9 @@ class OSAggregate: interface['ips'] = [{'address': fixed_ip['address'], 'netmask': fixed_ip['network'].netmask, 'type': 'ipv4'}] + interface['floating_ips'] = [] + for floating_ip in fixed_ip.floating_ips: + interface['floating_ips'].append(floating_ip.address) interfaces.append(interface) if instance.availability_zone: node_xrn = OSXrn(instance.availability_zone, 'node') @@ -128,18 +131,15 @@ class OSAggregate: rspec_node['slivers'] = [sliver] rspec_node['interfaces'] = interfaces # slivers always provide the ssh service - hostname = None + rspec_node['services'] = [] for interface in interfaces: - if 'ips' in interface and interface['ips'] and \ - isinstance(interface['ips'], list): - if interface['ips'][0].get('address'): - hostname = interface['ips'][0].get('address') - break - login = Login({'authentication': 'ssh-keys', - 'hostname': hostname, - 'port':'22', 'username': 'root'}) - service = Services({'login': login}) - rspec_node['services'] = [service] + if 'floating_ips' in interface: + for hostname in interface['floating_ips']: + login = Login({'authentication': 'ssh-keys', + 'hostname': hostname, + 'port':'22', 'username': 'root'}) + service = Services({'login': login}) + rspec_node['services'].append(service) rspec_nodes.append(rspec_node) return rspec_nodes -- 2.43.0