Merge pull request #32519 from tchaikov/wip-qa-skip-if-no-pool

qa/tasks/ceph_manager: do not pick a pool is there is no pools

Reviewed-By: Neha Ojha <nojha@redhat.com>
This commit is contained in:
Kefu Chai 2020-01-10 21:33:32 +08:00 committed by GitHub
commit 14a138e676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -666,6 +666,8 @@ class OSDThrasher(Thrasher):
Increase the size of the pool
"""
pool = self.ceph_manager.get_pool()
if pool is None:
return
self.log("Growing pool %s" % (pool,))
if self.ceph_manager.expand_pool(pool,
self.config.get('pool_grow_by', 10),
@ -677,6 +679,8 @@ class OSDThrasher(Thrasher):
Decrease the size of the pool
"""
pool = self.ceph_manager.get_pool()
if pool is None:
return
_ = self.ceph_manager.get_pool_pg_num(pool)
self.log("Shrinking pool %s" % (pool,))
if self.ceph_manager.contract_pool(
@ -1877,7 +1881,8 @@ class CephManager:
Pick a random pool
"""
with self.lock:
return random.choice(self.pools.keys())
if self.pools:
return random.choice(self.pools.keys())
def get_pool_pg_num(self, pool_name):
"""