from sfa.util.cache import Cache
# one would think the driver should not need to mess with the SFA db, but..
-from sfa.storage.alchemy import dbsession
from sfa.storage.model import RegRecord, SliverAllocation
from sfa.trust.credential import Credential
# the cache instance is a class member so it survives across incoming requests
cache = None
- def __init__ (self, config):
- Driver.__init__ (self, config)
+ def __init__ (self, api):
+ Driver.__init__ (self, api)
+ config=api.config
self.shell = PlShell (config)
self.cache=None
if config.SFA_AGGREGATE_CACHING:
# get the registry records
person_list, persons = [], {}
- person_list = dbsession.query (RegRecord).filter(RegRecord.pointer.in_(person_ids))
+ person_list = self.api.dbsession().query (RegRecord).filter(RegRecord.pointer.in_(person_ids))
# create a hrns keyed on the sfa record's pointer.
# Its possible for multiple records to have the same pointer so
# the dict's value will be a list of hrns.
slices.handle_peer(None, None, persons, peer)
# update sliver allocation states and set them to geni_provisioned
sliver_ids = [sliver['sliver_id'] for sliver in slivers]
- SliverAllocation.set_allocations(sliver_ids, 'geni_provisioned')
+ dbsession=self.api.dbsession()
+ SliverAllocation.set_allocations(sliver_ids, 'geni_provisioned',dbsession)
version_manager = VersionManager()
rspec_version = version_manager.get_version(options['geni_rspec_version'])
return self.describe(urns, rspec_version, options=options)
self.shell.DeleteLeases(leases_ids)
# delete sliver allocation states
- SliverAllocation.delete_allocations(sliver_ids)
+ dbsession=self.api.dbsession()
+ SliverAllocation.delete_allocations(sliver_ids,dbsession)
finally:
if peer:
self.shell.BindObjectToPeer('slice', slice_id, peer, slice['peer_slice_id'])