Beispiel #1
0
def get_policy(vmdk_path):
    """
    Returns VSAN policy string for VSAN object backing <vmdk_path>
    Throws exception if the path is not found or it is not a VSAN object
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(OBJTOOL_GET_ATTR.format(uuid))
    if rc != 0:
        logging.warning("Failed to get policy for %s : %s", vmdk_path, out)
        return None
    policy = json.loads(out)['Policy']
    return policy
def get_policy(vmdk_path):
    """
    Returns VSAN policy string for VSAN object backing <vmdk_path>
    Throws exception if the path is not found or it is not a VSAN object
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(OBJTOOL_GET_ATTR.format(uuid))
    if rc != 0:
        logging.warning("Failed to get policy for %s : %s", vmdk_path, out)
        return None
    policy = json.loads(out)['Policy']
    return policy
def set_policy(vmdk_path, policy_string):
    """
    Sets policy for an object backing <vmdk_path> to <policy>.
    Returns True on success
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(
        OBJTOOL_SET_POLICY.format(uuid, policy_string))
    if rc != 0:
        logging.warning("Failed to set policy for %s : %s", vmdk_path, out)
        return False
    return True
def set_policy(vmdk_path, policy_string):
    """
    Sets policy for an object backing <vmdk_path> to <policy>.
    Returns True on success
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(OBJTOOL_SET_POLICY.format(uuid,
                                                            policy_string))
    if rc != 0:
        logging.warning("Failed to set policy for %s : %s", vmdk_path, out)
        return False
    return True
Beispiel #5
0
def set_policy(vmdk_path, policy_string):
    """
    Sets policy for an object backing <vmdk_path> to <policy>.
    Returns None on success else return the output error. This can be
    displayed at the client
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(
        OBJTOOL_SET_POLICY.format(uuid, policy_string))
    if rc != 0:
        logging.warning("Failed to set policy for %s : %s", vmdk_path, out)
        return out
    return None
def set_policy(vmdk_path, policy_string):
    """
    Sets policy for an object backing <vmdk_path> to <policy>.
    Returns None on success else return the output error. This can be
    displayed at the client
    """
    uuid = vmdk_ops.get_vsan_uuid(vmdk_path)
    rc, out = vmdk_ops.RunCommand(OBJTOOL_SET_POLICY.format(uuid,
                                                            policy_string))
    if rc != 0:
        logging.warning("Failed to set policy for %s : %s", vmdk_path, out)
        return out
    return None