From 19fcef5e96ddeb2223ddcfb44d67ccec093a91e7 Mon Sep 17 00:00:00 2001 From: Adam King Date: Wed, 24 Feb 2021 16:44:57 -0500 Subject: [PATCH] mgr/cephadm: add iscsi and nfs to upgrade Fixes: https://tracker.ceph.com/issues/49462 Signed-off-by: Adam King (cherry picked from commit 20e7b4d5aaaf60442f5600dc914080b3c9615795) --- qa/suites/rados/cephadm/upgrade/fixed-2.yaml | 1 + src/pybind/mgr/cephadm/module.py | 13 +++++-------- src/pybind/mgr/cephadm/serve.py | 4 +--- src/pybind/mgr/cephadm/upgrade.py | 9 +++++---- src/pybind/mgr/cephadm/utils.py | 6 ++++-- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/qa/suites/rados/cephadm/upgrade/fixed-2.yaml b/qa/suites/rados/cephadm/upgrade/fixed-2.yaml index 8c79ebe96bf6f..a0ec7a192cbb3 100644 --- a/qa/suites/rados/cephadm/upgrade/fixed-2.yaml +++ b/qa/suites/rados/cephadm/upgrade/fixed-2.yaml @@ -20,6 +20,7 @@ roles: - prometheus.a - grafana.a - node-exporter.b + - ceph.iscsi.iscsi.a openstack: - volumes: # attached to each instance count: 4 diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index b46b7e3db71ae..50fede4e15e47 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -57,9 +57,9 @@ from .services.monitoring import GrafanaService, AlertmanagerService, Prometheus from .services.exporter import CephadmExporter, CephadmExporterConfig from .schedule import HostAssignment from .inventory import Inventory, SpecStore, HostCache, EventStore -from .upgrade import CEPH_UPGRADE_ORDER, CephadmUpgrade +from .upgrade import CephadmUpgrade from .template import TemplateMgr -from .utils import forall_hosts, cephadmNoImage +from .utils import CEPH_TYPES, GATEWAY_TYPES, forall_hosts, cephadmNoImage from .configchecks import CephadmConfigChecks try: @@ -90,8 +90,6 @@ Host * ConnectTimeout=30 """ -CEPH_TYPES = set(CEPH_UPGRADE_ORDER) - # Default container images ----------------------------------------------------- DEFAULT_IMAGE = 'docker.io/ceph/ceph' DEFAULT_PROMETHEUS_IMAGE = 'docker.io/prom/prometheus:v2.18.1' @@ -1228,8 +1226,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, daemon_type = daemon_name.split('.', 1)[0] # type: ignore image: Optional[str] = None if daemon_type in CEPH_TYPES or \ - daemon_type == 'nfs' or \ - daemon_type == 'iscsi': + daemon_type in GATEWAY_TYPES: # get container image image = str(self.get_foreign_ceph_option( utils.name_to_config_section(daemon_name), @@ -1736,10 +1733,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, if action != 'redeploy': raise OrchestratorError( f'Cannot execute {action} with new image. `action` needs to be `redeploy`') - if daemon_type not in CEPH_TYPES: + if daemon_type not in CEPH_TYPES and daemon_type not in GATEWAY_TYPES: raise OrchestratorError( f'Cannot redeploy {daemon_type}.{daemon_id} with a new image: Supported ' - f'types are: {", ".join(CEPH_TYPES)}') + f'types are: {", ".join(CEPH_TYPES + GATEWAY_TYPES)}') self.check_mon_command({ 'prefix': 'config set', diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index ae8436839c9b2..e2c2fa9a72749 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -24,7 +24,7 @@ from orchestrator import OrchestratorError, set_exception_subject, OrchestratorE from cephadm.services.cephadmservice import CephadmDaemonDeploySpec from cephadm.schedule import HostAssignment from cephadm.utils import forall_hosts, cephadmNoImage, is_repo_digest, \ - CephadmNoImage, CEPH_UPGRADE_ORDER, ContainerInspectInfo + CephadmNoImage, CEPH_TYPES, ContainerInspectInfo from mgr_module import MonCommandFailed from . import utils @@ -35,8 +35,6 @@ if TYPE_CHECKING: logger = logging.getLogger(__name__) -CEPH_TYPES = set(CEPH_UPGRADE_ORDER) - class CephadmServe: """ diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 1e655ee5f8faa..24b36fa8fc393 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -475,10 +475,11 @@ class CephadmUpgrade: to_upgrade.append(d) continue - # NOTE: known_ok_to_stop is an output argument for - # _wait_for_ok_to_stop - if not self._wait_for_ok_to_stop(d, known_ok_to_stop): - return + if d.daemon_type in ['mon', 'osd', 'mds']: + # NOTE: known_ok_to_stop is an output argument for + # _wait_for_ok_to_stop + if not self._wait_for_ok_to_stop(d, known_ok_to_stop): + return to_upgrade.append(d) diff --git a/src/pybind/mgr/cephadm/utils.py b/src/pybind/mgr/cephadm/utils.py index 82ad06576535c..bde3d1f4e261d 100644 --- a/src/pybind/mgr/cephadm/utils.py +++ b/src/pybind/mgr/cephadm/utils.py @@ -20,8 +20,10 @@ class CephadmNoImage(Enum): # ceph daemon types that use the ceph container image. -# NOTE: listed in upgrade order! -CEPH_UPGRADE_ORDER = ['mgr', 'mon', 'crash', 'osd', 'mds', 'rgw', 'rbd-mirror', 'cephfs-mirror'] +# NOTE: order important here as these are used for upgrade order +CEPH_TYPES = ['mgr', 'mon', 'crash', 'osd', 'mds', 'rgw', 'rbd-mirror', 'cephfs-mirror'] +GATEWAY_TYPES = ['iscsi', 'nfs'] +CEPH_UPGRADE_ORDER = CEPH_TYPES + GATEWAY_TYPES # Used for _run_cephadm used for check-host etc that don't require an --image parameter -- 2.39.5