Commit Graph

67 Commits

Author SHA1 Message Date
Patrick Donnelly
e2b39f6c8c
qa: avoid using sudo for regular test artifacts
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2021-07-01 10:56:10 -07:00
Rishabh Dave
1b34665741 qa/cephfs: don't take parameter cwd in _create_mntpt()
Accepting "cwd" as a parameter in _create_mntpt() methods was a mistake
that happened commit 5e71e9b065.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-03-10 12:04:41 +05:30
Rishabh Dave
5e71e9b065 qa/cephfs: move common and generic methods mount.py
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-03-05 10:03:12 +05:30
Rishabh Dave
21cbda91f1 qa/cephfs: refactor FuseMount.mount method
Make FuseMount.mount() such that it can LocalFuseMount can reuse it
instead of duplicating it. For this, move subtasks required for mounting
Ceph FS (like creating mountpoint directory) to a different method, so
that these methods can be overriden in LocalFuseMount as per
requirement.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-03-05 09:55:10 +05:30
Patrick Donnelly
3e5e03d4d2
qa: skip chdir for fuse_mount
The use of chdir will muck up the use of nsenter with valgrind:

    2021-03-03T02:13:49.897 DEBUG:teuthology.orchestra.run.smithi144:> sudo nsenter --net=/var/run/netns/ceph-ns--home-ubuntu-cephtest-mnt.0 cd /home/ubuntu/cephtest && sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage daemon-helper term env 'OPENSSL_ia32cap=~0x1000000000000000' valgrind --trace-children=no --child-silent-after-fork=yes '--soname-synonyms=somalloc=*tcmalloc*' --num-callers=50 --suppressions=/home/ubuntu/cephtest/valgrind.supp --xml=yes --xml-file=/var/log/ceph/valgrind/client.0.log --time-stamp=yes --vgdb=yes --exit-on-first-error=yes --error-exitcode=42 --tool=memcheck --leak-check=full --show-reachable=yes ceph-fuse -f --admin-socket '/var/run/ceph/$cluster-$name.$pid.asok' --id 0 /home/ubuntu/cephtest/mnt.0
    2021-03-03T02:13:49.899 DEBUG:teuthology.orchestra.run.smithi144:> sudo modprobe fuse
    2021-03-03T02:13:49.914 INFO:teuthology.orchestra.run:Running command with timeout 30
    2021-03-03T02:13:49.914 DEBUG:teuthology.orchestra.run.smithi144:> sudo mount -t fusectl /sys/fs/fuse/connections /sys/fs/fuse/connections
    2021-03-03T02:13:49.919 INFO:tasks.cephfs.fuse_mount.ceph-fuse.0.smithi144.stderr:nsenter: failed to execute cd: No such file or directory

It's not necessary to chdir at all to do the mount, so don't.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2021-03-03 09:30:21 -08:00
Patrick Donnelly
3681e3a1a8
qa: move get_valgrind_args to qa
This method is unused in the teuthology repo. The helper method better
belongs here where it is more easily modified.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2021-03-03 09:30:08 -08:00
Patrick Donnelly
8ebe66f362
Merge PR #39607 into master
* refs/pull/39607/head:
	qa/cephfs: check for Ceph FS before mounting
	qa/cephfs: remove parameter createfs from mount classes

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2021-02-24 10:34:29 -08:00
Rishabh Dave
db0b85b440 qa/cephfs: remove parameter createfs from mount classes
It's better to get rid of this paramter since it doesn't actually create
any new Ceph file system.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-02-20 15:32:52 +05:30
Sage Weil
c2d53135fd qa/tasks/cephfs/fuse_mount: pass admin_socket path
For ceph.py this comes from the ceph.conf.template, but it's not there
for cephadm.  Instead of inflicting this on the config inside the
container, just pass it to ceph-fuse incantation here.

Signed-off-by: Sage Weil <sage@newdream.net>
2021-02-01 10:50:33 -06:00
Xiubo Li
2f4980f394 qa: test_readahead add kernel client support
If the "ceph.cluster_fsid" and "ceph.client_id" vxattrs or the
"metric" debug file are not support yet, will assume the test
succeeds.

Fixes: https://tracker.ceph.com/issues/48053
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-12-18 09:07:26 +08:00
Patrick Donnelly
8e7a89009c
qa: remove redundant rmr
The mount.cleanup method will remove the mount point. This `rm -rf` will
always fail (with exit status 0).

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-10-13 10:16:40 -07:00
Patrick Donnelly
2432871a1b
qa: use null mode to prevent undesired changes to mountpoint
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-10-13 10:16:40 -07:00
Rishabh Dave
352a41d1b3 qa/cephfs: add tests for multi-FS auth tests
Add testsuite for testing authorization on Ceph cluster with multiple
file systems and enable it to be executable with Teuthology framework.

Also add helper methods required to setup the test environment for
multi-FS tests.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-09-11 18:02:48 +05:30
Rishabh Dave
9a36a0abd0 qa/cephfs: allow not aborting execution when mount command fails
This commit adds a new argument check_status to mount methods of
KernelMount, FuseMount, LocalKernelMount and LocalFuseMount. When value
of this argument is False, these methods would catch the
CommandFailedError exception and would return a tuple consisting of the
exception itself, and stdout and stderr of the mount command. This
allows reusing these mount methods while running negative tests for
commands.

The name "check_status" is selected so since teuthology's run() and
vstart_runner's run() use a variable with same name for the very same
purpose.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-09-10 17:10:51 +05:30
Rishabh Dave
07e493ffb5 qa/cephfs: allow reusing mount objects and add remount method
This commit introduces following two set of changes -

First, make client keyring path, mountpoint on host FS and CephFS and
CephFS's name attributes of the object representing the mount
and update all the mount object creation calls accordingly. Also,
rewrite all the mount object creation to use keyword arguments instead
of positional arguments to avoid mistakes, especially since a new
argument was added in this commit.

Second, add remount method to mount.py so that it's possible to unmount
safely, modify the attributes of the object representing the mount and
mount again based on new state of the object *in a single call*. The
method is placed in mount.py to avoid duplication.

This change has two leads to two more changes: upgrading interface of
mount() and mount_wait() and upgrading testsuites to adapt to these
change.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-09-10 17:10:51 +05:30
Patrick Donnelly
41d76856fa
Merge PR #35951 into master
* refs/pull/35951/head:
	qa/cephfs: set omit_sudo to False for wait_until_mounted() in...

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2020-07-13 11:10:00 -07:00
Rishabh Dave
aad0cfcb49 qa/cephfs: set omit_sudo to False for wait_until_mounted() in...
fuse_mount.py. This isn't critical at all to vstart_runner.py runs but
this patch must dramatically reduce the time it takes in case the
command fails with "permission denied" due to lack of superuser
privileges since in this case the command is re-run 9 more times, each
separated by a sleep for 5 seconds.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-07-07 09:45:28 +05:30
Kefu Chai
ee90f40905 qa/tasks/cephfs: drop py2 support
Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-07-05 10:58:28 +08:00
Patrick Donnelly
4636a1bda8
Merge PR #35664 into master
* refs/pull/35664/head:
	qa: add omit_sudo=False for commands ran with sudo

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
2020-06-25 14:31:33 -07:00
Kefu Chai
21ad5bf2eb qa/tasks/cephfs: flake8 fixes
Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-06-24 10:12:11 +08:00
Rishabh Dave
90727ee474 qa: add omit_sudo=False for commands ran with sudo
Commands that cleanup FUSE and kernel mount and that setup and
teardown/cleanup network namespaces are that ones that use sudo. Set
omit_sudo to False while running these commands.

Fixes: https://tracker.ceph.com/issues/46101
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-06-19 14:21:04 +05:30
Patrick Donnelly
62777f653d
qa: fix type error in stderr processing
Fixes: 422d736568bd4d92fdf380b07da0ccac46cf3efd
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-06-18 07:12:08 -07:00
Patrick Donnelly
3d75b5a55f
Merge PR #34839 into master
* refs/pull/34839/head:
	qa/cephfs: add FUSE module before running mount -t fusectl

Reviewed-by: Zheng Yan <zyan@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
2020-06-02 17:42:59 -07:00
Rishabh Dave
ea1432810c qa/cephfs: look for mountpoint in cmdline file
Look for self.mountpoint in the contents of /proc/<pid>/cmdline file
when finding asok file for the client so that vstart_runner.py won't end
up picking asok file for a client not created in current run.

This usually never happens so far because PID of newly created processes
is higher than that of previously created processes and list of asok
files returned by "glob.glob(asok_path)" in find_socket() is in
descending order of PIDs.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-06-01 23:53:02 +05:30
Rishabh Dave
2d7c32997b qa/cephfs: add FUSE module before running mount -t fusectl
Also, change timeout from 15 minutes to 30 seconds for the command
"mount -t fusectl xxx xxx" since 15 minutes is too much as per Zheng.

Fixes: https://tracker.ceph.com/issues/45304
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-05-22 15:26:37 +05:30
Patrick Donnelly
076d04654f
Merge PR #35062 into master
* refs/pull/35062/head:
	qa/tasks/cephfs/fuse_mount.py: retry when the admin socket is not ready

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Rishabh Dave <ridave@redhat.com>
2020-05-18 15:14:08 -07:00
Patrick Donnelly
5ea3a9a1f7
Merge PR #34951 into master
* refs/pull/34951/head:
	qa/cephfs: run() cleanup whether FS was mounted or not

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
2020-05-18 14:57:20 -07:00
Xiubo Li
422d736568 qa/tasks/cephfs/fuse_mount.py: retry when the admin socket is not ready
Fixes: https://tracker.ceph.com/issues/45552
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-05-14 22:00:35 -04:00
Rishabh Dave
e57c86fab3 qa/cephfs: run() cleanup whether FS was mounted or not
In case the mount command in mount() fails, it would still have created
the mountpoint and network namespace for the FS's mount. Therefore, run
cleanup() and cleanup_netns() in umount() and umount_wait() even when
self.mounted is set to False.

Also, move the call to cleanup_netns() in cleanup().

Fixes: https://tracker.ceph.com/issues/45430
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-05-14 10:06:21 +05:30
Michael Fritch
44bcee8d1a
qa/tasks: logger.warn() -> logger.warning()
logger.warn() is the same as logger.warning(), but was removed in py3.3

Signed-off-by: Michael Fritch <mfritch@suse.com>
2020-05-13 17:18:13 -06:00
Xiubo Li
211c3fbb4b qa/tasks/cephfs/fuse_mount: fix possible chmod 1777 error
INFO:teuthology.orchestra.run.smithi13a2:> (cd /home/ubuntu/cephtest && exec sudo chmod 1777 /home/ubuntu/cephtest/mnt.2)
INFO:teuthology.orchestra.run.smithi132.stderr:chmod: changing permissions of '/home/ubuntu/cephtest/mnt.2': Permission denied
DEBUG:teuthology.orchestra.run:got remote process result: 1

Here just wait and rety for 10 times.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-04-25 06:21:55 -04:00
Xiubo Li
0631342d10 qa/tasks/cephfs/mount: switch to StringIO to fix TypeErrors
TypeError: cannot use a string pattern on a bytes-like object

Fixes: https://tracker.ceph.com/issues/45175
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-04-23 20:55:35 -04:00
Gregory Farnum
6fae077e9e
Merge pull request #33576 from lxbsz/fuse
unshare-ns-mount: add isolating netns for mount helper support

Reviewed-by: Jeff Layton <jlayton@redhat.com>
2020-04-21 22:12:37 -07:00
Kefu Chai
c5bd318de6 qa/tasks/cephfs/fuse_mount.py: by python3 compatible
pass `StringIO()` to capture stdout whose value will be interpreted as a
string later on

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-04-20 19:55:09 +08:00
Gregory Farnum
b274265acd
Merge pull request #33711 from lxbsz/qa_umount_failed
qa/tasks/cephfs: umount the mountpoints when tearDown

Reviewed-by: Rishabh Dave <ridave@redhat.com>
2020-04-17 08:20:30 -07:00
Xiubo Li
8728da9c08 qa/cephfs/fuse-mount: do not use the 'stat' to check the mount state
If the network couldn't response due to some reasons, the 'stat' cmd
will stuck until the network recovery, the best case is it will stuck
forever.

Fixes: https://tracker.ceph.com/issues/44044
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-04-14 07:47:03 -04:00
Xiubo Li
f0c67256b9 qa/vstart_runner: add unsharing network namespace support
This will isolate the network namespace for each mount point with
a private ip address and iptables, etc.

For the kill() stuff it will just do DOWN the veth interface instead
of sending ipmi request for kernel mount and kill the fuse processes
for the fuse mount. This could avoid sending the socket FIN to the
ceph cluster.

Fixes: https://tracker.ceph.com/issues/44044
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-04-14 07:47:03 -04:00
Xiubo Li
95820bf48f qa/tasks/vstart_runner: use parent's umount methods
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-03-11 01:52:18 -04:00
Kyr Shatskyy
9f6c764f10 qa/tasks/cephfs: get rid of StringIO for py3
Use io.BytesIO and six.ensure_str for py3 compatibility

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
2020-03-06 10:19:55 +01:00
Patrick Donnelly
416a26e733
Merge PR #33636 into master
* refs/pull/33636/head:
	qa: add upgrade test for volume upgrade from legacy

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Ramana Raja <rraja@redhat.com>
2020-03-03 08:17:43 -08:00
Patrick Donnelly
0c8899c985
qa: add upgrade test for volume upgrade from legacy
This tests that volumes created using the ceph_volume_client.py library
continue to be accessible/function via the Nautilus/Octopus ceph-mgr
volumes plugin.

Fixes: https://tracker.ceph.com/issues/42723
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-03-02 20:27:15 -08:00
Patrick Donnelly
61681cffd2
Merge PR #33506 into master
* refs/pull/33506/head:
	client: add client_fs mount option support

Reviewed-by: Ramana Raja <rraja@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2020-03-02 16:58:02 -08:00
Xiubo Li
1a58e64299 client: add client_fs mount option support
"client_fs" is one alias for "client_mds_namespace=" and it will be
cleaner and be more user-friendly to use. "client_mds_namespace="
will be kept and backwards compatibility used.

Update the documents at the same time.

Fixes: https://tracker.ceph.com/issues/44212
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-02-27 19:30:31 -05:00
Yan, Zheng
261a456439 qa/cephfs: test case for auto reconnect after blacklisted
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Fixes: https://tracker.ceph.com/issues/42085
2020-01-15 15:43:17 +08:00
Sage Weil
1de47907c3 qa/tasks/cephfs/fuse_mount: use python3
Signed-off-by: Sage Weil <sage@redhat.com>
2019-12-18 17:13:57 -06:00
Thomas Bechtold
0127cd1e88 qa: Enable flake8 tox and fix failures
There were a couple of problems found by flake8 in the qa/
directory (most of them fixed now). Enabling flake8 during the usual
check runs hopefully avoids adding new issues in the future.

Signed-off-by: Thomas Bechtold <tbechtold@suse.com>
2019-12-12 10:21:01 +01:00
Patrick Donnelly
e8368d61be
Merge PR #29421 into master
* refs/pull/29421/head:
	qa/cephfs: add tests for ACLs
	qa/cephfs: allow running tests from xfstests-dev
	qa/tasks: add methods to get monitor's sockets
	qa/cephfs: don't crash if mountpoint dir is already deleted
	vstart_runner.py: set omit_sudo's default value to False
	qa/vstart_runner.py: fix get_keyring_path()
	qa/cephfs: don't abort if mountpoint is already present
	qa/cephfs: allow specifying mountpoint for kernel mounts
	qa/cephfs: allow specifying mountpoints for FUSE mounts
	qa/vstart_runner.py: allow specifying mountpoint for local FUSE mounts
	qa/mount.py: allow setting mountpoint
	qa/vstart_runner.py: add a method to create a temporary directory

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2019-12-05 13:25:03 -08:00
Patrick Donnelly
5a0fa12513
Merge PR #30553 into master
* refs/pull/30553/head:
	qa/tasks: check if fs mounted in umount_wait

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2019-11-20 15:31:33 -08:00
Rishabh Dave
af2a8eb24b qa/cephfs: don't crash if mountpoint dir is already deleted
Teuthology jobs crash due to this after the test and it's teardown has
run successfully.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 11:36:10 +05:30
Rishabh Dave
39a15d091f qa/cephfs: don't abort if mountpoint is already present
Instead, let the execution continue.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 11:36:10 +05:30