From: Tony Mack Date: Thu, 16 Aug 2012 13:45:33 +0000 (-0400) Subject: -m workaround for instance public ip bug X-Git-Tag: sfa-2.1-14~43 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ad0df20ee222367f767c9b56c100e1c653872976;p=sfa.git -m workaround for instance public ip bug --- 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'],