Example #1
0
def list_qtree():
    """List Qtrees in a Volume"""
    print()
    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 Qtrees need to be listed:-")
    print()
    vol_uuid = get_key_volume(svm_name, volume_name)
    print()
    print("The List of Qtrees:-")
    print("====================")
    try:
        for qtree in Qtree.get_collection(**{"volume.uuid": vol_uuid}):
            print("Name:- %s  ID:- %s" % (qtree.name, qtree.id))
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
    return vol_uuid
Example #2
0
def show_qtree(svm_name, volume_name) -> None:
    """List Qtrees in a Volume"""
    vol_uuid = get_key_volume(svm_name, volume_name)
    print("The List of Qtrees:-")
    print("====================")
    try:
        for qtree in Qtree.get_collection(**{"volume.uuid": vol_uuid}):
            print("Name:- %s  ID:- %s" % (qtree.name, qtree.id))
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))
### Step 3 - Get & print details
# Volumes
print("--> Printing volume details")
print("{:<20}{:<25}{:<15}{:<15}".format("SVM", "Name", "Size", "Used"))
for volume in Volume.get_collection():
    volume.get()
    print("{:<20}{:<25}{:<15}{:<15}".format(volume.svm.name, volume.name,
                                            volume.size, volume.space.used))
print("")

# Qtrees
print("--> Printing qtree details")
print("{:<20}{:<10}{:<15}{:<35}".format("SVM", "Style", "Export Policy",
                                        "Path"))
for qtree in Qtree.get_collection():
    qtree.get()
    print("{:<20}{:<10}{:<15}{:<35}".format(qtree.svm.name,
                                            qtree.security_style,
                                            qtree.export_policy.name,
                                            qtree.path))
print("")

# CIFS Shares
print("--> Printing CIFS share details")
print("{:<20}{:<15}{:<35}".format("SVM", "Share", "Path"))
for cifsshare in CifsShare.get_collection():
    cifsshare.get()
    print("{:<20}{:<15}{:<35}".format(cifsshare.svm.name, cifsshare.name,
                                      cifsshare.path))
print("")