示例#1
0
文件: awsfs.py 项目: adamcath/awsfs
    def __call__(self, op, *args):
        log.debug('-> %s %s', op, repr(args))
        try:
            ret = Operations.__call__(self, op, *args)
            log.debug('<- %s %s', op, repr(ret))
            return ret
        except FuseOSError as fuse_ex:
            # The lower-level code can log at a higher level if cares to
            log.debug('<- %s %d (%s)', op, fuse_ex.errno, fuse_ex.strerror)
            raise fuse_ex
        except BaseException as e:
            # For convenience, we let the lower-level code allow some
            # exceptions to bubble out. Process those now.
            fuse_ex, level = (None, None)
            try:
                (fuse_ex, level) = self.to_fuse_ex(e)
            except:
                log.fatal('<- %s failed to parse error. '
                          'Unmounting FS and crashing!',
                          op, exc_info=True)
                self.crash()

            if fuse_ex:
                log.log(level,
                        '<- %s %d (%s): %s: %s',
                        op, fuse_ex.errno, fuse_ex.strerror,
                        e.__class__.__name__, e.message or '-')
                raise fuse_ex
            else:
                # Crap, we didn't expect this kind of error.
                # Anything that made it out here is a programming error.
                # The wise choice is to dump core so we can debug post-mortem.
                log.fatal('<- %s resulted in an unrecoverable error. '
                          'Unmounting FS and crashing!',
                          op, exc_info=True)
                self.crash()
示例#2
0
 def __call__(self, op, path, *args):
     real_path = self._find_referent(path)
     logging.debug('calling %s with %s (%s) %s' % (op, path, real_path, str(args)))
     return Operations.__call__(self, op, real_path, *args)