def test_get_and_delete_share_server(self):
        self.share, share_network = self._create_share_and_share_network()
        share_server_id = self.client.get_share(
            self.share['id'])['share_server_id']

        # Get share server
        server = self.client.get_share_server(share_server_id)
        expected_keys = (
            'id',
            'host',
            'status',
            'created_at',
            'updated_at',
            'share_network_id',
            'share_network_name',
            'project_id',
        )

        if utils.is_microversion_supported('2.49'):
            expected_keys += ('identifier', 'is_auto_deletable')

        for key in expected_keys:
            self.assertIn(key, server)

        self._delete_share_and_share_server(self.share['id'], share_server_id)
        self.client.delete_share_network(share_network['id'])
示例#2
0
    def test_update_share_type_quotas_positive(self, microversion):
        if not utils.is_microversion_supported(microversion):
            msg = "Microversion '%s' not supported." % microversion
            raise self.skipException(msg)

        # Get project quotas
        cmd = 'quota-show --tenant-id %s ' % self.project_id
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        p_quotas = output_parser.details(quotas_raw)

        # Define share type quotas
        st_custom_quotas = {
            'shares': _get_share_type_quota_values(p_quotas['shares']),
            'snapshots': _get_share_type_quota_values(p_quotas['snapshots']),
            'gigabytes': _get_share_type_quota_values(p_quotas['gigabytes']),
            'snapshot_gigabytes': _get_share_type_quota_values(
                p_quotas['snapshot_gigabytes']),
        }
        supports_share_replica_quotas = (
            api_versions.APIVersion(microversion) >= api_versions.APIVersion(
                REPLICA_QUOTAS_MICROVERSION))

        if supports_share_replica_quotas:
            st_custom_quotas['share_replicas'] = _get_share_type_quota_values(
                p_quotas['share_replicas']
            )
            st_custom_quotas['replica_gigabytes'] = (
                _get_share_type_quota_values(p_quotas['replica_gigabytes']))
            replica_params = (' --share-replicas %s '
                              '--replica-gigabytes %s') % (
                st_custom_quotas['share_replicas'],
                st_custom_quotas['replica_gigabytes'])

        # Update quotas for share type
        cmd = ('quota-update %s --share-type %s '
               '--shares %s --gigabytes %s --snapshots %s '
               '--snapshot-gigabytes %s') % (
                   self.project_id, self.st_id,
                   st_custom_quotas['shares'],
                   st_custom_quotas['gigabytes'],
                   st_custom_quotas['snapshots'],
                   st_custom_quotas['snapshot_gigabytes'])

        if supports_share_replica_quotas:
            cmd += replica_params
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas
        self._verify_current_st_quotas_equal_to(st_custom_quotas, microversion)

        # Reset share type quotas
        cmd = 'quota-delete --tenant-id %s --share-type %s' % (
            self.project_id, self.st_id)
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas after reset
        self._verify_current_st_quotas_equal_to(p_quotas, microversion)
示例#3
0
    def test_update_quotas_for_share_groups(self, microversion):
        if not utils.is_microversion_supported(microversion):
            msg = "Microversion '%s' not supported." % microversion
            raise self.skipException(msg)

        # Get default quotas
        cmd = 'quota-defaults'
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        default_quotas = output_parser.details(quotas_raw)

        # Get project quotas
        cmd = 'quota-show --tenant-id %s ' % self.project_id
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        p_quotas = output_parser.details(quotas_raw)

        # Define custom share group quotas for project
        p_custom_quotas = {
            'share_groups':
            -1 if int(p_quotas['share_groups']) != -1 else 999,
            'share_group_snapshots':
            -1 if int(p_quotas['share_group_snapshots']) != -1 else 999,
        }

        # Update share group quotas for project
        cmd = ('quota-update %s --share-groups %s '
               '--share-group-snapshots %s') % (
                   self.project_id,
                   p_custom_quotas['share_groups'],
                   p_custom_quotas['share_group_snapshots'],
               )
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas
        self._verify_current_quotas_equal_to(p_custom_quotas, microversion)

        # Reset quotas
        cmd = 'quota-delete --tenant-id %s --share-type %s' % (self.project_id,
                                                               self.st_id)
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas after reset
        self._verify_current_quotas_equal_to(default_quotas, microversion)

        # Return project quotas back
        cmd = ('quota-update %s --share-groups %s '
               '--share-group-snapshots %s') % (
                   self.project_id, p_quotas['share_groups'],
                   p_quotas['share_group_snapshots'])
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas after reset
        self._verify_current_quotas_equal_to(p_quotas, microversion)
    def test_update_quotas_for_share_groups(self, microversion):
        if not utils.is_microversion_supported(microversion):
            msg = "Microversion '%s' not supported." % microversion
            raise self.skipException(msg)

        # Get default quotas
        cmd = 'quota-defaults'
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        default_quotas = output_parser.details(quotas_raw)

        # Get project quotas
        cmd = 'quota-show --tenant-id %s ' % self.project_id
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        p_quotas = output_parser.details(quotas_raw)

        # Define custom share group quotas for project
        p_custom_quotas = {
            'share_groups': -1 if int(p_quotas['share_groups']) != -1 else 999,
            'share_group_snapshots': -1 if int(
                p_quotas['share_group_snapshots']) != -1 else 999,
        }

        # Update share group quotas for project
        cmd = ('quota-update %s --share-groups %s '
               '--share-group-snapshots %s') % (
            self.project_id,
            p_custom_quotas['share_groups'],
            p_custom_quotas['share_group_snapshots'],
        )
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas
        self._verify_current_quotas_equal_to(p_custom_quotas, microversion)

        # Reset quotas
        cmd = 'quota-delete --tenant-id %s --share-type %s' % (
            self.project_id, self.st_id)
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas after reset
        self._verify_current_quotas_equal_to(default_quotas, microversion)

        # Return project quotas back
        cmd = ('quota-update %s --share-groups %s '
               '--share-group-snapshots %s') % (
            self.project_id,
            p_quotas['share_groups'], p_quotas['share_group_snapshots'])
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify quotas after reset
        self._verify_current_quotas_equal_to(p_quotas, microversion)
    def test_get_and_delete_share_server(self):
        self.share, share_network = self._create_share_and_share_network()
        share_server_id = self.client.get_share(
            self.share['id'])['share_server_id']

        # Get share server
        server = self.client.get_share_server(share_server_id)
        expected_keys = (
            'id', 'host', 'status', 'created_at', 'updated_at',
            'share_network_id', 'share_network_name', 'project_id',
        )

        if utils.is_microversion_supported('2.49'):
            expected_keys += ('identifier', 'is_auto_deletable')

        for key in expected_keys:
            self.assertIn(key, server)

        self._delete_share_and_share_server(self.share['id'], share_server_id)
示例#6
0
    def test_update_share_type_quotas_positive(self, microversion):
        if not utils.is_microversion_supported(microversion):
            msg = "Microversion '%s' not supported." % microversion
            raise self.skipException(msg)

        # Get project quotas
        cmd = 'quota-show --tenant-id %s ' % self.project_id
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        p_quotas = output_parser.details(quotas_raw)

        # Define share type quotas
        st_custom_quotas = {
            'shares':
            _get_share_type_quota_values(p_quotas['shares']),
            'snapshots':
            _get_share_type_quota_values(p_quotas['snapshots']),
            'gigabytes':
            _get_share_type_quota_values(p_quotas['gigabytes']),
            'snapshot_gigabytes':
            _get_share_type_quota_values(p_quotas['snapshot_gigabytes']),
        }

        # Update quotas for share type
        cmd = ('quota-update %s --share-type %s '
               '--shares %s --gigabytes %s --snapshots %s '
               '--snapshot-gigabytes %s') % (
                   self.project_id, self.st_id, st_custom_quotas['shares'],
                   st_custom_quotas['gigabytes'],
                   st_custom_quotas['snapshots'],
                   st_custom_quotas['snapshot_gigabytes'])
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas
        self._verify_current_st_quotas_equal_to(st_custom_quotas, microversion)

        # Reset share type quotas
        cmd = 'quota-delete --tenant-id %s --share-type %s' % (self.project_id,
                                                               self.st_id)
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas after reset
        self._verify_current_st_quotas_equal_to(p_quotas, microversion)
    def test_update_share_type_quotas_positive(self, microversion):
        if not utils.is_microversion_supported(microversion):
            msg = "Microversion '%s' not supported." % microversion
            raise self.skipException(msg)

        # Get project quotas
        cmd = 'quota-show --tenant-id %s ' % self.project_id
        quotas_raw = self.admin_client.manila(cmd, microversion=microversion)
        p_quotas = output_parser.details(quotas_raw)

        # Define share type quotas
        st_custom_quotas = {
            'shares': _get_share_type_quota_values(p_quotas['shares']),
            'snapshots': _get_share_type_quota_values(p_quotas['snapshots']),
            'gigabytes': _get_share_type_quota_values(p_quotas['gigabytes']),
            'snapshot_gigabytes': _get_share_type_quota_values(
                p_quotas['snapshot_gigabytes']),
        }

        # Update quotas for share type
        cmd = ('quota-update %s --share-type %s '
               '--shares %s --gigabytes %s --snapshots %s '
               '--snapshot-gigabytes %s') % (
                   self.project_id, self.st_id,
                   st_custom_quotas['shares'],
                   st_custom_quotas['gigabytes'],
                   st_custom_quotas['snapshots'],
                   st_custom_quotas['snapshot_gigabytes'])
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas
        self._verify_current_st_quotas_equal_to(st_custom_quotas, microversion)

        # Reset share type quotas
        cmd = 'quota-delete --tenant-id %s --share-type %s' % (
            self.project_id, self.st_id)
        self.admin_client.manila(cmd, microversion=microversion)

        # Verify share type quotas after reset
        self._verify_current_st_quotas_equal_to(p_quotas, microversion)
示例#8
0
 def skip_if_microversion_not_supported(self, microversion):
     if not utils.is_microversion_supported(microversion):
         raise self.skipException("Microversion '%s' is not supported." %
                                  microversion)
示例#9
0
 def skip_if_microversion_not_supported(self, microversion):
     if not utils.is_microversion_supported(microversion):
         raise self.skipException(
             "Microversion '%s' is not supported." % microversion)