예제 #1
0
def list_snapmirror() -> None:
    """List Snapmirror"""
    print("List of SnapMirror Relationships:")
    print("=================================")

    try:
        for snapmirrorrelationship in SnapmirrorRelationship.get_collection(
                fields="uuid"):
            print(snapmirrorrelationship.uuid)
            snapmirror1 = SnapmirrorRelationship.find(
                uuid=snapmirrorrelationship.uuid)
            print(snapmirror1.source.path)
            print(snapmirror1.destination.path)
            print(snapmirror1.state)
            print("-----------------------------")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
예제 #2
0
def delete_snapmirror() -> None:
    """Delete Snapmirror"""
    print("=============================================")
    print()
    show_snapmirror()

    snapmirror_uuid = input("Enter the UUID of the snapmirror to be deleted:-")
    snapmirrorrelationship = SnapmirrorRelationship.find(uuid=snapmirror_uuid)

    try:
        if snapmirrorrelationship.delete(poll=True):
            print("Snapmirror Relationship has been deleted Successfully.")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
예제 #3
0
def patch_snapmirror() -> None:
    """Update Snapmirror Relation"""
    print("=============================================")
    print()
    show_snapmirror()

    snapmirror_uuid = input("Enter the UUID of the snapmirror to be updated:-")
    snapmirrortransfer = SnapmirrorRelationship.find(uuid=snapmirror_uuid)
    snapchoice = input(
        "Enter the state to update?[snapmirrored/paused/broken_off/uninitialized/synchronizing] ")
    snapmirrortransfer.state = snapchoice
    try:
        if snapmirrortransfer.patch(poll=True):
            print("Snapmirror Relationship   Updated Successfully")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
예제 #4
0
def create_snapmirror() -> None:
    """Create snapmirror relationship"""
    print("===================")
    print("Please enter the following details:-")
    src_svm_name = input("Enter the Source SVM :-")
    src_vol_name = input("Enter the Source Volume :-")
    dst_svm_name = input("Enter the Destination SVM :-")
    dst_vol_name = input("Enter the Destination Volume :-")

    dataobj = {}
    src = src_svm_name + ":" + src_vol_name
    dst = dst_svm_name + ":" + dst_vol_name
    dataobj['source'] = {"path": src}
    dataobj['destination'] = {"path": dst}

    snapmirrorrelationship = SnapmirrorRelationship.from_dict(dataobj)

    try:
        if snapmirrorrelationship.post(poll=True):
            print("SnapmirrorRelationship  %s created Successfully")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))