mirror of
https://github.com/ceph/ceph
synced 2024-12-18 09:25:49 +00:00
Merge pull request #13367 from tchaikov/wip-qa-jewel-x-singleton
test: Thrasher: update pgp_num of all expanded pools if not yet Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
148d48812c
@ -112,6 +112,7 @@ class Thrasher:
|
||||
self.logger = logger
|
||||
self.config = config
|
||||
self.revive_timeout = self.config.get("revive_timeout", 150)
|
||||
self.pools_to_fix_pgp_num = set()
|
||||
if self.config.get('powercycle'):
|
||||
self.revive_timeout += 120
|
||||
self.clean_wait = self.config.get('clean_wait', 0)
|
||||
@ -137,12 +138,13 @@ class Thrasher:
|
||||
self.config = dict()
|
||||
# prevent monitor from auto-marking things out while thrasher runs
|
||||
# try both old and new tell syntax, in case we are testing old code
|
||||
try:
|
||||
manager.raw_cluster_cmd('--', 'tell', 'mon.*', 'injectargs',
|
||||
'--mon-osd-down-out-interval 0')
|
||||
except Exception:
|
||||
manager.raw_cluster_cmd('--', 'mon', 'tell', '*', 'injectargs',
|
||||
'--mon-osd-down-out-interval 0')
|
||||
self.saved_options = {}
|
||||
first_mon = teuthology.get_first_mon(manager.ctx, self.config).split('.')
|
||||
opt_name = 'mon_osd_down_out_interval'
|
||||
self.saved_options[opt_name] = manager.get_config(first_mon[0],
|
||||
first_mon[1],
|
||||
opt_name)
|
||||
self._set_config('mon', '*', opt_name, 0)
|
||||
# initialize ceph_objectstore_tool property - must be done before
|
||||
# do_thrash is spawned - http://tracker.ceph.com/issues/18799
|
||||
if (self.config.get('powercycle') or
|
||||
@ -172,6 +174,18 @@ class Thrasher:
|
||||
if self.noscrub_toggle_delay:
|
||||
self.noscrub_toggle_thread = gevent.spawn(self.do_noscrub_toggle)
|
||||
|
||||
def _set_config(self, service_type, service_id, name, value):
|
||||
opt_arg = '--{name} {value}'.format(name=name, value=value)
|
||||
try:
|
||||
whom = '.'.join([service_type, service_id])
|
||||
self.ceph_manager.raw_cluster_cmd('--', 'tell', whom,
|
||||
'injectargs', opt_arg)
|
||||
except Exception:
|
||||
self.ceph_manager.raw_cluster_cmd('--', service_type,
|
||||
'tell', service_id,
|
||||
'injectargs', opt_arg)
|
||||
|
||||
|
||||
def cmd_exists_on_osds(self, cmd):
|
||||
allremotes = self.ceph_manager.ctx.cluster.only(\
|
||||
teuthology.is_type('osd', self.cluster)).remotes.keys()
|
||||
@ -515,18 +529,24 @@ class Thrasher:
|
||||
Increase the size of the pool
|
||||
"""
|
||||
pool = self.ceph_manager.get_pool()
|
||||
orig_pg_num = self.ceph_manager.get_pool_pg_num(pool)
|
||||
self.log("Growing pool %s" % (pool,))
|
||||
self.ceph_manager.expand_pool(pool,
|
||||
self.config.get('pool_grow_by', 10),
|
||||
self.max_pgs)
|
||||
if orig_pg_num < self.ceph_manager.get_pool_pg_num(pool):
|
||||
self.pools_to_fix_pgp_num.add(pool)
|
||||
|
||||
def fix_pgp_num(self):
|
||||
def fix_pgp_num(self, pool=None):
|
||||
"""
|
||||
Fix number of pgs in pool.
|
||||
"""
|
||||
pool = self.ceph_manager.get_pool()
|
||||
if pool is None:
|
||||
pool = self.ceph_manager.get_pool()
|
||||
self.log("fixing pg num pool %s" % (pool,))
|
||||
self.ceph_manager.set_pool_pgpnum(pool)
|
||||
if pool in self.pools_to_fix_pgp_num:
|
||||
self.pools_to_fix_pgp_num.remove(pool)
|
||||
|
||||
def test_pool_min_size(self):
|
||||
"""
|
||||
@ -839,6 +859,13 @@ class Thrasher:
|
||||
Scrubber(self.ceph_manager, self.config)
|
||||
self.choose_action()()
|
||||
time.sleep(delay)
|
||||
for pool in list(self.pools_to_fix_pgp_num):
|
||||
if self.ceph_manager.get_pool_pg_num(pool) > 0:
|
||||
self.fix_pgp_num(pool)
|
||||
self.pools_to_fix_pgp_num.clear()
|
||||
for opt, value in self.saved_options.iteritems():
|
||||
self._set_config('mon', '*', opt, value)
|
||||
self.saved_options.clear()
|
||||
self.all_up()
|
||||
|
||||
|
||||
@ -1235,7 +1262,7 @@ class CephManager:
|
||||
proc = self.admin_socket(service_type, service_id,
|
||||
args, check_status=False, stdout=stdout)
|
||||
if proc.exitstatus is 0:
|
||||
break
|
||||
return proc
|
||||
else:
|
||||
tries += 1
|
||||
if (tries * 5) > timeout:
|
||||
@ -1259,6 +1286,16 @@ class CephManager:
|
||||
return i
|
||||
assert False
|
||||
|
||||
def get_config(self, service_type, service_id, name):
|
||||
"""
|
||||
:param node: like 'mon.a'
|
||||
:param name: the option name
|
||||
"""
|
||||
proc = self.wait_run_admin_socket(service_type, service_id,
|
||||
['config', 'show'])
|
||||
j = json.loads(proc.stdout.getvalue())
|
||||
return j[name]
|
||||
|
||||
def set_config(self, osdnum, **argdict):
|
||||
"""
|
||||
:param osdnum: osd number
|
||||
|
Loading…
Reference in New Issue
Block a user