Changeset 5f96438


Ignore:
Timestamp:
Apr 7, 2010 11:14:49 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
c23684d
Parents:
73e7f5c
Message:

checkpoint for download - not tested

Location:
fedd/federation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r73e7f5c r5f96438  
    886886                "uri": uri,
    887887                }
    888         if 'service' in r:
     888        if 'service' in r:
     889            for s in r['service']:
     890                # Tag each service with the origin testbed
     891                if s.has_key('fedAttr'):
     892                    # The else connects with the for
     893                    for a in s['fedAttr']:
     894                        if a.get('attribute', None) == 'testbed'):
     895                            break
     896                    else:
     897                        s['fedAttr'].append({'attribute': 'testbed',
     898                            'value': tb})
     899                else:
     900                    s['fedAttr'] = [ {'attribute': 'testbed', 'value': tb} ]
    889901            services.extend(r['service'])
    890902
     
    16141626            testbeds = set([ a.value for e in top.elements \
    16151627                    for a in e.attribute \
    1616                     if a.attribute == 'testbed'] )
     1628                        if a.attribute == 'testbed'])
    16171629
    16181630            allocated = { }         # Testbeds we can access
     
    16201632            connInfo = { }          # Connection information
    16211633            services = [ ]
     1634            masters = { }           # testbeds exporting services
    16221635            self.get_access_to_testbeds(testbeds, access_user,
    16231636                    export_project, master, allocated, tbparams, services)
     1637
     1638            # After this masters will hold a set of services exported by each
     1639            # testbed
     1640            for s in services:
     1641                i = s.get('visibility', 'import')
     1642                if i == 'export':
     1643                    for a in s.get('fedAttr', []):
     1644                        if a.get('attribute', '') == 'testbed':
     1645                            tb = a.get('value', None)
     1646                            if tb:
     1647                                if masters.has_key(tb): masters[tb].add(s.name)
     1648                                else: masters[tb] = set([s.name])
     1649                            else:
     1650                                log.error('Testbed attribute with no value?')
     1651
     1652
    16241653            self.split_topology(top, topo, testbeds)
    16251654
     
    16581687            part = experiment_partition(self.auth, self.store_url, self.tbmap,
    16591688                    self.muxmax)
    1660             part.add_portals(top, topo, eid, master, tbparams, ip_allocator,
     1689            part.add_portals(top, topo, eid, masters, tbparams, ip_allocator,
    16611690                    connInfo, expid)
    16621691            # Now get access to the dynamic testbeds
  • fedd/federation/experiment_partition.py

    r73e7f5c r5f96438  
    5656
    5757
    58     def new_portal_node(self, st, dt, tbparams, master, eid, myname, desthost,
     58    def new_portal_node(self, st, dt, tbparams, masters, eid, myname, desthost,
    5959            portal_type, iface_desc=(), conn_type="ssh", conn_attrs=[],
    6060            expid=None):
     
    6363        be attached.
    6464        """
     65        seer_master = None
     66        for k, s in masters.items():
     67            if 'SEER' in s:
     68                seer_master = k
     69                break
     70
     71        if seer_master:
     72            mdomain = tbparams[seer_master].get('domain', '.example.com')
     73            mproject = tbparams[seer_master].get('project', 'project')
     74            muser = tbparams[seer_master].get('user', 'root')
     75            smbshare = tbparams[seer_master].get('smbshare', 'USERS')
     76        else:
     77            mdomain = '.example.com'
     78            mproject = 'project'
     79            muser = 'root'
     80            smbshare = 'USERS'
     81
    6582        dproject = tbparams[dt].get('project', 'project')
    6683        ddomain = tbparams[dt].get('domain', ".example.com")
    67         mdomain = tbparams[master].get('domain', '.example.com')
    68         mproject = tbparams[master].get('project', 'project')
    69         muser = tbparams[master].get('user', 'root')
    70         smbshare = tbparams[master].get('smbshare', 'USERS')
    71 
    72         if st == master or dt == master:
    73             active = ("%s" % (st == master))
     84
     85        if (st in masters and dt not in masters) or \
     86                ( st in masters and dt not in masters ):
     87            active = ("%s" % (st in masters))
    7488        else:
    7589            active = ("%s" % (st > dt))
     
    249263                        )
    250264
    251     def create_dragon_substrate(self, sub, topo, tbs, tbparams, master, eid,
     265    def create_dragon_substrate(self, sub, topo, tbs, tbparams, masters, eid,
    252266            connInfo, expid=None):
    253267        """
     
    263277
    264278
    265         mdomain = tbparams[master].get('domain', '.example.com')
    266         mproject = tbparams[master].get('project', 'project')
     279        seer_master = None
     280        for k, s in masters.items():
     281            if 'SEER' in s:
     282                seer_master = k
     283                break
     284
     285        if seer_master:
     286            mdomain = tbparams[seer_master].get('domain', '.example.com')
     287            mproject = tbparams[seer_master].get('project', 'project')
     288        else:
     289            mdomain = '.example.com'
     290            mproject = 'project'
     291
    267292        # dn is the number of previously created dragon nets.  This routine
    268293        # creates a net numbered by dn
     
    295320                # This may need another look, but only a service gateway will
    296321                # look at the active parameter, and these are only inserted to
    297                 # connect to the master.
    298                 active = "%s" % ( tb == master)
     322                # connect to a master.
     323                active = "%s" % ( tb in masters)
    299324                info = {
    300325                        'type': 'transit',
     
    332357        self.new_dragon_topo(dn, sub, topo, tbs, tbparams, connInfo, expid)
    333358
    334     def insert_internet_portals(self, sub, topo, tbs, tbparams, master, eid,
     359    def insert_internet_portals(self, sub, topo, tbs, tbparams, masters, eid,
    335360            segment_substrate, portals, connInfo, expid):
    336361        # More than one testbed is on this substrate.  Insert
     
    347372                sproject = tbparams[st].get('project', 'project')
    348373                dproject = tbparams[dt].get('project', 'project')
    349                 mproject = tbparams[master].get('project', 'project')
    350374                sdomain = tbparams[st].get('domain', ".example.com")
    351375                ddomain = tbparams[dt].get('domain', ".example.com")
    352                 mdomain = tbparams[master].get('domain', '.example.com')
    353                 muser = tbparams[master].get('user', 'root')
    354                 smbshare = tbparams[master].get('smbshare', 'USERS')
    355376                aid = tbparams[dt]['allocID']['fedid']
    356                 if st == master or dt == master:
    357                     active = ("%s" % (st == master))
     377
     378                seer_master = None
     379                for k, s in masters.items():
     380                    if 'SEER' in s:
     381                        seer_master = k
     382                        break
     383
     384                if seer_master:
     385                    mdomain = tbparams[seer_master].get('domain', '.example.com')
     386                    mproject = tbparams[seer_master].get('project', 'project')
     387                    muser = tbparams[seer_master].get('user', 'root')
     388                    smbshare = tbparams[seer_master].get('smbshare', 'USERS')
     389                else:
     390                    mdomain = '.example.com'
     391                    mproject = 'project'
     392                    muser = 'root'
     393                    smbshare = 'USERS'
     394
     395                if (st in masters  and dt not in masters) or \
     396                        (st not in masters and dt in masters):
     397                    active = ("%s" % (st in masters))
    358398                else:
    359399                    active = ("%s" %(st > dt))
     400
    360401                if not segment_substrate[st].has_key(dt):
    361402                    # Put a substrate and a segment for the connected
     
    404445                    desthost = "%stunnel%d" % (st.lower(), len(portals[st][dt]))
    405446
    406                     if dt == master or st == master: portal_type = "both"
     447                    if dt in masters or st in masters: portal_type = "both"
    407448                    else: portal_type = "experiment"
    408449
     
    415456                        )
    416457                    portal, info  =  self.new_portal_node(st, dt, tbparams,
    417                             master, eid, myname, desthost, portal_type,
     458                            masters, eid, myname, desthost, portal_type,
    418459                            infs, conn_type="ssh", conn_attrs=[], expid=expid)
    419460
     
    422463                    connInfo[st].append(info)
    423464
    424     def add_control_portal(self, st, dt, master, eid, topo, tbparams, connInfo, expid):
     465    def add_control_portal(self, st, dt, masters, eid, topo, tbparams, connInfo, expid):
    425466        # Add to the master testbed
    426467        tsubstrate, segment_element = \
     
    429470        desthost = "%stunnel" % st
    430471
    431         portal, info = self.new_portal_node(st, dt, tbparams, master,
     472        portal, info = self.new_portal_node(st, dt, tbparams, masters,
    432473                eid, myname, desthost, "control",
    433474                ((tsubstrate.name,(('portal','true'),)),), conn_type="ssh",
     
    441482        connInfo[st].append(info)
    442483
    443     def new_dragon_portal(self, st, dt, master, eid, myip, dip, idx,
     484    def new_dragon_portal(self, st, dt, masters, eid, myip, dip, idx,
    444485            substrate, tbparams, expid):
    445486        # Add to the master testbed
     
    447488        desthost = "%s" % ip_addr(dip)
    448489
    449         portal, info = self.new_portal_node(st, dt, tbparams, master,
     490        portal, info = self.new_portal_node(st, dt, tbparams, masters,
    450491                eid, myname, desthost, "control",
    451492                ((substrate.name,(
     
    456497        return portal
    457498
    458     def add_portals(self, top, topo, eid, master, tbparams, ip_allocator,
     499    def add_portals(self, top, topo, eid, masters, tbparams, ip_allocator,
    459500            connInfo, expid):
    460501        """
     
    483524                    all([tbparams[x].has_key('dragon') for x in tbs]):
    484525                self.create_dragon_substrate(s, topo, tbs, tbparams,
    485                         master, eid, connInfo, expid)
     526                        masters, eid, connInfo, expid)
    486527            else:
    487                 self.insert_internet_portals(s, topo, tbs, tbparams, master,
     528                self.insert_internet_portals(s, topo, tbs, tbparams, masters,
    488529                        eid, segment_substrate, portals, connInfo, expid)
    489530
    490         # Make sure that all the slaves have a control portal back to the
    491         # master.
     531        # Make sure that all the service importers have a control portal back
     532        # to the master for each service.
     533        #XXX you're here
    492534        for tb in [ t for t in tbparams.keys() if t != master ]:
    493535            if len([e for e in topo[tb].elements \
Note: See TracChangeset for help on using the changeset viewer.