Ignore:
Timestamp:
Feb 10, 2010 11:26:38 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
8139a48
Parents:
43649f1
Message:

move the startcmd into the first lop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r43649f1 r35aa3ae  
    943943        t = topo.clone()
    944944
    945         # Weed out the things we aren't going to instantiate: Segments, portal
    946         # substrates, and portal interfaces.  (The copy in the for loop allows
    947         # us to delete from e.elements in side the for loop).
    948         for e in [e for e in t.elements]:
    949             if isinstance(e, topdl.Segment):
    950                 t.elements.remove(e)
    951             if isinstance(e, topdl.Computer):
    952                 e.interface = [i for i in e.interface \
    953                         if not i.get_attribute('portal') or \
    954                             i.get_attribute('dragon_vlan')]
    955         t.substrates = [ s.clone() for s in t.substrates ]
    956         t.incorporate_elements()
    957 
    958945        # The startcmds for master and slave testbeds
    959946        if master:
     
    964951            node_cmd = self.attrs.get('SlaveNodeStartCmd', 'bin/true')
    965952
    966         # Localize the software locations and add startcmds
    967         for e in t.elements:
     953        # Weed out the things we aren't going to instantiate: Segments, portal
     954        # substrates, and portal interfaces.  (The copy in the for loop allows
     955        # us to delete from e.elements in side the for loop).  While we're
     956        # touching all the elements, we also adjust paths from the original
     957        # testbed to local testbed paths and put the federation commands into
     958        # the start commands
     959        for e in [e for e in t.elements]:
     960            if isinstance(e, topdl.Segment):
     961                t.elements.remove(e)
     962            # Fix software paths
    968963            for s in getattr(e, 'software', []):
    969964                s.location = re.sub("^.*/", softdir, s.location)
    970965            if isinstance(e, topdl.Computer):
    971                 if e.get_attribute('portal'):
     966                if e.get_attribute('portal') and gate_cmd:
    972967                    # Portals never have a user-specified start command
    973968                    e.set_attribute('startup', gate_cmd)
    974                 else:
     969                elif node_cmd:
    975970                    if e.get_attribute('startup'):
    976971                        s.set_attribute('startup', "%s \\$USER '%s'" % \
     
    979974                        s.set_attribute('startup', node_cmd)
    980975
     976                # Remove portal interfaces that do not connect to DRAGON
     977                e.interface = [i for i in e.interface \
     978                        if not i.get_attribute('portal') or \
     979                            i.get_attribute('dragon_vlan')]
     980
     981        t.substrates = [ s.clone() for s in t.substrates ]
     982        t.incorporate_elements()
    981983
    982984        # Customize the ns2 output for local portal commands and images
Note: See TracChangeset for help on using the changeset viewer.