Changeset fd07c48 for fedd/federation


Ignore:
Timestamp:
Jun 25, 2010 3:11:30 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
1027cf7
Parents:
e11f4e0
Message:

Add support for user-supplied testbed mappings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    re11f4e0 rfd07c48  
    815815        else: return None
    816816
    817     def get_access(self, tb, nodes, tbparam, access_user, masters):
     817    def get_access(self, tb, nodes, tbparam, access_user, masters, tbmap):
    818818        """
    819819        Get access to testbed through fedd and set the parameters for that tb
     
    835835                        "More than one project export is not supported")
    836836
    837         uri = self.tbmap.get(testbed_base(tb), None)
     837        uri = tbmap.get(testbed_base(tb), None)
    838838        if not uri:
    839839            raise service_error(service_error.server_config,
     
    971971                self.log.error("Bad attribute in response: %s" % a)
    972972
    973     def release_access(self, tb, aid, uri=None):
     973    def release_access(self, tb, aid, tbmap=None, uri=None):
    974974        """
    975975        Release access to testbed through fedd
    976976        """
    977977
    978         if not uri:
    979             uri = self.tbmap.get(tb, None)
     978        if not uri and tbmap:
     979            uri = tbmap.get(tb, None)
    980980        if not uri:
    981981            raise service_error(service_error.server_config,
     
    11151115    def allocate_resources(self, allocated, masters, eid, expid,
    11161116            tbparams, top, topo, tmpdir, alloc_log=None, log_collector=None,
    1117             attrs=None, connInfo={}):
     1117            attrs=None, connInfo={}, tbmap=None):
    11181118
    11191119        started = { }           # Testbeds where a sub-experiment started
     
    11221122        # XXX
    11231123        fail_soft = False
     1124
     1125        if tbmap is None: tbmap = { }
    11241126
    11251127        log = alloc_log or self.log
     
    11341136            tb_attrs = copy.copy(attrs)
    11351137            thread_pool.wait_for_slot()
    1136             uri = tbparams[tb].get('uri', \
    1137                     self.tbmap.get(testbed_base(tb), None))
     1138            uri = tbparams[tb].get('uri', tbmap.get(testbed_base(tb), None))
    11381139            base, suffix = split_testbed(tb)
    11391140            if suffix:
     
    12141215                # release the allocations
    12151216                for tb in tbparams.keys():
    1216                     self.release_access(tb, tbparams[tb]['allocID'],
    1217                             tbparams[tb].get('uri', None))
     1217                    self.release_access(tb, tbparams[tb]['allocID'], 
     1218                            tbmap=tbmap, uri=tbparams[tb].get('uri', None))
    12181219                # Remove the placeholder
    12191220                self.state_lock.acquire()
     
    14061407
    14071408    def get_access_to_testbeds(self, testbeds, access_user, allocated,
    1408             tbparams, masters):
     1409            tbparams, masters, tbmap):
    14091410        """
    14101411        Request access to the various testbeds required for this instantiation
     
    14141415        """
    14151416        for tb in testbeds:
    1416             self.get_access(tb, None, tbparams, access_user, masters)
     1417            self.get_access(tb, None, tbparams, access_user, masters, tbmap)
    14171418            allocated[tb] = 1
    14181419
     
    16101611        self.check_experiment_access(fid, key)
    16111612
     1613        # Install the testbed map entries supplied with the request into a copy
     1614        # of the testbed map.
     1615        tbmap = dict(self.tbmap)
     1616        for m in req.get('testbedmap', []):
     1617            if 'testbed' in m and 'uri' in m:
     1618                tbmap[m['testbed']] = m['uri']
     1619
    16121620        try:
    16131621            tmpdir = tempfile.mkdtemp(prefix="split-")
     
    17551763
    17561764            self.get_access_to_testbeds(testbeds, access_user, allocated,
    1757                     tbparams, masters)
     1765                    tbparams, masters, tbmap)
    17581766
    17591767            self.split_topology(top, topo, testbeds)
     
    17911799                    self.auth.set_attribute(asignee, "%s/%s" % (configpath, f))
    17921800
    1793             part = experiment_partition(self.auth, self.store_url, self.tbmap,
     1801            part = experiment_partition(self.auth, self.store_url, tbmap,
    17941802                    self.muxmax, self.direct_transit)
    17951803            part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator,
     
    18931901                args=(allocated, masters, eid, expid, tbparams,
    18941902                    top, topo, tmpdir, alloc_log, alloc_collector, attrs,
    1895                     connInfo),
     1903                    connInfo, tbmap),
    18961904                name=eid)
    18971905        t.start()
Note: See TracChangeset for help on using the changeset viewer.