Commit Graph

79 Commits

Author SHA1 Message Date
Rishabh Dave
b7d740ede7 vstart_runnner: add sh method to LocalRemote
The method is a wrapper of teuthology.misc.sh

Fixes: https://tracker.ceph.com/issues/43496
Signed-off-by: Rishabh Dave <ridave@gmail.com>
2020-01-13 10:22:56 +05:30
Kefu Chai
5fe27c2267 qa/tasks/vstart_runner: write string to StringIO
we use `six.StringIO` for stdout when writing output messages from
`self.subproc.communicate()`, and `six.StringIO` accepts strings, so we
need to decode the output before sending them to `six.StringIO`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-12-28 01:11:54 +08:00
Kefu Chai
4c6a5798c2
Merge pull request #32222 from toabctl/qa-flake8-py3
qa: Run flake8 on python2 and python3

Reviewed-by: Kefu Chai <kchai@redhat.com>
2019-12-24 10:47:07 +08:00
Kefu Chai
130e3eddb9 qa/tasks/vstart_runner.py: use current python executable
python3 is not always the path to executable used by current python
session.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-12-20 21:39:49 +08:00
Kefu Chai
79584862f6 src,qa: install python bindings into lib/cython_modules/lib.3
instead of checking for the WITH_PYTHON* options, just hardwire to lib.3

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-12-19 11:52:54 +08:00
Sage Weil
3268ec7ac8 Merge PR #32252 into master
* refs/pull/32252/head:
	qa/cephfs/begin: libaio-devel on el8
	qa/tasks: nosetests -> python -m nose
	qa/tasks/rbd_fio: fio 2.21 -> 3.16
	src/test/cli-integration/rbd/snap-diff.t: python -> python
	qa/workunits: use nose 3
	qa/tasks/cbt: install python3 deps
	qa/tasks/ceph_manager.py: do not use python to write a file
	test/pybind/test_rados: execute takes a bytes (not str) payload
	qa/packages/packages: python[3]-ceph is no more
	qa: use python3 for venvs etc
	packaging: remove python3-ipaddres, as it is part of the stdlib in py3
	qa/packages: python-ceph -> python3-ceph
	qa/distros: centos7 -> centos8, rhel7 -> rhel8
	spec: remove _python_buildid in favor of python3_pkgversion macro
	spec: remove python2 packages and conditions
	debian: remove python >= 2.7 requirement
	debian: add mgr python versions
	debian: explicitly set PYTHON2=OFF to prevent picking up python2 interpreter
	debian: update control file to use python3 dependency names
	debian: remove all python2 overrides and declarations
	debian: remove all python2 install files

Reviewed-by: Alfredo Deza <adeza@redhat.com>
2019-12-17 15:23:27 -06:00
Kefu Chai
0a83d9003e
Merge pull request #31815 from tchaikov/wip-mgr-dashboard-gevent
mgr/dashboard: install teuthology using pip

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Ernesto Puertat <epuertat@redhat.com>
2019-12-16 17:30:08 +08:00
Sage Weil
240154f114 qa: use python3 for venvs etc
Signed-off-by: Sage Weil <sage@redhat.com>
2019-12-13 08:47:28 -06:00
Thomas Bechtold
bdcc94a1d1 qa: Run flake8 on python2 and python3
To be able to catch problems with python2 *and* python3, run flake8
with both versions. From the flake8 homepage:

It is very important to install Flake8 on the correct version of
Python for your needs. If you want Flake8 to properly parse new
language features in Python 3.5 (for example), you need it to be
installed on 3.5 for Flake8 to understand those features. In many
ways, Flake8 is tied to the version of Python on which it runs.

Also fix the problems with python3 on the way.
Note: This requires now the six module for teuthology. But this is
already an install_require in teuthology itself.

Signed-off-by: Thomas Bechtold <tbechtold@suse.com>
2019-12-13 09:24:20 +01:00
Kefu Chai
a9906b8cd2 vstart_runner: be python3 compatible
Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-12-12 20:38:35 +08: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
Rishabh Dave
8d7c45d3b0 qa/vstart_runner: add a method to create temporary file
The method's signature is kept identical to the method in teuthology.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-12-06 08:54:05 +05:30
Rishabh Dave
2f85a03b56 test_cephfs_shell: update test since shell can now read ceph.conf
In the test
test_cephfs_shell.TestMisc.test_issue_cephfs_shell_cmd_at_invocation,
don't set the shell option with in the command to be tested since
CephFS shell can now read it's value from ceph.conf.

Also, add methods to set config options for vstart as well teuthology
testing.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-12-06 08:52:59 +05:30
Rishabh Dave
2130785f2c qa/tasks: add methods to get monitor's sockets
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 16:14:36 +05:30
Rishabh Dave
5f19d2227d vstart_runner.py: set omit_sudo's default value to False
This shouldn't be an inconvenience since default value for omit_sudo is
already False in teuthology's codebase.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 11:36:10 +05:30
Rishabh Dave
ee3dedc6ea qa/vstart_runner.py: fix get_keyring_path()
Return "keyring" file in build directory in source repo when the
expected keyring file is absent.

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
Rishabh Dave
514b58e3a3 qa/vstart_runner.py: allow specifying mountpoint for local FUSE mounts
Allow specifying the directory in CephFS that should be FUSE mounted on
the given path when running tests locally.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 11:36:10 +05:30
Rishabh Dave
06c6d5c9bc qa/vstart_runner.py: add a method to create a temporary directory
Add a method that creates a temporary directory and returns the path to
it.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-11-06 11:36:09 +05:30
Patrick Donnelly
fc88e6c6c5
qa: use small default pg count for CephFS pools
The pg count needs to be a power-of-two since
dff5697464.

Also, mon_pg_warn_min_per_osd is disabled by default now (or set to a
low value in vstart/testing) so there's no need to base the pg count on
this value.

Ideally someday we can remove this so that the default cluster value is
used but we need to keep this for deployments of older versions of Ceph.

Fixes: https://tracker.ceph.com/issues/42228
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2019-10-14 10:45:05 -07:00
Jeff Layton
5b36293ab8 vstart_runner: allow the use of it with kernel mounts
Add a new command-line switch to allow it to use the kernel client
instead, and add all of the machinery to handle local kcephfs mounts.

Document this in the developer guide, along with the appropriate scary
warnings about using this on a machine that you care about. While we're
in there, also correct a typo about FUSE configuration.

Fixes: https://tracker.ceph.com/issues/41910
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2019-09-27 08:23:07 -04:00
Rishabh Dave
dc21d04172 vstart_runner: name booleans for options differently
This achieves 2 things: makes it more understandable for the reader that
the boolean variable is an option and reads less like a method name.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:13:18 +05:30
Rishabh Dave
254f705e27 qa/vstart_runner.py: add an option to remove old log
Add an option "--clear-old-log" to get rid of log entries before making
entries for current batch of tests.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:13:10 +05:30
Rishabh Dave
e16ad0126b qa/vstart_runner.py: make log initialization code reusable
Move it to a method so that the code be can be reused.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:12:00 +05:30
Rishabh Dave
1ef02b724d qa/vstart_runner.py: make printing of stdout of ps optional
stdout of ps command is generally pretty huge which makes it harder to
interpret logs. Don't print it by default and add "--log-ps-output" to
enable printing it.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:11:54 +05:30
Rishabh Dave
842b5590aa qa/vstart_runner.py: add timeout for vstart.sh and stop.sh
Override default timeout for execution of vstart.sh and stop.sh since
neither scripts take more than 100 seconds normally.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:10:22 +05:30
Rishabh Dave
83ff993e95 qa/vstart_runner.py: add an option to teardown cluster
Add "--teardown" option so that vstart_runner.py tears down Ceph
cluster automatically after the batch of tests has completed running.
Also delete build/dev and build/out directories, after running stop.sh.

Update the doc for vstart_runner.py as well.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-09-25 12:09:58 +05:30
alfonsomthd
7563f8b6d6 mgr/dashboard: run-backend-api-tests.sh CI improvements
As there is now a jenkins job to run this script
(see https://github.com/ceph/ceph-build/pull/1351),
this refactoring adapt the script to be run in a jenkins job as well as locally.

Signed-off-by: alfonsomthd <almartin@redhat.com>
2019-08-22 15:33:02 +02:00
Rishabh Dave
07688b96e1 qa/vstart_runner.py: ignores when source and destination are same
put_file() in vstart_runner.py should ignore the error when source and
destination paths supplied are same, since source and destination for
put_file() method in teuthology are on different machines, they
represent different locations.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-07-25 10:51:50 +05:30
Volker Theile
b812689c48 qa: vstart_runner fails because of string index out of range
Fix problem in LocalRemote::_perform_checks_and_return_list_of_args() when LocalCephManager::raw_cluster_cmd() is called with a empty command parameter.

Fixes: https://tracker.ceph.com/issues/40729
Signed-off-by: Volker Theile <vtheile@suse.com>
2019-07-11 15:15:10 +02:00
Patrick Donnelly
475f2deaf3
Merge PR #28561 into master
* refs/pull/28561/head:
	vstart_runner: upgrade the check for commands to be run as another user
	vstart_runner: split unicode arguments into lists

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2019-06-20 11:09:01 -07:00
Rishabh Dave
21a1b30a3e vstart_runner: upgrade the check for commands to be run as another user
Rectify the condition that checks if command to be issued as another
user using sudo is issued as a single argument after "-c".

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-06-20 21:35:38 +05:30
Rishabh Dave
da441cb381 vstart_runner: split unicode arguments into lists
Split not just string arguments but also unicode arguments into lists.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-06-20 11:04:59 +05:30
Rishabh Dave
c086c13b22 qa/tasks: upgrade command arguments checks in vstart_runner.py
Exempt run.Raw from checks in vstart_runner.py as most of them are
meant for strings.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-06-07 13:20:06 +05:30
Rishabh Dave
96be56c4f1 qa/tasks: upgrade the check for -c sudo option in vstart_runner.py
Right now vstart_runner.py checks if the command to be ran as a
different user using sudo is a single argument by checking if "-c" is
the second last arguemnt. However, this check fails in a case where
"-c" is option for a command being ran as root (e.g. "sudo python -c
some-python-program"). So, add check for this.

Fixes: http://tracker.ceph.com/issues/39385
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-05-26 17:10:44 +02:00
Rishabh Dave
532670bd05 qa: add wrappers for vstart's run() with check_status as False
Too often in tests it is required to run a command that we want to (or
will probably) fail so that we can check if it failed for expected
reason(s) (eg. a testcase where command must fail with "Permission
denied"). Therefore, add few wrapper methods for vstart_runner.py's
run() with check_status's default value as False so that we don't need
to pass check_status's value at every call to run() or it's other
wrappers.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-17 23:58:22 +05:30
Rishabh Dave
d90c0a0e81 qa: add stdin parameter to run_shell
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-17 23:58:22 +05:30
Rishabh Dave
5462ba5d9d qa: command to be ran as a different user should be a single string
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-17 23:58:19 +05:30
Rishabh Dave
bbca211225 qa: looks for quotes in Python shell and get rid of them
Since quotes are not a token for Python's shell simulation (unlike
Bash), raise a RuntimeError for them and add an exception for Python
command since it quotes to define a program on commandline.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-12 15:00:58 +05:30
Rishabh Dave
512f4721a5 qa: move checks on command arguments to a different method
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-12 15:00:58 +05:30
Rishabh Dave
ee940faaff qa: accept args as strings
Till now the run() method in vstart_runner.py accepts commands only as
a (Python) list. It is very inconvenient to write commands as
['setfacl', '-m', 'user:someuser:rwx', 'somedir/somefile'] when they
can be simply be written as
'setfacl -m user:someuser:rwx somedir/somefile'. Also, converting the
latter form to former one is exceedingly simple. So writing commands as
strings should be allowed.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-12 15:00:58 +05:30
Rishabh Dave
cb262323bc qa: add a method to run given command as root user
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-12 15:00:58 +05:30
Rishabh Dave
8ca094ff99 qa: add a method to run a command as a different user
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-12 15:00:57 +05:30
Rishabh Dave
3e0a1361f7 qa: allow keeping sudo in command arguments
sudo cannot be omitted from the given command's arguments, when running
passwd, chown and, specially, when sudo is used for running the given
command as different user.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-09 21:03:31 +05:30
Rishabh Dave
5df2b82c4f qa: make execution abortion optional for command ran through run_shell()
Signed-off-by: Rishabh Dave <ridave@redhat.com>
2019-04-09 21:03:31 +05:30
Patrick Donnelly
2ea41574a2
qa: use SIGTERM when stopping vstart service
Otherwise MDS will not send down:dne to mons when restarting.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2019-02-27 21:38:24 -08:00
alfonsomthd
c094e2d702 mgr/dashboard: fix skipped backend API tests
* When the creation of the cluster is delegated to vstart_runner.py
(--create or --create-target-only) the amount of MGRs required
is calculated by the script so there is no more skipped tests
due to insufficient amount of MGRs.

* Additionally, this issue is not reproducible anymore:
Fixes: https://tracker.ceph.com/issues/37964

* Fixed typo: TEUTHOLOFY_PY_REQS

Signed-off-by: Alfonso Martínez <almartin@redhat.com>
2019-01-30 13:05:02 +01:00
John Spray
e5fb5a1ddd qa: generalise REQUIRE_MEMSTORE
Move it up into CephTestCase so that mgr tests can
use it too, and pick it up in vstart_runner.py so
that these tests will work neatly there.

Signed-off-by: John Spray <john.spray@redhat.com>
2018-12-18 13:30:54 -06:00
James Page
20aa3ad17b Correct usage of collections.abc
Some classes should still be imported directly from collections;
only OrderedDict, Iterable and Callable (in the context of the
ceph codebase) are found in collections.abc.

The current code works due to the fallback support for Python 2.

Signed-off-by: James Page <james.page@ubuntu.com>
2018-11-29 09:48:43 +00:00
Ganesh Maharaj Mahalingam
625868974b fix python collections module warning for v3.7 and above
Python 3.7 now shows a warning as below.

/usr/bin/ceph:128: DeprecationWarning: Using or importing the ABCs from
'collections' instead of from 'collections.abc' is deprecated, and in
3.8 it will stop working
  import rados

This patch addresses the that particular issue.

Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2018-10-28 23:32:22 -07:00