Changeset 9b3627e


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

Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    rc2c153b r9b3627e  
    5656        Initializer.  Pulls parameters out of the ConfigParser's access section.
    5757        """
     58
     59        def software_list(v):
     60            l = [ ]
     61            if v:
     62                ps = v.split(" ")
     63                while len(ps):
     64                    loc, file = ps[0:2]
     65                    del ps[0:2]
     66                    l.append((loc, file))
     67            return l
     68
    5869
    5970        # Make sure that the configuration is in place
     
    7384        self.userconfcmd = config.get("access","userconfcmd")
    7485        self.userconfurl = config.get("access","userconfurl")
     86        self.federation_software = config.get("access", "federation_software")
     87        self.portal_software = config.get("access", "portal_software")
    7588        self.ssh_privkey_file = config.get("access","ssh_privkey_file")
    7689        self.ssh_pubkey_file = config.get("access","ssh_pubkey_file")
     
    7992        self.cleanup = not config.getboolean("access", "leave_tmpfiles")
    8093        self.access_type = config.get("access", "type")
     94   
     95        self.federation_software = software_list(self.federation_software)
     96        self.portal_software = software_list(self.portal_software)
    8197
    8298        self.access_type = self.access_type.lower()
     
    968984                'userconfig': client_null,
    969985            }
     986
     987        def server_port(f, s):
     988            p = urlparse(s.get('server', 'http://localhost'))
     989            print >>f, 'port: remote:%s:%s:%s' % (p.port, p.hostname, p.port)
     990
     991        def server_null(f,s): pass
     992
     993        def server_seer(f, s):
     994            print >>f, 'seer: true'
     995
     996        server_service_out = {
     997                'SMB': server_port,
     998                'tmcd': server_port,
     999                'userconfig': server_null,
     1000                'seer': server_seer,
     1001            }
    9701002        # XXX: end un hardcode this
    9711003
     
    10061038                        for s in [s for s in services \
    10071039                                if s.get('name', "") in self.imports]:
    1008                             p = urlparse(s.get('server', 'http://localhost'))
    1009                             print >>f, 'port: remote:%s:%s:%s' % \
    1010                                     (p.port, p.hostname, p.port)
     1040                            server_service_out[s['name']](f, s)
    10111041
    10121042                if tunnelconfig:
     
    10261056           
    10271057            # XXX: This little seer config file needs to go away.
    1028             if not seer_out:
    1029                 try:
    1030                     seerfn = "%s/seer.conf" % tmpdir
    1031                     f = open(seerfn, "w")
    1032                     if not master:
    1033                         print >>f, "ControlNode: control.%s.%s%s" % \
    1034                             (meid.lower(), mproj.lower(), mdomain)
    1035                     print >>f, "ExperimentID: %s" % mexp
    1036                     f.close()
    1037                 except IOError, e:
    1038                     raise service_error(service_error.internal,
    1039                             "Can't write seer.conf: %s" %e)
    1040                 seer_out = True
     1058            #if not seer_out:
     1059                #try:
     1060                    #seerfn = "%s/seer.conf" % tmpdir
     1061                    #f = open(seerfn, "w")
     1062                    #if not master:
     1063                        #print >>f, "ControlNode: control.%s.%s%s" % \
     1064                            #(meid.lower(), mproj.lower(), mdomain)
     1065                    #print >>f, "ExperimentID: %s" % mexp
     1066                    #f.close()
     1067                #except IOError, e:
     1068                    #raise service_error(service_error.internal,
     1069                            #"Can't write seer.conf: %s" %e)
     1070                #seer_out = True
    10411071
    10421072            if not client_out and type in ('control', 'both'):
     
    10501080                                s.get('visibility','') == 'import':
    10511081                            client_service_out[s['name']](f, s)
    1052                     # Does seer need this? (evidently so)
     1082                    # Seer uses this?
    10531083                    print >>f, "ExperimentID: %s/%s" % (mproj, meid)
    10541084                    f.close()
     
    11051135                return e.name[0] not in self.nodes
    11061136
     1137        def add_kit(e, kit):
     1138            """
     1139            Add a Software object created from the list of (install, location)
     1140            tuples passed as kit  to the software attribute of an object e.  We
     1141            do this enough to break out the code, but it's kind of a hack to
     1142            avoid changing the old tuple rep.
     1143            """
     1144
     1145            s = [ topdl.Software(install=i, location=l) for i, l in kit]
     1146
     1147            if isinstance(e.software, list): e.software.extend(s)
     1148            else: e.software = s
     1149
     1150
    11071151        t = topo.clone()
    11081152
     
    11491193            if isinstance(e, topdl.Segment):
    11501194                t.elements.remove(e)
    1151             # Fix software paths
    1152             for s in getattr(e, 'software', []):
    1153                 s.location = re.sub("^.*/", softdir, s.location)
    11541195            if isinstance(e, topdl.Computer):
     1196                add_kit(e, self.federation_software)
    11551197                if e.get_attribute('portal') and gate_cmd:
     1198                    # Add local portal support software
     1199                    add_kit(e, self.portal_software)
    11561200                    # Portals never have a user-specified start command
    11571201                    e.set_attribute('startup', gate_cmd)
     
    11671211                e.interface = [i for i in e.interface \
    11681212                        if not i.get_attribute('portal') or i.name in dinf ]
     1213            # Fix software paths
     1214            for s in getattr(e, 'software', []):
     1215                s.location = re.sub("^.*/", softdir, s.location)
    11691216
    11701217        t.substrates = [ s.clone() for s in t.substrates ]
     
    13681415                get_url(s, certfile, softdir)
    13691416
     1417            # Copy local portal node software to the tempdir
     1418            for l, f in self.portal_software:
     1419                base = os.path.basename(f)
     1420                copy_file(f, "%s/%s" % (softdir, base))
     1421
    13701422            for a in attrs:
    13711423                if a['attribute'] in configs:
  • fedd/federation/experiment_control.py

    rc2c153b r9b3627e  
    16981698                            master, eid, myname, desthost, portal_type,
    16991699                            infs, conn_type="ssh", conn_attrs=[], expid=expid)
    1700                     if self.fedkit:
    1701                         self.add_kit(portal, self.fedkit)
    1702                     if self.gatewaykit:
    1703                         self.add_kit(portal, self.gatewaykit)
     1700                    #if self.fedkit:
     1701                        #self.add_kit(portal, self.fedkit)
     1702                    #if self.gatewaykit:
     1703                        #self.add_kit(portal, self.gatewaykit)
    17041704
    17051705                    topo[st].elements.append(portal)
  • fedd/federation/protogeni_access.py

    rc2c153b r9b3627e  
    5656        """
    5757
     58        def software_list(v):
     59            l = [ ]
     60            if v:
     61                ps = v.split(" ")
     62                while len(ps):
     63                    loc, file = ps[0:2]
     64                    del ps[0:2]
     65                    l.append((loc, file))
     66            return l
     67
    5868        # Make sure that the configuration is in place
    5969        if not config:
     
    6878        self.userconfcmd = config.get("access","userconfcmd")
    6979        self.userconfurl = config.get("access","userconfurl")
     80        self.federation_software = config.get("access", "federation_software")
     81        self.portal_software = config.get("access", "portal_software")
    7082        self.ssh_port = config.get("access","ssh_port") or "22"
    7183        self.sshd = config.get("access","sshd")
     
    7789        self.staging_host = config.get("access", "staging_host") \
    7890                or "ops.emulab.net"
     91   
     92        self.federation_software = software_list(self.federation_software)
     93        self.portal_software = software_list(self.portal_software)
    7994
    8095        self.renewal_interval = config.get("access", "renewal") or (3 * 60 * 60)
     
    970985                get_url(s, certfile, softdir)
    971986
     987            # Copy local portal node software to the tempdir
     988            for s in (self.portal_software, self.federation_software):
     989                for l, f in s:
     990                    base = os.path.basename(f)
     991                    copy_file(f, "%s/%s" % (softdir, base))
     992
     993            # Ick.  Put this python rpm in a place that it will get moved into
     994            # the staging area.  It's a hack to install a modern (in a Roman
     995            # sense of modern) python on ProtoGENI
     996            python_rpm ="python2.4-2.4-1pydotorg.i586.rpm"
     997            if os.access("./%s" % python_rpm, os.R_OK):
     998                copy_file("./%s" % python_rpm, "%s/%s" % (softdir, python_rpm))
     999
    9721000            for a in attrs:
    9731001                if a['attribute'] in configs:
  • 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,
  • fedkit/Makefile

    rc2c153b r9b3627e  
    33         config_from_tunnelip.pl active_config.pl combo.pl \
    44         prep_gateway.pl port_forward.pl setup_bridge.pl import_key.pl \
    5          protogeni_routing.pl
     5         protogeni_routing.pl start_seer.pl
    66
    77LIBRARIES=gateway_lib.pm
  • fedkit/combo.pl

    rc2c153b r9b3627e  
    1818my $iface_file = "/var/emulab/boot/ifmap";
    1919my $ssh = "/usr/bin/ssh";
     20my $seer;
    2021my $ssh_port = 22;
    2122my @ports;
     
    3536    'ssh_port=s' => \$ssh_port,
    3637    'use_file' => \$use_file,
     38    'seer' => \$seer,
    3739);
    3840
     
    6163        "--ssh=$ssh --ssh_port=$ssh_port $portparam");
    6264    exit(20) if $?;
     65
     66    if ($seer ) {
     67        system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/start_seer.pl " .
     68            "--peer=$peer --seer --fedkit=$fedkit_dir --perl=$perl " .
     69            "--ssh=$ssh --ssh_privkey=$ssh_privkey");
     70        exit(20) if $?;
     71    }
     72
    6373}
    6474else {
  • fedkit/federate.pl

    rc2c153b r9b3627e  
    5858    $from->close();
    5959    $to->close();
    60     # Now, samba
    61     system('/usr/bin/yum -y install samba-client');
     60    # Now, samba.  Because of the python dance on PG, we need to call python2.2
     61    # explicitly
     62    system('/usr/bin/python2.2 /usr/bin/yum -y install samba-client');
    6263    # These tools expect the fstab to include smbfs instead
    6364    $smb_type = 'smbfs';
  • fedkit/gateway_lib.pm

    rc2c153b r9b3627e  
    367367
    368368
     369sub client_conf_filename {
     370    # Find the configuration file in the usual places, if there is one in
     371    # /usr/local/federation/etc, use it, otherwise look in the emulab standard
     372    # filesystems which depends on what experiment and project we're in.
     373    my $pid;
     374    my $eid;
     375    my $filename;
     376    my $fed_dir = "/usr/local/federation/etc/";
     377
     378    return "$fed_dir/client.conf" if -r "$fed_dir/client.conf";
     379
     380    my $tmcd = new IO::Pipe() || die "Can't create pipe: $!\n";
     381
     382    $tmcd->reader("$TMCC status");
     383
     384    while (<$tmcd>) {
     385        chomp;
     386        /ALLOCATED=([^\/]+)\/(\S+)/ && do {
     387            $pid = $1;
     388            $eid = $2;
     389        };
     390    }
     391    $tmcd->close();
     392    $filename = "/proj/$pid/exp/$eid/tmp/client.conf"
     393        if $pid and $eid;
     394
     395    return $filename;
     396}
     397
    369398sub wait_for_port {
    370399    my($addr, $port, $timeout, $sleep) = @_;
     
    376405
    377406    while (!$s) {
     407        # We've seen some arp pollution, so be proactive about clearing the
     408        # cache if we're waiting to get out.
     409        system("arp -d -a");
    378410        if (!($s = new IO::Socket(Domain => &AF_INET, PeerAddr => $addr,
    379411            PeerPort => $port))) {
  • fedkit/prep_gateway.pl

    rc2c153b r9b3627e  
    4949    $from->close();
    5050    $to->close();
    51     # Now, bridging
    52     system('/usr/bin/yum -y install bridge-utils');
     51    # Now, bridging (use old python...)
     52    system('/usr/bin/python2.2 /usr/bin/yum -y install bridge-utils');
    5353    #and keys
    5454    gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
  • fedkit/smbmount.Linux.pl

    rc2c153b r9b3627e  
    5959        /GID=(\S+)/ && do { $gid = $1; };
    6060        /HOMEDIR=(\S+)/ && do { $homedir = $1; };
     61        my $ids = $FSTYPE == 'smbfs' ? ",uid=$uid,gid=$gid" : "";
    6162
    6263        open(PWDFILE, ">/tmp/$user.cifs_creds") ||
     
    7071        print FSTAB "//$SHARE/$user\t";
    7172        print FSTAB "$homedir\t$FSTYPE\t";
    72         print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
     73        print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds$ids,ip=$ADDR\t0\t0\n";
    7374
    7475        #
     
    8384        if($user =~ m/$PUSER/i) {
    8485            print FSTAB "//$SHARE/proj-$PNAME\t";
    85             print FSTAB "$PROJROOT/$PNAME\tcifs\t";
    86             print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
     86            print FSTAB "$PROJROOT/$PNAME\t$FSTYPE\t";
     87            print FSTAB "rw,credentials=/tmp/$user.cifs_creds$ids,ip=$ADDR\t0\t0\n";
     88            mkdir("/$PROJROOT/$PNAME") unless -d "/$PROJROOT/$PNAME";
    8789            if ( $share) {
    8890                print FSTAB "//$SHARE/share\t";
    8991                print FSTAB "/share\t$FSTYPE\t";
    90                 print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
     92                print FSTAB "rw,credentials=/tmp/$user.cifs_creds$ids,ip=$ADDR\t0\t0\n";
    9193
    9294                mkdir("/share") unless -d "/share";
Note: See TracChangeset for help on using the changeset viewer.