From: Volker Theile Date: Thu, 17 Feb 2022 08:11:54 +0000 (+0100) Subject: mgr/dashboard: "Please expand your cluster first" shouldn't be shown if cluster is... X-Git-Tag: v16.2.8~177^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7a8371fc1979638f716b3d5c2792c11e667bc1bd;p=ceph.git 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 (cherry picked from commit 48fff60b63785ec07f71d3e59394b0c08357247c) Conflicts: src/cephadm/cephadm Signed-off-by: Volker Theile --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index bddcd46c82c37..333fd2a9f4116 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -4646,6 +4646,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))