]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: ignore exceptions raised when no cert/key found
authorNizamudeen A <nia@redhat.com>
Thu, 19 Sep 2024 03:39:20 +0000 (09:09 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 15 Oct 2024 04:34:10 +0000 (10:04 +0530)
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 <nia@redhat.com>
(cherry picked from commit a939c75f10780a5d3a086ab3db1f0c07e40fb8f8)

src/pybind/mgr/dashboard/services/nvmeof_conf.py
src/pybind/mgr/dashboard/services/orchestrator.py

index a5a9979af25720e1a980ec50f6843b611bc8c416..452c7334415fa99d213352675615bc9771c3c6b7 100644 (file)
@@ -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
index 3307efecddebea8c9b86700638b2b4714b6c97f4..542492c9f43e31b5a078d8196f2a63fd7152398f 100644 (file)
@@ -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):