mgr/cephadm: use new CEPH_IMAGE_TYPES for all daemons using ceph container image

We were using CEPH_TYPES + GATEWAY_TYPES, but that isn't really accurate.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2021-07-16 15:29:15 -04:00
parent 45737fe95a
commit deaff0c42c
2 changed files with 8 additions and 6 deletions

View File

@ -59,7 +59,7 @@ from .schedule import HostAssignment
from .inventory import Inventory, SpecStore, HostCache, EventStore, ClientKeyringStore, ClientKeyringSpec
from .upgrade import CephadmUpgrade
from .template import TemplateMgr
from .utils import CEPH_TYPES, GATEWAY_TYPES, forall_hosts, cephadmNoImage
from .utils import CEPH_IMAGE_TYPES, forall_hosts, cephadmNoImage
from .configchecks import CephadmConfigChecks
try:
@ -1346,8 +1346,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
def _get_container_image(self, daemon_name: str) -> Optional[str]:
daemon_type = daemon_name.split('.', 1)[0] # type: ignore
image: Optional[str] = None
if daemon_type in CEPH_TYPES or \
daemon_type in GATEWAY_TYPES:
if daemon_type in CEPH_IMAGE_TYPES:
# get container image
image = str(self.get_foreign_ceph_option(
utils.name_to_config_section(daemon_name),
@ -1891,10 +1890,10 @@ Then run the following:
if action != 'redeploy':
raise OrchestratorError(
f'Cannot execute {action} with new image. `action` needs to be `redeploy`')
if daemon_type not in CEPH_TYPES and daemon_type not in GATEWAY_TYPES:
if daemon_type not in CEPH_IMAGE_TYPES:
raise OrchestratorError(
f'Cannot redeploy {daemon_type}.{daemon_id} with a new image: Supported '
f'types are: {", ".join(CEPH_TYPES + GATEWAY_TYPES)}')
f'types are: {", ".join(CEPH_IMAGE_TYPES)}')
self.check_mon_command({
'prefix': 'config set',
@ -2495,7 +2494,7 @@ Then run the following:
for name, dd in dm.items():
if image_info.image_id == dd.container_image_id:
r['up_to_date'].append(dd.name())
elif dd.daemon_type in (CEPH_TYPES + GATEWAY_TYPES):
elif dd.daemon_type in CEPH_IMAGE_TYPES:
r['needs_update'][dd.name()] = {
'current_name': dd.container_image_name,
'current_id': dd.container_image_id,

View File

@ -24,8 +24,11 @@ class CephadmNoImage(Enum):
CEPH_TYPES = ['mgr', 'mon', 'crash', 'osd', 'mds', 'rgw', 'rbd-mirror', 'cephfs-mirror']
GATEWAY_TYPES = ['iscsi', 'nfs']
MONITORING_STACK_TYPES = ['node-exporter', 'prometheus', 'alertmanager', 'grafana']
CEPH_UPGRADE_ORDER = CEPH_TYPES + GATEWAY_TYPES + MONITORING_STACK_TYPES
# these daemon types use the ceph container image
CEPH_IMAGE_TYPES = CEPH_TYPES + ['iscsi', 'nfs']
# Used for _run_cephadm used for check-host etc that don't require an --image parameter
cephadmNoImage = CephadmNoImage.token