- Timestamp:
- Feb 1, 2013 1:25:43 PM (12 years ago)
- Branches:
- master
- Children:
- 17c6d91
- Parents:
- 9a52a80 (diff), 06a2b49 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- fedd
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/deter/__init__.py
r06a2b49 r328e93f 5 5 from ip_allocator import * 6 6 from ip_addr import * 7 from topdl_to_route import * -
fedd/federation/deter_impl.py
r9a52a80 r328e93f 8 8 import deter_internal_access 9 9 import benito_access 10 import desktop_access 10 11 import skeleton_access 11 12 … … 89 90 elif self.access_type == "benito": 90 91 self.access = benito_access.access(config, self.auth) 92 elif self.access_type == "desktop": 93 self.access = desktop_access.access(config, self.auth) 91 94 elif self.access_type == "skel": 92 95 self.access = skeleton_access.access(config, self.auth) -
fedd/federation/emulab_access.py
r06a2b49 r328e93f 691 691 """ 692 692 configs = ('hosts', 'ssh_pubkey', 'ssh_secretkey', 693 'seer_ca_pem', 'seer_node_pem' )693 'seer_ca_pem', 'seer_node_pem', 'route.tgz') 694 694 ename = None 695 695 pubkey_base = None -
fedd/federation/experiment_control.py
r06a2b49 r328e93f 44 44 from deter import ip_allocator 45 45 from deter import ip_addr 46 from deter import topology_to_route_file 46 47 import list_log 47 48 … … 137 138 or 'legacy' 138 139 self.auth_dir = config.get('experiment_control', 'auth_dir') 140 self.routing = config.get('experiment_control', 'routing') 139 141 # XXX: document this! 140 142 self.info_cache_limit = \ … … 1204 1206 1205 1207 for p, a in attrs: 1206 # PNNL Debug1207 self.log.debug("Append auth: %s %s" % (p, a))1208 1208 if p and a: 1209 1209 # Improperly configured overrides can add bad principals. … … 1623 1623 """ 1624 1624 1625 # XXX: PNNL debug1626 self.log.debug("calling wrangle software")1627 1625 # Copy the rpms and tarfiles to a distribution directory from 1628 1626 # which the federants can retrieve them … … 1637 1635 pkgs.update([x.location for e in top.elements for x in e.software]) 1638 1636 try: 1639 # XXX: PNNL debug1640 self.log.debug("wrangle software: makedirs")1641 1637 os.makedirs(softdir) 1642 # XXX: PNNL debug1643 self.log.debug("wrangle software: makedirs success")1644 1638 except EnvironmentError, e: 1645 1639 raise service_error( … … 1961 1955 Create the ssh keys necessary for interconnecting the portal nodes and 1962 1956 the global hosts file for letting each segment know about the IP 1963 addresses in play. Save these into the repo. Add attributes to the 1964 autorizer allowing access controllers to download them and return a set 1965 of attributes that inform the segments where to find this stuff. May 1957 addresses in play. If we have computed static routes, copy them into 1958 the repo. Save these into the repo. Add attributes to the autorizer 1959 allowing access controllers to download them and return a set of 1960 attributes that inform the segments where to find this stuff. May 1966 1961 raise service_errors in if there are problems. 1967 1962 """ … … 1971 1966 gw_pubkey = os.path.join(keydir, gw_pubkey_base) 1972 1967 gw_secretkey = os.path.join(keydir, gw_secretkey_base) 1968 route = os.path.join(tmpdir, 'route.tgz') 1973 1969 1974 1970 try: … … 1985 1981 # The config file system location 1986 1982 configdir ="%s%s" % ( self.repodir, configpath) 1983 route_conf = os.path.join(configdir, 'route.tgz') 1987 1984 try: 1988 1985 os.makedirs(configdir) … … 1998 1995 "Cannot write hosts file: %s" % e) 1999 1996 try: 1997 if os.path.exists(route): 1998 copy_file(route, route_conf) 1999 2000 2000 copy_file(gw_pubkey, os.path.join(configdir, gw_pubkey_base)) 2001 2001 copy_file(gw_secretkey, os.path.join(configdir, gw_secretkey_base)) … … 2014 2014 (tbparams[tb].allocID, "%s/%s" % (configpath, f)) \ 2015 2015 for tb in tbparams.keys() \ 2016 for f in ("hosts", 'ca.pem', 'node.pem', 2016 for f in ("hosts", 'ca.pem', 'node.pem', 'route.tgz', 2017 2017 gw_secretkey_base, gw_pubkey_base)])) 2018 2018 … … 2044 2044 }, 2045 2045 ] 2046 # Add info about static routes if we have some 2047 if os.path.exists(route_conf): 2048 attrs.append( 2049 { 2050 'attribute': 'route.tgz', 2051 'value': '%s/%s/config/%s' % \ 2052 (self.repo_url, expid, 'route.tgz') 2053 } 2054 ) 2046 2055 return attrs 2047 2056 … … 2170 2179 raise service_error(service_error.req, "No such experiment") 2171 2180 2181 @staticmethod 2182 def needs_route_computation(req): 2183 ''' 2184 Walk the request services looking for a static routing request 2185 ''' 2186 for s in req.get('service', []): 2187 if s.get('name', '') == 'static_routing': 2188 return True 2189 return False 2190 2191 def compute_static_routes(self, tmpdir, top): 2192 ''' 2193 Compute a set of static routes for the topology. The result is a file 2194 called route.tgz in tmpdir that contains a dinrectory, route, with a 2195 file per node in the topology that lists the prefix and router for all 2196 the routes in that node's routing table. Exceptions from the route 2197 calculation program and the tar creation call are not caught. 2198 ''' 2199 if self.routing is None: 2200 raise service_error(service_error.server, 2201 'Cannot provide staticroutes, no routing program specified') 2202 rg = tempfile.NamedTemporaryFile() 2203 outdir = os.path.join(tmpdir, 'route') 2204 tarfile = os.path.join(tmpdir, 'route.tgz') 2205 topology_to_route_file(top, file=rg) 2206 os.mkdir(outdir) 2207 try: 2208 for cmd in ( 2209 [self.routing, '--input', rg.name,'--output', outdir], 2210 ['tar', '-C', tmpdir, '-czf', tarfile, 'route']): 2211 subprocess.check_call(cmd) 2212 except subprocess.CalledProcessError, e: 2213 raise service_error(service_error.internal, 2214 'Cannot call %s: %s' % (' '.join(cmd), e.returncode)) 2215 rg.close() 2216 shutil.rmtree(outdir) 2217 2218 2172 2219 2173 2220 def save_federant_information(self, allocated, tbparams, eid, top): … … 2279 2326 # Assign the IPs 2280 2327 hosts, ip_allocator = self.allocate_ips_to_topo(top) 2328 if self.needs_route_computation(req): 2329 self.compute_static_routes(tmpdir, top) 2281 2330 # Find the testbeds to look up 2282 2331 tb_hosts = { } … … 2284 2333 for e in top.elements: 2285 2334 if isinstance(e, topdl.Computer): 2286 tb = e.get_attribute('testbed') or 'default' 2335 tb = e.get_attribute('testbed') 2336 # Put nodes not in a testbed into the 'default' testbed if 2337 # 'default' is in the fedd map, the instantiation will 2338 # work. 2339 if tb is None: 2340 tb = 'default' 2341 e.set_attribute('testbed', tb) 2287 2342 if tb in tb_hosts: tb_hosts[tb].append(e.name) 2288 2343 else: … … 2306 2361 2307 2362 attrs = self.generate_keys_and_hosts(tmpdir, expid, hosts, tbparams) 2308 # XXX: PNNL debug2309 self.log.debug("Back from generate keys")2310 2363 2311 2364 part = experiment_partition(self.auth, self.store_url, tbmap, … … 2313 2366 part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator, 2314 2367 connInfo, expid) 2315 # XXX: PNNL debug2316 self.log.debug("Back from add portals")2317 2368 2318 2369 auth_attrs = set() 2319 2370 # Now get access to the dynamic testbeds (those added above) 2320 2371 for tb in [ t for t in topo if t not in allocated]: 2321 # XXX: PNNL debug2322 self.log.debug("dynamic testbeds %s" %tb)2323 2372 self.get_access(tb, tbparams, fid, masters, tbmap, 2324 2373 expid, expcert_file) … … 2331 2380 for sk in store_keys.split(" ")])) 2332 2381 2333 # XXX: PNNL debug2334 self.log.debug("done with dynamic testbeds %s" % auth_attrs)2335 2382 if auth_attrs: 2336 2383 self.append_experiment_authorization(expid, auth_attrs) -
fedd/federation/util.py
r06a2b49 r328e93f 218 218 while not ok and retries < max_retries: 219 219 try: 220 if log:221 log.debug('Creating HTTPSConnection: %s' % cf)222 220 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 223 221 cert_file=cf, key_file=cf, timeout=30) 224 222 conn.putrequest('GET', po.path) 225 223 conn.endheaders() 226 if log:227 log.debug('Connecting')228 224 response = conn.getresponse() 229 if log:230 log.debug('Connected')231 225 232 226 lf = open("%s/%s" % (destdir, fn), "w") 233 if log:234 log.debug('initial read')235 227 buf = response.read(4096) 236 228 while buf: 237 229 lf.write(buf) 238 if log:239 log.debug('loop read')240 230 buf = response.read(4096) 241 231 lf.close()
Note: See TracChangeset
for help on using the changeset viewer.