Changeset 57facae for fedd/federation


Ignore:
Timestamp:
Nov 29, 2011 4:28:34 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
22a1a77
Parents:
ab3d6c5
Message:

Put pmasters back into get_testbed_services - too much can go wrong the
other way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    rab3d6c5 r57facae  
    17451745    def get_testbed_services(self, req, testbeds):
    17461746        """
    1747         Parse the services section of the request into a dict mapping
    1748         testbed to lists of federated_service objects.  The dict maps all
    1749         exporters of services to those service objects.
    1750         """
     1747        Parse the services section of the request into two dicts mapping
     1748        testbed to lists of federated_service objects.  The first dict maps all
     1749        exporters of services to those service objects, the second maps
     1750        testbeds to service objects only for services requiring portals.
     1751        """
     1752        # We construct both dicts here because deriving the second is more
     1753        # comples than it looks - both the keys and lists can differ, and it's
     1754        # much easier to generate both in one pass.
    17511755        masters = { }
     1756        pmasters = { }
    17521757        for s in req.get('service', []):
    17531758            # If this is a service request with the importall field
     
    17761781                    if tb in masters: masters[tb].append(fser)
    17771782                    else: masters[tb] = [fser]
     1783
     1784                    if fser.portal:
     1785                        if tb in pmasters: pmasters[tb].append(fser)
     1786                        else: pmasters[tb] = [fser]
    17781787                else:
    17791788                    self.log.error('Testbed service does not have name " + \
    17801789                            "and importers')
    1781         return masters
     1790        return masters, pmasters
    17821791
    17831792    def generate_keys_and_hosts(self, tmpdir, expid, hosts, tbparams):
     
    20792088                        testbeds.append(tb)
    20802089
    2081             masters = self.get_testbed_services(req, testbeds)
    2082             # The exporters who need portals
    2083             pmasters = dict([(k, [s for s in l if s.portal] ) \
    2084                     for k, l in masters.items()])
     2090            masters, pmasters = self.get_testbed_services(req, testbeds)
    20852091            allocated = { }         # Testbeds we can access
    20862092            topo ={ }               # Sub topologies
Note: See TracChangeset for help on using the changeset viewer.