当前位置: 首页>>代码示例>>Python>>正文


Python errno.EDQUOT属性代码示例

本文整理汇总了Python中errno.EDQUOT属性的典型用法代码示例。如果您正苦于以下问题:Python errno.EDQUOT属性的具体用法?Python errno.EDQUOT怎么用?Python errno.EDQUOT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在errno的用法示例。


在下文中一共展示了errno.EDQUOT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: returns_sftp_error

# 需要导入模块: import errno [as 别名]
# 或者: from errno import EDQUOT [as 别名]
def returns_sftp_error(func):

    def wrapped(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except OSError as err:
            LOG.debug("Error calling %s(%s, %s): %s",
                      func, args, kwargs, err, exc_info=True)
            errno = err.errno
            if errno in {EACCES, EDQUOT, EPERM, EROFS}:
                return paramiko.SFTP_PERMISSION_DENIED
            if errno in {ENOENT, ENOTDIR}:
                return paramiko.SFTP_NO_SUCH_FILE
            return paramiko.SFTP_FAILURE
        except Exception as err:
            LOG.debug("Error calling %s(%s, %s): %s",
                      func, args, kwargs, err, exc_info=True)
            return paramiko.SFTP_FAILURE

    return wrapped 
开发者ID:carletes,项目名称:mock-ssh-server,代码行数:22,代码来源:sftp.py

示例2: test_maximum_size_enforced

# 需要导入模块: import errno [as 别名]
# 或者: from errno import EDQUOT [as 别名]
def test_maximum_size_enforced(self):
        """
        The maximum size specified for a filesystem is enforced by the ZFS
        implementation.  Attempts to write more data than the maximum size
        fail.
        """
        pool = build_pool(self)
        service = service_for_pool(self, pool)
        # 40 MiB is an arbitrary value for the maximum size which is
        # sufficiently smaller than the current test pool size of 100 MiB.
        # Note that at the moment the usable pool size (minus the internal
        # data and reservations) is about 60 MiB.
        maximum_size = 40 * 1024 * 1024
        volume = service.get(
            MY_VOLUME, size=VolumeSize(maximum_size=maximum_size))
        creating = pool.create(volume)

        def write_and_flush(file_object, data):
            file_object.write(data)
            file_object.flush()

        def created(filesystem):
            path = filesystem.get_path()
            # Try to write one byte more than the maximum_size of data.
            with path.child(b"ok").open("w") as fObj:
                chunk_size = 8 * 1024
                chunk = b"x" * chunk_size
                for _ in range(maximum_size / chunk_size):
                    fObj.write(chunk)
                fObj.flush()
                exception = self.assertRaises(
                    IOError, write_and_flush, fObj, b'x')
                self.assertEqual(exception.args[0], errno.EDQUOT)

        creating.addCallback(created)
        return creating 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:38,代码来源:test_filesystems_zfs.py

示例3: lzc_receive_translate_error

# 需要导入模块: import errno [as 别名]
# 或者: from errno import EDQUOT [as 别名]
def lzc_receive_translate_error(ret, snapname, fd, force, origin, props):
    if ret == 0:
        return
    if ret == errno.EINVAL:
        if not _is_valid_snap_name(snapname) and not _is_valid_fs_name(snapname):
            raise lzc_exc.NameInvalid(snapname)
        elif len(snapname) > MAXNAMELEN:
            raise lzc_exc.NameTooLong(snapname)
        elif origin is not None and not _is_valid_snap_name(origin):
            raise lzc_exc.NameInvalid(origin)
        else:
            raise lzc_exc.BadStream()
    if ret == errno.ENOENT:
        if not _is_valid_snap_name(snapname):
            raise lzc_exc.NameInvalid(snapname)
        else:
            raise lzc_exc.DatasetNotFound(snapname)
    if ret == errno.EEXIST:
        raise lzc_exc.DatasetExists(snapname)
    if ret == errno.ENOTSUP:
        raise lzc_exc.StreamFeatureNotSupported()
    if ret == errno.ENODEV:
        raise lzc_exc.StreamMismatch(_fs_name(snapname))
    if ret == errno.ETXTBSY:
        raise lzc_exc.DestinationModified(_fs_name(snapname))
    if ret == errno.EBUSY:
        raise lzc_exc.DatasetBusy(_fs_name(snapname))
    if ret == errno.ENOSPC:
        raise lzc_exc.NoSpace(_fs_name(snapname))
    if ret == errno.EDQUOT:
        raise lzc_exc.QuotaExceeded(_fs_name(snapname))
    if ret == errno.ENAMETOOLONG:
        raise lzc_exc.NameTooLong(snapname)
    if ret == errno.EROFS:
        raise lzc_exc.ReadOnlyPool(_pool_name(snapname))
    if ret == errno.EAGAIN:
        raise lzc_exc.SuspendedPool(_pool_name(snapname))

    raise lzc_exc.StreamIOError(ret) 
开发者ID:ClusterHQ,项目名称:pyzfs,代码行数:41,代码来源:_error_translation.py

示例4: __init__

# 需要导入模块: import errno [as 别名]
# 或者: from errno import EDQUOT [as 别名]
def __init__(self, code=None, msg='Unknown error'):
        super(XAttrMetadataError, self).__init__(msg)
        self.code = code
        self.msg = msg

        # Parsing code and msg
        if (self.code in (errno.ENOSPC, errno.EDQUOT)
                or 'No space left' in self.msg or 'Disk quota excedded' in self.msg):
            self.reason = 'NO_SPACE'
        elif self.code == errno.E2BIG or 'Argument list too long' in self.msg:
            self.reason = 'VALUE_TOO_LONG'
        else:
            self.reason = 'NOT_SUPPORTED' 
开发者ID:tvalacarta,项目名称:tvalacarta,代码行数:15,代码来源:utils.py

示例5: __init__

# 需要导入模块: import errno [as 别名]
# 或者: from errno import EDQUOT [as 别名]
def __init__(self, code=None, msg='Unknown error'):
        super(XAttrMetadataError, self).__init__(msg)
        self.code = code
        self.msg = msg

        # Parsing code and msg
        if (self.code in (errno.ENOSPC, errno.EDQUOT) or
                'No space left' in self.msg or 'Disk quota excedded' in self.msg):
            self.reason = 'NO_SPACE'
        elif self.code == errno.E2BIG or 'Argument list too long' in self.msg:
            self.reason = 'VALUE_TOO_LONG'
        else:
            self.reason = 'NOT_SUPPORTED' 
开发者ID:yasoob,项目名称:youtube-dl-GUI,代码行数:15,代码来源:utils.py


注:本文中的errno.EDQUOT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。