git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
calling aggregate manager for slice start/stop operations
[sfa.git]
/
geni
/
util
/
slices.py
diff --git
a/geni/util/slices.py
b/geni/util/slices.py
index
5bfc5ee
..
b063eb7
100644
(file)
--- a/
geni/util/slices.py
+++ b/
geni/util/slices.py
@@
-16,7
+16,10
@@
class Slices(SimpleStorage):
self.api = api
self.ttl = ttl
self.threshold = None
self.api = api
self.ttl = ttl
self.threshold = None
- self.slices_file = os.sep.join([self.api.server_basedir, self.api.interface +'.'+ self.api.hrn + '.slices'])
+ path = self.api.config.basepath
+ filename = ".".join([self.api.interface, self.api.hrn, "slices"])
+ filepath = path + os.sep + filename
+ self.slices_file = filepath
SimpleStorage.__init__(self, self.slices_file)
self.policy = Policy(self.api)
self.load()
SimpleStorage.__init__(self, self.slices_file)
self.policy = Policy(self.api)
self.load()
@@
-126,8
+129,7
@@
class Slices(SimpleStorage):
records = registry.resolve(credential, hrn)
for record in records:
if record.get_type() in ['slice']:
records = registry.resolve(credential, hrn)
for record in records:
if record.get_type() in ['slice']:
- slice_info = record.as_dict()
- slice = slice_info['pl_info']
+ slice = record.as_dict()
if not slice:
raise RecordNotFound(slice_hrn)
if not slice:
raise RecordNotFound(slice_hrn)
@@
-146,8
+148,7
@@
class Slices(SimpleStorage):
if not site_records:
raise RecordNotFound(authority)
site_record = site_records[0]
if not site_records:
raise RecordNotFound(authority)
site_record = site_records[0]
- site_info = site_record.as_dict()
- site = site_info['pl_info']
+ site = site_record.as_dict()
# add the site
site.pop('site_id')
# add the site
site.pop('site_id')
@@
-159,8
+160,7
@@
class Slices(SimpleStorage):
# get the list of valid slice users from the registry and make
# they are added to the slice
# get the list of valid slice users from the registry and make
# they are added to the slice
- geni_info = slice_info['geni_info']
- researchers = geni_info['researcher']
+ researchers = slice.get('researcher', [])
for researcher in researchers:
person_record = {}
person_records = registry.resolve(credential, researcher)
for researcher in researchers:
person_record = {}
person_records = registry.resolve(credential, researcher)
@@
-169,7
+169,7
@@
class Slices(SimpleStorage):
person_record = record
if not person_record:
pass
person_record = record
if not person_record:
pass
- person_dict = person_record.as_dict()
['pl_info']
+ person_dict = person_record.as_dict()
persons = self.api.plshell.GetPersons(self.api.plauth, [person_dict['email']], ['person_id', 'key_ids'])
# Create the person record
persons = self.api.plshell.GetPersons(self.api.plauth, [person_dict['email']], ['person_id', 'key_ids'])
# Create the person record
@@
-268,9
+268,9
@@
class Slices(SimpleStorage):
def start_slice_smgr(self, hrn):
credential = self.api.getCredential()
def start_slice_smgr(self, hrn):
credential = self.api.getCredential()
- aggregates = Aggregates()
+ aggregates = Aggregates(
self.api
)
for aggregate in aggregates:
for aggregate in aggregates:
- aggre
e
gates[aggregate].start_slice(credential, hrn)
+ aggregates[aggregate].start_slice(credential, hrn)
return 1
return 1
@@
-293,7
+293,7
@@
class Slices(SimpleStorage):
def stop_slice_smgr(self, hrn):
credential = self.api.getCredential()
def stop_slice_smgr(self, hrn):
credential = self.api.getCredential()
- aggregates = Aggregates()
+ aggregates = Aggregates(
self.api
)
for aggregate in aggregates:
for aggregate in aggregates:
- aggregate[aggregate].stop_slice(credential, hrn)
+ aggregate
s
[aggregate].stop_slice(credential, hrn)