Beispiel #1
0
 def test_modify_pool(self):
     cli = t_rest()
     pool0 = UnityPool.get(cli=cli, _id='pool_30')
     resp = pool0.modify(name="new_name",
                         is_fastvp_enabled=True,
                         alert_threshold=80)
     assert_that(resp.is_ok(), equal_to(True))
Beispiel #2
0
 def test_create_nfs_share_async(self):
     pool = UnityPool.get(cli=t_rest(), _id='pool_5')
     nas_server = UnityNasServer.get(cli=t_rest(), _id='nas_6')
     job = UnityJob.create_nfs_share(
         cli=t_rest(), pool=pool, nas_server=nas_server,
         name='513dd8b0-2c22-4da0-888e-494d320303b6',
         size=4294967296)
     assert_that(JobStateEnum.COMPLETED, equal_to(job.state))
Beispiel #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))
Beispiel #4
0
 def test_disk_groups(self):
     cli = t_rest()
     pool0 = UnityPool.get(cli=cli, _id='pool_1')
     disk_groups = pool0.disk_groups
     assert_that(disk_groups, instance_of(dict))
     assert_that(len(disk_groups), equal_to(2))
     assert_that(disk_groups['dg_8'], instance_of(list))
     assert_that(disk_groups['dg_15'], instance_of(list))
     for key in disk_groups:
         for disk in disk_groups[key]:
             assert_that(disk, instance_of(UnityDisk))
Beispiel #5
0
 def test_create_nfs_share_failed(self):
     pool = UnityPool.get(cli=t_rest(), _id='pool_5')
     nas_server = UnityNasServer.get(cli=t_rest(), _id='nas_6')
     self.assertRaisesRegexp(
         ex.JobStateError,
         'Job State: FAILED.  Error Detail: ',
         UnityJob.create_nfs_share,
         cli=t_rest(), pool=pool, nas_server=nas_server,
         name='613dd8b0-2c22-4da0-888e-494d320303b7',
         size=4294967296,
         async=False)
Beispiel #6
0
 def test_create_move_session(self):
     cli = t_rest()
     lun = UnityLun.get(cli=cli, _id='sv_18')
     dest_pool = UnityPool.get(cli=cli, _id='pool_5')
     move_session = UnityMoveSession.create(cli=cli,
                                            source_storage_resource=lun,
                                            destination_pool=dest_pool,
                                            is_dest_thin=True,
                                            is_data_reduction_applied=True,
                                            priority=5)
     assert_that(move_session.id, equal_to('move_32'))
     assert_that(move_session.state, equal_to(MoveSessionStateEnum.RUNNING))
     assert_that(move_session.status,
                 equal_to(MoveSessionStatusEnum.INITIALIZING))
     assert_that(move_session.priority,
                 equal_to(MoveSessionPriorityEnum.HIGH))
Beispiel #7
0
    def get_details(self, pool_id, pool_name):
        """ Get storage pool details"""
        try:
            api_response = self.conn.get_pool(_id=pool_id, name=pool_name)
            details = api_response._get_properties()

            is_fast_vp_enabled = api_response._get_property_from_raw(
                'pool_fast_vp').is_schedule_enabled
            details['is_fast_vp_enabled'] = is_fast_vp_enabled

            details['size_free_with_unit'] = utils.\
                convert_size_with_unit(int(details['size_free']))

            details['size_subscribed_with_unit'] = utils.\
                convert_size_with_unit(int(details['size_subscribed']))

            details['size_total_with_unit'] = utils.\
                convert_size_with_unit(int(details['size_total']))

            details['size_used_with_unit'] = utils.\
                convert_size_with_unit(int(details['size_used']))

            details['snap_size_subscribed_with_unit'] = utils.\
                convert_size_with_unit(int(details['snap_size_subscribed']))

            details['snap_size_used_with_unit'] = utils.\
                convert_size_with_unit(int(details['snap_size_used']))

            pool_instance = UnityPool.get(self.conn._cli, details['id'])
            pool_tier_list = []
            pool_tier_list.append((pool_instance.tiers)._get_properties())
            pool_tier_dict = {}
            pool_tier_dict['UnityPoolTierList'] = pool_tier_list
            details['tiers'] = pool_tier_dict
            return details
        except Exception as e:
            error = str(e)
            check_list = ['not found', 'no attribute']
            if any(ele in error for ele in check_list):
                error_message = "pool details are not found"
                LOG.info(error_message)
                return None
            error_message = 'Get details of storage pool failed with ' \
                            'error: {0}'.format(str(e))
            LOG.error(error_message)
            self.module.fail_json(msg=error_message)
Beispiel #8
0
 def test_create_move_session_to_thick(self):
     cli = t_rest()
     lun = UnityLun.get(cli=cli, _id='sv_19')
     dest_pool = UnityPool.get(cli=cli, _id='pool_6')
     move_session = UnityMoveSession.create(cli=cli,
                                            source_storage_resource=lun,
                                            destination_pool=dest_pool,
                                            is_dest_thin=False,
                                            is_data_reduction_applied=False,
                                            priority=5)
     assert_that(move_session.id, equal_to('move_35'))
     assert_that(move_session.state,
                 equal_to(MoveSessionStateEnum.COMPLETED))
     assert_that(move_session.status,
                 equal_to(MoveSessionStatusEnum.INITIALIZING))
     assert_that(move_session.priority,
                 equal_to(MoveSessionPriorityEnum.NORMAL))
Beispiel #9
0
 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)
Beispiel #10
0
    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))
Beispiel #11
0
 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))