Ignore:
Timestamp:
Mar 9, 2010 1:08:05 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
4e9719b
Parents:
c2c153b
Message:

SEER support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/proxy_protogeni_segment.py

    rc2c153b r9b3627e  
    191191                'userconfig': client_null,
    192192            }
     193
     194        def server_port(f, s):
     195            p = urlparse(s.get('server', 'http://localhost'))
     196            print >>f, 'port: remote:%s:%s:%s' % (p.port, p.hostname, p.port)
     197
     198        def server_null(f,s): pass
     199
     200        def server_seer(f, s):
     201            print >>f, 'seer: true'
     202
     203        server_service_out = {
     204                'SMB': server_port,
     205                'tmcd': server_port,
     206                'userconfig': server_null,
     207                'seer': server_seer,
     208            }
    193209        # XXX: end un hardcode this
    194210
     
    231247                        for s in [s for s in services \
    232248                                if s.get('name', "") in parent.imports]:
    233                             p = urlparse(s.get('server', 'http://localhost'))
    234                             print >>f, 'port: remote:%s:%s:%s' % \
    235                                     (p.port, p.hostname, p.port)
     249                            server_service_out[s['name']](f, s)
    236250
    237251                if tunnelconfig:
     
    251265           
    252266            # XXX: This little seer config file needs to go away.
    253             if not seer_out:
    254                 try:
    255                     seerfn = "%s/seer.conf" % tmpdir
    256                     f = open(seerfn, "w")
    257                     if not master:
    258                         print >>f, "ControlNode: control.%s.%s%s" % \
    259                             (meid.lower(), mproj.lower(), mdomain)
    260                     print >>f, "ExperimentID: %s" % mexp
    261                     f.close()
    262                 except IOError, e:
    263                     raise service_error(service_error.internal,
    264                             "Can't write seer.conf: %s" %e)
    265                 seer_out = True
     267            #if not seer_out:
     268                #try:
     269                    #seerfn = "%s/seer.conf" % tmpdir
     270                    #f = open(seerfn, "w")
     271                    #if not master:
     272                        #print >>f, "ControlNode: control.%s.%s%s" % \
     273                            #(meid.lower(), mproj.lower(), mdomain)
     274                    #print >>f, "ExperimentID: %s" % mexp
     275                    #f.close()
     276                #except IOError, e:
     277                    #raise service_error(service_error.internal,
     278                            #"Can't write seer.conf: %s" %e)
     279                #seer_out = True
    266280
    267281            if not client_out and type in ('control', 'both'):
     
    273287                                s.get('visibility','') == 'import':
    274288                            client_service_out[s['name']](f, s)
    275                     # Does seer need this?
    276                     # print >>f, "ExperimentID: %s/%s" % (mproj, meid)
     289                    # Seer uses this to find credentials in the shared project
     290                    # dir.
     291                    print >>f, "ExperimentID: %s/%s" % (mproj, meid)
    277292                    f.close()
    278293                except IOError, e:
     
    326341
    327342    def configure_nodes(self, topo, nodes, user, host, sshd, sshd_config,
    328             gate_cmd, node_cmd, pubkey, secretkey, stagingdir, tmpdir):
     343            gate_cmd, node_cmd, pubkey, secretkey, federation_software,
     344            portal_software, stagingdir, tmpdir):
    329345
    330346        fed_dir = "/usr/local/federation"
     
    354370                                % i.name)
    355371                   
     372                for l, f in federation_software:
     373                    base = os.path.basename(f)
     374                    print >>script, "%s %s@%s:%s/%s ." % \
     375                            (scp, user, host, stagingdir, base)
     376                    print >>script, \
     377                            "%s -C %s -xzf %s" % (tar, l, base)
     378
    356379                for s in e.software:
    357380                    # XXX: Just tarfiles for now
     
    364387                            "%s -C %s -xzf %s" % (tar, s.install, s_base)
    365388                for f in ('hosts', pubkey, secretkey, 'client.conf',
    366                         'userconf', 'seer.conf'):
     389                        'userconf'):
    367390                    print >>script, "%s %s@%s:%s/%s %s/etc" % \
    368391                            (scp, user, host, stagingdir, f, fed_dir)
     
    379402                            (scp, user, host, stagingdir, vname, fed_dir)
    380403
     404                # Hackery dackery dock: the ProtoGENI python is really ancient.
     405                # Get a modern version (though packaged for Mandrake (remember
     406                # Mandrake?  good times, good times)) and install it for SEER.
     407                python_rpm="python2.4-2.4-1pydotorg.i586.rpm"
     408                print >>script, "%s %s@%s:%s/%s ." % \
     409                        (scp, user, host, stagingdir, python_rpm)
     410                print >>script, "rpm --install ./%s" % python_rpm
     411                print >>script, "rm /usr/bin/python"
     412                print >>script, "ln /usr/bin/python2.4 /usr/bin/python"
     413                # Back to less hacky stuff
    381414
    382415                # Start commands
    383416                if e.get_attribute('portal') and gate_cmd:
     417                    # Install portal software
     418                    for l, f in portal_software:
     419                        base = os.path.basename(f)
     420                        print >>script, "%s %s@%s:%s/%s ." % \
     421                                (scp, user, host, stagingdir, base)
     422                        print >>script, \
     423                                "%s -C %s -xzf %s" % (tar, l, base)
     424
    384425                    # Portals never have a user-specified start command
    385426                    print >>script, gate_cmd
     
    548589
    549590        # With manifest in hand, we can export the portal node names.
    550         nodes = self.manifest_to_dict(manifest, ignore_debug=True)
     591        nodes = self.manifest_to_dict(manifest)
    551592        self.export_store_info(export_certfile, nodes, parent.ssh_port,
    552593                connInfo)
     
    612653        self.configure_nodes(topo, nodes, user, parent.staging_host,
    613654                parent.sshd, parent.sshd_config, gate_cmd, node_cmd,
    614                 pubkey, secretkey, stagingdir, tmpdir)
     655                pubkey, secretkey, parent.federation_software,
     656                parent.portal_software, stagingdir, tmpdir)
    615657
    616658        self.start_nodes(user, parent.staging_host,
Note: See TracChangeset for help on using the changeset viewer.