Changeset dd3e38b for fedd/federation/protogeni_access.py
- Timestamp:
- Mar 7, 2010 8:01:52 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 062b991
- Parents:
- d101c8c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/protogeni_access.py
rd101c8c rdd3e38b 4 4 import stat # for chmod constants 5 5 import re 6 import time 6 7 import string 7 8 import copy … … 76 77 self.staging_host = config.get("access", "staging_host") \ 77 78 or "ops.emulab.net" 79 80 self.renewal_interval = config.get("access", "renewal") or (3 * 60 * 60) 81 self.renewal_interval = int(self.renewal_interval) 78 82 79 83 self.ch_url = config.get("access", "ch_url") … … 131 135 self.start_segment = proxy_protogeni_segment.start_segment 132 136 self.stop_segment = proxy_protogeni_segment.stop_segment 137 self.renew_segment = proxy_protogeni_segment.renew_segment 133 138 134 139 self.call_SetValue = service_caller('SetValue') 135 140 self.call_GetValue = service_caller('GetValue') 141 142 self.RenewSlices() 136 143 137 144 self.soap_services = {\ … … 212 219 213 220 # Access line (t, p, u) -> (a, pw) line 214 # XXX: you are here215 221 m = access_re.match(line) 216 222 if m != None: … … 1114 1120 stopper(self, user, staging, slice_cred, cf, cpw) 1115 1121 return { 'allocID': req['allocID'] } 1122 1123 def RenewSlices(self): 1124 self.log.info("Scanning for slices to renew") 1125 self.state_lock.acquire() 1126 aids = self.allocation.keys() 1127 self.state_lock.release() 1128 1129 for aid in aids: 1130 self.state_lock.acquire() 1131 if self.allocation.has_key(aid): 1132 name = self.allocation[aid].get('slice_name', None) 1133 scred = self.allocation[aid].get('slice_credential', None) 1134 cf, user, ssh_key, cpw = self.allocation[aid]['credentials'] 1135 else: 1136 name = None 1137 scred = None 1138 self.state_lock.release() 1139 1140 # There's a ProtoGENI slice associated with the segment; renew it. 1141 if name and scred: 1142 renewer = self.renew_segment(log=self.log, 1143 debug=self.create_debug, keyfile=ssh_key, 1144 cm_url = self.cm_url, sa_url = self.sa_url, 1145 ch_url = self.ch_url) 1146 new_scred = renewer(name, scred, self.renewal_interval, cf, cpw) 1147 if new_scred: 1148 self.log.info("Slice %s renewed until %s GMT" % \ 1149 (name, time.asctime(time.gmtime(\ 1150 time.time()+self.renewal_interval)))) 1151 self.state_lock.acquire() 1152 if self.allocation.has_key(aid): 1153 self.allocation[aid]['slice_credential'] = new_scred 1154 self.state_lock.release() 1155 else: 1156 self.log.info("Failed to renew slice %s " % name) 1157 1158 # Let's do this all again soon. (4 tries before the slices time out) 1159 t = Timer(self.renewal_interval/4, self.RenewSlices) 1160 t.start()
Note: See TracChangeset
for help on using the changeset viewer.