Changeset f9ef40b for fedd/federation
- Timestamp:
- Sep 2, 2009 5:59:16 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
- Children:
- 9beaf7c
- Parents:
- 6c57fe9
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/access.py
r6c57fe9 rf9ef40b 1136 1136 return rv 1137 1137 1138 def generate_portal_configs(self, topo, pubkey_base, secretkey_base, 1139 tmpdir): 1140 for p in [ e for e in topo.elements \ 1141 if isinstance(e, topdl.Computer) and e.get_attribute('portal')]: 1142 myname = e.name[0] 1143 peer = e.get_attribute('peer') 1144 lexp = e.get_attribute('experiment') 1145 lproj, leid = lexp.split('/', 1) 1146 ldomain = e.get_attribute('domain') 1147 scriptdir = e.get_attribute('scriptdir') 1148 active = e.get_attribute('active') 1149 type = e.get_attribute('type') 1150 segid = fedid(hexstr=e.get_attribute('peer_segment')) 1151 for e in topo.elements: 1152 if isinstance(e, topdl.Segment) and e.id.fedid == segid: 1153 seg = e 1154 break 1155 else: 1156 raise service_error(service_error.req, 1157 "Can't find segment for portal %s" % myname) 1158 1159 rexp = seg.get_attribute('experiment') 1160 rproj, reid = rexp.split("/", 1) 1161 rdomain = seg.get_attribute('domain') 1162 cfn = "%s/%s.%s.%s%s.gw.conf" % \ 1163 (tmpdir, myname, leid, lproj, ldomain) 1164 try: 1165 f = open(cfn, "w") 1166 print >>f, "Active: %s" % active 1167 print >>f, "BossName: boss" 1168 print >>f, "FsName: fs" 1169 print >>f, "EventServerName: event-server%s" % ldomain 1170 print >>f, "RemoteEventServerName: event-server%s" % rdomain 1171 print >>f, "SeerControl: control.%s.%s%s" % \ 1172 (leid.lower(), lproj.lower(), ldomain) 1173 print >>f, "Type: %s" % type 1174 print >>f, "RemoteExperiment: %s" % rexp 1175 print >>f, "LocalExperiment: %s" % lexp 1176 print >>f, "RemoteConfigFile: " + \ 1177 "/proj/%s/exp/%s/tmp/%s.%s.%s%s.gw.conf" \ 1178 % (rproj, reid, peer.lower(), reid.lower(), 1179 rproj.lower(), rdomain) 1180 print >>f, "Peer: %s.%s.%s%s" % \ 1181 (peer.lower(), reid.lower(), rproj.lower(), rdomain) 1182 print >>f, "Pubkeys: /proj/%s/exp/%s/tmp/%s" % \ 1183 (lproj, leid, pubkey_base) 1184 print >>f, "Privkey: /proj/%s/exp/%s/tmp/%s" % \ 1185 (lproj, leid, secretkey_base) 1186 f.close() 1187 except IOError, e: 1188 raise service_error(service_error.internal, 1189 "Can't write protal config %s: %s" % (cfn, e)) 1190 1138 1191 def StartSegment(self, req, fid): 1139 1192 def get_url(url, cf, tmpdir): … … 1161 1214 1162 1215 configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey')) 1216 keys = set(('ssh_pubkey', 'ssh_secretkey')) 1163 1217 1164 1218 … … 1200 1254 if a['attribute'] in configs: 1201 1255 get_url(a['value'], certfile, tmpdir) 1256 if a['attribute'] == 'ssh_pubkey': 1257 pubkey_base = a['attribute'].rpartition('/')[2] 1258 if a['attribute'] == 'ssh_secretkey': 1259 secretkey_base = a['attribute'].rpartition('/')[2] 1260 1261 self.generate_portal_configs(topo, pubkey_base, secretkey_base, tmpdir) 1202 1262 1203 1263 return { 'allocID': req['allocID'] } -
fedd/federation/experiment_control.py
r6c57fe9 rf9ef40b 2161 2161 req['fedAttr'] = attrs 2162 2162 2163 print req 2163 2164 r = self.caller(uri, req, self.cert_file, self.cert_pwd, 2164 2165 self.trusted_certs) … … 2230 2231 trusted_certs=self.trusted_certs, 2231 2232 caller=self.call_StartSegment) 2232 if not starter(uri, aid, topo[master] ):2233 if not starter(uri, aid, topo[master], attrs): 2233 2234 failed.append(master) 2234 2235 … … 2613 2614 sproject = tbparams[st].get('project', 'project') 2614 2615 dproject = tbparams[dt].get('project', 'project') 2615 sdomain = ".%s.%s%s" % (eid, sproject, 2616 tbparams[st].get('domain', ".example.com")) 2617 ddomain = ".%s.%s%s" % (eid, dproject, 2618 tbparams[dt].get('domain', ".example.com")) 2619 mdomain = "%s.%s%s" % (eid, 2620 tbparams[master].get('project', 'project'), 2621 tbparams[master].get('domain', '.example.com')) 2616 mproject = tbparams[master].get('project', 'project') 2617 sdomain = tbparams[st].get('domain', ".example.com") 2618 ddomain = tbparams[dt].get('domain', ".example.com") 2619 mdomain = tbparams[master].get('domain', '.example.com') 2622 2620 # XXX: active and type need to be unkludged 2623 2621 active = ("%s" % (st == master)) … … 2626 2624 # testbed in there. 2627 2625 tsubstrate = \ 2628 topdl.Substrate(name='%s-%s' % (st, dt)) 2626 topdl.Substrate(name='%s-%s' % (st, dt), 2627 attribute= [ 2628 topdl.Attribute( 2629 attribute='portal', 2630 value='true') 2631 ] 2632 ) 2629 2633 segment_element = topdl.Segment( 2630 2634 id= tbparams[dt]['allocID'], … … 2652 2656 for n, v in (\ 2653 2657 ('portal', 'true'), 2658 ('domain', sdomain), 2654 2659 ('masterdomain', mdomain), 2660 ('masterexperiment', "%s/%s" % \ 2661 (mproject, eid)), 2655 2662 ('experiment', "%s/%s" % \ 2656 2663 (sproject, eid)), 2657 ('peer', "%s.%s" % \ 2658 (desthost, ddomain)), 2664 ('peer', "%s" % desthost), 2665 ('peer_segment', "%s" % \ 2666 tbparams[dt]['allocID']['fedid']), 2659 2667 ('scriptdir', 2660 2668 "/usr/local/federation/bin"), … … 2674 2682 topdl.Interface( 2675 2683 substrate=\ 2676 segment_substrate[st][dt].name 2684 segment_substrate[st][dt].name, 2685 attribute=[ 2686 topdl.Attribute(attribute='portal', 2687 value='true') 2688 ] 2677 2689 ), 2678 2690 ],
Note: See TracChangeset
for help on using the changeset viewer.