actions.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:charm-glusterfs 作者: openstack 项目源码 文件源码
def enable_volume_quota():
    """
    Enable quotas on the volume
    """
    # Gather our action parameters
    vol = action_get("volume")
    usage_limit = action_get("usage-limit")
    parsed_usage_limit = int(usage_limit)
    path = action_get("path")
    # Turn quotas on if not already enabled
    quotas_enabled = volume.volume_quotas_enabled(vol)
    if quotas_enabled.is_err():
        action_fail("Enable quota failed: {}".format(quotas_enabled.value))
    if not quotas_enabled.value:
        try:
            volume.volume_enable_quotas(vol)
        except GlusterCmdException as e:
            action_fail("Enable quotas failed: {}".format(e))

    try:
        volume.volume_add_quota(vol, path, parsed_usage_limit)
    except GlusterCmdException as e:
        action_fail("Add quota failed: {}".format(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号