Пример #1
0
def policy_in_use(path, name):
    """
    Check if a policy is in use by a VMDK and return the name of the first VMDK
    using it if it is, None otherwise
    """
    for vmdk in vmdk_utils.list_vmdks(path):
        policy = kv_get_vsan_policy_name(os.path.join(path, vmdk))
        if policy == name:
            return vmdk
    return None
Пример #2
0
def policy_in_use(path, name):
    """
    Check if a policy is in use by a VMDK and return the name of the first VMDK
    using it if it is, None otherwise
    """
    for vmdk in vmdk_utils.list_vmdks(path):
        policy = kv_get_vsan_policy_name(os.path.join(path, vmdk))
        if policy == name:
            return vmdk
    return None
Пример #3
0
def list_volumes_and_policies():
    """ Return a list of vmdks and the policies in use"""
    vmdks_and_policies = []
    path = vsan_info.get_vsan_dockvols_path()
    if not path:
        return []

    for vmdk in vmdk_utils.list_vmdks(path):
        policy = kv_get_vsan_policy_name(os.path.join(path, vmdk))
        vmdks_and_policies.append({'volume': vmdk, 'policy': policy})
    return vmdks_and_policies
Пример #4
0
def list_volumes_and_policies():
    """ Return a list of vmdks and the policies in use"""
    vmdks_and_policies = []
    path = vsan_info.get_vsan_dockvols_path()
    if not path:
        return []

    for vmdk in vmdk_utils.list_vmdks(path):
        policy = kv_get_vsan_policy_name(os.path.join(path, vmdk))
        vmdks_and_policies.append({'volume': vmdk, 'policy': policy})
    return vmdks_and_policies
Пример #5
0
def listVMDK(path):
    """ returns a list of volume names (note: may be an empty list) """
    vmdks = vmdk_utils.list_vmdks(path)
    # fully qualified path
    return [{u'Name': vmdk_utils.strip_vmdk_extension(x),
             u'Attributes': {}} for x in vmdks]