def delete_quotarule() -> None: """Delete Quota""" print("=============================================") print() show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() print() show_volume(svm_name) print() volume_name = input( "Enter the name of the volume for which the quota needs to be modified:- " ) print() option = input( "Would you like to update Quotas of Volume or Qtree [group/users/qtree]:- " ) if option == "users": users_name = input( "Enter the name of the user,s for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, users=users_name) except NetAppRestError as error: print("Exception caught :" + str(error)) if option == "qtree": show_qtree(svm_name, volume_name) qtree_name = input( "Enter the name of the qtree for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, qtree=qtree_name) except NetAppRestError as error: print("Exception caught :" + str(error)) if option == "group": group_name = input( "Enter the name of the group for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, group=group_name) except NetAppRestError as error: print("Exception caught :" + str(error)) print() try: if quotarule.delete(poll=True): print("Quota-Rule deleted Successfully") except NetAppRestError as error: print("Exception caught :" + str(error))
def patch_quotarule() -> None: """Update Quota""" print("=============================================") print() show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() print() show_volume(svm_name) print() volume_name = input( "Enter the name of the volume for which the quota needs to be modified:- " ) print() option = input( "Would you like to update Quotas of Volume or Qtree [group/users/qtree]:- " ) if option == "users": users_name = input( "Enter the name of the user,s for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, users=users_name) except NetAppRestError as error: print("Exception caught :" + str(error)) if option == "qtree": show_qtree(svm_name, volume_name) qtree_name = input( "Enter the name of the qtree for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, qtree=qtree_name) except NetAppRestError as error: print("Exception caught :" + str(error)) if option == "group": group_name = input( "Enter the name of the group for which the quota needs to be modified:- " ) try: quotarule = QuotaRule.find(svm=svm_name, volume=volume_name, group=group_name) except NetAppRestError as error: print("Exception caught :" + str(error)) print() spacechange = input("Would you like to change the space limits (y/n):- ") if spacechange == 'y': spahali = input("Enter the Space Hard-Limit:- ") spasoli = input("Enter the Space Soft-Limit:- ") quotarule.space = {"hard_limit": spahali, "soft_limit": spasoli} filechange = input("Would you like to change the file limits (y/n):- ") if filechange == 'y': fihali = input("Enter the File Hard-Limit:- ") fisoli = input("Enter the File Soft-Limit:- ") quotarule.files = {"hard_limit": fihali, "soft_limit": fisoli} try: if quotarule.patch(poll=True): print("Quota-Rule updated successfully") except NetAppRestError as error: print("Exception caught :" + str(error))