Merge "Explicitly enable msgr2 for Nautilus and later"

This commit is contained in:
Zuul 2022-01-11 09:54:44 +00:00 committed by Gerrit Code Review
commit bfa3691822
2 changed files with 40 additions and 4 deletions

View File

@ -2186,6 +2186,20 @@ def roll_monitor_cluster(new_version, upgrade_key):
wait_for_all_monitors_to_upgrade(new_version=new_version,
upgrade_key=upgrade_key)
bootstrap_manager()
# NOTE(jmcvaughn):
# Nautilus and later binaries use msgr2 by default, but existing
# clusters that have been upgraded from pre-Nautilus will not
# automatically have msgr2 enabled. Without this, Ceph will show
# a warning only (with no impact to operations), but newly added units
# will not be able to join the cluster. Therefore, we ensure it is
# enabled on upgrade for all versions including and after Nautilus
# (to cater for previous charm versions that will not have done this).
nautilus_or_later = cmp_pkgrevno('ceph-common', '14.0.0') >= 0
if nautilus_or_later:
wait_for_all_monitors_to_upgrade(new_version=new_version,
upgrade_key=upgrade_key)
enable_msgr2()
except ValueError:
log("Failed to find {} in list {}.".format(
my_name, mon_sorted_list))
@ -3332,6 +3346,16 @@ def bootstrap_manager():
service_restart(unit)
def enable_msgr2():
"""
Enables msgr2
:raises: subprocess.CalledProcessError if the command fails
"""
cmd = ['ceph', 'mon', 'enable-msgr2']
subprocess.check_call(cmd)
def osd_noout(enable):
"""Sets or unsets 'noout'

View File

@ -299,12 +299,13 @@ class UpgradeRollingTestCase(unittest.TestCase):
service='mon',
upgrade_key='admin',
version=new_version)
if new_version == 'luminous':
if new_version in ['luminous', 'mimic']:
wait_for_all_monitors_to_upgrade.assert_called_with(
new_version=new_version,
upgrade_key='admin',
)
bootstrap_manager.assert_called_once_with()
if new_version == 'luminous':
bootstrap_manager.assert_called_once_with()
else:
wait_for_all_monitors_to_upgrade.assert_not_called()
bootstrap_manager.assert_not_called()
@ -312,12 +313,23 @@ class UpgradeRollingTestCase(unittest.TestCase):
upgrade_monitor.assert_has_calls([
call(new_version, restart_daemons=False)])
def test_roll_monitor_cluster_luminous(self):
self._test_roll_monitor_cluster(new_version='luminous')
@patch.object(charms_ceph.utils, 'cmp_pkgrevno', lambda _x, _y: 1)
@patch.object(charms_ceph.utils, 'enable_msgr2')
def test_roll_monitor_cluster_mimic(self, mock_enable_msgr2):
self._test_roll_monitor_cluster(new_version='mimic')
mock_enable_msgr2.assert_called_once()
@patch.object(charms_ceph.utils, 'cmp_pkgrevno', lambda _x, _y: 1)
@patch.object(charms_ceph.utils, 'enable_msgr2')
def test_roll_monitor_cluster_luminous(self, mock_enable_msgr2):
self._test_roll_monitor_cluster(new_version='luminous')
mock_enable_msgr2.assert_called_once()
@patch.object(charms_ceph.utils, 'cmp_pkgrevno', lambda _x, _y: -1)
def test_roll_monitor_cluster_jewel(self):
self._test_roll_monitor_cluster(new_version='jewel')
@patch.object(charms_ceph.utils, 'cmp_pkgrevno', lambda _x, _y: -1)
def test_roll_monitor_cluster_hammer(self):
self._test_roll_monitor_cluster(new_version='hammer')