systemd: Ensure ceph-osd.target called during upgrade
For systemd based installations, ceph-osd.target should be restarted instead of ceph-osd-all (an upstart configuration) to ensure that all ceph-osd processes are restarted in the event that no directory ownership changes need to take place during the upgrade. Change-Id: I893e440ec90d1f74b52cedb84c332b0ec57f74fe Closes-Bug: 1742120
This commit is contained in:
parent
1ccf7c2b25
commit
550237abc1
|
@ -1922,6 +1922,9 @@ def upgrade_osd(new_version):
|
||||||
# way to update the code on the node.
|
# way to update the code on the node.
|
||||||
if not dirs_need_ownership_update('osd'):
|
if not dirs_need_ownership_update('osd'):
|
||||||
log('Restarting all OSDs to load new binaries', DEBUG)
|
log('Restarting all OSDs to load new binaries', DEBUG)
|
||||||
|
if systemd():
|
||||||
|
service_restart('ceph-osd.target')
|
||||||
|
else:
|
||||||
service_restart('ceph-osd-all')
|
service_restart('ceph-osd-all')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,52 @@ class UpgradeRollingTestCase(unittest.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@patch.object(ceph.utils, 'service_restart')
|
||||||
|
@patch.object(ceph.utils, '_upgrade_single_osd')
|
||||||
|
@patch.object(ceph.utils, 'update_owner')
|
||||||
|
@patch('os.listdir')
|
||||||
|
@patch.object(ceph.utils, '_get_child_dirs')
|
||||||
|
@patch.object(ceph.utils, 'dirs_need_ownership_update')
|
||||||
|
@patch.object(ceph.utils, 'apt_install')
|
||||||
|
@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, 'get_local_osd_ids')
|
||||||
|
@patch.object(ceph.utils, 'systemd')
|
||||||
|
@patch.object(ceph.utils, 'get_version')
|
||||||
|
@patch.object(ceph.utils, 'config')
|
||||||
|
def test_upgrade_osd_luminous(self, config, get_version, systemd,
|
||||||
|
local_osds, add_source, apt_update,
|
||||||
|
status_set,
|
||||||
|
log,
|
||||||
|
apt_install,
|
||||||
|
dirs_need_ownership_update,
|
||||||
|
_get_child_dirs, listdir, update_owner,
|
||||||
|
_upgrade_single_osd, service_restart):
|
||||||
|
config.side_effect = config_side_effect
|
||||||
|
get_version.side_effect = [10.2, 12.2]
|
||||||
|
systemd.return_value = True
|
||||||
|
local_osds.return_value = [0, 1, 2]
|
||||||
|
listdir.return_value = ['osd', 'mon', 'fs']
|
||||||
|
_get_child_dirs.return_value = ['ceph-0', 'ceph-1', 'ceph-2']
|
||||||
|
dirs_need_ownership_update.return_value = False
|
||||||
|
|
||||||
|
ceph.utils.upgrade_osd('luminous')
|
||||||
|
service_restart.assert_called_with('ceph-osd.target')
|
||||||
|
update_owner.assert_not_called()
|
||||||
|
_upgrade_single_osd.assert_not_called()
|
||||||
|
status_set.assert_has_calls([
|
||||||
|
call('maintenance', 'Upgrading osd'),
|
||||||
|
call('maintenance', 'Upgrading packages to luminous')
|
||||||
|
])
|
||||||
|
log.assert_has_calls(
|
||||||
|
[
|
||||||
|
call('Current ceph version is 10.2'),
|
||||||
|
call('Upgrading to: luminous')
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
@patch.object(ceph.utils, 'stop_osd')
|
@patch.object(ceph.utils, 'stop_osd')
|
||||||
@patch.object(ceph.utils, 'disable_osd')
|
@patch.object(ceph.utils, 'disable_osd')
|
||||||
@patch.object(ceph.utils, 'update_owner')
|
@patch.object(ceph.utils, 'update_owner')
|
||||||
|
|
Loading…
Reference in New Issue