- Timestamp:
- Mar 10, 2014 9:39:08 AM (11 years ago)
- Branches:
- master
- Children:
- 4a02274
- Parents:
- ea0e8cb
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
rea0e8cb r26821ac 104 104 self.info_segment = emulab_segment.info_segment 105 105 self.operation_segment = emulab_segment.operation_segment 106 self.exports_segment = emulab_segment.exports_segment 106 107 107 108 self.restricted = [ ] … … 563 564 def export_store_info(self, cf, proj, ename, connInfo): 564 565 """ 565 For the export requests in the connection info, install the peer names 566 at the experiment controller via SetValue calls. 566 For the export requests in the connection info, send out teh SetValue 567 calls for parameters initialized by the segment's export_segment 568 object. Values are all in the connInfo parameter's value fields. 567 569 """ 568 570 569 571 for c in connInfo: 570 for p in [ p for p in c.get('parameter', []) \ 571 if p.get('type', '') == 'output']: 572 573 if p.get('name', '') == 'peer': 574 k = p.get('key', None) 575 surl = p.get('store', None) 576 if surl : 577 if self.nat_portal: 578 value = self.nat_portal 579 elif k and k.index('/') != -1: 580 value = "%s.%s.%s%s" % \ 581 (k[k.index('/')+1:], ename, proj, self.domain) 582 else: 583 self.log.error("Bad export request: %s" % p) 584 continue 585 self.log.debug("Setting %s to %s on %s" % \ 586 (k, value, surl)) 587 req = { 'name': k, 'value': value } 588 self.call_SetValue(surl, req, cf) 589 else: 590 self.log.error("Bad export request: %s" % p) 591 elif p.get('name', '') == 'ssh_port': 592 k = p.get('key', None) 593 surl = p.get('store', None) 594 if surl and k: 595 req = { 'name': k, 'value': self.ssh_port } 596 self.log.debug("Setting %s to %s on %s" % \ 597 (k, self.ssh_port, surl)) 598 self.call_SetValue(surl, req, cf) 599 else: 600 self.log.error("Bad export request: %s" % p) 601 else: 602 self.log.error("Unknown export parameter: %s" % \ 572 for p in c.get('parameter', []): 573 # Ignore non-output parameters 574 if p.get('type', '') != 'output': 575 continue 576 # Sanity check store, key and value 577 surl = p.get('store', None) 578 key = p.get('key', None) 579 value = p.get('value', None) 580 if surl is None: 581 self.log.error("Export parameter without store: %s" % \ 603 582 p.get('name')) 604 583 continue 584 if key is None: 585 self.log.error("Export parameter without key: %s" % \ 586 p.get('name')) 587 continue 588 if value is None: 589 self.log.error("Unknown (unset) export parameter: %s" % \ 590 p.get('name')) 591 continue 592 # Set the store value 593 req = { 'name': key, 'value': value } 594 self.call_SetValue(surl, req, cf) 605 595 606 596 def add_seer_node(self, topo, name, startup): … … 984 974 self.configure_seer_services(services, topo, softdir) 985 975 # Get and send synch store variables 976 exporter = self.exports_segment(keyfile=self.ssh_privkey_file, 977 debug=self.create_debug, log=alloc_log, boss=self.boss, 978 ops=self.ops, cert=xmlrpc_cert) 979 exporter(self, ename, proj, user, connInfo, tmpdir, gid) 986 980 self.export_store_info(certfile, proj, ename, connInfo) 987 981 self.import_store_info(certfile, connInfo) -
fedd/federation/emulab_segment.py
rea0e8cb r26821ac 181 181 self.do_operation(op, l, p, param, top) 182 182 return True 183 184 class exports_segment(ssh_emulab_segment, xmlrpc_emulab_segment): 185 ''' 186 Class to export parameters from this segment. For a standard segment these 187 are calculated, so there is no testbed interaction. For shared-NAT DETER 188 installations, this is more involved. This class is a hook for that more 189 involved setup. 190 ''' 191 def __init__(self, log=None, keyfile=None, debug=False, boss=None, 192 ops=None, cert=None): 193 ssh_emulab_segment.__init__(self, log=log, keyfile=keyfile, debug=debug) 194 xmlrpc_emulab_segment.__init__(self, boss=boss, ops=ops, cert=cert) 195 196 def __call__(self, parent, eid, pid, user, connInfo, tmpdir, timeout=0, 197 gid=None): 198 ''' 199 Install the parameter values into each output parameter in each 200 connInfo entry. This class understands peer and ssh_port output 201 variables. 202 ''' 203 204 for c in connInfo: 205 for p in c.get('parameter', []): 206 # Only set output parameters 207 if p.get('type', '') != 'output': 208 continue 209 name = p.get('name', '') 210 # Debugging output 211 k = p.get('key', None) 212 if name == 'peer': 213 if parent.nat_portal: 214 value = parent.nat_portal 215 elif k and k.index('/') != -1: 216 value = "%s.%s.%s%s" % \ 217 (k[k.index('/')+1:], eid, pid, parent.domain) 218 else: 219 self.log.error("Bad export request: %s" % p) 220 continue 221 p['value'] = value 222 self.log.debug("Assigning %s to %s" % (k, value)) 223 elif name == 'ssh_port': 224 value = parent.ssh_port 225 p['value'] = value 226 self.log.debug("Assigning %s to %s" % (k, value)) 227 else: 228 self.log.error("Unknown export parameter: %s" % \ 229 p.get('name')) 230 continue 231 return True
Note: See TracChangeset
for help on using the changeset viewer.