summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Page <james.page@ubuntu.com>2018-01-10 10:43:12 +0000
committerJames Page <james.page@ubuntu.com>2018-01-10 10:51:02 +0000
commitad2d606b0c9c2ab0a65d5a699237a20f53a5b826 (patch)
tree5829a63e947fba3a83b760bd6d328a494e4c8e4b
parent8d10c2026e650728c39d6cb4c8ab518c80121154 (diff)
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
Notes
Notes (review): Code-Review+2: Chris MacNaughton <chris.macnaughton@canonical.com> Workflow+1: Chris MacNaughton <chris.macnaughton@canonical.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 10 Jan 2018 11:17:21 +0000 Reviewed-on: https://review.openstack.org/532485 Project: openstack/charms.ceph Branch: refs/heads/master
-rw-r--r--ceph/utils.py13
-rw-r--r--unit_tests/test_mon_upgrade_roll.py50
-rw-r--r--unit_tests/test_osd_upgrade_roll.py2
3 files changed, 51 insertions, 14 deletions
diff --git a/ceph/utils.py b/ceph/utils.py
index 0f9d23a..2915225 100644
--- a/ceph/utils.py
+++ b/ceph/utils.py
@@ -1674,12 +1674,23 @@ def roll_monitor_cluster(new_version, upgrade_key):
1674 service='mon', 1674 service='mon',
1675 my_name=my_name, 1675 my_name=my_name,
1676 version=new_version) 1676 version=new_version)
1677 # NOTE(jamespage):
1678 # Wait until all monitors have upgraded before bootstrapping
1679 # the ceph-mgr daemons due to use of new mgr keyring profiles
1680 if new_version == 'luminous':
1681 wait_for_all_monitors_to_upgrade(new_version=new_version,
1682 upgrade_key=upgrade_key)
1683 bootstrap_manager()
1677 except ValueError: 1684 except ValueError:
1678 log("Failed to find {} in list {}.".format( 1685 log("Failed to find {} in list {}.".format(
1679 my_name, mon_sorted_list)) 1686 my_name, mon_sorted_list))
1680 status_set('blocked', 'failed to upgrade monitor') 1687 status_set('blocked', 'failed to upgrade monitor')
1681 1688
1682 1689
1690# TODO(jamespage):
1691# Mimic support will need to ensure that ceph-mgr daemons are also
1692# restarted during upgrades - probably through use of one of the
1693# high level systemd targets shipped by the packaging.
1683def upgrade_monitor(new_version): 1694def upgrade_monitor(new_version):
1684 """Upgrade the current ceph monitor to the new version 1695 """Upgrade the current ceph monitor to the new version
1685 1696
@@ -1883,7 +1894,7 @@ def roll_osd_cluster(new_version, upgrade_key):
1883 version=new_version) 1894 version=new_version)
1884 else: 1895 else:
1885 # Check if the previous node has finished 1896 # Check if the previous node has finished
1886 status_set('blocked', 1897 status_set('waiting',
1887 'Waiting on {} to finish upgrading'.format( 1898 'Waiting on {} to finish upgrading'.format(
1888 osd_sorted_list[position - 1].name)) 1899 osd_sorted_list[position - 1].name))
1889 wait_on_previous_node( 1900 wait_on_previous_node(
diff --git a/unit_tests/test_mon_upgrade_roll.py b/unit_tests/test_mon_upgrade_roll.py
index 6a763ba..0f1a17e 100644
--- a/unit_tests/test_mon_upgrade_roll.py
+++ b/unit_tests/test_mon_upgrade_roll.py
@@ -223,21 +223,22 @@ class UpgradeRollingTestCase(unittest.TestCase):
223 group='ceph', 223 group='ceph',
224 perms=0o755) 224 perms=0o755)
225 225
226 @patch.object(ceph.utils, 'get_version') 226 @patch.object(ceph.utils, 'bootstrap_manager')
227 @patch.object(ceph.utils, 'wait_for_all_monitors_to_upgrade')
227 @patch.object(ceph.utils, 'status_set') 228 @patch.object(ceph.utils, 'status_set')
228 @patch.object(ceph.utils, 'lock_and_roll') 229 @patch.object(ceph.utils, 'lock_and_roll')
229 @patch.object(ceph.utils, 'wait_on_previous_node') 230 @patch.object(ceph.utils, 'wait_on_previous_node')
230 @patch.object(ceph.utils, 'get_mon_map') 231 @patch.object(ceph.utils, 'get_mon_map')
231 @patch.object(ceph.utils, 'socket') 232 @patch.object(ceph.utils, 'socket')
232 def test_roll_monitor_cluster_second(self, 233 def _test_roll_monitor_cluster(self,
233 socket, 234 socket,
234 get_mon_map, 235 get_mon_map,
235 wait_on_previous_node, 236 wait_on_previous_node,
236 lock_and_roll, 237 lock_and_roll,
237 status_set, 238 status_set,
238 get_version): 239 wait_for_all_monitors_to_upgrade,
239 get_version.return_value = "0.94.1" 240 bootstrap_manager,
240 wait_on_previous_node.return_value = None 241 new_version):
241 socket.gethostname.return_value = "ip-192-168-1-3" 242 socket.gethostname.return_value = "ip-192-168-1-3"
242 get_mon_map.return_value = { 243 get_mon_map.return_value = {
243 'monmap': { 244 'monmap': {
@@ -251,15 +252,40 @@ class UpgradeRollingTestCase(unittest.TestCase):
251 ] 252 ]
252 } 253 }
253 } 254 }
254 ceph.utils.roll_monitor_cluster(new_version='0.94.1', 255 ceph.utils.roll_monitor_cluster(new_version=new_version,
255 upgrade_key='admin') 256 upgrade_key='admin')
257 get_mon_map.assert_called_once_with('admin')
258 wait_on_previous_node.assert_called_with(
259 upgrade_key='admin',
260 service='mon',
261 previous_node='ip-192-168-1-2',
262 version=new_version,
263 )
256 status_set.assert_called_with( 264 status_set.assert_called_with(
257 'waiting', 265 'waiting',
258 'Waiting on ip-192-168-1-2 to finish upgrading') 266 'Waiting on ip-192-168-1-2 to finish upgrading')
259 lock_and_roll.assert_called_with(my_name='ip-192-168-1-3', 267 lock_and_roll.assert_called_with(my_name='ip-192-168-1-3',
260 service='mon', 268 service='mon',
261 upgrade_key='admin', 269 upgrade_key='admin',
262 version='0.94.1') 270 version=new_version)
271 if new_version == 'luminous':
272 wait_for_all_monitors_to_upgrade.assert_called_with(
273 new_version=new_version,
274 upgrade_key='admin',
275 )
276 bootstrap_manager.assert_called_once_with()
277 else:
278 wait_for_all_monitors_to_upgrade.assert_not_called()
279 bootstrap_manager.assert_not_called()
280
281 def test_roll_monitor_cluster_luminous(self):
282 self._test_roll_monitor_cluster(new_version='luminous')
283
284 def test_roll_monitor_cluster_jewel(self):
285 self._test_roll_monitor_cluster(new_version='jewel')
286
287 def test_roll_monitor_cluster_hammer(self):
288 self._test_roll_monitor_cluster(new_version='hammer')
263 289
264 @patch.object(ceph.utils, 'log') 290 @patch.object(ceph.utils, 'log')
265 @patch.object(ceph.utils, 'time') 291 @patch.object(ceph.utils, 'time')
diff --git a/unit_tests/test_osd_upgrade_roll.py b/unit_tests/test_osd_upgrade_roll.py
index 77e1b7f..28b234b 100644
--- a/unit_tests/test_osd_upgrade_roll.py
+++ b/unit_tests/test_osd_upgrade_roll.py
@@ -332,7 +332,7 @@ class UpgradeRollingTestCase(unittest.TestCase):
332 ceph.utils.roll_osd_cluster(new_version='0.94.1', 332 ceph.utils.roll_osd_cluster(new_version='0.94.1',
333 upgrade_key='osd-upgrade') 333 upgrade_key='osd-upgrade')
334 status_set.assert_called_with( 334 status_set.assert_called_with(
335 'blocked', 335 'waiting',
336 'Waiting on ip-192-168-1-2 to finish upgrading') 336 'Waiting on ip-192-168-1-2 to finish upgrading')
337 lock_and_roll.assert_called_with(my_name='ip-192-168-1-3', 337 lock_and_roll.assert_called_with(my_name='ip-192-168-1-3',
338 service='osd', 338 service='osd',