From ad0df20ee222367f767c9b56c100e1c653872976 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 16 Aug 2012 09:45:33 -0400 Subject: [PATCH] -m workaround for instance public ip bug --- sfa/openstack/osaggregate.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sfa/openstack/osaggregate.py b/sfa/openstack/osaggregate.py index 73e0f61e..78b05851 100644 --- a/sfa/openstack/osaggregate.py +++ b/sfa/openstack/osaggregate.py @@ -120,8 +120,19 @@ class OSAggregate: sliver['disk_image'] = [disk_image] # build interfaces - interfaces = [] + rspec_node['services'] = [] + rspec_node['interfaces'] = [] addresses = instance.addresses + # HACK: public ips are stored in the list of private, but + # this seems wrong. Assume pub ip is the last in the list of + # private ips until openstack bug is fixed. + if addresses.get('private'): + login = Login({'authentication': 'ssh-keys', + 'hostname': addresses.get('private')[-1]['addr'], + 'port':'22', 'username': 'root'}) + service = Services({'login': login}) + rspec_node['services'].append(service) + for private_ip in addresses.get('private', []): if_xrn = PlXrn(auth=self.driver.hrn, interface='node%s:eth0' % (instance.hostId)) @@ -129,11 +140,9 @@ class OSAggregate: interface['ips'] = [{'address': private_ip['addr'], #'netmask': private_ip['network'], 'type': private_ip['version']}] - interfaces.append(interface) - rspec_node['interfaces'] = interfaces + rspec_node['interfaces'].append(interface) # slivers always provide the ssh service - rspec_node['services'] = [] for public_ip in addresses.get('public', []): login = Login({'authentication': 'ssh-keys', 'hostname': public_ip['addr'], -- 2.43.0