def patch_snapshot() -> None:
    """Update Snapshot"""
    print("=============================================")
    print()
    vol_uuid = show_snapshot()
    print()
    print("=============================================")
    print("Please enter the following to update the required snapshot")

    snapshot_name = input("Enter the name of the snapshot to be updated:-")

    snapshot = Snapshot.find(vol_uuid, name=snapshot_name)
    snapbool = input("Would you like to update the name (y/n): ")
    if snapbool == 'y':
        snapname = input("Enter the name of the snapshot to be updated:-")
        snapshot.name = snapname
    combool = input("Would you like to update the comment (y/n): ")
    if combool == 'y':
        snapcom = input("Enter the comment of the snapshot to be updated:-")
        snapshot.comment = snapcom
    expirybool = input("Would you like to update the expiry date (y/n): ")
    if expirybool == 'y':
        snapexpiry = input(
            "Enter the expiry date of the snapshot to be updated (format:- 2019-02-04T19:00:00Z):-"
        )
        snapshot.expiry_time = snapexpiry

    try:
        if snapshot.patch(poll=True):
            print("Snapshot  %s Updated Successfully" % snapshot.name)
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))
Пример #2
0
def delete_snapshot() -> None:
    """Delete Snapshot"""

    print()
    print("The List of SVMs:-")
    show_svm()
    print()
    svm_name = input(
        "Enter the SVM from which the Volumes need to be listed:-")
    print()
    show_volume(svm_name)
    print()
    volume_name = input(
        "Enter the Volume from which the Snapshots need to be listed:-")
    print()
    vol_uuid = get_key_volume(svm_name, volume_name)
    show_snapshot(svm_name, volume_name)
    print()

    snapshotname = input(
        "Enter the name of the snapshot that needs to be Deleted:- ")

    try:
        snapshot = Snapshot.find(vol_uuid, name=snapshotname)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))

    try:
        if snapshot.delete(poll=True):
            print("Snapshot  %s has been deleted Successfully." %
                  snapshot.name)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
Пример #3
0
def patch_snapshot() -> None:
    """Update Snapshot"""
    print()
    print("The List of SVMs:-")
    show_svm()
    print()
    svm_name = input(
        "Enter the SVM from which the Volumes need to be listed:-")
    print()
    show_volume(svm_name)
    print()
    volume_name = input(
        "Enter the Volume from which the Snapshots need to be listed:-")
    print()
    vol_uuid = get_key_volume(svm_name, volume_name)
    show_snapshot(svm_name, volume_name)
    print()

    snapshot_name = input("Enter the name of the snapshot to be updated:-")

    snapshot = Snapshot.find(vol_uuid, name=snapshot_name)
    snapbool = input("Would you like to update the name (y/n): ")
    if snapbool == 'y':
        snapname = input("Enter the name of the snapshot to be updated:-")
        snapshot.name = snapname
    combool = input("Would you like to update the comment (y/n): ")
    if combool == 'y':
        snapcom = input("Enter the comment of the snapshot to be updated:-")
        snapshot.comment = snapcom
    expirybool = input("Would you like to update the expiry date (y/n): ")
    if expirybool == 'y':
        snapexpiry = input(
            "Enter the expiry date of the snapshot to be updated (format:- 2019-02-04T19:00:00Z):-"
        )
        snapshot.expiry_time = snapexpiry

    try:
        if snapshot.patch(poll=True):
            print("Snapshot  %s Updated Successfully" % snapshot.name)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
def delete_snapshot() -> None:
    """Delete Snapshot"""
    print("=============================================")
    print()
    vol_uuid = show_snapshot()
    print()
    print("=============================================")
    print("please enter the following the details to delete snapshot.")
    snapshotname = input(
        "Enter the name of the snapshot that needs to be Deleted:- ")

    try:
        snapshot = Snapshot.find(vol_uuid, name=snapshotname)
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))

    try:
        if snapshot.delete(poll=True):
            print("Snapshot  %s has been deleted Successfully." %
                  snapshot.name)
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))
Пример #5
0
def get_snapshot(volume, snapshot_name):
    return (Snapshot.find(volume.uuid, name=snapshot_name))