Ignore:
Timestamp:
Mar 18, 2010 11:39:59 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
1627c3d
Parents:
bdf00d5
Message:

Handle replayed StartSegment? calls. SSL sometimes kills the response and this is needed to get the response to the controller w/o redoing the allocation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    rbdf00d5 rcd06678  
    12461246        """
    12471247
     1248        call_SetValue = service_caller('SetValue', log=self.log)
    12481249        for c in connInfo:
    12491250            for p in [ p for p in c.get('parameter', []) \
     
    12571258                                (k[k.index('/')+1:], ename, proj, self.domain)
    12581259                        req = { 'name': k, 'value': value }
    1259                         self.call_SetValue(surl, req, cf)
     1260                        call_SetValue(surl, req, cf)
    12601261                    else:
    12611262                        self.log.error("Bad export request: %s" % p)
     
    12651266                    if surl and k:
    12661267                        req = { 'name': k, 'value': self.ssh_port }
    1267                         self.call_SetValue(surl, req, cf)
     1268                        call_SetValue(surl, req, cf)
    12681269                    else:
    12691270                        self.log.error("Bad export request: %s" % p)
     
    13361337        if not self.auth.check_attribute(fid, auth_attr):
    13371338            raise service_error(service_error.access, "Access denied")
     1339        else:
     1340            # See if this is a replay of an earlier succeeded StartSegment -
     1341            # sometimes SSL kills 'em.  If so, replay the response rather than
     1342            # redoing the allocation.
     1343            self.state_lock.acquire()
     1344            retval = self.allocation[aid].get('started', None)
     1345            self.state_lock.release()
     1346            if retval:
     1347                self.log.warning("Duplicate StartSegment for %s: " % aid + \
     1348                        "replaying response")
     1349                return retval
     1350
     1351        # A new request.  Do it.
    13381352
    13391353        if req.has_key('segmentdescription') and \
     
    15011515            self.state_lock.acquire()
    15021516            logv = "".join(self.allocation[aid]['log'])
     1517            # It's possible that the StartSegment call gets retried (!).
     1518            # if the 'started' key is in the allocation, we'll return it rather
     1519            # than redo the setup.
     1520            self.allocation[aid]['started'] = {
     1521                    'allocID': req['allocID'],
     1522                    'allocationLog': logv,
     1523                    }
     1524            retval = self.allocation[aid]['started']
    15031525            self.state_lock.release()
    15041526
    1505             return { 'allocID': req['allocID'], 'allocationLog': logv }
     1527            return retval
    15061528        elif err:
    15071529            raise service_error(service_error.federant,
Note: See TracChangeset for help on using the changeset viewer.