From bf87bc797ff0b47a60f7169698bb8ed2a5080c14 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Fri, 30 Sep 2022 01:29:39 +0530 Subject: [PATCH] mgr/cephadm: iscsi username and password defaults to admin A while ago, the iscsi username and password were defaulted to admin the config_dashboard part. But it was not saved to the `iscsi-gateway.cfg.j2` which results in a misconfiguration. For eg, if you deploy an iscsi service with service_spec which doesn't have the api_user and api_password field it results the dashboard to show the gateways as always down because dashboard was unable to make request to the iscsi server and every api calls result in a `[dashboard ERROR rest_client] iscsi REST API failed GET req status: 401`. Fixes: https://tracker.ceph.com/issues/57730 Signed-off-by: Nizamudeen A --- src/pybind/mgr/dashboard/services/tcmu_service.py | 1 + src/python-common/ceph/deployment/service_spec.py | 6 +++--- src/python-common/ceph/tests/test_service_spec.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/tcmu_service.py b/src/pybind/mgr/dashboard/services/tcmu_service.py index 9defa2f18e6..a81b6e8f222 100644 --- a/src/pybind/mgr/dashboard/services/tcmu_service.py +++ b/src/pybind/mgr/dashboard/services/tcmu_service.py @@ -20,6 +20,7 @@ class TcmuService(object): def get_iscsi_info(): daemons = {} # type: Dict[str, dict] images = {} # type: Dict[str, dict] + daemon = None for service in CephService.get_service_list(SERVICE_TYPE): metadata = service['metadata'] if metadata is None: diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 16db5ed7cc4..af9780c9a42 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -928,9 +928,9 @@ class IscsiServiceSpec(ServiceSpec): service_id: Optional[str] = None, pool: Optional[str] = None, trusted_ip_list: Optional[str] = None, - api_port: Optional[int] = None, - api_user: Optional[str] = None, - api_password: Optional[str] = None, + api_port: Optional[int] = 5000, + api_user: Optional[str] = 'admin', + api_password: Optional[str] = 'admin', api_secure: Optional[bool] = None, ssl_cert: Optional[str] = None, ssl_key: Optional[str] = None, diff --git a/src/python-common/ceph/tests/test_service_spec.py b/src/python-common/ceph/tests/test_service_spec.py index d3fb4329668..28dc1680f0f 100644 --- a/src/python-common/ceph/tests/test_service_spec.py +++ b/src/python-common/ceph/tests/test_service_spec.py @@ -283,7 +283,9 @@ service_name: iscsi.iscsi networks: - ::0/8 spec: - api_user: api_user + api_password: admin + api_port: 5000 + api_user: admin pool: pool trusted_ip_list: - ::1 -- 2.47.3