def create_capacitypool_async(client, resource_group_name,
                              anf_account_name, capacitypool_name,
                              service_level, size, location, tags=None):

    capacitypool_body = CapacityPool(
        location=location,
        service_level=service_level,
        size=size)

    return client.pools.create_or_update(capacitypool_body,
                                         resource_group_name,
                                         anf_account_name,
                                         capacitypool_name).result()
Пример #2
0
def create_pool(client, rg=TEST_RG, acc_name=TEST_ACC_1, pool_name=TEST_POOL_1, location=LOCATION, pool_only=False):
    if not pool_only:
        create_account(client, rg, acc_name, location)

    pool_body = CapacityPool(service_level=SERVICE_LEVEL, size=DEFAULT_SIZE, location=location)
    pool = client.pools.begin_create_or_update(
        rg,
        acc_name,
        pool_name,
        pool_body
    ).result()

    return pool
Пример #3
0
def create_pool(cmd,
                client,
                account_name,
                pool_name,
                resource_group_name,
                location,
                size,
                service_level,
                tag=None):
    body = CapacityPool(service_level=service_level,
                        size=int(size),
                        location=location,
                        tags=generate_tags(tag))
    return client.create_or_update(body, resource_group_name, account_name,
                                   pool_name)
Пример #4
0
def create_pool(client,
                account_name,
                pool_name,
                resource_group_name,
                service_level,
                location,
                size,
                tags=None,
                qos_type=None):
    body = CapacityPool(service_level=service_level,
                        size=int(size) * tib_scale,
                        location=location,
                        tags=tags,
                        qos_type=qos_type)
    return client.begin_create_or_update(resource_group_name, account_name,
                                         pool_name, body)
Пример #5
0
def patch_pool(cmd,
               instance,
               location=None,
               size=None,
               service_level=None,
               tag=None):
    # put operation to update the record
    if size is not None:
        size = int(size)
    body = CapacityPool(service_level=service_level,
                        size=size,
                        location=location,
                        tags=generate_tags(tag))
    _update_mapper(instance, body,
                   ['location', 'service_level', 'size', 'tags'])
    return body
Пример #6
0
    def test_update_pool(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.service_level, "Premium")

        pool_body = CapacityPool(service_level="Standard",
                                 size=DEFAULT_SIZE,
                                 location=LOCATION)
        pool = self.client.pools.create_or_update(pool_body, TEST_RG,
                                                  TEST_ACC_1, TEST_POOL_1, {
                                                      'location': LOCATION
                                                  }).result()
        self.assertEqual(pool.service_level, "Standard")

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
 def create_azure_netapp_capacity_pool(self):
     """
         Create a capacity pool for the given Azure NetApp Account
         :return: None
     """
     capacity_pool_body = CapacityPool(
         location=self.parameters['location'],
         size=self.parameters['size'] * SIZE_POOL
     )
     try:
         self.client.pools.create_or_update(body=capacity_pool_body, resource_group_name=self.parameters['resource_group'],
                                            account_name=self.parameters['account_name'],
                                            pool_name=self.parameters['name'])
     except CloudError as error:
         self.module.fail_json(msg='Error creating capacity pool %s for Azure NetApp account %s: %s'
                                   % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
                               exception=traceback.format_exc())
def create_capacitypool_async(client,
                              resource_group_name,
                              anf_account_name,
                              capacitypool_name,
                              service_level,
                              size,
                              location,
                              tags=None):
    """Creates a capacity pool within an account

    Function that creates a Capacity Pool, capacity pools are needed to define
    maximum service level and capacity.

    Args:
        client (NetAppManagementClient): Azure Resource Provider
            Client designed to interact with ANF resources
        resource_group_name (string): Name of the resource group where the
            capacity pool will be created, it needs to be the same as the
            Account
        anf_account_name (string): Name of the Azure NetApp Files Account where
            the capacity pool will be created
        capacitypool_name (string): Capacity pool name
        service_level (string): Desired service level for this new capacity
            pool, valid values are "Ultra","Premium","Standard"
        size (long): Capacity pool size, values range from 4398046511104
            (4TiB) to 549755813888000 (500TiB)
        location (string): Azure short name of the region where resource will
            be deployed, needs to be the same as the account
        tags (object): Optional. Key-value pairs to tag the resource, default
            value is None. E.g. {'cc':'1234','dept':'IT'}

    Returns:
        CapacityPool: Returns the newly created capacity pool resource
    """

    capacitypool_body = CapacityPool(location=location,
                                     service_level=service_level,
                                     size=size,
                                     tags=tags)

    return client.pools.begin_create_or_update(resource_group_name,
                                               anf_account_name,
                                               capacitypool_name,
                                               capacitypool_body).result()
Пример #9
0
 def modify_azure_netapp_capacity_pool(self, modify):
     """
         Modify a capacity pool for the given Azure NetApp Account
         :return: None
     """
     capacity_pool_body = CapacityPool(
         location=self.parameters['location'],
         service_level=self.parameters['service_level'],
         size=self.parameters['size'] * SIZE_POOL)
     try:
         self.get_method('pools', 'update')(
             body=capacity_pool_body,
             resource_group_name=self.parameters['resource_group'],
             account_name=self.parameters['account_name'],
             pool_name=self.parameters['name'])
     except (CloudError, AzureError) as error:
         self.module.fail_json(
             msg=
             'Error modifying capacity pool %s for Azure NetApp account %s: %s'
             % (self.parameters['name'], self.parameters['account_name'],
                to_native(error)),
             exception=traceback.format_exc())