From 48fff60b63785ec07f71d3e59394b0c08357247c Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Wed, 9 Feb 2022 09:37:48 +0100 Subject: [PATCH] mgr/dashboard: "Please expand your cluster first" shouldn't be shown if cluster is already meaningfully running This PR will assume that a cluster is already up and fully running. If this should not be the expected behaviour, deployment tools have to set 'INSTALLED' explicitly. Without this assumption it might happen that upgraded and fully running clusters, e.g. Octopus -> Pacific, will show the 'Expand Cluster' on first log in. cephadm will take care that the bootstrap phase will write the necessary key to show the 'Expand cluster' page. Fixes: https://tracker.ceph.com/issues/54215 Signed-off-by: Volker Theile --- src/cephadm/cephadm | 3 +++ src/pybind/mgr/dashboard/services/cluster.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 8eaae9261965b..57c63789c75a6 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -5152,6 +5152,9 @@ def command_bootstrap(ctx): logger.info('Enabling autotune for osd_memory_target') cli(['config', 'set', 'osd', 'osd_memory_target_autotune', 'true']) + # Notify the Dashboard to show the 'Expand cluster' page on first log in. + cli(['config-key', 'set', 'mgr/dashboard/cluster/status', 'INSTALLED']) + logger.info('You can access the Ceph CLI with:\n\n' '\tsudo %s shell --fsid %s -c %s -k %s\n' % ( sys.argv[0], diff --git a/src/pybind/mgr/dashboard/services/cluster.py b/src/pybind/mgr/dashboard/services/cluster.py index aad517a21d68a..a057f24381f78 100644 --- a/src/pybind/mgr/dashboard/services/cluster.py +++ b/src/pybind/mgr/dashboard/services/cluster.py @@ -12,7 +12,12 @@ class ClusterModel: status: Status - def __init__(self, status=Status.INSTALLED.name): + def __init__(self, status=Status.POST_INSTALLED.name): + """ + :param status: The status of the cluster. Assume that the cluster + is already functional by default. + :type status: str + """ self.status = self.Status[status] def dict(self): @@ -23,4 +28,8 @@ class ClusterModel: @classmethod def from_db(cls): - return cls(status=mgr.get_store('cluster/status', cls.Status.INSTALLED.name)) + """ + Get the stored cluster status from the configuration key/value store. + If the status is not set, assume it is already fully functional. + """ + return cls(status=mgr.get_store('cluster/status', cls.Status.POST_INSTALLED.name)) -- 2.39.5