Commit Graph

88 Commits

Author SHA1 Message Date
Patrick Donnelly
facd7a59ae
Merge PR #39847 into master
* refs/pull/39847/head:
	qa/cephfs: don't expect "file exists" error for "mkdir -p"
	qa/cephfs: don't take parameter cwd in _create_mntpt()

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
2021-03-16 20:21:52 -07:00
Venky Shankar
cecc3a6982 test: add symbolic link synchronization test for cephfs-mirror
Fixes: http://tracker.ceph.com/issues/49711
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2021-03-12 03:53:42 -05:00
Rishabh Dave
60d5d7cf9c qa/cephfs: don't expect "file exists" error for "mkdir -p"
Get rid of try-except block in _create_mntpt() since "mkdir -p" doesn't
raise any error when the directory to be created already exists. Also,
use chmod command instead of mkdir command to set the permission mode on
directory since mkdir command would have no effect on the directory's
permission mode if the directory already exists.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-03-10 12:05:15 +05:30
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
Patrick Donnelly
1cbad56fd2
Merge PR #37711 into master
* refs/pull/37711/head:
	qa/cephfs: create class LocalCephFSMount
	vstart_runner: reuse FuseMount methods in LocalFuseMount
	vstart_runner: reuse KernelMount methods in LocalKernelMount
	qa/cephfs: move common and generic methods mount.py
	qa/cephfs: refactor FuseMount.mount method
	qa/cephfs: refactor KernelMount.mount method

Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2021-03-09 13:41:53 -08:00
Rishabh Dave
4d0f56fcc5 qa/cephfs: move is_blocklisted() to filesystem.CephCluster
Using self.fs.mon_manager in mount.py can lead to a crash since self.fs
can be None. Move is_blocklisted() to tasks.filesystem.CephCluster where
it can get access to mon_manager without depending on objects
representing Ceph FSs.

Fixes: https://tracker.ceph.com/issues/49511
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-03-06 09:11:36 +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
95eb0043bf qa/cephfs: check for Ceph FS before mounting
If the given Ceph FS, or the default Ceph FS when no Ceph FS is given,
is absent, abort the execution with AsssertionError and an error
message.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2021-02-24 19:10:52 +05:30
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
Venky Shankar
f81e8f1e88 test: add tests for mirroring module w/ daemon verification
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2021-01-19 01:08:10 -05: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
Xiubo Li
cf6797828a qa: add debug information for client address for kclient
Fixes: https://tracker.ceph.com/issues/48242
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-11-17 09:44:57 +08:00
Patrick Donnelly
0939625530
qa: avoid using ceph.dir.entries for empty check
This avoids a bug [1] in the kernel client.

[1] https://tracker.ceph.com/issues/48104

Fixes: https://tracker.ceph.com/issues/23718
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-11-03 15:43:04 -08:00
Patrick Donnelly
f8f607dbd1
qa: print debug info on mount cleanup
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-10-13 10:16:40 -07:00
Rishabh Dave
3f0284f272 qa/cephfs: add methods to read/write on CephFS mounts
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-09-10 23:57:15 +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
72d6f0413e
qa: move run_shell args to kwargs
To avoid listing all run args.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-08-29 10:22:12 -07:00
Sage Weil
dfd01d7653 blacklist -> blocklist
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Neha Ojha <nojha@redhat.com>
2020-08-24 19:53:08 +00:00
Patrick Donnelly
ac6c150eb0
qa: do not append file names to dirname
Otherwise the files generated are not actually under the sub-directory!
This is correcting a confusing aspect of the test infrastructure but
doesn't actually require any changes to the tests.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-08-06 19:17:02 -07:00
Xiubo Li
47600028ae qa: defer cleaning the mountpoint's netnses and the bridge
The netnses maybe created/deleted many times in the whole test cases,
we can defer cleaning them untile the last mountpoint is unmounted
or when the test is exiting.

Fixes: https://tracker.ceph.com/issues/46282
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-07-29 20:58:36 -04:00
Xiubo Li
c0c5550ed7 qa/tasks/cephfs/mount.py: remove the stale netnses and bridge
If the previous test cases failed, the netnses and bridge will be
left. Here will remove them when new test cases begin.

Fixes: https://tracker.ceph.com/issues/45806
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-07-29 08:41:18 +08:00
Xiubo Li
438aaf851f qa/tasks/cephfs/mount.py: try to flush the stale ceph-brx dev info
Once we have run the test cases and the ceph-brx bridge is setup,
it will save the config in "/etc/sysconfig/network-scripts/ifcfg-ceph-brx"
or somewhere else. It will be kept after the ceph-brx bridge removed.
So next time once the ceph-brx bridge is created or added, it will
read the config from it, then when we config it again we will get
error like:

    "RTNETLINK answers: File exists"

Here we need to flush it before config it.

Fixes: https://tracker.ceph.com/issues/45817
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-07-29 08:41:02 +08:00
Xiubo Li
f8d8e3083a qa/tasks/cephfs/mount.py: switch to run_shell_payload() helper
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-07-29 08:40:43 +08:00
Xiubo Li
2524af9d7e qa/tasks/cephfs/mount.py: clean up the none used code
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-07-14 06:27:44 -04:00
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
Patrick Donnelly
c050623065
qa: refactor _wait_subtree and _get_subtree
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-06-24 15:43:30 -07:00
Patrick Donnelly
e21f6bee65
Merge PR #35540 into master
* refs/pull/35540/head:
	qa/cephfs: don't pass cmd args from run_as_user as str
	qa/cephfs: refactor run_as_root() to user run_as_user()

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2020-06-24 11:31:29 -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
Rishabh Dave
23f279d7a9 qa/cephfs: don't pass cmd args from run_as_user as str
Passing command arguments from run_as_user() to run_shell() as string
can be problematic since command argument to be passed to -c option of
sudo should be a single argument (i.e. 'ls dir' instead of
['ls', 'dir']).

Fixes: https://tracker.ceph.com/issues/46057
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-06-17 23:13:05 +05:30
Rishabh Dave
4c9811aae3 qa/cephfs: refactor run_as_root() to user run_as_user()
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-06-17 23:12:59 +05:30
Patrick Donnelly
4729688792
Merge PR #35202 into master
* refs/pull/35202/head:
	qa: return a string via getfattr

Reviewed-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
2020-06-03 07:43:08 -07:00
Xiubo Li
9bc1a74342 qa/tasks/cephfs/mount.py: remove netns name parsing in mountpoint setter
We can get the correct netns name always by using the netns_name
getter.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-05-27 21:34:02 -04:00
Patrick Donnelly
3c1330795a
qa: return a string via getfattr
Fixes: https://tracker.ceph.com/issues/45666
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-05-22 14:15:19 -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
Patrick Donnelly
0825b9b97d
Merge PR #35058 into master
* refs/pull/35058/head:
	qa/tasks: logger.warn() -> logger.warning()

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2020-05-18 14:34:28 -07:00
Patrick Donnelly
6f14713aed
qa: do not save/restore ip_forward sysctl
We don't really care if this is left on during the course of the mount.
These settings don't persist across tests anyway.

Fixes: https://tracker.ceph.com/issues/45525
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-05-14 20:15:38 -07: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
Patrick Donnelly
01aea7f7e1
Merge PR #34978 into master
* refs/pull/34978/head:
	qa/tasks/cephfs/mount.py: always setup the NAT rules
	qa/tasks/cephfs/mount.py: fall back to use ip command to setup the bridge

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Rishabh Dave <ridave@redhat.com>
Reviewed-by: Ramana Raja <rraja@redhat.com>
2020-05-12 11:59:51 -07:00
Xiubo Li
2e6e3916a0 qa/tasks/cephfs/mount.py: always setup the NAT rules
If the last test failed just after the 'ceph-brx' bridge is created
but with setuping the NAT rules in iptables, so if we run the test
case again, it will just skip seting the 'ceph-brx' and the NAT rules.
Then deleting the NAT rules will get the errors like:

iptables: Bad rule (does a matching rule exist in that chain?).

Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-05-11 23:20:42 -04:00
Xiubo Li
f7b49f5bab qa/tasks/cephfs/mount.py: fall back to use ip command to setup the bridge
CentOS/RHEL8 have abandoned the bridge-utils package so the brctl
cmd is none avalible, and on Ubuntu 18.04 and 20.04 the nmcli is
buggy to setup the bridge. So this will fall back to use ip cmd
to setup the bridge stuff.

Fixes: https://tracker.ceph.com/issues/45459
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-05-11 22:51:29 -04:00
Rishabh Dave
71b823daee qa/cephfs: use StringIO instead of BytesIO
Fixes: https://tracker.ceph.com/issues/45425
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-05-07 12:13:53 +05:30
Gregory Farnum
0a9612bcde
Merge pull request #34595 from rishabh-d-dave/fs-move-run_shell
qa/cephfs: move run_shell to mount.py and add methods for negative testing

Reviewed-by: Jeff Layton <jlayton@redhat.com>
2020-04-27 16:35:20 -07:00
Xiubo Li
65f97690af qa/tasks/cephfs/mount: to make sure that the count/seek are int type
To fix "stderr:dd: invalid number: '5.0'".

Fixes: https://tracker.ceph.com/issues/45247
Signed-off-by: Xiubo Li <xiubli@redhat.com>
2020-04-24 05:05:54 -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
Rishabh Dave
ec1c2af43f vstart_runner.py: add methods for negative testing a cmd
Methods like run_shell effectively conduct positive test on the given
command. Add methods that runs given command expecting failure and then
verifies return value and error message with given one. Rewrite testcmd,
testcmd_as_user and testcmd_as_root to create these new methods for
negative testing since run_shell, run_as_user and run_as_root is
equivalent of running positive test.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-04-17 00:28:20 +05:30
Rishabh Dave
7b15a8437e qa/cephfs: move run_shell and related methods to mount.py
LocalFuseMount and LocalKernelMount can directly inherit these methods
from CephFSMount via FuseMount and KernelMount respectively. Moving
would avoid duplication and would make these methods more accessible
for reusing via inheritance.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2020-04-17 00:27:41 +05:30