def delete_initiator(cluster, headers_inc): """Delete Initiator Group""" print("=============================================") print() show_svm(cluster, headers_inc) print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() show_igroup(svm_name, cluster, headers_inc) igroup_name = input("Enter the Igroup name:- ") igroup_uuid = get_key_igroup(svm_name, igroup_name, cluster, headers_inc) url = "https://{}/api/protocols/san/igroups/{}".format( cluster, igroup_uuid) try: response = requests.delete(url, headers=headers_inc, verify=False) except requests.exceptions.HTTPError as err: print(str(err)) sys.exit(1) except requests.exceptions.RequestException as err: print(str(err)) sys.exit(1) url_text = response.json() if 'error' in url_text: print(url_text) sys.exit(1) print("Initiator Group has been deleted.")
def delete_igroup() -> None: """Delete Initiator Group.""" print("Delete Initiator Group.") print("=======================") print() show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() show_igroup(svm_name) igroup_name = input("Enter the Igroup name:- ") igroup_uuid = get_key_igroup(svm_name, igroup_name) try: igrp = Igroup.find(uuid=igroup_uuid) if igrp.delete(poll=True): print("Igroup has been deleted Successfully.") except NetAppRestError as error: print("Exception caught :" + str(error))
def patch_igroup() -> None: """Update Initiator Group""" print("Update Initiator Group.") print("=======================") print() show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() show_igroup(svm_name) igroup_name = input("Enter the Igroup name:- ") igroup_uuid = get_key_igroup(svm_name, igroup_name) print(igroup_uuid) initiator_name = input("Enter the Intiator name:- ") try: dictobj = {"igroup.uuid": igroup_uuid, "name": initiator_name} init = IgroupInitiator.from_dict(dictobj) init.post() except NetAppRestError as error: print("Exception caught :" + str(error))
def list_igroup() -> None: """Lists Initiator Group.""" show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() print("Getting Initiator Group Details") print("===============================") try: for igroup in Igroup.get_collection(**{"svm.name": svm_name}, fields="uuid"): print("Igroup Name = %s; Igroup UUID = %s" % (igroup.name, igroup.uuid)) except NetAppRestError as error: print("Exception caught :" + str(error)) igroup_name = input( "Enter the Igroup from which the Initiators need to be listed:-") igroup_uuid = get_key_igroup(svm_name, igroup_name) try: for ini in IgroupInitiator.get_collection(igroup_uuid): print("Initiator Name = %s " % (ini.name)) except NetAppRestError as error: print("Exception caught :" + str(error))