Changeset 8fbef04 for fedd


Ignore:
Timestamp:
Mar 10, 2014 5:25:42 PM (6 years ago)
Author:
Ted Faber <faber@…>
Branches:
master
Children:
d75005b
Parents:
a2ca699
Message:

Shared NAT integrated

Location:
fedd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fedd/deter/topdl.py

    ra2ca699 r8fbef04  
    998998    return t
    999999
    1000 def generate_portal_command_filter(cmd, add_filter=None):
     1000def generate_portal_command_filter(cmd, add_filter=None, suffix=''):
    10011001    def rv(e):
    10021002        s =""
     
    10081008                add = True
    10091009            if gw and add:
    1010                 s = "%s ${%s}\n" % (cmd, to_tcl_name(e.name))
     1010                s = "%s ${%s} %s\n" % (cmd, to_tcl_name(e.name), suffix)
    10111011        return s
    10121012    return rv
  • fedd/federation/emulab_access.py

    ra2ca699 r8fbef04  
    3232import list_log
    3333import emulab_segment
     34import emulab_shared_nat_segment
    3435
    3536
     
    9192        self.node_startcommand = config.get("access", "node_startcommand")
    9293        self.nat_portal = config.get("access", "nat_portal")
     94        self.shared_nat = config.getboolean("access", "shared_nat")
    9395
    9496        self.uri = 'https://%s:%d' % (socket.getfqdn(),
     
    100102
    101103        self.access_type = self.access_type.lower()
    102         self.start_segment = emulab_segment.start_segment
    103         self.stop_segment = emulab_segment.stop_segment
    104         self.info_segment = emulab_segment.info_segment
    105         self.operation_segment = emulab_segment.operation_segment
    106         self.exports_segment = emulab_segment.exports_segment
     104        if self.shared_nat:
     105            self.start_segment = emulab_shared_nat_segment.start_segment
     106            self.stop_segment = emulab_shared_nat_segment.stop_segment
     107            self.info_segment = emulab_shared_nat_segment.info_segment
     108            self.operation_segment = emulab_shared_nat_segment.operation_segment
     109            self.exports_segment = emulab_shared_nat_segment.exports_segment
     110        else:
     111            self.start_segment = emulab_segment.start_segment
     112            self.stop_segment = emulab_segment.stop_segment
     113            self.info_segment = emulab_segment.info_segment
     114            self.operation_segment = emulab_segment.operation_segment
     115            self.exports_segment = emulab_segment.exports_segment
    107116
    108117        self.restricted = [ ]
     
    541550
    542551        if self.portal_command:
     552            if self.shared_nat: suffix = 'shared nat 0/0/tcp rdr 22/tcp'
     553            else: suffix = ''
     554
    543555            filters.append(topdl.generate_portal_command_filter(
    544                 self.portal_command, add_filter=add_filter))
     556                self.portal_command, add_filter=add_filter, suffix=suffix))
    545557
    546558        if self.portal_image:
     
    977989                    debug=self.create_debug, log=alloc_log, boss=self.boss,
    978990                    ops=self.ops, cert=xmlrpc_cert)
    979             exporter(self, ename, proj, user, connInfo, tmpdir, gid)
     991            if not exporter(self, ename, proj, user, connInfo, tmpdir, gid):
     992                raise service_error(service_error.internal,
     993                        'Failed to gather export variables')
    980994            self.export_store_info(certfile, proj, ename, connInfo)
    981995            self.import_store_info(certfile, connInfo)
  • fedd/federation/ssh_emulab_segment.py

    ra2ca699 r8fbef04  
    5959        return rv == 0
    6060
     61    def scp_file_from(self, file, user, host, dest=""):
     62        """
     63        scp a file to the remote host.  If debug is set the action is only
     64        logged.
     65        """
     66
     67        scp_cmd = [self.scp_exec, '-o', 'IdentitiesOnly yes',
     68                '-o', 'StrictHostKeyChecking no', '-o', 'ForwardX11 no','-i',
     69                self.ssh_privkey_file, "%s@%s:%s" % (user, host, file), dest]
     70        rv = 0
     71
     72        try:
     73            dnull = open("/dev/null", "w")
     74        except EnvironmentError:
     75            self.log.debug("[ssh_file]: failed to open " + \
     76                    "/dev/null for redirect")
     77            dnull = Null
     78
     79        self.log.debug("[scp_file]: %s" % " ".join(scp_cmd))
     80        if not self.debug:
     81            rv = subprocess.call(scp_cmd, stdout=dnull,
     82                    stderr=dnull, close_fds=True)
     83
     84        return rv == 0
     85
    6186    def ssh_cmd(self, user, host, cmd, wname=None, timeout=None):
    6287        """
  • fedd/federation/xmlrpc_emulab_segment.py

    ra2ca699 r8fbef04  
    141141        return state
    142142
    143     def make_null_experiment(self, pid, eid, tmpdir, gid=None):
     143    def make_null_experiment(self, pid, eid, tmpdir, gid=None, ns_str=None):
    144144        """
    145145        Create a null copy of the experiment so that we capture any logs there
    146146        if the modify fails.  Emulab software discards the logs from a failed
    147         startexp.
    148         """
     147        startexp.  If ns_str is given, use that to construct the null
     148        experiment.
     149        """
     150
     151        if ns_str is None:
     152            ns_str = self.null
    149153
    150154        if self.debug:
     
    157161                    'proj': pid,
    158162                    'exp': eid,
    159                     'nsfilestr': self.null,
     163                    'nsfilestr': ns_str,
    160164                    'batch': False,
    161165                    'idleswap': 0,
Note: See TracChangeset for help on using the changeset viewer.