fix allocation state names
[sfa.git] / sfa / planetlab / pldriver.py
index fe3d0ab..bb6edbb 100644 (file)
@@ -1,4 +1,3 @@
-import time
 import datetime
 #
 from sfa.util.faults import MissingSfaInfo, UnknownSfaType, \
@@ -6,7 +5,7 @@ from sfa.util.faults import MissingSfaInfo, UnknownSfaType, \
 from sfa.util.sfalogging import logger
 from sfa.util.defaultdict import defaultdict
 from sfa.util.sfatime import utcparse, datetime_to_string, datetime_to_epoch
-from sfa.util.xrn import hrn_to_urn, get_leaf
+from sfa.util.xrn import Xrn, hrn_to_urn, get_leaf
 from sfa.util.cache import Cache
 
 # one would think the driver should not need to mess with the SFA db, but..
@@ -701,10 +700,10 @@ class PlDriver (Driver):
         # only used by plc and ple.
         slices.handle_peer(site, slice, persons, peer)
         
-        return aggregate.describe(slice_xrn=xrn.get_urn(), version=rspec.version)
+        return aggregate.describe([xrn.get_urn()], version=rspec.version, allocation_status='geni_allocated')
 
     def provision(self, urns, options={}):
-        return self.describe(urns, options=options)
+        return self.describe(urns, None, options=options, allocation_status='geni_provisioned')
 
     def delete(self, urns, options={}):
         names = []
@@ -722,7 +721,7 @@ class PlDriver (Driver):
             node_ids = ids
         else:
             node_ids = slice['node_ids']
-     
+        slice_hrn = PlXrn(auth=self.hrn, slicename=slice['name']).get_hrn()     
         # determine if this is a peer slice
         # xxx I wonder if this would not need to use PlSlices.get_peer instead 
         # in which case plc.peers could be deprecated as this here
@@ -735,14 +734,14 @@ class PlDriver (Driver):
         finally:
             if peer:
                 self.shell.BindObjectToPeer('slice', slice['slice_id'], peer, slice['peer_slice_id'])
-        return 1
+        return True
     
     def renew (self, urns, expiration_time, options={}):
         # we can only renew slices, not individual slivers. ignore sliver
         # ids in the urn 
         names = []
         for urn in urns:
-            xrn = PlXrn(urn=urn, type='slice')
+            xrn = PlXrn(xrn=urn, type='slice')
             names.append(xrn.pl_slicename())
         slices = self.shell.GetSlices(names, ['slice_id'])
         if not slices:
@@ -764,7 +763,7 @@ class PlDriver (Driver):
             pass
         else:
             raise UnsupportedOperation(action)
-        description = self.describe(urns)
+        description = self.describe(urns, None, options)
         return description['geni_slivers']
 
     # set the 'enabled' tag to 0