Depends: sfa-common
Description: the SFA layer around MyPLC
-Package: sfa-cm
-Architecture: any
-Depends: sfa-common
-Description: the SFA layer around MyPLC NodeManager
-
Package: sfa-federica
Architecture: any
Depends: sfa-common
[
'config/sfa-config-tty',
'config/sfa-config',
- 'config/gen-sfa-cm-config.py',
+# 'config/gen-sfa-cm-config.py',
'sfa/server/sfa-start.py',
- 'sfa/server/sfa_component_setup.py',
+# 'sfa/server/sfa_component_setup.py',
'sfatables/sfatables',
'keyconvert/keyconvert.py',
'flashpolicy/sfa_flashpolicy.py',
'sfatables/processors',
]
-# need to do something about functions
-initscripts = [ 'sfa', 'sfa-cm', 'functions.sfa' ]
+initscripts = [ 'sfa',
+ 'functions.sfa',
+ ]
data_files = [ ('/etc/sfa/', [ 'config/aggregates.xml',
'config/registries.xml',
Group: Applications/System
Requires: sfa
-%package cm
-Summary: the SFA layer around MyPLC NodeManager
-Group: Applications/System
-Requires: sfa
-Requires: pyOpenSSL >= 0.6
+#%package cm
+#Summary: the SFA layer around MyPLC NodeManager
+#Group: Applications/System
+#Requires: sfa
+#Requires: pyOpenSSL >= 0.6
%package federica
Summary: the SFA layer around Federica
This package implements the SFA interface which serves as a layer
between the existing PlanetLab interfaces and the SFA API.
-%description cm
-This package implements the SFA interface which serves as a layer
-between the existing PlanetLab NodeManager interfaces and the SFA API.
+#%description cm
+#This package implements the SFA interface which serves as a layer
+#between the existing PlanetLab NodeManager interfaces and the SFA API.
%description federica
The SFA driver for FEDERICA.
/etc/sfa/xml.xsd
/etc/sfa/protogeni-rspec-common.xsd
/etc/sfa/topology
-%{_bindir}/gen-sfa-cm-config.py*
+#%{_bindir}/gen-sfa-cm-config.py*
-%files cm
-/etc/init.d/sfa-cm
-%{_bindir}/sfa_component_setup.py*
-# cron jobs here
+#%files cm
+#/etc/init.d/sfa-cm
+#%{_bindir}/sfa_component_setup.py*
+## cron jobs here
%files federica
%{python_sitelib}/sfa/federica
%postun
[ "$1" -ge "1" ] && { service sfa dbdump ; service sfa restart ; }
-### sfa-cm installs the 'sfa-cm' service
-%post cm
-chkconfig --add sfa-cm
-
-%preun cm
-if [ "$1" = 0 ] ; then
- /sbin/service sfa-cm stop || :
- /sbin/chkconfig --del sfa-cm || :
-fi
-
-%postun cm
-[ "$1" -ge "1" ] && service sfa-cm restart || :
+#### sfa-cm installs the 'sfa-cm' service
+#%post cm
+#chkconfig --add sfa-cm
+#
+#%preun cm
+#if [ "$1" = 0 ] ; then
+# /sbin/service sfa-cm stop || :
+# /sbin/chkconfig --del sfa-cm || :
+#fi
+#
+#%postun cm
+#[ "$1" -ge "1" ] && service sfa-cm restart || :
%changelog
* Sun Dec 16 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - sfa-2.1-22
result.extend(mylist)
for item in mylist:
for key in myfilter.keys():
- if myfilter[key] != item[key]:
- result.remove(item)
- break
+ if 'ids' in key:
+ pass
+ else:
+ if myfilter[key] != item[key]:
+ result.remove(item)
+ break
return result
try:
for user in DB['users_list']:
if param['user_id'] == user['user_id']:
- user['keys'].append(param['key'])
+ if 'keys' in user.keys():
+ user['keys'].append(param['key'])
+ else:
+ user['keys'] = [param['key']]
return True
return False
except:
slice = slices[0]
# sort slivers by node id
- slice_nodes = self.driver.shell.GetNodes({'node_ids': slice['node_ids']})
+ slice_nodes = []
+ if 'node_ids' in slice.keys():
+ slice_nodes = self.driver.shell.GetNodes({'node_ids': slice['node_ids']})
for node in slice_nodes:
slivers[node['node_id']] = node
# if we are dealing with a slice that has no node just return
# and empty list
if slice_xrn:
- if not slice or not slice['node_ids']:
+ if not slice or 'node_ids' not in slice.keys() or not slice['node_ids']:
return []
filter = {}
def update_relation (self, subject_type, target_type, relation_name, subject_id, target_ids):
# hard-wire the code for slice/user for now, could be smarter if needed
if subject_type =='slice' and target_type == 'user' and relation_name == 'researcher':
- subject=self.shell.GetSlices (subject_id)[0]
+ subject=self.shell.GetSlices ({'slice_id': subject_id})[0]
+ if 'user_ids' not in subject.keys():
+ subject['user_ids'] = []
current_target_ids = subject['user_ids']
add_target_ids = list ( set (target_ids).difference(current_target_ids))
del_target_ids = list ( set (current_target_ids).difference(target_ids))
requested_attributes = rspec.version.get_slice_attributes()
# ensure slice record exists
- slice = slices.verify_slice(slice_hrn, slice_record, peer, sfa_peer, options=options)
+ slice = slices.verify_slice(slice_hrn, slice_record, sfa_peer, options=options)
# ensure user records exists
- users = slices.verify_users(slice_hrn, slice, users, peer, sfa_peer, options=options)
+ #users = slices.verify_users(slice_hrn, slice, users, sfa_peer, options=options)
# add/remove slice from nodes
requested_slivers = []
hostname = xrn_to_hostname(node.get('component_id').strip())
if hostname:
requested_slivers.append(hostname)
- nodes = slices.verify_slice_nodes(slice, requested_slivers, peer)
+ requested_slivers_ids = []
+ for hostname in requested_slivers:
+ node_id = self.shell.GetNodes({'hostname': hostname})[0]['node_id']
+ requested_slivers_ids.append(node_id)
+ nodes = slices.verify_slice_nodes(slice, requested_slivers_ids)
return aggregate.get_rspec(slice_xrn=slice_urn, version=rspec.version)
return sfa_peer
- def verify_slice_nodes(self, slice, requested_slivers, peer):
-
+ def verify_slice_nodes(self, slice, requested_slivers):
+ if 'node_ids' not in slice.keys():
+ slice['node_ids']=[]
nodes = self.driver.shell.GetNodes({'node_ids': slice['node_ids']})
- current_slivers = [node['hostname'] for node in nodes]
+ current_slivers = [node['node_id'] for node in nodes]
# remove nodes not in rspec
deleted_nodes = list(set(current_slivers).difference(requested_slivers))
- def verify_slice(self, slice_hrn, slice_record, peer, sfa_peer, options={}):
+ def verify_slice(self, slice_hrn, slice_record, sfa_peer, options={}):
slicename = hrn_to_dummy_slicename(slice_hrn)
parts = slicename.split("_")
login_base = parts[0]
return slice
- def verify_users(self, slice_hrn, slice_record, users, peer, sfa_peer, options={}):
+ def verify_users(self, slice_hrn, slice_record, users, sfa_peer, options={}):
users_by_email = {}
users_dict = {}
+ users_by_site = {}
for user in users:
user['urn'] = user['urn'].lower()
hrn, type = urn_to_hrn(user['urn'])
username = get_leaf(hrn)
- login_base = PlXrn(xrn=user['urn']).pl_login_base()
+ login_base = DummyXrn(xrn=user['urn']).dummy_login_base()
user['username'] = username
user['site'] = login_base
# update_existing users
updated_users_list = [user for user in users_dict.values() if user['email'] in \
updated_user_ids]
- self.verify_keys(existing_slice_users, updated_users_list, peer, options)
+ self.verify_keys(existing_slice_users, updated_users_list, options)
added_persons = []
# add new users
'key_ids': added_user.get('key_ids', []),
}
person['person_id'] = self.driver.shell.AddPerson(person)
- if peer:
- person['peer_person_id'] = added_user['person_id']
added_persons.append(person)
# enable the account
return added_persons
- def verify_keys(self, old_users, new_users, peer, options={}):
+ def verify_keys(self, old_users, new_users, options={}):
# existing keys
existing_keys = []
for user in old_users:
sliver_id_parts = leaf.split(':')
name = sliver_id_parts[0]
name = re.sub('[^a-zA-Z0-9_]', '', name)
- return self.pl_login_base() + '_' + name
+ return name
#def hrn_to_pl_authname(hrn):
def dummy_authname (self):
self._normalize()
return self.leaf
- def pl_login_base (self):
+ def dummy_login_base (self):
self._normalize()
if self.type and self.type.startswith('authority'):
base = self.leaf
# anyway the driver should receive an object
# (and then extract __dict__ itself if needed)
print "DO NOT REMOVE ME before driver.update, record=%s"%record
- (pointer, new_key_pointer) = self.driver.update (record.__dict__, new_record.__dict__, hrn, new_key)
- if new_key and new_key_pointer:
+ new_key_pointer = -1
+ try:
+ (pointer, new_key_pointer) = self.driver.update (record.__dict__, new_record.__dict__, hrn, new_key)
+ except:
+ pass
+ if new_key and new_key_pointer:
record.reg_keys=[ RegKey (new_key, new_key_pointer)]
record.gid = gid
- dbsession.commit();
+ dbsession.commit()
# update membership for researchers, pis, owners, operators
self.update_driver_relations (record, new_record)
self.shell.AddPersonKey(pointer, {'key_type' : 'ssh', 'key' : pub_key})
elif type == 'node':
- login_base = PlXrn(xrn=sfa_record['authority'],type='node').pl_login_base()
+ login_base = PlXrn(xrn=sfa_record['authority'],type='authority').pl_login_base()
nodes = self.shell.GetNodes([pl_record['hostname']])
if not nodes:
pointer = self.shell.AddNode(login_base, pl_record)