def test_create_filesystem_success(self): pool = UnityPool(_id='pool_1', cli=t_rest()) fs = pool.create_filesystem( 'nas_2', 'fs3', 3 * 1024 ** 3, proto=FSSupportedProtocolEnum.CIFS, tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH) assert_that(fs.get_id(), equal_to('fs_12'))
def test_create_lun_with_muitl_property(self): pool = UnityPool(_id='pool_1', cli=t_rest()) lun = pool.create_lun("LunName", 100, description="Hello World", is_thin=True, is_repl_dst=True, tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH) assert_that(lun, instance_of(UnityLun))
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))
def test_pool_fast_vp_properties(self): pool = UnityPool(_id='pool_1', cli=t_rest()) fast = pool.pool_fast_vp assert_that(fast.status, equal_to(FastVPStatusEnum.ACTIVE)) assert_that(fast.relocation_rate, equal_to(FastVPRelocationRateEnum.MEDIUM)) assert_that(fast.type, equal_to(PoolDataRelocationTypeEnum.SCHEDULED)) assert_that(fast.is_schedule_enabled, equal_to(True)) assert_that(str(fast.relocation_duration_estimate), equal_to('0:00:00')) assert_that(fast.size_moving_down, equal_to(0)) assert_that(fast.size_moving_up, equal_to(0)) assert_that(fast.size_moving_within, equal_to(0)) assert_that(fast.percent_complete, equal_to(0)) assert_that(fast.data_relocated, equal_to(0)) assert_that(str(fast.last_start_time), equal_to('2016-03-13 22:00:00+00:00')) assert_that(str(fast.last_end_time), equal_to('2016-03-14 06:00:00+00:00'))
def create_pool(self, name, raid_groups, description=None, **kwargs): """Create pool based on RaidGroupParameter. :param name: pool name :param raid_groups: a list of *RaidGroupParameter* :param description: pool description :param alert_threshold: Threshold at which the system will generate alerts about the free space in the pool, specified as a percentage. :param is_harvest_enabled: True - Enable pool harvesting for the pool. False - Disable pool harvesting for the pool. :param is_snap_harvest_enabled: True - Enable snapshot harvesting for the pool. False - Disable snapshot harvesting for the pool. :param pool_harvest_high_threshold: Pool used space high threshold at which the system will automatically starts to delete snapshots in the pool :param pool_harvest_low_threshold: Pool used space low threshold under which the system will automatically stop deletion of snapshots in the pool :param snap_harvest_high_threshold: Snapshot used space high threshold at which the system automatically starts to delete snapshots in the pool :param snap_harvest_low_threshold: Snapshot used space low threshold below which the system will stop automatically deleting snapshots in the pool :param is_fast_cache_enabled: True - FAST Cache will be enabled for this pool. False - FAST Cache will be disabled for this pool. :param is_fastvp_enabled: True - Enable scheduled data relocations for the pool. False - Disable scheduled data relocations for the pool. :param pool_type: PoolTypeEnum.TRADITIONAL - Create traditional pool. PoolTypeEnum.DYNAMIC - Create dynamic pool. (default) """ return UnityPool.create(self._cli, name=name, description=description, raid_groups=raid_groups, **kwargs)
def pool_modify(self, id, new_pool_name, pool_description, fast_cache, fast_vp): """ Modify attributes of storage pool """ pool_obj = UnityPool.get(self.conn._cli, id) try: pool_obj.modify(name=new_pool_name, description=pool_description, is_fast_cache_enabled=fast_cache, is_fastvp_enabled=fast_vp) new_storage_pool_details = self.get_details(pool_id=id, pool_name=None) LOG.info("Modification Successful") return new_storage_pool_details except Exception as e: if self.module.params['pool_id']: pool_identifier = self.module.params['pool_id'] else: pool_identifier = self.module.params['pool_name'] error_message = 'Modify attributes of storage pool {0} ' \ 'failed with error: {1}'.format(pool_identifier, str(e)) LOG.error(error_message) self.module.fail_json(msg=error_message)
def test_create_nfs_share_async_all_params(self): pool = UnityPool.get(cli=t_rest(), _id='pool_5') nas_server = UnityNasServer.get(cli=t_rest(), _id='nas_6') size = 3 * 1024**3 job = UnityJob.create_nfs_share( cli=t_rest(), pool=pool, nas_server=nas_server, name='513dd8b0-2c22-4da0-888e-494d320303b7', size=size, is_thin=True, tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH, default_access=NFSShareDefaultAccessEnum.READ_WRITE, min_security=NFSShareSecurityEnum.KERBEROS, no_access_hosts_string='Host_1', read_only_hosts_string='Host_2', read_write_hosts_string='Host_3', read_only_root_hosts_string='Host_5,Host_4', root_access_hosts_string='Host_6', anonymous_uid=10001, anonymous_gid=10002, export_option=20001) assert_that(JobStateEnum.COMPLETED, equal_to(job.state))
def test_migrate_lun_source_deduplicated_dest_not_supported(self): lun = UnityLun('sv_5620', cli=t_rest()) dest_pool = UnityPool('pool_5', cli=t_rest()) r = lun.migrate(dest_pool) assert_that(r, equal_to(False))
def test_migrate_lun_cancelled(self): lun = UnityLun('sv_2', cli=t_rest()) dest_pool = UnityPool('pool_8', cli=t_rest()) r = lun.migrate(dest_pool) assert_that(r, equal_to(False))
def test_migrate_lun_timeout(self): lun = UnityLun('sv_2', cli=t_rest()) dest_pool = UnityPool('pool_5', cli=t_rest()) assert_that( calling(lun.migrate).with_args(dest_pool, timeout=10), raises(UnityMigrationTimeoutException))
def test_migrate_lun_has_thin_clone(self): lun = UnityLun('sv_2', cli=t_rest()) dest_pool = UnityPool('pool_6', cli=t_rest()) r = lun.migrate(dest_pool) assert_that(r, equal_to(False))
def test_migrate_lun_pool_does_not_exist(self): lun = UnityLun('sv_2', cli=t_rest()) dest_pool = UnityPool('pool_does_not_exist', cli=t_rest()) assert_that( calling(lun.migrate).with_args(dest_pool), raises(UnityMigrationSourceDestNotExistsError))
def f(): cli = t_rest(version='5.0.0') pool = UnityPool('pool_1', cli=cli) pool.is_all_flash = False pool.create_lun('lun_3', is_thin=False, is_compression=True)
def test_create_lun_with_compression_enabled(self): pool = UnityPool(_id='pool_1', cli=t_rest(version='4.3')) lun = pool.create_lun("LunName", 100, is_compression=True) assert_that(lun, instance_of(UnityLun))
def test_create_lun_on_spb(self): pool = UnityPool(_id='pool_1', cli=t_rest()) sp = UnityStorageProcessor(_id='spb', cli=t_rest()) lun = pool.create_lun("LunName", 100, sp=sp) assert_that(lun, instance_of(UnityLun))
def test_properties(self): pool = UnityPool(_id='pool_1', cli=t_rest()) self.verify_pool_1(pool)
def test_create_vmfs(self): pool = UnityPool(_id='pool_1', cli=t_rest()) vmfs = pool.create_vmfs(vmfs_name="VMFS datastore", size_gb=100) assert_that(vmfs, instance_of(UnityLun))
def f(): cli = t_rest(version='5.0.0') pool = UnityPool('pool_1', cli=cli) pool.create_lun('lun_2', is_compression=False, is_advanced_dedup_enabled=True)
def f(): pool = UnityPool(_id='pool_1', cli=t_rest()) nas_server = UnityNasServer.get(cli=t_rest(), _id='nas_1') pool.create_nfs_share(nas_server, name='job_share_failed', size=1)
def test_delete_pool(self): cli = t_rest() pool = UnityPool.get(cli=cli, _id='pool_4') resp = pool.delete() assert_that(resp.is_ok(), equal_to(True))
def _inner(): UnityPool.create(cli=cli, name='duplicate_pool', description='Unity test pool.', raid_groups=raid_groups)
def test_create_lun(self): pool = UnityPool(_id='pool_1', cli=t_rest()) lun = pool.create_lun("LunName", 100) assert_that(lun, instance_of(UnityLun))
def test_migrate_compressed_lun_success(self): lun = UnityLun('sv_18', cli=t_rest()) dest_pool = UnityPool('pool_5', cli=t_rest()) r = lun.migrate(dest_pool) assert_that(r, equal_to(True))
def test_migrate_lun_source_compressed_dest_not_flash(self): lun = UnityLun('sv_18', cli=t_rest()) dest_pool = UnityPool('pool_4', cli=t_rest()) r = lun.migrate(dest_pool) assert_that(r, equal_to(False))
def test_is_compression_supported(self, unity_version, pool_id, is_all_flash, expected): cli = t_rest(unity_version) pool = UnityPool(_id=pool_id, cli=cli) pool.is_all_flash = is_all_flash assert_that(pool.is_compression_supported(), equal_to(expected))