Changeset 43649f1


Ignore:
Timestamp:
Feb 10, 2010 11:06:05 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
35aa3ae
Parents:
b4624b2
Message:

moved startcmd generation into the access controller where it belongs. About to neaten it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    rb4624b2 r43649f1  
    956956        t.incorporate_elements()
    957957
    958         if master: cmdname = 'MasterConnectorStartCmd'
    959         else:cmdname = 'SlaveConnectorStartCmd'
    960 
    961         # Localize the software locations and add
     958        # The startcmds for master and slave testbeds
     959        if master:
     960            gate_cmd = self.attrs.get('MasterConnectorStartCmd', '/bin/true')
     961            node_cmd = self.attrs.get('MasterNodeStartCmd', 'bin/true')
     962        else:
     963            gate_cmd = self.attrs.get('SlaveConnectorStartCmd', '/bin/true')
     964            node_cmd = self.attrs.get('SlaveNodeStartCmd', 'bin/true')
     965
     966        # Localize the software locations and add startcmds
    962967        for e in t.elements:
    963968            for s in getattr(e, 'software', []):
    964969                s.location = re.sub("^.*/", softdir, s.location)
    965             if isinstance(e, topdl.Computer) and e.get_attribute('portal'):
    966                 e.set_attribute('startup', self.attrs.get(cmdname))
     970            if isinstance(e, topdl.Computer):
     971                if e.get_attribute('portal'):
     972                    # Portals never have a user-specified start command
     973                    e.set_attribute('startup', gate_cmd)
     974                else:
     975                    if e.get_attribute('startup'):
     976                        s.set_attribute('startup', "%s \\$USER '%s'" % \
     977                                (node_cmd, e.get_attribute('startup')))
     978                    else:
     979                        s.set_attribute('startup', node_cmd)
    967980
    968981
     
    970983        filters = []
    971984
    972         if master: cmdname = 'MasterConnectorCmd'
    973         else:cmdname = 'SlaveConnectorCmd'
     985        # NB: these are extra commands issued for the node, not the startcmds
     986        if master: cmd = self.attrs.get('MasterConnectorCmd', '')
     987        else: cmd = self.attrs.get('SlaveConnectorCmd', '')
    974988
    975989        if self.attrs.has_key('dragon'):
     
    979993            add_filter = None
    980994
    981         if self.attrs.has_key(cmdname):
    982             filters.append(topdl.generate_portal_command_filter(
    983                 self.attrs.get(cmdname), add_filter=add_filter))
     995        if cmd:
     996            filters.append(topdl.generate_portal_command_filter(cmd,
     997                add_filter=add_filter))
    984998
    985999        if self.attrs.has_key('connectorImage'):
Note: See TracChangeset for help on using the changeset viewer.