X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplslices.py;h=16d9bc33f70222e3c845748567ea9171b88ebed9;hb=ab323f56e4e20f8b210572274b09136c15050904;hp=2b4459dec1cf5bcb5c0ce47252eff083f7d90fd1;hpb=f9c817aea70e3d100bdae6e69a6c630593999e94;p=sfa.git diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index 2b4459de..16d9bc33 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -184,14 +184,15 @@ class PlSlices: slivers = {} for node in rspec_nodes: - hostname = None - client_id = node.get('client_id') - if node.get('component_name'): - hostname = node.get('component_name').strip() - elif node.get('component_id'): - hostname = xrn_to_hostname(node.get('component_id').strip()) + hostname = node.get('component_name') + client_id = node.get('client_id') + component_id = node.get('component_id').strip() if hostname: - slivers[hostname] = client_id + hostname = hostname.strip() + elif component_id: + hostname = xrn_to_hostname(component_id) + if hostname: + slivers[hostname] = {'client_id': client_id, 'component_id': component_id} nodes = self.driver.shell.GetNodes(slice['node_ids'], ['node_id', 'hostname', 'interface_ids']) current_slivers = [node['hostname'] for node in nodes] @@ -216,10 +217,13 @@ class PlSlices: # update sliver allocations for node in resulting_nodes: - client_id = slivers[node['hostname']] + client_id = slivers[node['hostname']]['client_id'] + component_id = slivers[node['hostname']]['component_id'] sliver_hrn = '%s.%s-%s' % (self.driver.hrn, slice['slice_id'], node['node_id']) sliver_id = Xrn(sliver_hrn, type='sliver').urn - record = SliverAllocation(sliver_id=sliver_id, client_id=client_id, allocation_state='geni_allocated') + record = SliverAllocation(sliver_id=sliver_id, client_id=client_id, + component_id=component_id, + allocation_state='geni_allocated') record.sync() return resulting_nodes