コード例 #1
0
def create_aggregate_pycl(aggr_name: str, node_name: str, disk_count: int) -> None:
    """Create an aggregate on the specified node"""

    aggregate = Aggregate.from_dict({
    'node': {'name':node_name},
    'name': aggr_name,
    'block_storage': {'primary': {'disk_count': disk_count}}
    })

    try:
        aggregate.post()
        print("Aggregate %s created successfully" % aggregate.name)
    except NetAppRestError as err:
        print("Error: Aggregate was not created: %s" % err)
    return
コード例 #2
0
def create_aggregate() -> None:
    """ Create aggregate"""
    print("----------Create Aggregate-----------")
    print()
    show_node()
    node_name = input("Enter the name of the node name :- ")
    node_uuid = input("Enter the name of the node uuid :- ")
    print()
    show_disk()
    aggr_name = input("Enter the name of the Aggregate :- ")
    disk_count = input("Enter the Disk Count :- ")
    raid_size = input("Enter the RAID size :- ")
    raid_type = input("Enter the RAID type :- ")

    aggrobj = {
        "block_storage": {
            "mirror": {
                "enabled": "false"
            },
            "primary": {
                "checksum_style": "block",
                "disk_class": "performance",
                "disk_count": disk_count,
                "raid_size": raid_size,
                "raid_type": raid_type
            }
        },
        "name": aggr_name,
        "node": {
            "name": node_name,
            "uuid": node_uuid
        },
        "snaplock_type": "non_snaplock"
    }

    try:
        aggr = Aggregate.from_dict(aggrobj)
        if aggr.post(poll=True):
            print("Aggregate created successfully.")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))