From: Nizamudeen A Date: Thu, 29 Sep 2022 19:59:39 +0000 (+0530) Subject: mgr/cephadm: iscsi username and password defaults to admin X-Git-Tag: v18.1.0~726^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bf87bc797ff0b47a60f7169698bb8ed2a5080c14;p=ceph.git 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 --- diff --git a/src/pybind/mgr/dashboard/services/tcmu_service.py b/src/pybind/mgr/dashboard/services/tcmu_service.py index 9defa2f18e63..a81b6e8f2224 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 16db5ed7cc4e..af9780c9a426 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 d3fb4329668b..28dc1680f0f0 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