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
This commit is contained in:
parent
899702cc87
commit
dd2f3db1f4
|
@ -1700,8 +1700,7 @@ def upgrade_monitor(new_version):
|
|||
sys.exit(1)
|
||||
try:
|
||||
if systemd():
|
||||
for mon_id in get_local_mon_ids():
|
||||
service_stop('ceph-mon@{}'.format(mon_id))
|
||||
service_stop('ceph-mon')
|
||||
else:
|
||||
service_stop('ceph-mon-all')
|
||||
apt_install(packages=determine_packages(), fatal=True)
|
||||
|
@ -1725,8 +1724,7 @@ def upgrade_monitor(new_version):
|
|||
perms=0o755)
|
||||
|
||||
if systemd():
|
||||
for mon_id in get_local_mon_ids():
|
||||
service_start('ceph-mon@{}'.format(mon_id))
|
||||
service_start('ceph-mon')
|
||||
else:
|
||||
service_start('ceph-mon-all')
|
||||
except subprocess.CalledProcessError as err:
|
||||
|
|
|
@ -115,11 +115,11 @@ class UpgradeRollingTestCase(unittest.TestCase):
|
|||
status_set.assert_has_calls([
|
||||
call('maintenance', 'Upgrading monitor'),
|
||||
])
|
||||
assert not chownr.called
|
||||
mkdir.assert_called_with('/var/lib/ceph/mon/ceph-testmon',
|
||||
owner='root',
|
||||
group='root',
|
||||
perms=0o755)
|
||||
chownr.assert_not_called()
|
||||
|
||||
@patch.object(ceph.utils, 'ceph_user')
|
||||
@patch.object(ceph.utils, 'socket')
|
||||
|
@ -174,6 +174,52 @@ class UpgradeRollingTestCase(unittest.TestCase):
|
|||
group='ceph',
|
||||
perms=0o755)
|
||||
|
||||
@patch.object(ceph.utils, 'ceph_user')
|
||||
@patch.object(ceph.utils, 'socket')
|
||||
@patch.object(ceph.utils, 'mkdir')
|
||||
@patch.object(ceph.utils, 'apt_install')
|
||||
@patch.object(ceph.utils, 'chownr')
|
||||
@patch.object(ceph.utils, 'service_stop')
|
||||
@patch.object(ceph.utils, 'service_start')
|
||||
@patch.object(ceph.utils, 'log')
|
||||
@patch.object(ceph.utils, 'status_set')
|
||||
@patch.object(ceph.utils, 'apt_update')
|
||||
@patch.object(ceph.utils, 'add_source')
|
||||
@patch.object(ceph.utils, 'systemd')
|
||||
@patch.object(ceph.utils, 'get_version')
|
||||
@patch.object(ceph.utils, 'config')
|
||||
def test_upgrade_monitor_luminous(self, config, get_version,
|
||||
systemd, add_source,
|
||||
apt_update, status_set, log,
|
||||
service_start, service_stop, chownr,
|
||||
apt_install, mkdir, socket,
|
||||
ceph_user):
|
||||
get_version.side_effect = [10.2, 12.2]
|
||||
config.side_effect = config_side_effect
|
||||
socket.gethostname.return_value = 'testmon'
|
||||
ceph_user.return_value = 'ceph'
|
||||
systemd.return_value = True
|
||||
|
||||
ceph.utils.upgrade_monitor('luminous')
|
||||
service_stop.assert_called_with('ceph-mon')
|
||||
service_start.assert_called_with('ceph-mon')
|
||||
add_source.assert_called_with('cloud:trusty-kilo', 'key')
|
||||
|
||||
log.assert_has_calls(
|
||||
[
|
||||
call('Current ceph version is 10.2'),
|
||||
call('Upgrading to: luminous')
|
||||
]
|
||||
)
|
||||
status_set.assert_has_calls([
|
||||
call('maintenance', 'Upgrading monitor'),
|
||||
])
|
||||
chownr.assert_not_called()
|
||||
mkdir.assert_called_with('/var/lib/ceph/mon/ceph-testmon',
|
||||
owner='ceph',
|
||||
group='ceph',
|
||||
perms=0o755)
|
||||
|
||||
@patch.object(ceph.utils, 'get_version')
|
||||
@patch.object(ceph.utils, 'status_set')
|
||||
@patch.object(ceph.utils, 'lock_and_roll')
|
||||
|
|
Loading…
Reference in New Issue