From 4b2114f83570ee3df2644ed56523509e57b046df Mon Sep 17 00:00:00 2001 From: Ilya Kharin Date: Mon, 19 Sep 2016 22:27:58 +0300 Subject: [PATCH] Restart radosgw during upgrade-ceph The radosgw have to be restarted during the upgrade of Ceph otherwise the object store will be unavailable on the primary controller. Change-Id: If949b24a6176c3c65ff4c26b089b4997bd991cb5 Related-Bug: #1624341 --- octane/commands/upgrade_ceph.py | 1 + octane/tests/test_ceph.py | 14 ++++++++++++++ octane/util/ceph.py | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/octane/commands/upgrade_ceph.py b/octane/commands/upgrade_ceph.py index 440a7a19..95b3f735 100644 --- a/octane/commands/upgrade_ceph.py +++ b/octane/commands/upgrade_ceph.py @@ -167,6 +167,7 @@ def upgrade_ceph(orig_id, seed_id): "env-{0}-ceph.conf.tar.gz".format(orig_id)) conf_filename, db_path = extract_mon_conf_files(orig_env, tar_filename) ceph_set_new_mons(orig_env, seed_env, tar_filename, conf_filename, db_path) + ceph.restart_radosgw(seed_env) def upgrade_ceph_with_graph(orig_id, seed_id): diff --git a/octane/tests/test_ceph.py b/octane/tests/test_ceph.py index 97d70912..3daac228 100644 --- a/octane/tests/test_ceph.py +++ b/octane/tests/test_ceph.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import mock + import pytest from octane.util import ceph @@ -35,3 +37,15 @@ def test_get_ceph_conf_filename(mocker, node, cmd_output, conf_file): "octane.util.ssh.call_output", return_value=cmd_output) assert conf_file == ceph.get_ceph_conf_filename(node) mock_ssh.assert_called_once_with(cmd, node=node) + + +def test_restart_radowgw(mocker): + mock_get = mocker.patch("octane.util.env.get_one_controller") + mock_call = mocker.patch("octane.util.ssh.call") + mock_env = mock.Mock() + + ceph.restart_radosgw(mock_env) + + mock_get.assert_called_once_with(mock_env) + mock_call.assert_called_once_with(["service", "radosgw", "restart"], + node=mock_get.return_value) diff --git a/octane/util/ceph.py b/octane/util/ceph.py index 5fc9518b..2747a27c 100644 --- a/octane/util/ceph.py +++ b/octane/util/ceph.py @@ -48,3 +48,8 @@ def get_ceph_conf_filename(node): if value == '-c' and i < len(cmdline): return cmdline[i + 1] return '/etc/ceph/ceph.conf' + + +def restart_radosgw(env): + node = env_util.get_one_controller(env) + ssh.call(["service", "radosgw", "restart"], node=node)