]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
5 years agoqa: add .teuthology_branch with `master` contents 35369/head
Kyr Shatskyy [Tue, 2 Jun 2020 17:05:30 +0000 (19:05 +0200)]
qa: add .teuthology_branch with `master` contents

This is follow up change for:

    teuthology-suite: automate -t argument default value
    https://github.com/ceph/teuthology/pull/1490

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 07cc36dcd264b66a7f3a19687b336737a772c2f5)

5 years agoMerge pull request #35132 from shyukri/wip-45483-nautilus
Jan Fajerski [Wed, 3 Jun 2020 14:50:09 +0000 (16:50 +0200)]
Merge pull request #35132 from shyukri/wip-45483-nautilus

nautilus: ceph-volume: add ceph.osdspec_affinity tag

5 years agoMerge pull request #34171 from tchaikov/nautilus-py3
Kefu Chai [Wed, 3 Jun 2020 12:56:22 +0000 (20:56 +0800)]
Merge pull request #34171 from tchaikov/nautilus-py3

nautilus: qa: migrate to python3

Reviewed-by: Thomas Bechtold <tbechtold@suse.com>
5 years agoqa/suites/rgw/tempest: bump up keystone to 17.0.0 34171/head
Kefu Chai [Mon, 25 May 2020 07:52:04 +0000 (15:52 +0800)]
qa/suites/rgw/tempest: bump up keystone to 17.0.0

Fixes: https://tracker.ceph.com/issues/45692
please note, the change on master also includes changes to use identity
v3. in this change, we only pick the change to use newer keystone to
address the pip install issue

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 9bd3e0ff4027cfbef0c62931b669f20c989e8bb2

5 years agoqa/tasks/tox: use the latest stable tox
Kefu Chai [Sun, 24 May 2020 17:07:09 +0000 (01:07 +0800)]
qa/tasks/tox: use the latest stable tox

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit cd437bc5dfd7b82d2348810a177d56654083a6d2)

5 years agoqa/tasks/tox: use python3 for tox tests
Kefu Chai [Sun, 24 May 2020 17:04:37 +0000 (01:04 +0800)]
qa/tasks/tox: use python3 for tox tests

both tempest and keystone have dropped python2 support in their tox
based tests.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit b7152e8e943b713e779aec0c2414986bd556a423)

5 years agoqa/valgrind.supp: less specific when suppressing issues/22052
Kefu Chai [Sun, 24 May 2020 15:57:46 +0000 (23:57 +0800)]
qa/valgrind.supp: less specific when suppressing issues/22052

Fixes: https://tracker.ceph.com/issues/22052
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit a8e9fd71d79f7696a47773acdcc738f47a88d8d8)

5 years agoqa/tasks/tempest.py: install python3 for tempest test
Kefu Chai [Sun, 24 May 2020 15:06:08 +0000 (23:06 +0800)]
qa/tasks/tempest.py: install python3 for tempest test

install python3 for tempest's tox based test otherwise the test would
fail if python3.6 or python3.8 is not found.

this change is not cherry-picked from master, as our python bindings
are now built with python3.6, so python3.6 is always used. it's
supported by tempest's test.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/tasks/keystone.py: install python3
Kefu Chai [Sun, 24 May 2020 14:51:05 +0000 (22:51 +0800)]
qa/tasks/keystone.py: install python3

install python3 for keystone's tox based test otherwise python34 would
be installed, and keystone's tox based test does not support python34.

this change is not cherry-picked from master, as our python bindings are
now built with python3.6, so python3.6 is always used. it's supported by
keystone's test.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/suites/rgw: disable valgrind for tests that require py2/ubuntu
Sage Weil [Tue, 17 Dec 2019 16:52:37 +0000 (10:52 -0600)]
qa/suites/rgw: disable valgrind for tests that require py2/ubuntu

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit ea21829ae728354b759f117e9af8a20eb8213687)

Conflicts:
qa/suites/rgw/website/overrides.yaml
qa/suites/upgrade/nautilus-p2p/nautilus-p2p-stress-split/7-final-workload/.qa: trivial resolution

5 years agoDNM qa/rgw: disable debuginfo packages
Casey Bodley [Fri, 29 Mar 2019 18:18:55 +0000 (14:18 -0400)]
DNM qa/rgw: disable debuginfo packages

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d0142a189abfad641145986ca1552c27c870f713)

5 years agoqa/tasks/ceph_manager.py: do not use python to write a file
Sage Weil [Fri, 13 Dec 2019 18:42:57 +0000 (18:42 +0000)]
qa/tasks/ceph_manager.py: do not use python to write a file

/usr/bin/python dne on el8, /usr/bin/python3 dne on el7.  But
all we need to do is write a file--we can do that with tee.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit d4f4a2cbd81f2c86e281b9220bd5b727c0fd85f3)

5 years agotest_sessionmap: use sudo_write_file() from teuthology.misc
Rishabh Dave [Fri, 19 Jul 2019 04:35:18 +0000 (10:05 +0530)]
test_sessionmap: use sudo_write_file() from teuthology.misc

Instead of defining a method to write files within the testsuite, use
sudo_write_file() from teuthology.misc.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 4b776240705ebe8bdd0d43cd6244491e435a509c)

5 years agoqa: use py3 compat list from range
Patrick Donnelly [Mon, 18 May 2020 19:57:43 +0000 (12:57 -0700)]
qa: use py3 compat list from range

Fixes: https://tracker.ceph.com/issues/45590
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 8d51b33e5d70feec3b65ac3eb819a3515befcdac)

5 years agoqa/tasks/keystone: get rid of cStringIO for py3
Kyr Shatskyy [Fri, 21 Feb 2020 19:15:44 +0000 (20:15 +0100)]
qa/tasks/keystone: get rid of cStringIO for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit dcf85e4328bfba057d30b6720f6e641dacb11e9f)

5 years agoqa/keystone: pip install bindep
Casey Bodley [Thu, 5 Sep 2019 18:06:45 +0000 (14:06 -0400)]
qa/keystone: pip install bindep

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 2144fd8cc7f156264aff958c54c5e35d0e65757c)

5 years agomgr/insights: fix python3 DeprecationWarning
Michael Fritch [Mon, 4 May 2020 18:37:11 +0000 (12:37 -0600)]
mgr/insights: fix python3 DeprecationWarning

insights/module.py:167: DeprecationWarning: invalid escape sequence \d
    r = "ceph version (?P<release>\d+)\.(?P<major>\d+)\.(?P<minor>\d+)"

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 41ffb701eca6280df00cd526edfce3a9c851b53b)

5 years agoqa/tasks/cephfs: remove sys.exc_clear() calls
Kefu Chai [Fri, 8 May 2020 03:10:56 +0000 (11:10 +0800)]
qa/tasks/cephfs: remove sys.exc_clear() calls

sys.exc_clear() was removed in Python3, see
https://docs.python.org/3/whatsnew/3.0.html#index-22. so we should not
call it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 702de9590cdfe6c95ef8e87cb74cd05944e380c9)

5 years agovstart_runner.py: use tuple instead of set
Rishabh Dave [Fri, 8 May 2020 11:40:24 +0000 (17:10 +0530)]
vstart_runner.py: use tuple instead of set

Using python3 leads to an error that says
"TypeError: unhashable type: 'Raw'".

Fixes: https://tracker.ceph.com/issues/45446
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit cb0bfc8fab4372b0caf5102823883b0b913d4fcb)

Conflicts:
qa/tasks/vstart_runner.py: trivial resolution

5 years agoqa/tasks: logger.warn() -> logger.warning()
Michael Fritch [Wed, 13 May 2020 23:16:17 +0000 (17:16 -0600)]
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>
(cherry picked from commit 44bcee8d1a637b1429a0c9576397f70f0a660ec2)

Conflicts:
qa/tasks/vstart_runner.py: trivial resolution

5 years agotest/rgw: Cluster.admin() returns output as utf-8 str
Casey Bodley [Mon, 4 May 2020 20:39:59 +0000 (16:39 -0400)]
test/rgw: Cluster.admin() returns output as utf-8 str

fixes the TypeError:

  File "rgw_multi/tests.py", line 1107, in test_bucket_sync_disable
    check_buckets_sync_status_obj_not_exist(zone, buckets)
  File "rgw_multi/tests.py", line 438, in check_buckets_sync_status_obj_not_exist
    if log_list.find(':'+bucket+":") >= 0:
TypeError: argument should be integer or bytes-like object, not 'str'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ff5ce2cf1457e1945aea0fe4a023bc48bffe1174)

5 years agoqa/tasks/qemu: open file in text mode
Kefu Chai [Fri, 1 May 2020 08:52:41 +0000 (16:52 +0800)]
qa/tasks/qemu: open file in text mode

in python3, if a file is opened in 'rb' mode, we will have bytes when
reading from it, as a result, we have following failure like:
```
Traceback (most recent call last):
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_master/teuthology/contextutil.py", line 32, in nested
    vars.append(enter())
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/home/teuthworker/src/github.com_tchaikov_ceph_nautilus-py3/qa/tasks/qemu.py", line 124, in generate_iso
    test_setup = ''.join(f.readlines())
TypeError: sequence item 0: expected str instance, bytes found
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 0b21c597d438fcba43629d0795b2d4ff6112c9cf)

5 years agoqa/tasks: use list comprehension for checking the length
Kefu Chai [Thu, 30 Apr 2020 10:07:00 +0000 (18:07 +0800)]
qa/tasks: use list comprehension for checking the length

instead of using filter(), use `sum()` for counting its
length, as in Python3, `filter()` actually returns a `filter` object
instead of a list.

in this change, `filter()` calls are replaced with `sum()`
for Python3 compatibility.

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 726c59be58473cfe53fa3ea63cf35b58ed797886)

5 years agoqa/tasks/cephfs/test_volumes: to make sure the size is int type
Xiubo Li [Fri, 24 Apr 2020 01:08:23 +0000 (21:08 -0400)]
qa/tasks/cephfs/test_volumes: to make sure the size is int type

Fix "Error EINVAL: invalid size option '4915200.0'".

In pytho2 int/2 will get a int type result, but in python3 it maybe
a float type.

Fixes: https://tracker.ceph.com/issues/45247
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit afe19f24baf3983a42f6213c04efc20307c286d2)

5 years agoqa/tasks/cephfs/mount: to make sure that the count/seek are int type
Xiubo Li [Thu, 23 Apr 2020 21:31:24 +0000 (17:31 -0400)]
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>
(cherry picked from commit 65f97690af8ca49e7a8b508621bf47d4fc004853)

5 years agoqa/tasks/cephfs/cephfs_test_case: switch 'dict_keys' object to list
Xiubo Li [Thu, 23 Apr 2020 13:23:31 +0000 (09:23 -0400)]
qa/tasks/cephfs/cephfs_test_case: switch 'dict_keys' object to list

Fix the "TypeError: 'dict_keys' object does not support indexing" under
py3.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 666974e0a663aba6aff37cf78728c44b0e3a08c1)

5 years agoqa/tasks/rbd_fio: update NamedTemporaryFile usage for python3
Ilya Dryomov [Tue, 28 Apr 2020 21:38:05 +0000 (23:38 +0200)]
qa/tasks/rbd_fio: update NamedTemporaryFile usage for python3

Open the file in text mode to avoid 'bytes' objects.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 4e3160a019b5af51e498793aaa24a2a7b82b4b54)

5 years agoqa/tasks/rbd: update NamedTemporaryFile usage for python3
Ilya Dryomov [Tue, 28 Apr 2020 21:22:17 +0000 (23:22 +0200)]
qa/tasks/rbd: update NamedTemporaryFile usage for python3

- open the file in text mode to avoid 'bytes' objects

- 'bufsize' is now spelled 'buffering' and switching buffering off
  with 'buffering=0' is only allowed in binary mode.  As we need the
  file to be either in the page cache or on disk before we copy it
  to the remote, call flush().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit aba9910388cce7c03aa90726b5de1263298ac8ec)

5 years agoqa/volume_client: fix TestVolumeClient failing under new py3 runtime
Xiubo Li [Thu, 16 Apr 2020 02:53:23 +0000 (22:53 -0400)]
qa/volume_client: fix TestVolumeClient failing under new py3 runtime

The pybind now has dropped the WITH_PYTHON2 option, and for now only
py3 supported.

Fixes: https://tracker.ceph.com/issues/45103
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 0ed507dfd4dd1e38c358cd6c77f20fac6e3a8343)

Conflicts:
qa/suites/fs/upgrade/snaps/clusters/.qa
qa/tasks/cephfs/test_volume_client.py: trivial resolution

5 years agoqa/cephfs: whitelist TOO_FEW_PGS
Kefu Chai [Thu, 30 Apr 2020 05:50:39 +0000 (13:50 +0800)]
qa/cephfs: whitelist TOO_FEW_PGS

1ac34a5ea3d1aca299b02e574b295dd4bf6167f4 is not backported to mimic, but
we are still running upgrade test from mimic. so in mimic, monitor
still complains at seeing too many pgs per osd.

this change is not cherry-picked from master, because we already have
1ac34a5ea3d1aca299b02e574b295dd4bf6167f4 in master.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/tasks: s/string.uppercase/string.ascii_uppercase/
Kefu Chai [Mon, 27 Apr 2020 09:31:12 +0000 (17:31 +0800)]
qa/tasks: s/string.uppercase/string.ascii_uppercase/

`string.uppercase` is renamed to `string.ascii_uppercase` in Python2
and Python3. so let's update accordingly.

this change is not cherry-picked from master, as the modified file does
not exist in master anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/tasks: s/itervalues/values/ to by py3 compatible
Kefu Chai [Mon, 27 Apr 2020 05:11:56 +0000 (13:11 +0800)]
qa/tasks: s/itervalues/values/ to by py3 compatible

this change is not cherry-picked from master, as the changed files do
not exist in master anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/tasks/cephfs: switch to StringIO to fix byte-like errors
Xiubo Li [Thu, 23 Apr 2020 11:21:46 +0000 (07:21 -0400)]
qa/tasks/cephfs: switch to StringIO to fix byte-like errors

Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit dd4fc808a8a26ebbfae5b5e4bc3b6c99bf0f5d37)

5 years agoqa/tasks/vstart_runner: remove the stdin str type check
Xiubo Li [Thu, 23 Apr 2020 11:39:31 +0000 (07:39 -0400)]
qa/tasks/vstart_runner: remove the stdin str type check

For the "ceph-dencoder" it will use the byte type data.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit bf10478294e26dc785dd79b0367bf096e9f67b42)

5 years agoqa/cephfs: fix AssertionError: CommandFailedError not raised under py3
Xiubo Li [Tue, 21 Apr 2020 02:22:55 +0000 (22:22 -0400)]
qa/cephfs: fix AssertionError: CommandFailedError not raised under py3

Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 7f57576123b81051a5e64f7c7234153ee11f4062)

5 years agomgr/dashboard: fix API tests
Alfonso Martínez [Fri, 24 Apr 2020 08:53:24 +0000 (10:53 +0200)]
mgr/dashboard: fix API tests

* test_perf_counters_mgr_get
* test_selftest_cluster_log

Fixes: https://tracker.ceph.com/issues/45170
Fixes: https://tracker.ceph.com/issues/45246
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
(cherry picked from commit 0ac296430f45ddf937b6c4c25607f0b757dcf447)

5 years agoqa/tasks/vstart_runner.py: use StringIO for capturing text
Kefu Chai [Sat, 25 Apr 2020 01:47:00 +0000 (09:47 +0800)]
qa/tasks/vstart_runner.py: use StringIO for capturing text

to be consistent with 8bfe977854686149c74de3ebaed7b571d43404dd

Fixes: https://tracker.ceph.com/issues/45246
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 2de78c3bd9eed9bec235b68e8e52b4635e9add61)

5 years agoqa/tasks/cephfs/test_scrub: fix self.assertEqual no attribute '_type_equality_funcs'
Xiubo Li [Thu, 23 Apr 2020 05:08:04 +0000 (01:08 -0400)]
qa/tasks/cephfs/test_scrub: fix self.assertEqual no attribute '_type_equality_funcs'

Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 89d06490886fb5cf840cadde49913dd497c14cf8)

5 years agoqa/tasks/cephfs/mount: switch to StringIO to fix TypeErrors
Xiubo Li [Wed, 22 Apr 2020 12:34:05 +0000 (08:34 -0400)]
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>
(cherry picked from commit 0631342d105575fda009e9e97b26859616be2565)

Conflicts:
qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs/mount.py: drop the change not applicable to
nautilus.

5 years agoqa/tasks: decode bytes returned by base64.b64encode()
Kefu Chai [Mon, 27 Apr 2020 03:04:21 +0000 (11:04 +0800)]
qa/tasks: decode bytes returned by base64.b64encode()

we use the return value from `base64.b64encode()` as a string, this works
in python2, but in python3, instead of a string, `base64.b64encode()`
returns bytes. so for instance, if we try to compose command line
arguments using `pipes.quote()` by passing a byte instance, we will have
```
TypeError: cannot use a string pattern on a bytes-like object
```

in this change, the retval is always decoded using ASCII, because base64
only returns ASCII strings when encoding.

this change is not cherry-picked from master, as the changed files do
not exist in master anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
5 years agoqa/tasks/rados: get rid of itervalues for py3
Kyr Shatskyy [Sat, 15 Feb 2020 02:36:08 +0000 (03:36 +0100)]
qa/tasks/rados: get rid of itervalues for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit dd8bacdb131db74411a07d2952182c7218472769)

5 years agoqa/tasks/mgr: use relative import
Kefu Chai [Fri, 27 Mar 2020 05:57:37 +0000 (13:57 +0800)]
qa/tasks/mgr: use relative import

for better readability, and to ease the pain of developer to track back
to the top level python package for referencing a submodule

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 7d37226548a1d543bd0cdba916f3e00730a91797)

5 years agoqa/tasks/cephfs/fuse_mount.py: by python3 compatible
Kefu Chai [Mon, 20 Apr 2020 11:50:02 +0000 (19:50 +0800)]
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>
(cherry picked from commit c5bd318de65866b4992314c2fb0e82090b4d2979)

5 years agopybind/mgr/dashboard/run-backend-api-tests.sh: use python3 by default
Kefu Chai [Mon, 20 Apr 2020 11:13:52 +0000 (19:13 +0800)]
pybind/mgr/dashboard/run-backend-api-tests.sh: use python3 by default

since vstart_runner.py is now py3, let's use python3 by default

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit d54f3ea43e05c2823c813e9687194b0b1fe15ffe)

Conflicts:
src/pybind/mgr/dashboard/run-backend-api-tests.sh: trivial
resolution

5 years agoqa/tasks/vstart_runner.py: be python3 compatible
Kefu Chai [Mon, 20 Apr 2020 10:27:58 +0000 (18:27 +0800)]
qa/tasks/vstart_runner.py: be python3 compatible

differentiate `str` and `bytes` instances, and drop python2 support from
vstart_runner.py, as we've moved to python3 already

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit bedea85019076999a205c421bbf593ab8ab0641b)

Conflicts:
qa/tasks/vstart_runner.py: trivial resolution

5 years agoqa/tasks/rbd_fio: unbreak after the conversion from StringIO
Ilya Dryomov [Wed, 8 Apr 2020 10:24:51 +0000 (12:24 +0200)]
qa/tasks/rbd_fio: unbreak after the conversion from StringIO

Fix a bad typo in commit db7ae8eff60a ("qa/tasks/rbd_fio: get rid of
StringIO for py3").

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit c3f4f1d6604749a51c552b868ef373f321139005)

5 years agoqa/tasks/openssl_keys.py: sort cert configs before creating certs
Kefu Chai [Wed, 8 Apr 2020 11:22:06 +0000 (19:22 +0800)]
qa/tasks/openssl_keys.py: sort cert configs before creating certs

we cannot rely on the order in which items are arranged in a dict, the
order varies from version to another. in Python2, it happens to work,
and we can always have the self-signed cert added first. but in Python3,
it does not. and an exception is thrown
```
teuthology.exceptions.ConfigError: ssl: ca root not found for
certificate rgw.client.0
```

in this change, before creating certs, the settings are reordered so
that the self-signed ones are created first.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit f28a5fef3b8ddb97962f91cc78174fd6e1431fed)

5 years agoqa/tasks/ceph_objectstore_tool.py: use str.startswit
Kefu Chai [Wed, 8 Apr 2020 04:32:54 +0000 (12:32 +0800)]
qa/tasks/ceph_objectstore_tool.py: use str.startswit

in Python3, string module does not offer `string.find()` anymore, let's
use `str.find()` method instead.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 77ec9ce88df54b7758e56eeef1b3cf3f14952513)

5 years agotest/rgw: upload using a NamedTemporaryFile
Kefu Chai [Wed, 8 Apr 2020 02:50:21 +0000 (10:50 +0800)]
test/rgw: upload using a NamedTemporaryFile

in boto, it tries to figure out the MIME type of a file by its name, if
the file-like objects has an attribute of "name". in Python2, the "name"
is always "<fdopen>", fortunately. while in Python3, `TemporaryFile` also
have a "name" which is its fd, and it is an integer now. so we have following
error when sending a `TemporaryFile` using
`upload_part_from_file()`:
```
2020-04-08T02:25:34.660 INFO:tasks.rgw_multisite_tests:Traceback (most recent call last):
2020-04-08T02:25:34.661 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/virtualenv/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
2020-04-08T02:25:34.661 INFO:tasks.rgw_multisite_tests:    self.test(*self.arg)
2020-04-08T02:25:34.662 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/rgw_multi/tests_ps.py", line 2567, in test_ps_creation_triggers
2020-04-08T02:25:34.662 INFO:tasks.rgw_multisite_tests:    uploader.upload_part_from_file(fp, 1)
2020-04-08T02:25:34.663 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/virtualenv/lib/python3.5/site-packages/boto/s3/multipart.py", line 260, in upload_part_from_file
2020-04-08T02:25:34.663 INFO:tasks.rgw_multisite_tests:    query_args=query_args, size=size)
2020-04-08T02:25:34.664 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/virtualenv/lib/python3.5/site-packages/boto/s3/key.py", line 1293, in set_contents_from_file
2020-04-08T02:25:34.664 INFO:tasks.rgw_multisite_tests:    chunked_transfer=chunked_transfer, size=size)
2020-04-08T02:25:34.664 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/virtualenv/lib/python3.5/site-packages/boto/s3/key.py", line 750, in send_file
2020-04-08T02:25:34.665 INFO:tasks.rgw_multisite_tests:    chunked_transfer=chunked_transfer, size=size)
2020-04-08T02:25:34.665 INFO:tasks.rgw_multisite_tests:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/virtualenv/lib/python3.5/site-packages/boto/s3/key.py", line 920, in
_send_file_internal
2020-04-08T02:25:34.666 INFO:tasks.rgw_multisite_tests:    self.content_type = mimetypes.guess_type(self.path)[0]
2020-04-08T02:25:34.666 INFO:tasks.rgw_multisite_tests:  File "/usr/lib/python3.5/mimetypes.py", line 289, in guess_type
2020-04-08T02:25:34.667 INFO:tasks.rgw_multisite_tests:    return _db.guess_type(url, strict)
2020-04-08T02:25:34.667 INFO:tasks.rgw_multisite_tests:  File "/usr/lib/python3.5/mimetypes.py", line 114, in guess_type
2020-04-08T02:25:34.667 INFO:tasks.rgw_multisite_tests:    scheme, url = urllib.parse.splittype(url)
2020-04-08T02:25:34.668 INFO:tasks.rgw_multisite_tests:  File "/usr/lib/python3.5/urllib/parse.py", line 881, in splittype
2020-04-08T02:25:34.668 INFO:tasks.rgw_multisite_tests:    match = _typeprog.match(url)
2020-04-08T02:25:34.669 INFO:tasks.rgw_multisite_tests:TypeError: expected string or bytes-like object
```

to address this issue, in this change, a `NamedTemporaryFile` is used
instead of `TemporaryFile`. the former does have a "name" which is a
`str`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 523c623b282ce5cf4e4bb7bcf2b35c4009d89b3a)

Conflicts:
src/test/rgw/rgw_multi/tests_ps.py: trivial resolution

5 years agoqa/standalone/scrub: s/$(pgid)/${pgid}/
Kefu Chai [Tue, 7 Apr 2020 16:53:55 +0000 (00:53 +0800)]
qa/standalone/scrub: s/$(pgid)/${pgid}/

to address the test failures like
```
2020-04-07T15:44:58.693 INFO:tasks.workunit.client.0.smithi049.stderr:/home/ubuntu/cephtest/clone.client.0/qa/standalone/scrub/osd-scrub-repair.sh:498: TEST_auto_repair_bluestore_failed:  ceph pg dump
pgs
2020-04-07T15:44:58.694 INFO:tasks.workunit.client.0.smithi049.stderr://home/ubuntu/cephtest/clone.client.0/qa/standalone/scrub/osd-scrub-repair.sh:498: TEST_auto_repair_bluestore_failed:  pgid
2020-04-07T15:44:58.694 INFO:tasks.workunit.client.0.smithi049.stderr:/home/ubuntu/cephtest/clone.client.0/qa/standalone/scrub/osd-scrub-repair.sh: line 498: pgid: command not found
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6fba2216056a300184465bd4a3486f48e1660b6f)

5 years agoqa/tasks/ceph_manager.py: do not return a filter
Kefu Chai [Tue, 7 Apr 2020 16:45:49 +0000 (00:45 +0800)]
qa/tasks/ceph_manager.py: do not return a filter

as the caller might want to `len(manager.get_osd_status()['raw'])`, and
`len()` does not accept a `filter` object.

also, the filtered osd statuses are printed out using `self.log()`, so
we should materialize the `filter` object before sending it to logging
facility. otherwise we will have something like:
```
2020-04-08T02:58:37.001 INFO:tasks.ceph.ceph_manager.ceph:<filter object at 0x7f5a080e1518>
```
in the logging message.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6bc09c5041d025c7ed3638ccfbf6496e1626abfb)

5 years agotest/rgw/rgw_multi: return (str, int) from make_request()
Kefu Chai [Tue, 7 Apr 2020 13:22:36 +0000 (21:22 +0800)]
test/rgw/rgw_multi: return (str, int) from make_request()

so its consumer can feed the returned str to json.loads()

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 23ddf03d26c2c8550b8c9a0c5334fe7b8f4e1682)

5 years agoqa/tasks/mgr: s/urllib.quote_plus/parse.quote_plus/
Kefu Chai [Tue, 7 Apr 2020 12:27:08 +0000 (20:27 +0800)]
qa/tasks/mgr: s/urllib.quote_plus/parse.quote_plus/

in Python3, urllib.quote_plus is moved into urllib.parse, let's use
six.moves at this moment.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6c2f40a5281a1cccf0cab82c620ef1c6a40dd6ef)

Conflicts:
qa/tasks/mgr/dashboard/test_rgw.py: trivial resolution

5 years agotest/rgw/rgw_multi: s/urllib.urlencode/urlparse.urlencode/
Kefu Chai [Tue, 7 Apr 2020 12:00:52 +0000 (20:00 +0800)]
test/rgw/rgw_multi: s/urllib.urlencode/urlparse.urlencode/

urllib in python3 does not offer urlencode anymore, so let's use
six.moves.parse now.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 4e87fcfea0dbfc7d05046cc24137b71d9ce52393)

5 years agotest/rgw/rgw_multi: pass bytes to hmac.new()
Kefu Chai [Tue, 7 Apr 2020 05:29:27 +0000 (13:29 +0800)]
test/rgw/rgw_multi: pass bytes to hmac.new()

in Python3, `key` passed to `hmac.new()` should be bytes or bytearray

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit adfcf08588e6031be837602dc4d1f8d6d14d795b)

5 years agoqa/tasks/radosgw_admin.py: coerce key.name and key.acl to str
Kefu Chai [Mon, 6 Apr 2020 16:51:12 +0000 (00:51 +0800)]
qa/tasks/radosgw_admin.py: coerce key.name and key.acl to str

if `key.name` is not set, boto fills it with md5, in that case, it comes
from `base64.b64encode()`. so we need to make sure it's str before
passing it to shell.

the same applies to `key.get_xml_acl()`, as its return value comes
directly from something like
```
        response = self.connection.make_request('GET', self.name, key_name,
                                                query_args=query_args,
                                                headers=headers)
        body = response.read()
        # ...
        return body
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 96ed9c87c0ca336d13b3da81bc26484426e24f28)

5 years agotest/rgw/rgw_multi/tests.py: decode retval of bucket.get_policy()
Kefu Chai [Mon, 6 Apr 2020 15:20:32 +0000 (23:20 +0800)]
test/rgw/rgw_multi/tests.py: decode retval of bucket.get_policy()

return value of bucket.get_policy() is a bytes, so we need to decode it
before comparing it with a string, since the content of policy is ASCII,
it'd be suffice to decode it with 'ascii'.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit ea63b52b1705e80977ce1fe6d2dc276ea9477344)

5 years agotest/rgw: pass encoding to Key.get_content_as_string()
Kefu Chai [Mon, 6 Apr 2020 15:11:21 +0000 (23:11 +0800)]
test/rgw: pass encoding to Key.get_content_as_string()

we assume that boto.Key.get_content_as_string() returns str instead of
bytes, and compare the return value with a string, so, to ensure that
lhs and rhs are both strings, we need to decode the returned content.

since we always store strings composed with ASCII, it's safe to use
'ascii' to decode them.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit fcf4de3855f01e80b90d246529916a5915fe413d)

Conflicts:
src/test/rgw/rgw_multi/tests_az.py: trivial resolution

5 years agoqa/tasks: pass encoding to Key.get_content_as_string()
Kefu Chai [Mon, 6 Apr 2020 15:08:59 +0000 (23:08 +0800)]
qa/tasks: pass encoding to Key.get_content_as_string()

we assume that boto.Key.get_content_as_string() returns str instead of
bytes, and compare the return value with a string, so, to ensure that
lhs and rhs are both strings, we need to decode the returned content.

since we always store strings composed with ASCII, it's safe to use
'ascii' to decode them.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 9ccf88d95fa5d184c56ac638bed37c3e3101356d)

Conflicts:
qa/tasks/radosgw_admin.py: trivial resolution

5 years agoqa/tasks/ragweed.py: open file in text mode
Kefu Chai [Mon, 6 Apr 2020 13:14:36 +0000 (21:14 +0800)]
qa/tasks/ragweed.py: open file in text mode

this file is a template for `boto.cfg` which only contains text, so we
can just open it in text mode, and the file-like object will be passed
to run() as stdin, which is able to consume strings.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 3809737fb859ebebe72d635708e0d69676cc5aa6)

5 years agoqa,test: decode return val of base64.b64encode()
Kefu Chai [Mon, 6 Apr 2020 10:55:53 +0000 (18:55 +0800)]
qa,test: decode return val of base64.b64encode()

base64.b64encode() returns bytes in Python3, and we will pass it as a
commandline parameter later on, which will be quoted. so the command
line can be consumed by shell. so before sending it to shell, we should
convert it to string.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 91b49ab39d7377e0816fa3c44e2cabed9ce14f12)

Conflicts:
qa/tasks/s3tests_java.py: trivial resolution

5 years agoqa/tasks/radosgw_admin.py: do not use dict.has_keys()
Kefu Chai [Mon, 6 Apr 2020 08:55:05 +0000 (16:55 +0800)]
qa/tasks/radosgw_admin.py: do not use dict.has_keys()

in python3, `dict.has_key()` was removed. let's use __contains__
instead.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 590e9b35aa86ab3e70561a8ecde21da2729dafb3)

5 years agoqa/tasks/tempest.py: always write str is value of options
Kefu Chai [Mon, 6 Apr 2020 08:37:55 +0000 (16:37 +0800)]
qa/tasks/tempest.py: always write str is value of options

in Python2, ConfigParser is almost the same as RawConfigParser, which
allows set non-string values, but in Python3, ConfigParser.set() only
accepts strings as value of option.

since we do not use "cpar" as an internal storage for options, it does
not matter what type of options we set using ConfigParser as long as it
can be consumed by tempest. boolean settings are translated to "true" or
"false". see also
https://docs.openstack.org/tempest/latest/sampleconf.html

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 5ef3a5fe3282146b56bd2a589fef17c28d57e8e2)

5 years agoqa/tasks/tempest.py: use configparser from six.moves
Kefu Chai [Mon, 6 Apr 2020 07:18:51 +0000 (15:18 +0800)]
qa/tasks/tempest.py: use configparser from six.moves

as ConfigParser is offerd by `configparser` module in Python3, so use
six.moves before the migration.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit b1726bfb08f7a408b37f6c6d1d7dc80eae0d6423)

5 years agoqa/tasks/ragweed.py: use str methods of helper from string module
Kefu Chai [Mon, 6 Apr 2020 07:12:46 +0000 (15:12 +0800)]
qa/tasks/ragweed.py: use str methods of helper from string module

in Python3, some methods offered by `string` module are now member
method of `str` class, and `string.uppercase` is renamed to
`string.ascii_uppercase` in Python2 and Python3. so let's update
accordingly.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6ad2ca9767fde8d6c8ce68035f34f93a4594fd4a)

5 years agotest/rgw/rgw_multi: do not decode a str
Kefu Chai [Mon, 6 Apr 2020 07:03:22 +0000 (15:03 +0800)]
test/rgw/rgw_multi: do not decode a str

`s` comes from `rgwadmin()`, which passes `StringIO` as stdout, so the
the output should an instance of `str` in both Python2 and Python3.
hence there is no need to decode it using UTF-8 codecs again.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 7202d8a72c749a152a648dcbbcd86387dc988672)

Conflicts:
src/test/rgw/rgw_multi/tests.py: trivial resolution

5 years agoqa/tasks/radosgw_admin: use HTTPMessage as a dict in PY3
Kefu Chai [Mon, 6 Apr 2020 06:52:02 +0000 (14:52 +0800)]
qa/tasks/radosgw_admin: use HTTPMessage as a dict in PY3

in Python3, HTTPMessage is a dict-like class by itself, and it does not
offer `dict` attribute anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 4a9c43313acbd26d33364a43b2835e561ceb259b)

5 years agoqa/tasks/keystone.py: use list(a_dict) for concatenating lists
Kefu Chai [Mon, 6 Apr 2020 05:25:54 +0000 (13:25 +0800)]
qa/tasks/keystone.py: use list(a_dict) for concatenating lists

`dict.items()` does not return a list in python3, so we need to convert
it to a list first.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 35a3d5f7f8a53e667d3196aa72be5b495b70e91f)

Conflicts:
qa/tasks/keystone.py: trivial resolution

5 years agoqa/tasks/util/rgw: use StringIO for capturing strings
Kefu Chai [Mon, 6 Apr 2020 04:48:18 +0000 (12:48 +0800)]
qa/tasks/util/rgw: use StringIO for capturing strings

this change should address the failure of
```
2020-04-06T03:07:59.152 ERROR:teuthology.contextutil:Saw exception from nested tasks
Traceback (most recent call last):
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_wip-py3/teuthology/contextutil.py", line 32, in nested
    vars.append(enter())
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/rgw.py", line 266, in configure_compression
    rgwadmin(ctx, client, cmd=['user', 'list'], check_status=True)
  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/util/rgw.py", line 43, in rgwadmin
    j = json.loads(out)
  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 5d0dc8346c7c025a868fd32b112cdb32fa5dc9ea)

5 years agoqa/tasks/cephfs: return ascii decoded xattr
Kefu Chai [Sun, 5 Apr 2020 15:59:06 +0000 (23:59 +0800)]
qa/tasks/cephfs: return ascii decoded xattr

as callers of `TestForwardScrub._read_str_xattr()` expects str.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 7f48f61bdc8f88e1025796aec5158bbd69b1eb65)

5 years agoqa/tasks/cephfs: cast mds_recall_warning_decay_rate to float
Kefu Chai [Sun, 5 Apr 2020 15:30:13 +0000 (23:30 +0800)]
qa/tasks/cephfs: cast mds_recall_warning_decay_rate to float

this change should address the failure of
```
2020-04-05T15:14:23.088 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2020-04-05T15:14:23.088 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_client_limits.py", line 110, in test_client_pin_mincaps
2020-04-05T15:14:23.089 INFO:tasks.cephfs_test_runner:    self._test_client_pin(True, 200)
2020-04-05T15:14:23.089 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_client_limits.py", line 71, in _test_client_pin
2020-04-05T15:14:23.090 INFO:tasks.cephfs_test_runner:    self.wait_for_health("MDS_CLIENT_RECALL", mds_recall_warning_decay_rate*2)
2020-04-05T15:14:23.091 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/ceph_test_case.py", line 152, in wait_for_health
2020-04-05T15:14:23.091 INFO:tasks.cephfs_test_runner:    self.wait_until_true(seen_health_warning, timeout)
2020-04-05T15:14:23.092 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/ceph_test_case.py", line 193, in wait_until_true
2020-04-05T15:14:23.093 INFO:tasks.cephfs_test_runner:    if elapsed >= timeout:
2020-04-05T15:14:23.093 INFO:tasks.cephfs_test_runner:TypeError: unorderable types: int() >= str()
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 162be9210613a4b4a921fa0ff285c869548d7d49)

Conflicts:
qa/tasks/cephfs/test_client_limits.py: trivial resolution

5 years agoqa/tasks/cephfs: allow caller to use BytesIO when calling rados()
Kefu Chai [Sun, 5 Apr 2020 13:45:51 +0000 (21:45 +0800)]
qa/tasks/cephfs: allow caller to use BytesIO when calling rados()

when the caller expects binary data, it should pass BytesIO as stdout.

this change shold address the failure of
```
2020-04-05T12:47:25.335 INFO:tasks.cephfs_test_runner:======================================================================
2020-04-05T12:47:25.336 INFO:tasks.cephfs_test_runner:ERROR: test_apply_tag (tasks.cephfs.test_forward_scrub.TestForwardScrub)
2020-04-05T12:47:25.336 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2020-04-05T12:47:25.336 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2020-04-05T12:47:25.337 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_forward_scrub.py", line 75, in test_apply_tag
2020-04-05T12:47:25.337 INFO:tasks.cephfs_test_runner:    self.assertTagged(inos[dirpath], tag, self.fs.get_metadata_pool_name())
2020-04-05T12:47:25.337 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_forward_scrub.py", line 98, in assertTagged
2020-04-05T12:47:25.338 INFO:tasks.cephfs_test_runner:    "scrub_tag"
2020-04-05T12:47:25.338 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_forward_scrub.py", line 35, in _read_str_xattr
2020-04-05T12:47:25.339 INFO:tasks.cephfs_test_runner:    strlen = struct.unpack('i', output[0:4])[0]
2020-04-05T12:47:25.339 INFO:tasks.cephfs_test_runner:TypeError: a bytes-like object is required, not 'str'
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 20dafc6d52acc4af235dc061fa67ecd617a90159)

5 years agoqa/tasks/cephfs: use BytesIO for capturing binary
Kefu Chai [Sun, 5 Apr 2020 13:16:10 +0000 (21:16 +0800)]
qa/tasks/cephfs: use BytesIO for capturing binary

this change partially reverts e46eb8348e0639ea162b7e224bca40e0257ad6ef.

xattrs could contain non-utf8 encoded data, and should be captured using
BytesIO. moreover, it will be fed to `ceph-dencoder`, which expects
binary when performing "import".

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit eb2c6b3740cee7c8e28c163f73525cbabf2e7faf)

5 years agoqa/tasks/fs.py: use six.viewitems()
Kefu Chai [Sun, 5 Apr 2020 12:54:02 +0000 (20:54 +0800)]
qa/tasks/fs.py: use six.viewitems()

in python3, dict.viewitems() is replaced with dict.items().

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 51fc7a992204fb14aba2eb29d96c1785a79ca27f)

5 years agoqa/tasks/cephfs: use assertCountEqual if PY3
Kefu Chai [Sun, 5 Apr 2020 12:50:11 +0000 (20:50 +0800)]
qa/tasks/cephfs: use assertCountEqual if PY3

assertItemsEqual is renamed to assertCountEqual in Python3.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 21d6c5a95b4a6873bc8f35a74e3f48436bd96264)

5 years agoqa/tasks/cephfs: compare number with number
Kefu Chai [Sun, 5 Apr 2020 12:44:20 +0000 (20:44 +0800)]
qa/tasks/cephfs: compare number with number

to address following failure:
```
2020-04-05T12:25:30.997 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2020-04-05T12:25:30.997 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_misc.py", line 50, in test_root_rctime
2020-04-05T12:25:30.998 INFO:tasks.cephfs_test_runner:    self.assertGreaterEqual(rctime, t-10)
2020-04-05T12:25:30.998 INFO:tasks.cephfs_test_runner:  File "/usr/lib/python3.5/unittest/case.py", line 1215, in assertGreaterEqual
2020-04-05T12:25:30.998 INFO:tasks.cephfs_test_runner:    if not a >= b:
2020-04-05T12:25:30.999 INFO:tasks.cephfs_test_runner:TypeError: unorderable types: str() >= float()
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 83e41daec4d7353361d3897770ad31f79bc80681)

5 years agoqa/tasks/cephfs: do no radom.sample(a_dict)
Kefu Chai [Sun, 5 Apr 2020 12:39:35 +0000 (20:39 +0800)]
qa/tasks/cephfs: do no radom.sample(a_dict)

collect the keys instead of filtering a dict,
to address following failure:
```
2020-04-05T12:15:36.275 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2020-04-05T12:15:36.275 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_strays.py", line 29, in test_files_throttle
2020-04-05T12:15:36.275 INFO:tasks.cephfs_test_runner:    self._test_throttling(self.FILES_THROTTLE)
2020-04-05T12:15:36.276 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_strays.py", line 96, in _test_throttling
2020-04-05T12:15:36.276 INFO:tasks.cephfs_test_runner:    return self._do_test_throttling(throttle_type)
2020-04-05T12:15:36.278 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/test_strays.py", line 176, in _do_test_throttling
2020-04-05T12:15:36.278 INFO:tasks.cephfs_test_runner:    mds_max_purge_ops = int(self.fs.get_config("mds_max_purge_ops", 'mds'))
2020-04-05T12:15:36.279 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/github.com_tchaikov_ceph_wip-qa-py3/qa/tasks/cephfs/filesystem.py", line 285, in get_config
2020-04-05T12:15:36.279 INFO:tasks.cephfs_test_runner:    service_id = random.sample(filter(lambda i: self.mds_daemons[i].running(), self.mds_daemons), 1)[0]
2020-04-05T12:15:36.280 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/git.ceph.com_git_teuthology_py3/virtualenv/lib/python3.5/random.py", line 311, in sample
2020-04-05T12:15:36.280 INFO:tasks.cephfs_test_runner:    raise TypeError("Population must be a sequence or set.  For dicts, use list(d).")
2020-04-05T12:15:36.280 INFO:tasks.cephfs_test_runner:TypeError: Population must be a sequence or set.  For dicts, use list(d).
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 40d0356249193bf4aaa2d38923eef19caa63eb59)

5 years agoqa/tasks: use StringIO for capturing string output
Kefu Chai [Sun, 5 Apr 2020 10:35:42 +0000 (18:35 +0800)]
qa/tasks: use StringIO for capturing string output

see d8d44ed1566b19eec055e07da2a0fed88fed4152

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 8bfe977854686149c74de3ebaed7b571d43404dd)

Conflicts:
qa/tasks/ceph_manager.py
qa/tasks/cephadm.py: trivial resolutions

5 years agotest/rgw: use "a // b" instead of "a / b"
Kefu Chai [Sat, 4 Apr 2020 16:20:42 +0000 (00:20 +0800)]
test/rgw: use "a // b" instead of "a / b"

for expressions where the value is expected to be integer. as in
python3, `a / b` returns a float.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 253fc931800a0fac8f86c9228f58ba096f58dfeb)

5 years agoqa/tasks: use "a // b" instead of "a / b"
Kefu Chai [Sat, 4 Apr 2020 16:02:40 +0000 (00:02 +0800)]
qa/tasks: use "a // b" instead of "a / b"

for expressions where the value is expected to be integer. as in
python3, `a / b` returns a float.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 2089bf04b9c3b4bb065bf4c0bafa97419f2d87ff)

Conflicts:
qa/tasks/cephfs/test_full.py
qa/tasks/cephfs/test_strays.py: trivial resolutions

5 years agoMerge pull request #35278 from jan--f/rm-mds_log_max_segments-nautlius
Nathan Cutler [Tue, 2 Jun 2020 19:35:52 +0000 (21:35 +0200)]
Merge pull request #35278 from jan--f/rm-mds_log_max_segments-nautlius

nautilus: doc: mds-config-ref: update 'mds_log_max_segments' value

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
5 years agoqa/tasks: do not random.choice(a_view)
Kefu Chai [Thu, 2 Apr 2020 05:29:45 +0000 (13:29 +0800)]
qa/tasks: do not random.choice(a_view)

use `random.sample()` instead of `random.choice(list(a_view))` for better performance.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 9ca45bd942ef1ed0d7ed61d87caffdfc97e54e5e)

Conflicts:
qa/tasks/ceph_manager.py: trivial resolution

5 years agopybind/mgr/dashboard/.pylintrc: drop xrange from the whitelist
Kefu Chai [Wed, 1 Apr 2020 12:22:21 +0000 (20:22 +0800)]
pybind/mgr/dashboard/.pylintrc: drop xrange from the whitelist

since dashboard is now xrange-free, there is no need to have
xrange-builtin in whitelist, moreover, in python3 the error message
cannot be emitted at seeing xrange.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 0930652318f0f2bbbefbe7dd829bc914405c9013)

5 years agopybind: s/xrange/range/
Kefu Chai [Wed, 1 Apr 2020 12:20:13 +0000 (20:20 +0800)]
pybind: s/xrange/range/

fortunately, cython does not complain at seeing xrange, but let's drop
the last bit of python2.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit ad2bbbc1edb29d3623299fd25f72458623415a96)

5 years agoqa,tes: s/xrange/range/
Kefu Chai [Wed, 1 Apr 2020 12:14:02 +0000 (20:14 +0800)]
qa,tes: s/xrange/range/

use six.moves.range for python3 copatibility, we can drop six after
migrating to python3.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit dd8d929c9ccd9864e4a5005e44eac2739e5fa762)

Conflicts:
qa/tasks/cephfs/test_failover.py: trivial resolution

5 years agoqa/tasks: use next(iter(..)) for accessing first element in a view
Kefu Chai [Tue, 31 Mar 2020 02:16:40 +0000 (10:16 +0800)]
qa/tasks: use next(iter(..)) for accessing first element in a view

in python2, dict.values() and dict.keys() return lists. but in python3,
they return views, which cannot be indexed directly using an integer index.

there are three use cases when we access these views in python3:

1. get the first element
2. get all the elements and then *might* want to access them by index
3. get the first element assuming there is only a single element in
   the view
4. iterate thru the view

in the 1st case, we cannot assume the number of elements, so to be
python3 compatible, we should use `next(iter(a_dict))` instead.

in the 2nd case, in this change, the view is materialized using
`list(a_dict)`.

in the 3rd case, we can just continue using the short hand of
```py
(first_element,) = a_dict.keys()
```
to unpack the view. this works in both python2 and python3.

in the 4th case, the existing code works in both python2 and python3, as
both list and view can be iterated using `iter`, and `len` works as
well.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit d7258ea7fdcd81d4a88028a25b32ed5b278d0752)

Conflicts:
qa/tasks/barbican.py
qa/tasks/cbt.py
qa/tasks/vault.py: trivial resolutions

5 years agoqa/tasks/cephfs: use StringIO for capturing str
Kefu Chai [Sat, 28 Mar 2020 11:10:03 +0000 (19:10 +0800)]
qa/tasks/cephfs: use StringIO for capturing str

if we don't expect non-utf8 in stdout, use StringIO instead of BytesIO.

see also d8d44ed1566b19eec055e07da2a0fed88fed4152

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit f10f86579684a0d1b8d99787b8e19709a64df7d6)

Conflicts:
qa/tasks/cephfs/mount.py: trivial resolution

5 years agoqa: get rid of iteritems for python3 compatibility
Kyr Shatskyy [Wed, 9 Oct 2019 12:36:58 +0000 (14:36 +0200)]
qa: get rid of iteritems for python3 compatibility

Fixes: https://tracker.ceph.com/issues/42267
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 50b1823faca0e73fe81a3c2aca12dae3e250abb6)

Conflicts:
qa/tasks/barbican.py
qa/tasks/ragweed.py
qa/tasks/s3roundtrip.py
qa/tasks/s3tests.py
qa/tasks/s3tests_java.py
qa/tasks/vault.py: trivial resolution

5 years agoqa/tasks/ceph.py: quote "<kind>" in command line
Kefu Chai [Fri, 6 Mar 2020 04:17:40 +0000 (12:17 +0800)]
qa/tasks/ceph.py: quote "<kind>" in command line

otherwise bash will intepret "kind" as a file when handling command like
```
sudo zgrep <kind> /var/log/ceph/valgrind/* /dev/null | sort | uniq
```
and try to feed its content to zgrep, and write the output of zgrep
to /var/log/ceph/valgrind/*. this is not the intended behavior. what we
what to do is to pass "<kind>" as an argument to zgrep, along with
the globbed files names which matches "/var/log/ceph/valgrind/*".

in this change, "<kind>" is quoted as in the command line. it's also
what `pipes.quote()` does before the change of
35cf5131e7152ce20d916aa99c124751d6a97f5c.

this addresses the regression introduced by
35cf5131e7152ce20d916aa99c124751d6a97f5c.

Fixes: https://tracker.ceph.com/issues/44454
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit da736c22c5ac39f3b45018f6a9a52cc469e504d5)

5 years agotasks/ceph: drop testdir replacement in skeleton_config
Kyr Shatskyy [Wed, 9 Oct 2019 23:15:37 +0000 (01:15 +0200)]
tasks/ceph: drop testdir replacement in skeleton_config

The str.format is not used anymore for ceph.conf.template

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit f1a96b55dc9b383810cbae6b2c4e953806ed9313)

5 years agoqa/tasks/cephfs: fix syntax error
Kefu Chai [Tue, 24 Mar 2020 10:15:58 +0000 (18:15 +0800)]
qa/tasks/cephfs: fix syntax error

it's a regression introduced by 9f6c764f10

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 496d7e21325e8efa6bbac57a519db2f07d8d7ee5)

5 years agoqa/tasks/mgr: fix imports for py3
Kefu Chai [Fri, 27 Mar 2020 05:33:05 +0000 (13:33 +0800)]
qa/tasks/mgr: fix imports for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit e7473b631d862110160c3ef95aa6edce11fe2092)

5 years agoqa/tasks/ceph_fuse: fix import for py3
Kyr Shatskyy [Mon, 16 Dec 2019 02:13:50 +0000 (03:13 +0100)]
qa/tasks/ceph_fuse: fix import for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit ac2fa95b21a3d4b3719af39c6416606111458cf8)

5 years agoqa/tasks/qemu: get rid of cStringIO for py3
Kyr Shatskyy [Fri, 21 Feb 2020 18:45:58 +0000 (19:45 +0100)]
qa/tasks/qemu: get rid of cStringIO for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 914c0816e639b16780cfb991f5a89ffbb496d001)

5 years agoqa/tasks/ragweed: get rid of cString for py3
Kyr Shatskyy [Sat, 15 Feb 2020 10:20:11 +0000 (11:20 +0100)]
qa/tasks/ragweed: get rid of cString for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit f0c5f56ef8ba869ccacf799a9ed6df9dedf0caaa)

5 years agoqa/tasks/s3tests: py3 compat
Kyr Shatskyy [Sat, 15 Feb 2020 10:12:40 +0000 (11:12 +0100)]
qa/tasks/s3tests: py3 compat

- use string.ascii_uppercase instead string.uppercase
- use six.ensure_str for bytes when required
- use six.ensure_binary if needed
- get rid of dict.itervalues in favor of dict.values
- get rid of cStringIO.StringIO in favor io.BytesIO

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 478083e7319b0fc0eba5fc4f7fa9193ece784b15)

5 years agoqa/tasks/rgw_logsocket: get rid of cStringIO for py3
Kyr Shatskyy [Sat, 15 Feb 2020 11:08:52 +0000 (12:08 +0100)]
qa/tasks/rgw_logsocket: get rid of cStringIO for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 4cf205f2856b66140f798484bff4951c95ad01a1)

5 years agoqa/tasks: fix import module path for py3 compat
Kyr Shatskyy [Mon, 16 Dec 2019 10:35:08 +0000 (11:35 +0100)]
qa/tasks: fix import module path for py3 compat

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 1c81d3873d904e42f7a534db0e419c23e5220aed)

5 years agoqa/tasks/cephfs/kernel_mount: get rid of StringIO.StringIO for py3
Kyr Shatskyy [Mon, 16 Dec 2019 01:46:13 +0000 (02:46 +0100)]
qa/tasks/cephfs/kernel_mount: get rid of StringIO.StringIO for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 875b45f3c903781ba99dbd2fcf4d2fc89001c25b)

Conflicts:
qa/tasks/cephfs/kernel_mount.py: trivial resolution

5 years agoqa/tasks/kclient: fix import for py3
Kyr Shatskyy [Mon, 16 Dec 2019 01:50:09 +0000 (02:50 +0100)]
qa/tasks/kclient: fix import for py3

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 06f22a3097c66a3f04e2b00a388aa468fa5dbd30)