X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplslices.py;h=b3c6813e0e634b3af2a8f99a33488ed39e391c76;hb=7e1d7d63b6e65af7451c533fda704b14e327e48f;hp=4d23ff2d225f2021a1a075104235f763424cd1cc;hpb=5246a6bcb681854188f5953011aa6181a6032f35;p=sfa.git diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index 4d23ff2d..b3c6813e 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -10,7 +10,6 @@ from sfa.planetlab.vlink import VLink from sfa.planetlab.topology import Topology from sfa.planetlab.plxrn import PlXrn, hrn_to_pl_slicename, xrn_to_hostname, top_auth, hash_loginbase from sfa.storage.model import SliverAllocation -from sfa.storage.alchemy import dbsession MAXINT = 2L**31-1 @@ -272,7 +271,7 @@ class PlSlices: component_id=component_id, slice_urn = slice_urn, allocation_state='geni_allocated') - record.sync() + record.sync(self.driver.api.dbsession()) return resulting_nodes def free_egre_key(self): @@ -326,21 +325,23 @@ class PlSlices: for link in requested_links: # get the ip address of the first node in the link ifname1 = Xrn(link['interface1']['component_id']).get_leaf() - ifname_parts = ifname1.split(':') - node_raw = ifname_parts[0] - device = None - if len(ifname_parts) > 1: - device = ifname_parts[1] - node_id = int(node_raw.replace('node', '')) - node = nodes_dict[node_id] - if1 = interfaces_dict[node['interface_ids'][0]] - ipaddr = if1['ip'] - topo_rspec = VLink.get_topo_rspec(link, ipaddr) - # set topo_rspec tag - slice_tags.append({'name': 'topo_rspec', 'value': str([topo_rspec]), 'node_id': node_id}) - # set vini_topo tag - slice_tags.append({'name': 'vini_topo', 'value': 'manual', 'node_id': node_id}) - #self.driver.shell.AddSliceTag(slice['name'], 'topo_rspec', str([topo_rspec]), node_id) + + if ifname1: + ifname_parts = ifname1.split(':') + node_raw = ifname_parts[0] + device = None + if len(ifname_parts) > 1: + device = ifname_parts[1] + node_id = int(node_raw.replace('node', '')) + node = nodes_dict[node_id] + if1 = interfaces_dict[node['interface_ids'][0]] + ipaddr = if1['ip'] + topo_rspec = VLink.get_topo_rspec(link, ipaddr) + # set topo_rspec tag + slice_tags.append({'name': 'topo_rspec', 'value': str([topo_rspec]), 'node_id': node_id}) + # set vini_topo tag + slice_tags.append({'name': 'vini_topo', 'value': 'manual', 'node_id': node_id}) + #self.driver.shell.AddSliceTag(slice['name'], 'topo_rspec', str([topo_rspec]), node_id) self.verify_slice_attributes(slice, slice_tags, {'append': True}, admin=True) @@ -452,7 +453,7 @@ class PlSlices: else: slice = slice_exists[0] #Update expiration if necessary - if slice['expires'] != expires: + if slice.get('expires', None) != expires: self.driver.shell.UpdateSlice( int(slice['slice_id']), {'expires' : expires}) return self.driver.shell.GetSlices(int(slice['slice_id']))[0] @@ -510,11 +511,12 @@ class PlSlices: 'first_name': person_hrn, 'last_name': person_hrn, 'email': users_by_hrn[person_hrn].get('email', "%s@geni.net"%person_hrn.split('.')[-1]), - 'enabled': True } person_id = self.driver.shell.AddPerson(person) self.driver.shell.AddRoleToPerson('user', int(person_id)) + # enable the account + self.driver.shell.UpdatePerson(int(person_id), {'enabled': True}) self.driver.shell.SetPersonHrn(int(person_id), person_hrn) self.driver.shell.SetPersonSfaCreated(int(person_id), 'True') self.driver.shell.AddPersonToSite(int(person_id), site['site_id'])