blob: 942499476f816e3cf732b0704b298253c5f5bfeb [file] [log] [blame]
bkopilov1f161e52016-04-18 13:27:48 +03001# Copyright 2016 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.api.volume import base
Michał Dulkoad3c2d82017-02-02 13:41:28 +010017from tempest import config
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080018from tempest.lib import decorators
bkopilov1f161e52016-04-18 13:27:48 +030019
Michał Dulkoad3c2d82017-02-02 13:41:28 +010020CONF = config.CONF
21
bkopilov1f161e52016-04-18 13:27:48 +030022
Ken'ichi Ohmichie8afb8c2017-03-27 11:25:37 -070023class VolumePoolsAdminTestsJSON(base.BaseVolumeAdminTest):
zhuflfcfb31b2020-04-20 15:41:07 +080024 """Test getting volume pools by admin users"""
25
Michał Dulkoad3c2d82017-02-02 13:41:28 +010026 def _assert_pools(self, with_detail=False):
Masayuki Igawa2b960982017-06-05 11:16:59 +090027 cinder_pools = self.admin_scheduler_stats_client.list_pools(
lkuchlan1df80332016-11-30 16:24:27 +020028 detail=with_detail)['pools']
zhuflf045a522019-09-20 17:03:31 +080029 self.assertNotEmpty(cinder_pools, "no cinder pools listed.")
Michał Dulkoad3c2d82017-02-02 13:41:28 +010030 self.assertIn('name', cinder_pools[0])
31 if with_detail:
32 self.assertIn(CONF.volume.vendor_name,
33 [pool['capabilities']['vendor_name']
34 for pool in cinder_pools])
bkopilov1f161e52016-04-18 13:27:48 +030035
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080036 @decorators.idempotent_id('0248a46c-e226-4933-be10-ad6fca8227e7')
lkuchlan1df80332016-11-30 16:24:27 +020037 def test_get_pools_without_details(self):
zhuflfcfb31b2020-04-20 15:41:07 +080038 """Test getting volume pools without detail"""
Michał Dulkoad3c2d82017-02-02 13:41:28 +010039 self._assert_pools()
lkuchlan1df80332016-11-30 16:24:27 +020040
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080041 @decorators.idempotent_id('d4bb61f7-762d-4437-b8a4-5785759a0ced')
bkopilov1f161e52016-04-18 13:27:48 +030042 def test_get_pools_with_details(self):
zhuflfcfb31b2020-04-20 15:41:07 +080043 """Test getting volume pools with detail"""
Michał Dulkoad3c2d82017-02-02 13:41:28 +010044 self._assert_pools(with_detail=True)