示例#1
0
def pause_mirror(session, mirror_id, return_type=None, **kwargs):
    """
    Pauses a mirror job.  This should only be initiated from the source VPSA.
    e.g. the mirror job ID should start with "srcjvpsa-".

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)

    path = '/api/mirror_jobs/{0}/pause.json'.format(mirror_id)

    return session.post_api(path=path, return_type=return_type, **kwargs)
示例#2
0
def get_snapshots(session, mirror_id, return_type=None, **kwargs):
    """
    Get all snapshots from mirror job

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)

    path = '/api/mirror_jobs/{0}/snapshots.json'.format(mirror_id)

    return session.post_api(path=path, return_type=return_type, **kwargs)
示例#3
0
def get_mirror(session, mirror_id, return_type=None, **kwargs):
    """
    Retrieves details for the specified mirror job configured on the VPSA.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        create_volume_mirror.  For example: 'srcjvpsa-00000001'.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)

    path = '/api/mirror_jobs/{0}.json'.format(mirror_id)

    return session.get_api(path=path, return_type=return_type, **kwargs)
示例#4
0
def break_mirror(session, mirror_id, return_type=None, **kwargs):
    """
    Breaks a mirror job.  This can be initiated from either the source or
    destination VPSA.  A broken mirror can be reconnected if all appropriate
    snapshots still exist on both systems to resume the relationship - this
    possibility can be ascertained by calling get_suggested_mirrors and
    issuing a resume_broken_mirror using the right information.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001' or
        'dstjvpsa-00000001'.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)

    path = '/api/mirror_jobs/{0}/break.json'.format(mirror_id)

    return session.post_api(path=path, return_type=return_type, **kwargs)
示例#5
0
def remove_mirror_snapshot_policy(session,
                                  mirror_id,
                                  policy_id,
                                  delete_snapshots,
                                  return_type=None,
                                  **kwargs):
    """
    Removes a snapshot policy from an existing mirror job.  A mirror job must
    always have at least one snapshot policy attached.  This should only be
    initiated from the source VPSA.  e.g. the mirror job ID should start with
    "srcjvpsa-".

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type policy_id: str
    :param policy_id: The snapshot policy 'name' value as returned by
        get_all_snapshot_policies.  For example: 'policy-00000001'.  Required.

    :type delete_snapshots: str
    :param delete_snapshots: If set to 'YES', all snapshots created by the
        specified policy will be deleted.  If 'NO', they won't.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)
    verify_policy_id(policy_id)
    delete_snapshots = verify_boolean(delete_snapshots, "delete_snapshots")

    body_values = {
        'policyname': policy_id,
        'delete_snapshots': delete_snapshots
    }

    path = '/api/mirror_jobs/{0}/detach_snapshot_policy.json'.format(mirror_id)

    return session.post_api(path=path,
                            body=body_values,
                            return_type=return_type,
                            **kwargs)
示例#6
0
def update_mirror_wan_optimization(session,
                                   mirror_id,
                                   wan_optimization,
                                   return_type=None,
                                   **kwargs):
    """
    Change the WAN optimization setting for a mirror job.  This should only be
    initiated from the source VPSA.  e.g. the mirror job ID should start with
    "srcjvpsa-".

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type wan_optimization: str
    :param wan_optimization: If set to 'YES', the mirror will attempt to
        reduce the amount of data needing to be synchronized to the remote
        side at the expense of more load on the source VPSA.  If set to 'NO',
        more data will be sent by the mirror with less load on the source
        VPSA.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)
    wan_optimization = verify_boolean(wan_optimization, "wan_optimization")

    path = '/api/mirror_jobs/{0}/set_wan_optimization.json'.format(mirror_id)

    body_values = {'wan_optimization': wan_optimization}

    return session.post_api(path=path,
                            body=body_values,
                            return_type=return_type,
                            **kwargs)
示例#7
0
def clone_mirror_job(session,
                     mirror_id,
                     snapshot_id,
                     clone_name,
                     return_type=None,
                     **kwargs):
    """
    Clone a mirror job's snapshot into a volume.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type snapshot_id: str
    :param snapshot_id: A snapshot's id.  Required.

    :type clone_name: str
    :param clone_name: The new cloned volume name.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)
    verify_snapshot_id(snapshot_id)

    body_values = {"snapshot": snapshot_id, 'clone_name': clone_name}

    path = '/api/mirror_jobs/{0}/clone_snapshot.json'.format(mirror_id)

    return session.post_api(path=path,
                            body=body_values,
                            return_type=return_type,
                            **kwargs)
示例#8
0
def add_mirror_snapshot_policy(session,
                               mirror_id,
                               policy_id,
                               return_type=None,
                               **kwargs):
    """
    Adds an additional snapshot policy to an existing mirror job.  This should
    only be initiated from the source VPSA.  e.g. the mirror job ID should
    start with "srcjvpsa-".

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type mirror_id: str
    :param mirror_id: The mirror job 'job_name' value as returned by
        get_all_mirrors.  For example: 'srcjvpsa-00000001'.  Required.

    :type policy_id: str
    :param policy_id: The snapshot policy 'name' value as returned by
        get_all_snapshot_policies.  For example: 'policy-00000001'.  Required.

    :type return_type: str
    :param return_type: If this is set to the string 'json', this function
        will return a JSON string.  Otherwise, it will return a Python
        dictionary.  Optional (will return a Python dictionary by default).

    :rtype: dict, str
    :returns: A dictionary or JSON data set as a string depending on
        return_type parameter.
    """
    verify_mirror_id(mirror_id)
    verify_policy_id(policy_id)

    body_values = {'policyname': policy_id}

    path = '/api/mirror_jobs/{0}/attach_snapshot_policy.json'.format(mirror_id)

    return session.post_api(path=path,
                            body=body_values,
                            return_type=return_type,
                            **kwargs)