Changeset 8cab4c2


Ignore:
Timestamp:
Mar 4, 2012 6:45:19 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, master
Children:
6527d60
Parents:
2bb8b35
Message:

More improved logging

Location:
fedd/federation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/access.py

    r2bb8b35 r8cab4c2  
    784784        """
    785785
     786        self.log.info("RequestAccess called by %s" % fid)
    786787        # The dance to get into the request body
    787788        if req.has_key('RequestAccessRequestBody'):
     
    829830        checked and if valid, the state and cached certificate are destroyed.
    830831        """
     832        self.log.info("ReleaseAccess called by %s" % fid)
    831833        # The dance to get into the request body
    832834        if req.has_key('ReleaseAccessRequestBody'):
     
    871873            self.log.debug("[ReleaseAccess] Removing %s" % cf)
    872874            os.remove(cf)
     875            self.log.info("ReleaseAccess succeeded for %s" % fid)
    873876            return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
    874877        else:
  • fedd/federation/emulab_access.py

    r2bb8b35 r8cab4c2  
    241241            return rv
    242242
     243        self.log.info("RequestAccess called by %s" % fid)
    243244        # The dance to get into the request body
    244245        if req.has_key('RequestAccessRequestBody'):
     
    291292            f.close()
    292293        except EnvironmentError, e:
     294            self.log.info("RequestAccess failed for by %s: internal error" \
     295                    % fid)
    293296            raise service_error(service_error.internal,
    294297                    "Can't open %s/%s : %s" % (self.certdir, aid, e))
     298        self.log.debug('RequestAccess Returning allocation ID: %s' % allocID)
    295299        resp = self.build_access_response({ 'fedid': allocID } ,
    296300                pname, services, proof)
     
    298302
    299303    def ReleaseAccess(self, req, fid):
     304        self.log.info("ReleaseAccess called by %s" % fid)
    300305        # The dance to get into the request body
    301306        if req.has_key('ReleaseAccessRequestBody'):
     
    335340            self.log.debug("Removing %s" % cf)
    336341            os.remove(cf)
     342            self.log.info("ReleaseAccess succeeded for %s" % fid)
    337343            return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
    338344        else:
     
    811817        rv = None   # Return value from segment creation
    812818
     819        self.log.info("StartSegment called by %s" % fid)
    813820        try:
    814821            req = req['StartSegmentRequestBody']
     
    826833                with_proof=True)
    827834        if not access_ok:
     835            self.log.info("StartSegment for %s failed: access denied" % fid)
    828836            raise service_error(service_error.access, "Access denied")
    829837        else:
     
    852860            os.mkdir(softdir)
    853861        except EnvironmentError:
     862            self.log.info("StartSegment for %s failed: internal error" % fid)
    854863            raise service_error(service_error.internal, "Cannot create tmp dir")
    855864
     
    884893            rv = starter(self, ename, proj, user, expfile, tmpdir, gid=gid)
    885894        except service_error, e:
     895            self.log.info("StartSegment for %s failed: %s"  % (fid, e))
    886896            err = e
    887897        except:
    888898            t, v, st = sys.exc_info()
     899            self.log.info("StartSegment for %s failed: unexpected error:  %s" \
     900                    % (fid, v, traceback.extract_tb(st)))
    889901            err = service_error(service_error.internal, "%s: %s" % \
    890902                    (v, traceback.extract_tb(st)))
     
    895907
    896908        if rv:
     909            self.log.info("StartSegment for %s succeeded" % fid)
    897910            return self.finalize_experiment(starter, topo, aid, req['allocID'],
    898911                    proof)
     
    904917
    905918    def TerminateSegment(self, req, fid):
     919        self.log.info("TerminateSegment called by %s" % fid)
    906920        try:
    907921            req = req['TerminateSegmentRequestBody']
     
    934948
    935949        if not proj:
     950            self.log.info("TerminateSegment failed for %s: cannot find project"\
     951                    % fid)
    936952            raise service_error(service_error.internal,
    937953                    "Can't find project for %s" % aid)
     
    941957
    942958        if not user:
     959            self.log.info("TerminateSegment failed for %s: cannot find user"\
     960                    % fid)
    943961            raise service_error(service_error.internal,
    944962                    "Can't find creation user for %s" % aid)
    945963        if not ename:
     964            self.log.info(
     965                    "TerminateSegment failed for %s: cannot find experiment"\
     966                    % fid)
    946967            raise service_error(service_error.internal,
    947968                    "Can't find experiment name for %s" % aid)
     
    950971                cert=xmlrpc_cert)
    951972        stopper(self, user, proj, ename, gid, nonce)
     973        self.log.info("TerminateSegment succeeded for %s %s %s" % \
     974                (fid, proj, ename))
    952975        return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
    953976
    954977    def InfoSegment(self, req, fid):
     978        self.log.info("InfoSegment called by %s" % fid)
    955979        try:
    956980            req = req['InfoSegmentRequestBody']
     
    9831007
    9841008        if not proj:
     1009            self.log.info("InfoSegment failed for %s: cannot find project"% fid)
    9851010            raise service_error(service_error.internal,
    9861011                    "Can't find project for %s" % aid)
     
    9901015
    9911016        if not user:
     1017            self.log.info("InfoSegment failed for %s: cannot find user"% fid)
    9921018            raise service_error(service_error.internal,
    9931019                    "Can't find creation user for %s" % aid)
    9941020        if not ename:
     1021            self.log.info("InfoSegment failed for %s: cannot find exp"% fid)
    9951022            raise service_error(service_error.internal,
    9961023                    "Can't find experiment name for %s" % aid)
     
    9991026                cert=xmlrpc_cert)
    10001027        info(self, user, proj, ename)
     1028        self.log.info("InfoSegment gathered info for %s %s %s %s" % \
     1029                (fid, user, proj, ename))
    10011030        self.decorate_topology(info, topo)
    10021031        self.state_lock.acquire()
     
    10051034            self.write_state()
    10061035        self.state_lock.release()
     1036        self.log.info("InfoSegment updated info for %s %s %s %s" % \
     1037                (fid, user, proj, ename))
    10071038
    10081039        rv = {
     
    10101041                'proof': proof.to_dict(),
    10111042                }
     1043        self.log.info("InfoSegment succeeded info for %s %s %s %s" % \
     1044                (fid, user, proj, ename))
    10121045        if topo:
    10131046            rv['segmentdescription'] = { 'topdldescription' : topo.to_dict() }
     
    10241057                return None
    10251058
     1059        self.log.info("OperationSegment called by %s" % fid)
    10261060        try:
    10271061            req = req['OperationSegmentRequestBody']
     
    10351069                with_proof=True)
    10361070        if not access_ok:
     1071            self.log.info("OperationSegment failed for %s: access denied" % fid)
    10371072            raise service_error(service_error.access, "Access denied")
    10381073
     
    10421077
    10431078        if op is None :
     1079            self.log.info("OperationSegment failed for %s: no operation" % fid)
    10441080            raise service_error(service_error.req, "missing operation")
    10451081        elif targets is None:
     1082            self.log.info("OperationSegment failed for %s: no targets" % fid)
    10461083            raise service_error(service_error.req, "no targets")
    10471084
     
    10721109                cert=xmlrpc_cert)
    10731110        ops(self, op, ptargets, params, topo)
     1111        self.log.info("OperationSegment operated for %s" % fid)
    10741112       
    10751113        status.extend(ops.status)
     1114        self.log.info("OperationSegment succeed for %s" % fid)
    10761115
    10771116        return {
  • fedd/federation/experiment_control.py

    r2bb8b35 r8cab4c2  
    16611661            self.auth.save()
    16621662
    1663         access_ok, proof = self.auth.check_attribute(fid, 'new',
    1664                 with_proof=True)
     1663        try:
     1664            access_ok, proof = self.auth.check_attribute(fid, 'new',
     1665                    with_proof=True)
     1666        except service_error, e:
     1667            self.log.info("New experiment call for %s: access denied" % fid)
     1668            raise e
     1669
    16651670
    16661671        if not access_ok:
     
    19982003            raise service_error(service_error.req, "No request?")
    19992004
    2000         proof = self.check_experiment_access(fid, key)
     2005        try:
     2006            proof = self.check_experiment_access(fid, key)
     2007        except service_error, e:
     2008            self.log.info("vtopo call failed for %s: access denied" %  fid)
     2009            raise e
    20012010
    20022011        self.state_lock.acquire()
     
    20532062            raise service_error(service_error.req, "No request?")
    20542063
    2055         proof = self.check_experiment_access(fid, key)
     2064        try:
     2065            proof = self.check_experiment_access(fid, key)
     2066        except service_error, e:
     2067            self.log.info("vis call failed for %s: access denied" %  fid)
     2068            raise e
    20562069
    20572070        self.state_lock.acquire()
     
    21552168            self.auth.save()
    21562169
    2157         # Make sure that the caller can talk to us
    2158         proof = self.check_experiment_access(fid, key)
     2170        try:
     2171            # Make sure that the caller can talk to us
     2172            proof = self.check_experiment_access(fid, key)
     2173        except service_error, e:
     2174            self.log.info("Create experiment call failed for %s: access denied"\
     2175                    % fid)
     2176            raise e
     2177
    21592178
    21602179        # Install the testbed map entries supplied with the request into a copy
     
    23982417            raise service_error(service_error.req, "No request?")
    23992418
    2400         proof = self.check_experiment_access(fid, key)
     2419        try:
     2420            proof = self.check_experiment_access(fid, key)
     2421        except service_error, e:
     2422            self.log.info("Info call failed for %s: access denied" %  fid)
     2423
    24012424
    24022425        self.update_info(key, fresh)
     
    24982521            else: return None
    24992522
     2523        self.log.info("Operation call started for %s" %  fid)
    25002524        req = req.get('OperationRequestBody', None)
    25012525        if not req:
     
    25222546            raise service_error(service_error.req, "No request?")
    25232547
    2524         proof = self.check_experiment_access(fid, key)
     2548        try:
     2549            proof = self.check_experiment_access(fid, key)
     2550        except service_error, e:
     2551            self.log.info("Operation call failed for %s: access denied" %  fid)
     2552            raise e
     2553
    25252554        self.state_lock.acquire()
    25262555        if key in self.state:
     
    25342563
    25352564        if top is None:
     2565            self.log.info("Operation call failed for %s: not active" %  fid)
    25362566            raise service_error(service_error.partial, "No topology yet",
    25372567                    proof=proof)
     
    25582588                results)
    25592589
     2590        self.log.info("Operation call succeeded for %s" %  fid)
    25602591        return {
    25612592                'experiment': exp,
     
    27202751
    27212752        key = self.get_experiment_key(req, 'experiment')
    2722         proof = self.check_experiment_access(fid, key)
     2753        try:
     2754            proof = self.check_experiment_access(fid, key)
     2755        except service_error, e:
     2756            self.log.info(
     2757                    "Terminate experiment call failed for %s: access denied" \
     2758                            % fid)
     2759            raise e
    27232760        exp = req.get('experiment', False)
    27242761        force = req.get('force', False)
Note: See TracChangeset for help on using the changeset viewer.