vmdk_ops.py 文件源码

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

项目:vsphere-storage-for-docker 作者: vmware 项目源码 文件源码
def validate_vsan_policy_name(policy_name, vmdk_path):
    """
    Ensure that the policy file exists
    """
    if not vsan_info.is_on_vsan(vmdk_path):
        raise ValidationError('Cannot use a VSAN policy on a non-VSAN datastore')

    if not vsan_policy.policy_exists(policy_name):
        err_msg = 'Policy {0} does not exist.'.format(policy_name)

        # If valid policies exist, append their names along with error message
        # for available policy names that can be used
        avail_policies = vsan_policy.get_policies()
        if avail_policies:
            avail_msg = ' Available policies are: {0}'.format(list(avail_policies.keys()))
            err_msg = err_msg + avail_msg
        raise ValidationError(err_msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号