Commit Graph

22 Commits

Author SHA1 Message Date
Chris MacNaughton 18fc2c6748 Ensure we restart the correct systemd unit on upgrade.
Closes-Bug: #1962296
Change-Id: I7acabfcb28b5faee3d4a6018595d24914db552b2
2022-02-25 11:09:47 +01:00
Zuul bfa3691822 Merge "Explicitly enable msgr2 for Nautilus and later" 2022-01-11 09:54:44 +00:00
James Troup 0dec5c0188 Spelling fixes from codespell with additional consistency cleanups.
Change-Id: I1d409043eec980982fc6fc472524c562f908d402
2021-12-20 13:54:16 +00:00
James Vaughn ff752de0f0 Explicitly enable msgr2 for Nautilus and later
When updating to Ceph Nautilus (OpenStack Train) or later releases from
a pre-Nautilus release, msgr2 will not be enabled without manual
intervention (e.g. running `juju ssh ceph-mon/leader 'sudo ceph mon
enable-msgr2'`).

Leaving msgr2 disabled (i.e. using msgr1 only) isn't an issue for normal
operations; Ceph will simply show a warning in `sudo ceph status` that
this is the case. However, Ceph Nautilus and later releases default to
msgr2, meaning that new ceph-mon units will attempt to communicate with
the existing cluster using msgr2.

This commit enables msgr2 on package upgrades on all Ceph releases
including and after Nautilus.

Closes-Bug: #1840701
Change-Id: Ib90cd03b16f2062fa6c6a43d242d51306ae8ca95
2021-12-14 14:51:06 +01:00
Edward Hope-Morley a14800daa1 Upgrade mon packages immediately
Instead of deferring the upgrading of packages
when doing a release upgrade, do them immediately
and only defer daemon restarts. This is to avoid
any api incompatibilities between newer mons and
older clients.

Change-Id: Idf77871561fa14ad61e0c7901eeb333254e37012
Closes-Bug: #1897594
2020-09-29 11:44:17 +01:00
Alex Kavanagh b688f04889 Add a progress watchdog for OSD upgrades
This patch add the concept of a watchdog to the upgrade_monitor so that
the charm can achieve two objectives of 1. Waiting for much longer, but
2. detecting whether the previous node has died / gone away.  This is
needed for 'large' OSDs where the time to upgrade a node may exceed the
current limit of 10 minutes, but also not to wait for 30 minutes on a
dead previous node.  The watchdog implements two timeouts and an
addition 'alive' key from the previous node to indicate that it is still
running.  Otherwise, functionality is identical.

Change-Id: Ia450e936c2096f092af3be5a369b7abaf5023b16
Related-Bug: #1762852
2020-07-14 12:53:40 +01:00
Zuul 5c06f74ab3 Merge "Use unittest.mock instead of mock" 2020-07-13 05:54:38 +00:00
Alex Kavanagh 05c8a8a5b8 Fix upgrade bug (luminous) where mgr is not restarted
From luminous to mimic, the ceph-mgr isn't restarted, leaving it at
luminous, rather than mimic.  This change ensures that the ceph-mgr is
restarted when the version is luminous or later.

Change-Id: I2844736af2de27ce071db859311ac99b9b3057ad
Related-Bug: #1849874
2020-07-08 15:39:43 +01:00
Hervé Beraud 4f135d9e97 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Change-Id: Id257b597368aff252ce7120b9dbc02f21a41e629
2020-06-09 00:03:48 +02: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
Chris MacNaughton 0434024b2b Fix charms.ceph mocks to not depend on system version
The charms.ceph utils.py library defines a constant based
on the running OS version. This change updates where the
version is read, allowing it to be nicely mocked.

Change-Id: Ibd65526cad0812f93963bd82619fcd27e055f6f3
Closes-Bug: #1861659
2020-02-03 10:18:08 +01:00
James Page ad2d606b0c upgrade: Ensure ceph-mgr is bootstrapped
When upgrading to Luminous, ensure that the ceph-mgr daemons
are bootstrapped *once* all ceph-mons have been upgraded.

This ensures that the call to create the required keyring
supports the new profile for the mgr daemon.

Change-Id: Iff04c493a642cc5475eb31653064c2bab1210539
Closes-Bug: 1742408
2018-01-10 10:51:02 +00:00
Zuul 8d10c2026e Merge "py3: Deal with comparison with str and None" 2018-01-10 09:28:59 +00:00
James Page e007b5265c py3: Deal with comparison with str and None
Under Python 3, its not possible to compare a float with an object
of type str or NoneType; ensure that these conditions are handled
in the conditional which waits for the previous unit in the cluster
to complete upgrade before the current unit commences.

This change also includes a minor change to the way time span
assessed in unit tests for this function.

Change-Id: I34e3be4c55976d562497257626a339c72efabbad
Closes-Bug: 1742079
2018-01-09 16:02:48 +00:00
James Page dd2f3db1f4 systemd: Use ceph-mon unit during upgrades
The monitor bootstrap code uses the ceph-mon systemd unit (instead
of the ceph-mon@ systemd unit); ensure that the monitor upgrade
code uses ceph-mon as well otherwise ceph-mon daemons are not
restarted during a managed upgrade.

Change-Id: I6ca7c5c7ca8cf3a62a5ee3209f14c059c0eec9be
Closes-Bug: 1742082
2018-01-09 14:28:02 +00:00
James Page ae147d8a18 upgrade: correct permissions for ceph-mon dirs
Ensure that the directory in /var/lib/ceph/mon for the local
mon unit is user writable, ensuring that ceph-mon daemons
>= Luminous are able to start.

Closes-Bug: 1742083

Change-Id: I9cac4bd258b7038738a693329588420696eac703
2018-01-09 13:58:47 +00:00
Edward Hope-Morley dd978b7bd0 Code cleanup
* import ordering
* doctrings
* unit tests cleanup
* move code out of __init__.py
* rename files

Change-Id: Id56d4ea1a0cca33df03f40222bbf51a6bef58b20
2017-08-11 12:42:29 +01:00
Billy Olsen c835714905 chownr /var/lib/ceph only when needed
Infernalis release of Ceph switched to running the ceph daemons
under the ceph:ceph user instead of root:root. The upgrade OSD
logic does not take this into conideration and blindly runs the
recursive chown for whatever the current user is expected to be
when the upgrade is run.

This is problematic in production clusters with large numbers of
objects stored across 10 or more OSDs as this will cause a walk
of all the inodes under /var/lib/ceph unnecessarily. This change
ensures that the chown is only done when the upgrade target is
Jewel (Ubuntu Cloud Archives do not contain Infernalis release).

Change-Id: Id4bd48ebb90928b989df718404263e40f926c201
Partial-Bug: #1657527
2017-01-18 11:31:38 -07:00
James Page 9c707f166a Ensure that links are followed during upgrade
When upgrading mon and osd units, ensure that symlinks are followed
to ensure that directory based OSD's are upgraded correctly (which
are typically a symlink from /var/lib/ceph/osd/X -> actual_dir).

Change-Id: I7656bbc633b9706bd406dbca0f11fe6108916a02
Partial-Bug: 1611082
2017-01-07 16:35:34 +00:00
James Page f5b53c6abe Tidy up status set/log messages during upgrades
Misc updates to use of status_set, and ensure that
the new version of ceph is correctly logged by passing down
to upgrade_{mon,osd}.

Change-Id: If094eacbc8cab598a0913bf1f93e5a6de88203d7
2016-10-20 15:24:47 +01:00
James Page 7766bef0b9 Fixup py3 compatibility 2016-09-20 14:49:19 +01:00
Chris Holcombe 33d1d35e7a Move unit tests to shared library and remove dependence on utils code 2016-09-07 13:31:23 -07:00