qa: have kclient tests use new mount.ceph functionality

Now that the mount helper has the ability to discover mon addrs and
can scrape secrets from the keyring, take advantage of it and simplify
the KernelMount class.

Fixes: https://tracker.ceph.com/issues/41892
Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
Jeff Layton 2019-09-17 09:30:16 -04:00
parent 526ff7165e
commit 57f91d1550
2 changed files with 7 additions and 38 deletions

View File

@ -18,46 +18,21 @@ UMOUNT_TIMEOUT = 300
class KernelMount(CephFSMount):
def __init__(self, ctx, mons, test_dir, client_id, client_remote,
def __init__(self, ctx, test_dir, client_id, client_remote,
ipmi_user, ipmi_password, ipmi_domain):
super(KernelMount, self).__init__(ctx, test_dir, client_id, client_remote)
self.mons = mons
self.mounted = False
self.ipmi_user = ipmi_user
self.ipmi_password = ipmi_password
self.ipmi_domain = ipmi_domain
def write_secret_file(self, remote, role, keyring, filename):
"""
Stash the keyring in the filename specified.
"""
remote.run(
args=[
'adjust-ulimits',
'ceph-coverage',
'{tdir}/archive/coverage'.format(tdir=self.test_dir),
'ceph-authtool',
'--name={role}'.format(role=role),
'--print-key',
keyring,
run.Raw('>'),
filename,
],
timeout=(5*60),
)
def mount(self, mount_path=None, mount_fs_name=None):
self.setupfs(name=mount_fs_name)
log.info('Mounting kclient client.{id} at {remote} {mnt}...'.format(
id=self.client_id, remote=self.client_remote, mnt=self.mountpoint))
keyring = self.get_keyring_path()
secret = '{tdir}/ceph.data/client.{id}.secret'.format(tdir=self.test_dir, id=self.client_id)
self.write_secret_file(self.client_remote, 'client.{id}'.format(id=self.client_id),
keyring, secret)
self.client_remote.run(
args=[
'mkdir',
@ -70,8 +45,8 @@ class KernelMount(CephFSMount):
if mount_path is None:
mount_path = "/"
opts = 'name={id},secretfile={secret},norequire_active_mds'.format(id=self.client_id,
secret=secret)
opts = 'name={id},norequire_active_mds,conf={conf}'.format(id=self.client_id,
conf=self.config_path)
if mount_fs_name is not None:
opts += ",mds_namespace={0}".format(mount_fs_name)
@ -82,8 +57,10 @@ class KernelMount(CephFSMount):
'adjust-ulimits',
'ceph-coverage',
'{tdir}/archive/coverage'.format(tdir=self.test_dir),
'/sbin/mount.ceph',
'{mons}:{mount_path}'.format(mons=','.join(self.mons), mount_path=mount_path),
'/bin/mount',
'-t',
'ceph',
':{mount_path}'.format(mount_path=mount_path),
self.mountpoint,
'-v',
'-o',

View File

@ -72,13 +72,6 @@ def task(ctx, config):
test_dir = misc.get_testdir(ctx)
# Assemble mon addresses
remotes_and_roles = ctx.cluster.remotes.items()
roles = [roles for (remote_, roles) in remotes_and_roles]
ips = [remote_.ssh.get_transport().getpeername()[0]
for (remote_, _) in remotes_and_roles]
mons = misc.get_mons(roles, ips).values()
mounts = {}
for id_, remote in clients:
client_config = config.get("client.%s" % id_)
@ -90,7 +83,6 @@ def task(ctx, config):
kernel_mount = KernelMount(
ctx,
mons,
test_dir,
id_,
remote,