from teuthology.orchestra import run
from teuthology.contextutil import MaxWhileTries
-from tasks.cephfs.mount import CephFSMount
+from tasks.cephfs.mount import CephFSMount, UMOUNT_TIMEOUT
log = logging.getLogger(__name__)
-UMOUNT_TIMEOUT = 300
# internal metadata directory
DEBUGFS_META_DIR = 'meta'
super(KernelMount, self).__init__(ctx=ctx, test_dir=test_dir,
client_id=client_id, client_remote=client_remote,
client_keyring_path=client_keyring_path, hostfs_mntpt=hostfs_mntpt,
- cephfs_name=cephfs_name, cephfs_mntpt=cephfs_mntpt, brxnet=brxnet)
+ cephfs_name=cephfs_name, cephfs_mntpt=cephfs_mntpt, brxnet=brxnet,
+ client_config=client_config)
- self.client_config = client_config
- self.dynamic_debug = client_config.get('dynamic_debug', False)
- self.rbytes = client_config.get('rbytes', False)
+ if client_config.get('debug', False):
+ self.client_remote.run(args=["sudo", "bash", "-c", "echo 'module ceph +p' > /sys/kernel/debug/dynamic_debug/control"])
+ self.client_remote.run(args=["sudo", "bash", "-c", "echo 'module libceph +p' > /sys/kernel/debug/dynamic_debug/control"])
+
+ self.dynamic_debug = self.client_config.get('dynamic_debug', False)
+ self.rbytes = self.client_config.get('rbytes', False)
self.snapdirname = client_config.get('snapdirname', '.snap')
- self.syntax_style = client_config.get('syntax', 'v2')
+ self.syntax_style = self.client_config.get('syntax', 'v2')
self.inst = None
self.addr = None
self._mount_bin = ['adjust-ulimits', 'ceph-coverage', self.test_dir +\
'/archive/coverage', '/bin/mount', '-t', 'ceph']
- def mount(self, mntopts=[], check_status=True, **kwargs):
+ def mount(self, mntopts=None, check_status=True, **kwargs):
self.update_attrs(**kwargs)
self.assert_and_log_minimum_mount_details()
self.enable_dynamic_debug()
self.ctx[f'kmount_count.{self.client_remote.hostname}'] = kmount_count + 1
- self.mounted = True
+ self.gather_mount_info()
+
+ def gather_mount_info(self):
+ self.id = self._get_global_id()
+ self.get_global_inst()
+ self.get_global_addr()
def _run_mount_cmd(self, mntopts, check_status):
mount_cmd = self._get_mount_cmd(mntopts)
mountcmd_stdout, mountcmd_stderr = StringIO(), StringIO()
try:
- self.client_remote.run(args=mount_cmd, timeout=(30*60),
+ self.client_remote.run(args=mount_cmd, timeout=300,
stdout=mountcmd_stdout,
stderr=mountcmd_stderr, omit_sudo=False)
except CommandFailedError as e:
def _make_mount_cmd_old_or_new_style(self):
optd = {}
mnt_stx = ''
+
+ self.validate_subvol_options()
+
+ assert(self.cephfs_mntpt)
if self.syntax_style == 'v1':
mnt_stx = f':{self.cephfs_mntpt}'
if self.client_id:
self.cleanup()
return
+ if self.is_blocked():
+ self._run_umount_lf()
+ self.cleanup()
+ return
+
log.debug('Unmounting client client.{id}...'.format(id=self.client_id))
try:
cmd=['sudo', 'umount', self.hostfs_mntpt]
if force:
cmd.append('-f')
- self.client_remote.run(args=cmd, timeout=(15*60), omit_sudo=False)
+ self.client_remote.run(args=cmd, timeout=UMOUNT_TIMEOUT, omit_sudo=False)
except Exception as e:
log.debug('Killing processes on client.{id}...'.format(id=self.client_id))
self.client_remote.run(
args=['sudo', run.Raw('PATH=/usr/sbin:$PATH'), 'lsof',
run.Raw(';'), 'ps', 'auxf'],
- timeout=(15*60), omit_sudo=False)
+ timeout=UMOUNT_TIMEOUT, omit_sudo=False)
raise e
if self.dynamic_debug:
self.disable_dynamic_debug()
self.ctx[f'kmount_count.{self.client_remote.hostname}'] = kmount_count - 1
- self.mounted = False
self.cleanup()
- def umount_wait(self, force=False, require_clean=False, timeout=900):
+ def umount_wait(self, force=False, require_clean=False,
+ timeout=UMOUNT_TIMEOUT):
"""
Unlike the fuse client, the kernel client's umount is immediate
"""
raise
# force delete the netns and umount
- log.debug('Force/lazy unmounting on client.{id}...'.format(id=self.client_id))
- self.client_remote.run(args=['sudo', 'umount', '-f', '-l',
- self.mountpoint],
- timeout=(15*60), omit_sudo=False)
-
- self.mounted = False
+ self._run_umount_lf()
self.cleanup()
def wait_until_mounted(self):
Unlike the fuse client, the kernel client is up and running as soon
as the initial mount() function returns.
"""
- assert self.mounted
+ assert self.is_mounted()
def teardown(self):
super(KernelMount, self).teardown()
- if self.mounted:
+ if self.is_mounted():
self.umount()
def _get_debug_dir(self):
Look up the CephFS client ID for this mount, using debugfs.
"""
- assert self.mounted
+ assert self.is_mounted()
return self._get_global_id()