def flush_all_pg_stats(self):
self.flush_pg_stats(range(len(self.get_osd_dump())))
- def do_rados(self, remote, cmd, check_status=True):
+ def do_rados(self, cmd, pool=None, namespace=None, remote=None, **kwargs):
"""
Execute a remote rados command.
"""
+ if remote is None:
+ remote = self.controller
+
testdir = teuthology.get_testdir(self.ctx)
pre = [
'adjust-ulimits',
'--cluster',
self.cluster,
]
+ if pool is not None:
+ pre += ['--pool', pool]
+ if namespace is not None:
+ pre += ['--namespace', namespace]
pre.extend(cmd)
proc = remote.run(
args=pre,
wait=True,
- check_status=check_status
+ **kwargs
)
return proc
Threads not used yet.
"""
args = [
- '-p', pool,
'--num-objects', num_objects,
'-b', size,
'bench', timelimit,
]
if not cleanup:
args.append('--no-cleanup')
- return self.do_rados(self.controller, map(str, args))
+ return self.do_rados(map(str, args), pool=pool)
def do_put(self, pool, obj, fname, namespace=None):
"""
Implement rados put operation
"""
- args = ['-p', pool]
- if namespace is not None:
- args += ['-N', namespace]
- args += [
- 'put',
- obj,
- fname
- ]
+ args = ['put', obj, fname]
return self.do_rados(
- self.controller,
args,
- check_status=False
+ check_status=False,
+ pool=pool,
+ namespace=namespace
).exitstatus
def do_get(self, pool, obj, fname='/dev/null', namespace=None):
"""
Implement rados get operation
"""
- args = ['-p', pool]
- if namespace is not None:
- args += ['-N', namespace]
- args += [
- 'get',
- obj,
- fname
- ]
+ args = ['get', obj, fname]
return self.do_rados(
- self.controller,
args,
- check_status=False
+ check_status=False,
+ pool=pool,
+ namespace=namespace,
).exitstatus
def do_rm(self, pool, obj, namespace=None):
"""
Implement rados rm operation
"""
- args = ['-p', pool]
- if namespace is not None:
- args += ['-N', namespace]
- args += [
- 'rm',
- obj
- ]
+ args = ['rm', obj]
return self.do_rados(
- self.controller,
args,
- check_status=False
+ check_status=False,
+ pool=pool,
+ namespace=namespace
).exitstatus
def osd_admin_socket(self, osd_id, command, check_status=True, timeout=0, stdout=None):
import logging
import time
-from teuthology import misc as teuthology
-
log = logging.getLogger(__name__)
with manager.pool(pool, 1):
log.info("starting repair test type 2")
victim_osd = chooser(manager, pool, 0)
- first_mon = teuthology.get_first_mon(ctx, config)
- (mon,) = ctx.cluster.only(first_mon).remotes.keys()
# create object
log.info("doing put and setomapval")
manager.do_put(pool, 'file1', '/etc/hosts')
- manager.do_rados(mon, ['-p', pool, 'setomapval', 'file1',
- 'key', 'val'])
+ manager.do_rados(['setomapval', 'file1', 'key', 'val'], pool=pool)
manager.do_put(pool, 'file2', '/etc/hosts')
manager.do_put(pool, 'file3', '/etc/hosts')
manager.do_put(pool, 'file4', '/etc/hosts')
manager.do_put(pool, 'file5', '/etc/hosts')
- manager.do_rados(mon, ['-p', pool, 'setomapval', 'file5',
- 'key', 'val'])
+ manager.do_rados(['setomapval', 'file5', 'key', 'val'], pool=pool)
manager.do_put(pool, 'file6', '/etc/hosts')
# corrupt object
pool = 'rbd'
omap_key = 'key'
omap_val = 'val'
- manager.do_rados(mon, ['-p', pool, 'setomapval', obj_name,
- omap_key, omap_val])
+ manager.do_rados(['setomapval', obj_name, omap_key, omap_val], pool=pool)
# Update missing digests, requires "osd deep scrub update digest min age: 0"
pgnum = get_pgnum(pg)
manager.do_pg_scrub(pool, pgnum, 'deep-scrub')
manager.wait_for_clean()
# write some data
- p = manager.do_rados(mon, ['-p', 'rbd', 'bench', '--no-cleanup', '1',
- 'write', '-b', '4096'])
+ p = manager.do_rados(['bench', '--no-cleanup', '1', 'write', '-b', '4096'], pool='rbd')
log.info('err is %d' % p.exitstatus)
# wait for some PG to have data that we can mess with
osd = acting[0]
osd_remote, obj_path, obj_name = find_victim_object(ctx, pg, osd)
- manager.do_rados(mon, ['-p', 'rbd', 'setomapval', obj_name, 'key', 'val'])
+ manager.do_rados(['setomapval', obj_name, 'key', 'val'], pool='rbd')
log.info('err is %d' % p.exitstatus)
- manager.do_rados(mon, ['-p', 'rbd', 'setomapheader', obj_name, 'hdr'])
+ manager.do_rados(['setomapheader', obj_name, 'hdr'], pool='rbd')
log.info('err is %d' % p.exitstatus)
# Update missing digests, requires "osd deep scrub update digest min age: 0"