Beispiel #1
0
def make_volume(volume_name: str, vserver_name: str, aggr_name: str,
                net_path: str, volume_size: int) -> None:
    """Creates a new volume in a SVM"""

    data = {
        'name': volume_name,
        'svm': {
            'name': vserver_name
        },
        'aggregates': [{
            'name': aggr_name
        }],
        'size': volume_size,
        'nas': {
            'security_style': 'ntfs',
            'path': net_path
        }
    }

    volume = Volume(**data)

    try:
        volume.post()
        print("Volume %s created successfully" % volume.name)
    except NetAppRestError as err:
        print("Error: Volume was not created: %s" % err)
    return
Beispiel #2
0
# pip3 install netapp-ontap -i https://mirrors.aliyun.com/pypi/simple

# volume create with python
from netapp_ontap import config
from netapp_ontap.host_connection import HostConnection
from netapp_ontap.resources import Volume

config.CONNECTION = HostConnection('192.168.20.111',
                                   'admin',
                                   'netapp123',
                                   verify=False)
config.CONNECTION.verify = False

vol1 = input("input vol name: ")
size1 = int(input("input vol size[GB]: "))
size1 = int(size1 * 1024**3)

volume1 = Volume(name=vol1,
                 size=size1,
                 svm={'name': 'svm1'},
                 aggregates=[{
                     'name': 'aggr1_zw01'
                 }])

volume1.post()

print(f"{vol1} created successfully!")