Commit Graph

19 Commits

Author SHA1 Message Date
Robert Gildein 1a7e8df4ef Fixed raise text value instead of Exception
I used ValueError for both exception.
Also removed unnecessary flake8 ignore option.

Closes-Bug: #1917351
Change-Id: I5ee58aa0a34d7c266b3811f9c6b9b3076bfdc048
2021-03-31 21:26:21 +02:00
Ghanshyam Mann a290b14e3b [ussuri][goal] Updates for python 2.7 drop
OpenStack is dropping the py2.7 support in ussuri cycle.

charm repos need few updates on either py2 drop or updating
ussuri python template, tox.ini etc.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Needed-By: https://review.opendev.org/#/c/714728/

Change-Id: I2bcf1208d75d8cdda4e3892b3e48c85eaf5db8d1
2020-03-25 06:14:19 +00:00
Frode Nordahl fead2944a8
Unpin flake8, fix lint
We need to unpin flake8 to allow linting on Python 3.8 systems.

Change-Id: Idf2fea27b19cec47ffed9891b518ac7b5b75e405
2020-03-12 11:12:37 +01:00
Corey Bryant c5a7e8f1c8 Rename ceph to charms_ceph
The new python3-ceph-common deb package (introduced in ceph octopus)
adds a new ceph directory (a parent package in python terms) in
/usr/lib/python3/dist-packages/ceph/. This results in a conflict with
charm-ceph-xyz/lib/ceph/ on imports. For example, with the current
import of ceph.utils in ceph-osd/hooks/ceph_hooks.py, Python finds no
utils.py in /usr/lib/python3/dist-packages/ceph/ and then stops
searching. Therefore, rename ceph to charms_ceph to avoid the
conflict.

Change-Id: I6eaf03e291f65125269b1836dd2636806f9945e1
2020-02-24 15:19:34 +00:00
Corey Bryant cb8684cb19 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Change-Id: I15fca9607c86fe763b009033a92a357d8e6c895b
Story: #2005924
Task: #34228
2019-07-30 10:13:58 -04:00
James Page f29aba7672 Updates to support Ceph Nautilus release
For Nautilus the Ceph monitors automatically create the admin and
bootstrap keyrings as part of cluster formation so the charm just
needs to retrieve the admin keyring after the monitors have been
bootstrapped.

As the bootstrap process is two quite distinct steps, this change
refactors the bootstrap_monitor_cluster function into two discrete
functions - one to create and start the ceph monitor, and a second
to create the ceph keyrings on the local filesystem.

As the osd-bootstrap keyring is not actually created on disk from
Nautilus onwards, the 'is_bootstrapped' function now looks for the
client.admin keyring across all Ceph releases - this should be
backwards compatible.

This change also adds the standing data for upgrade paths to
Nautilus, however this is as yet untested.

Change-Id: I2dfab7404b72e314625ea554ee64595c5e26f3c6
2019-05-31 10:43:34 +01:00
Ghanshyam Mann 5e72e54053 Dropping the py35 testing
All the integration testing has been moved to
Bionic now[1] and py3.5 is not tested runtime for
Train or stable/stein[2].

As per below ML thread, we are good to drop the py35
testing now:
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005097.html

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004647.html
[2]
https://governance.openstack.org/tc/reference/runtimes/stein.html
https://governance.openstack.org/tc/reference/runtimes/train.html

Change-Id: Ibcf91346b7e0b7b6788a3f0e085698efe9d6f8e4
2019-04-23 04:51:01 +00:00
Frode Nordahl 151a242dba
Add helper for creating rbd-mirror key
tox: Remove cleanup of Python object files as this breaks
in the upstream gate.

tox: While at it migrate from os-testr to stestr.

Change-Id: I1bad5311ed034188a78dc67b493c22bff7ce4f7d
2019-02-13 07:08:22 +01:00
Doug Hellmann d43a3c0862 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: I63830ec00763aa522934f555b1d90b409df6e147
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-09-26 18:41:06 -04:00
wangqi 54ba08674b Enable Python hash seed randomization in tests
Unit tests should run with hash seed randomization
on, to ensure code is not introduced that relies on
ordered access of dicts, sets, etc.

Python 3.3 enables this at runtime by default.

Change-Id: I792cf9d24867b0bb8c9c43030ed80d5fd6ce6ec0
2018-06-05 13:48:28 +00:00
Frode Nordahl 3550df998f
Remove the reformat option, add check of device pristinity
As a part of the mitigation of LP Bug #1698154 remove the reformat
option and initialization of journal devices entirely. Ceph charms
can rely on actions to have operator administratively execute
zap_disk.

There should not be a code path that could accidentally execute
zap_disk without administrative intervention.

Make py27 test noop

Flip pep8 test to py3

Partial-Bug: #1698154
Change-Id: I90a866aa138d18e4242783c42d4c7c587f696d7d
2018-06-04 12:13:28 +02:00
James Page 9d1a8a61fa Add support for key manager configuration
Add support for propagation of key manager configuration from
calling charms into OSD preparation codepaths; this is used
predominately in the 'vault' key management approach where
the block device is encrypted outside of ceph-volume/ceph-disk
vs the 'ceph' key management approach where ceph tools take
responsibility for management of the keys lower down the stack.

The 'vault' key management approach is integrated in the
_initialize_disk function - if vault is selected as the key
manager, then vaultlocker is used to encrypt and open the disk;
the resulting /dev/mapper/crypt-<UUID> device is then used
for LVM, rather than the underlying partition.

Change-Id: If73e7bd518a7bc60c2db08e2aa3a93dcfe79c0dd
2018-04-25 12:09:33 +01:00
Alex Kavanagh 407d98b96a Make charms.ceph fully py2/py3 compatible
These changes make the charms.ceph library suitable for both the
old-stable Python 2 charms and the (to be) updates Python 3 only charms.
Avoided use of six by using str() with the decode('UTF-8') function to
allow the library to be used with both Py2 and Py3.  The str(...)
coercions can be removed at a later date when the library no longer
needs to be synced to Py2 versions of the ceph-* charms.

Change-Id: I416053439444bf4cf8945d1fe96643f9ed0f05f4
2017-10-30 12:02:58 +00:00
Chris MacNaughton 594b6a361d Add optional additional device types
We want to allow the user to use additional block
devices as bluestore Write Ahead Log
or bluestore RocksDB storage

Closes-Bug: #1710474
Change-Id: I4d5a03a340b88959f9d36864244fd42060302a15
2017-09-25 11:30:36 -04:00
James Page 43e7a3c691 Call ceph-create-keys for >= Luminos
Ceph Luminos removes the automatic call to ceph-create-keys on
ceph-mon startup; deployment tools are required to call this
after the monitors have been started to create the admin keyring
across the cluster.

ceph-create-keys still blocks until the cluster is in quorum, at
which points keys are created and written out to the normal location
in /etc/ceph.

Change-Id: Ifc9b8aaf3dbce71cb62567ba03455d2196eaf29f
2017-07-05 11:05:22 +01:00
Billy Olsen fd3fad022d Fix pep8 for setup.py
Commit 195d002ab added a setup.py to the charms.ceph library for
inclusion in the pypi repositories. The setup.py file included was
not lint checked and introduces pep8 violations which are checked
in dependent projects (charm-ceph-osd, charm-ceph-mon, etc).

This change fixes the pep8 linting and also adds the setup.py file
to the tox configuration file to prevent future issues.

Change-Id: Ic84d3348023e8fa968638be935af9b5d31806ef1
2017-03-13 16:22:14 -07:00
James Page 195d002ab1 Add setup.py for use as python module
charms.ceph is not currently installable using pip; add required
setup.py file to ensure it can be consumed in this way.

Change-Id: Ife1828213d01eed541153089eef0b93efb941a57
2017-03-10 11:35:41 +00:00
James Page 7766bef0b9 Fixup py3 compatibility 2016-09-20 14:49:19 +01:00
Chris Holcombe 13f8e8a1b0 Add pool support to get_named_key
This patch adds a list of pool support into the
get_named_key
function to allow callers to specify the pools the cephx key
should have access to.  This patch also adds in tox testing.
2016-08-04 15:12:00 -07:00