Beispiel #1
0
def patch_collection_volume() -> None:
    """Update the volume collection"""
    print("=============================================")
    print()
    show_svm()
    print()
    svm_name = input(
        "Enter the SVM from which the Volumes need to be listed:-")
    print()
    show_volume(svm_name)
    print()

    noofnames = int(
        input("Enter number of Volumes to be Updated [eg: int value:1,2,3] : "))
    volume_names = list(map(str, input(
        "\nEnter the Volume names to be updated [eg: aaa bbb ccc] : ").strip().split()))[:noofnames]
    volume_names_final = '|'.join([str(v) for v in volume_names])
    vol_state = input("Enter the new state of the Volume [offline/online]: ")
    print("Please ensure that the volumes are unmounted in case you are offlining.")
    page_size = min(len(volume_names_final) - 1, 1)

    try:
        Volume.patch_collection({"state": vol_state},
                                name=volume_names_final,
                                max_records=page_size)
        print(
            list(
                Volume.get_collection(
                    fields='state',
                    name=volume_names_final)))
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
Beispiel #2
0
def patch_collection_volume(api, apiuser, apipass):
    """Turn the given volumes off then on again"""
    print("=============================================")
    print()
    show_volume(api, apiuser, apipass)
    print()
    noofnames = int(
        input(
            "Enter number of Volumes to be Updated [eg: int value:1,2,3] : "))
    volume_names = list(
        map(
            str,
            input("\nEnter the Volume names to be updated [eg: aaa bbb ccc] : "
                  ).strip().split()))[:noofnames]
    volume_names_final = '|'.join([str(v) for v in volume_names])
    vol_state = input("Enter the new state of the Volume [offline/online]: ")
    page_size = min(len(volume_names_final) - 1, 1)

    try:
        Volume.patch_collection({"state": vol_state},
                                name=volume_names_final,
                                max_records=page_size)
        print(
            list(Volume.get_collection(fields='state',
                                       name=volume_names_final)))
    except NetAppRestError as e:
        print("HTTP Error Code is " % e.http_err_response.http_response.text)
        print("Exception caught :" + str(e))
    return