Bugfix, wrong node attribute were used to create sliver info in get_nodes_and_links. NT
[sfa.git] / sfa / senslab / slabaggregate.py
index 467250e..7063f66 100644 (file)
@@ -67,11 +67,13 @@ class SlabAggregate:
         slice_name = slice_hrn
         print >>sys.stderr,"\r\n \r\n \t\t_____________ Slabaggregate api get_slice_and_slivers "
         slices = self.driver.GetSlices(slice_filter= str(slice_name), filter_type = 'slice_hrn')
-        #slices = self.driver.GetSlices({'slice_hrn':str(slice_name)})
         print >>sys.stderr,"\r\n \r\n \t\t_____________ Slabaggregate api get_slice_and_slivers  slices %s " %(slices)
         if not slices:
             return (slice, slivers)
-        slice = slices[0]
+        if isinstance(slice, list):
+            slice = slices[0]
+        else:
+           slice =slices
 
         # sort slivers by node id , if there is a job
         #and therfore, node allocated to this slice
@@ -236,9 +238,9 @@ class SlabAggregate:
         
             #tags = [PLTag(node_tags[tag_id]) for tag_id in node['node_tag_ids']]
             rspec_node['tags'] = []
-            if node['hrn'] in slivers:
+            if node['hostname'] in slivers:
                 # add sliver info
-                sliver = slivers[node['node_id']]
+                sliver = slivers[node['hostname']]
                 rspec_node['sliver_id'] = sliver['sliver_id']
                 rspec_node['client_id'] = node['hostname']
                 rspec_node['slivers'] = [sliver]