From 5c4a09544b3ab995bf1844cdfdd90612a461d99b Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Thu, 19 Sep 2024 09:09:20 +0530 Subject: [PATCH] mgr/dashboard: ignore exceptions raised when no cert/key found for nvmeof client, when there are no cert found, it raises an exception which gets logged more often because the dashboard polls the client frequently. ``` Sep 18 13:40:54 ceph-node-00 ceph-mgr[2716]: log_channel(cephadm) log [ERR] : No secret found for entity nvmeof_root_ca_cert with service name nvmeof.rbd.default Traceback (most recent call last): File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 140, in wrapper return OrchResult(f(*args, **kwargs)) File "/usr/share/ceph/mgr/cephadm/module.py", line 3271, in cert_store_get_cert raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname) cephadm.inventory.OrchSecretNotFound: No secret found for entity nvmeof_root_ca_cert with service name nvmeof.rbd.default Sep 18 13:40:54 ceph-node-00 ceph-mgr[2716]: [dashboard INFO orchestrator] is orchestrator available: True, Sep 18 13:40:54 ceph-node-00 ceph-mgr[2716]: [cephadm ERROR orchestrator._interface] No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Traceback (most recent call last): File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 140, in wrapper return OrchResult(f(*args, **kwargs)) File "/usr/share/ceph/mgr/cephadm/module.py", line 3271, in cert_store_get_cert raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname) cephadm.inventory.OrchSecretNotFound: No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: 2024-09-18T13:40:54.529+0000 7fbbd9272640 -1 log_channel(cephadm) log [ERR] : No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: Traceback (most recent call last): Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 140, in wrapper Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: return OrchResult(f(*args, **kwargs)) Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: File "/usr/share/ceph/mgr/cephadm/module.py", line 3271, in cert_store_get_cert Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname) Sep 18 13:40:54 ceph-node-00 ceph-0377c7c2-75c1-11ef-bb0e-5254000e47d2-mgr-ceph-node-00-cvrrld[2712]: cephadm.inventory.OrchSecretNotFound: No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Sep 18 13:40:54 ceph-node-00 ceph-mgr[2716]: log_channel(cephadm) log [ERR] : No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Traceback (most recent call last): File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 140, in wrapper return OrchResult(f(*args, **kwargs)) File "/usr/share/ceph/mgr/cephadm/module.py", line 3271, in cert_store_get_cert raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname) cephadm.inventory.OrchSecretNotFound: No secret found for entity nvmeof_server_cert with service name nvmeof.rbd.default Sep 18 13:40:54 ceph-node-00 ceph-mgr[2716]: [dashboard INFO nvmeof_client] Insecurely connecting to: 192.168.100.101:5500 ``` Fixes: https://tracker.ceph.com/issues/68141 Signed-off-by: Nizamudeen A (cherry picked from commit a939c75f10780a5d3a086ab3db1f0c07e40fb8f8) --- src/pybind/mgr/dashboard/services/nvmeof_conf.py | 6 ++++-- src/pybind/mgr/dashboard/services/orchestrator.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/nvmeof_conf.py b/src/pybind/mgr/dashboard/services/nvmeof_conf.py index a5a9979af2572..452c7334415fa 100644 --- a/src/pybind/mgr/dashboard/services/nvmeof_conf.py +++ b/src/pybind/mgr/dashboard/services/nvmeof_conf.py @@ -129,8 +129,10 @@ class NvmeofGatewaysConfig(object): orch = OrchClient.instance() if orch.available(): if key: - return orch.cert_store.get_key(entity, service_name) - return orch.cert_store.get_cert(entity, service_name) + return orch.cert_store.get_key(entity, service_name, + ignore_missing_exception=True) + return orch.cert_store.get_cert(entity, service_name, + ignore_missing_exception=True) return None except OrchestratorError: # just return None if any orchestrator error is raised diff --git a/src/pybind/mgr/dashboard/services/orchestrator.py b/src/pybind/mgr/dashboard/services/orchestrator.py index 3307efecddebe..542492c9f43e3 100644 --- a/src/pybind/mgr/dashboard/services/orchestrator.py +++ b/src/pybind/mgr/dashboard/services/orchestrator.py @@ -204,13 +204,17 @@ class CertStoreManager(ResourceManager): @wait_api_result def get_cert(self, entity: str, service_name: Optional[str] = None, - hostname: Optional[str] = None) -> str: - return self.api.cert_store_get_cert(entity, service_name, hostname) + hostname: Optional[str] = None, + ignore_missing_exception: bool = False) -> str: + return self.api.cert_store_get_cert(entity, service_name, hostname, + no_exception_when_missing=ignore_missing_exception) @wait_api_result def get_key(self, entity: str, service_name: Optional[str] = None, - hostname: Optional[str] = None) -> str: - return self.api.cert_store_get_key(entity, service_name, hostname) + hostname: Optional[str] = None, + ignore_missing_exception: bool = False) -> str: + return self.api.cert_store_get_key(entity, service_name, hostname, + no_exception_when_missing=ignore_missing_exception) class OrchClient(object): -- 2.39.5