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)
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
@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):