Changeset b770aa0
- Timestamp:
- Sep 8, 2009 2:54:45 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
- Children:
- 22defdb
- Parents:
- 574055e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/access.py
r574055e rb770aa0 1279 1279 configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey')) 1280 1280 1281 err = None # Any service_error generated after tmpdir is created 1282 rv = None # Return value from segment creation 1283 1281 1284 try: 1282 1285 req = req['StartSegmentRequestBody'] … … 1307 1310 raise service_error(service_error.internal, "Cannot create tmp dir") 1308 1311 1309 sw = set() 1310 for e in topo.elements: 1311 for s in getattr(e, 'software', []): 1312 sw.add(s.location) 1313 if len(sw) > 0: 1314 os.mkdir(softdir) 1315 for s in sw: 1316 get_url(s, certfile, softdir) 1317 1318 for a in attrs: 1319 if a['attribute'] in configs: 1320 get_url(a['value'], certfile, tmpdir) 1321 if a['attribute'] == 'ssh_pubkey': 1322 pubkey_base = a['value'].rpartition('/')[2] 1323 if a['attribute'] == 'ssh_secretkey': 1324 secretkey_base = a['value'].rpartition('/')[2] 1325 if a['attribute'] == 'experiment_name': 1326 ename = a['value'] 1327 1328 proj = None 1329 user = None 1330 self.state_lock.acquire() 1331 if self.allocation.has_key(aid): 1332 proj = self.allocation[aid].get('project', None) 1333 if not proj: 1334 proj = self.allocation[aid].get('sproject', None) 1335 user = self.allocation[aid].get('user', None) 1336 self.allocation[aid]['experiment'] = ename 1337 self.write_state() 1338 self.state_lock.release() 1339 1340 if not proj: 1341 raise service_error(service_error.internal, 1342 "Can't find project for %s" %aid) 1343 1344 if not user: 1345 raise service_error(service_error.internal, 1346 "Can't find creation user for %s" %aid) 1347 1348 expfile = "%s/experiment.tcl" % tmpdir 1349 1350 self.generate_portal_configs(topo, pubkey_base, 1351 secretkey_base, tmpdir, master) 1352 self.generate_ns2(topo, expfile, 1353 "/proj/%s/software/%s/" % (proj, ename), master) 1354 starter = self.start_segment(keyfile=self.ssh_privkey_file, 1355 debug=self.create_debug) 1356 rv = starter(self, ename, proj, user, expfile, tmpdir) 1357 1358 self.log.debug("[StartSegment]: removing %s" % tmpdir) 1312 # Try block alllows us to clean up temporary files. 1313 try: 1314 sw = set() 1315 for e in topo.elements: 1316 for s in getattr(e, 'software', []): 1317 sw.add(s.location) 1318 if len(sw) > 0: 1319 os.mkdir(softdir) 1320 for s in sw: 1321 get_url(s, certfile, softdir) 1322 1323 for a in attrs: 1324 if a['attribute'] in configs: 1325 get_url(a['value'], certfile, tmpdir) 1326 if a['attribute'] == 'ssh_pubkey': 1327 pubkey_base = a['value'].rpartition('/')[2] 1328 if a['attribute'] == 'ssh_secretkey': 1329 secretkey_base = a['value'].rpartition('/')[2] 1330 if a['attribute'] == 'experiment_name': 1331 ename = a['value'] 1332 1333 proj = None 1334 user = None 1335 self.state_lock.acquire() 1336 if self.allocation.has_key(aid): 1337 proj = self.allocation[aid].get('project', None) 1338 if not proj: 1339 proj = self.allocation[aid].get('sproject', None) 1340 user = self.allocation[aid].get('user', None) 1341 self.allocation[aid]['experiment'] = ename 1342 self.write_state() 1343 self.state_lock.release() 1344 1345 if not proj: 1346 raise service_error(service_error.internal, 1347 "Can't find project for %s" %aid) 1348 1349 if not user: 1350 raise service_error(service_error.internal, 1351 "Can't find creation user for %s" %aid) 1352 1353 expfile = "%s/experiment.tcl" % tmpdir 1354 1355 self.generate_portal_configs(topo, pubkey_base, 1356 secretkey_base, tmpdir, master) 1357 self.generate_ns2(topo, expfile, 1358 "/proj/%s/software/%s/" % (proj, ename), master) 1359 starter = self.start_segment(keyfile=self.ssh_privkey_file, 1360 debug=self.create_debug) 1361 rv = starter(self, ename, proj, user, expfile, tmpdir) 1362 except service_error, e: 1363 err = e 1364 1365 self.log.debug("[StartSegment]: removing %s" % tmpdir) 1359 1366 # Walk up tmpdir, deleting as we go 1360 1367 for path, dirs, files in os.walk(tmpdir, topdown=False): … … 1367 1374 if rv: 1368 1375 return { 'allocID': req['allocID'] } 1376 elif err: 1377 raise service_error(service_error.federant, 1378 "Swapin failed: %s" % err) 1369 1379 else: 1370 1380 raise service_error(service_error.federant, "Swapin failed")
Note: See TracChangeset
for help on using the changeset viewer.