Ejemplo n.º 1
0
def create_pool_if_needed():
    env = get_env_yaml()
    pool_num = env['unity']['pools']['min_number']

    unity = get_unity_system(env['unity'])
    pools = unity.get_pool()
    pools = [p for p in pools]
    if len(pools) < pool_num:
        from storops.unity.resource.pool import RaidGroupParameter
        from storops.unity import enums
        LOG.info("Required number of pools is {}, actual is {} ".format(
            pool_num, len(pools)))
        for x in range(pool_num - len(pools)):
            pool_name = "snmp_pool_{}".format(x)
            dg = filter_disk_group(unity.get_disk_group())
            raid_groups = [
                RaidGroupParameter(dg.id, 2, enums.RaidTypeEnum.RAID10,
                                   enums.RaidStripeWidthEnum.BEST_FIT)
            ]
            new_pool = unity.create_pool(
                pool_name,
                raid_groups,
                description='Created for snmpagent-unity testing.')
            LOG.info("Created pool with ID: {}".format(new_pool.id))
            pools.append(new_pool)
            garbage.pools.append(new_pool)

    else:
        LOG.info("There are enough pools, expect={}, "
                 "actual={}, skipping creating pools".format(
                     pool_num, len(pools)))
    return pools
Ejemplo n.º 2
0
 def test_create_pool(self):
     cli = t_rest()
     disk_group = UnityDiskGroup.get(cli=cli, _id='dg_15')
     raid_group_0 = RaidGroupParameter(
         disk_group=disk_group,
         disk_num=3,
         raid_type=RaidTypeEnum.RAID5,
         stripe_width=RaidStripeWidthEnum.BEST_FIT)
     raid_groups = [raid_group_0]
     pool = UnityPool.create(cli=cli,
                             name='test_pool',
                             description='Unity test pool.',
                             raid_groups=raid_groups,
                             alert_threshold=15,
                             is_harvest_enabled=True,
                             is_snap_harvest_enabled=True,
                             pool_harvest_high_threshold=80,
                             pool_harvest_low_threshold=40,
                             snap_harvest_high_threshold=80,
                             snap_harvest_low_threshold=40,
                             is_fast_cache_enabled=True,
                             is_fastvp_enabled=True,
                             pool_type=StoragePoolTypeEnum.DYNAMIC)
     assert_that(pool.id, equal_to('pool_4'))
     assert_that(pool.pool_type, equal_to(StoragePoolTypeEnum.DYNAMIC))
     assert_that(pool.is_all_flash, equal_to(False))
Ejemplo n.º 3
0
 def test_extend_pool(self):
     cli = t_rest()
     raid_group_0 = RaidGroupParameter(
         disk_group='dg_8',
         disk_num=4,
         raid_type=RaidTypeEnum.RAID10,
         stripe_width=RaidStripeWidthEnum.BEST_FIT)
     raid_groups = [raid_group_0]
     pool0 = UnityPool.get(cli=cli, _id='pool_1')
     resp = pool0.modify(raid_groups=raid_groups)
     assert_that(resp.is_ok(), equal_to(True))
Ejemplo n.º 4
0
    def test_create_pool_name_in_use(self):
        cli = t_rest()
        raid_group_0 = RaidGroupParameter(
            disk_group='dg_15',
            disk_num=3, raid_type=RaidTypeEnum.RAID5,
            stripe_width=RaidStripeWidthEnum.BEST_FIT)
        raid_groups = [raid_group_0]

        def _inner():
            UnityPool.create(
                cli=cli, name='duplicate_pool',
                description='Unity test pool.',
                raid_groups=raid_groups)

        assert_that(_inner, raises(UnityPoolNameInUseError))
Ejemplo n.º 5
0
 def test_create_pool(self):
     unity = t_unity()
     disk_group = unity.get_disk_group(_id='dg_15')
     raid_group_0 = RaidGroupParameter(
         disk_group=disk_group,
         disk_num=3, raid_type=RaidTypeEnum.RAID5,
         stripe_width=RaidStripeWidthEnum.BEST_FIT)
     raid_groups = [raid_group_0]
     pool = unity.create_pool(
         name='test_pool', description='Unity test pool.',
         raid_groups=raid_groups, alert_threshold=15,
         is_harvest_enabled=True, is_snap_harvest_enabled=True,
         pool_harvest_high_threshold=80, pool_harvest_low_threshold=40,
         snap_harvest_high_threshold=80, snap_harvest_low_threshold=40,
         is_fast_cache_enabled=True, is_fastvp_enabled=True,
         pool_type=StoragePoolTypeEnum.DYNAMIC)
     assert_that(pool, instance_of(UnityPool))