From 179ad62844e739afa70c59a7e6f445c3483c8f71 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 30 Jan 2026 15:12:14 +0100 Subject: [PATCH] node-proxy: add 'vendor based' redfish system selection This commit adds REDFISH_SYSTEM_CLASSES registry (generic, dell, ...), this way the user can choose a system class. The default value is BaseRedfishSystem (generic) when vendor isn't specified. Fixes: https://tracker.ceph.com/issues/74749 Signed-off-by: Guillaume Abrioux --- src/ceph-node-proxy/ceph_node_proxy/main.py | 25 +++++++++++++++------ src/ceph-node-proxy/ceph_node_proxy/util.py | 3 ++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ceph-node-proxy/ceph_node_proxy/main.py b/src/ceph-node-proxy/ceph_node_proxy/main.py index 9a449ecf884..e37996a4cc8 100644 --- a/src/ceph-node-proxy/ceph_node_proxy/main.py +++ b/src/ceph-node-proxy/ceph_node_proxy/main.py @@ -1,9 +1,11 @@ -from ceph_node_proxy.redfishdellsystem import RedfishDellSystem from ceph_node_proxy.api import NodeProxyApi +from ceph_node_proxy.atollon import AtollonSystem +from ceph_node_proxy.baseredfishsystem import BaseRedfishSystem +from ceph_node_proxy.redfishdellsystem import RedfishDellSystem from ceph_node_proxy.reporter import Reporter from ceph_node_proxy.util import Config, get_logger, http_req, write_tmp_file, CONFIG from urllib.error import HTTPError -from typing import Dict, Any, Optional +from typing import Dict, Any, Optional, Type import argparse import os @@ -13,6 +15,13 @@ import time import signal +REDFISH_SYSTEM_CLASSES: Dict[str, Type[BaseRedfishSystem]] = { + 'generic': BaseRedfishSystem, + 'dell': RedfishDellSystem, + 'atollon': AtollonSystem, +} + + class NodeProxyManager: def __init__(self, **kw: Any) -> None: self.exc: Optional[Exception] = None @@ -76,11 +85,13 @@ class NodeProxyManager: self.log.warning('No oob details could be loaded, exiting...') raise SystemExit(1) try: - self.system = RedfishDellSystem(host=oob_details['host'], - port=oob_details['port'], - username=oob_details['username'], - password=oob_details['password'], - config=self.config) + vendor = getattr(self.config, 'system', {}).get('vendor', 'generic') + system_cls = REDFISH_SYSTEM_CLASSES.get(vendor, BaseRedfishSystem) + self.system = system_cls(host=oob_details['host'], + port=oob_details['port'], + username=oob_details['username'], + password=oob_details['password'], + config=self.config) self.system.start() except RuntimeError: self.log.error("Can't initialize the redfish system.") diff --git a/src/ceph-node-proxy/ceph_node_proxy/util.py b/src/ceph-node-proxy/ceph_node_proxy/util.py index c6af0304b92..bcee6171a99 100644 --- a/src/ceph-node-proxy/ceph_node_proxy/util.py +++ b/src/ceph-node-proxy/ceph_node_proxy/util.py @@ -19,7 +19,8 @@ CONFIG: Dict[str, Any] = { 'endpoint': 'https://%(mgr_host):%(mgr_port)/node-proxy/data', }, 'system': { - 'refresh_interval': 5 + 'refresh_interval': 5, + 'vendor': 'generic', }, 'api': { 'port': 9456, -- 2.47.3