blob: 744bc01b1c4a8d3ba1fc0535fe928e4c89987a56 [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):
Michał Dulkoad3c2d82017-02-02 13:41:28 +010024 def _assert_pools(self, with_detail=False):
Masayuki Igawa2b960982017-06-05 11:16:59 +090025 cinder_pools = self.admin_scheduler_stats_client.list_pools(
lkuchlan1df80332016-11-30 16:24:27 +020026 detail=with_detail)['pools']
zhuflf045a522019-09-20 17:03:31 +080027 self.assertNotEmpty(cinder_pools, "no cinder pools listed.")
Michał Dulkoad3c2d82017-02-02 13:41:28 +010028 self.assertIn('name', cinder_pools[0])
29 if with_detail:
30 self.assertIn(CONF.volume.vendor_name,
31 [pool['capabilities']['vendor_name']
32 for pool in cinder_pools])
bkopilov1f161e52016-04-18 13:27:48 +030033
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080034 @decorators.idempotent_id('0248a46c-e226-4933-be10-ad6fca8227e7')
lkuchlan1df80332016-11-30 16:24:27 +020035 def test_get_pools_without_details(self):
Michał Dulkoad3c2d82017-02-02 13:41:28 +010036 self._assert_pools()
lkuchlan1df80332016-11-30 16:24:27 +020037
Ken'ichi Ohmichi6b279c72017-01-27 18:26:59 -080038 @decorators.idempotent_id('d4bb61f7-762d-4437-b8a4-5785759a0ced')
bkopilov1f161e52016-04-18 13:27:48 +030039 def test_get_pools_with_details(self):
Michał Dulkoad3c2d82017-02-02 13:41:28 +010040 self._assert_pools(with_detail=True)