Bug #43524
closedmgr/dashboard: forward ceph-iscsi HTTP response error messages to dashboard front-end
0%
Description
Currently, Ceph-Dashboard iSCSI component displays a brief "500 - Internal Error Server" on ceph-iscsi REST API errors. While users can access logs or enable tracebacks, in this specific case a more descriptive message would be welcome.
An example of this, when an iSCSI admin tries to remove a target where some user is logged on to, the back-end ceph-iscsi REST API will return a "Client 'iqn.1994-05.xxxx' is logged in to iqn.2001-07.xxxxxx - unable to delete until it's logged out", but that message will never hit the dashboard admin. See details below:
exception : Dec 25 10:45:00 xxxxxxx005 rbd-target-api[909]: ::ffff:10.8.128.5 - - [25/Dec/2019 10:45:00] "DELETE /api/client/iqn.2001-07.com.ceph:1577083503381/iqn.1994-05.com.yyyyyy:xxxxxxx025 HTTP/1.1" 400 - Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: [25/Dec/2019:10:45:00] HTTP Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: Traceback (most recent call last): Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 638, in respond Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: self._do_respond(path_info) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: response.body = self.handler() Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/lib/python3.6/site-packages/cherrypy/lib/encoding.py", line 219, in __call__ Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: self.body = self.oldhandler(*args, **kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/lib/python3.6/site-packages/cherrypy/_cptools.py", line 230, in wrap Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: return self.newhandler(innerfunc, *args, **kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/services/exception.py", line 88, in dashboard_exception_handler Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: return handler(*args, **kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__ Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: return self.callable(*self.args, **self.kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/__init__.py", line 649, in inner Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: ret = func(*args, **kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/__init__.py", line 842, in wrapper Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: return func(*vpath, **params) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/__init__.py", line 454, in wrapper Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: raise ex Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/__init__.py", line 444, in wrapper Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: status, value = task.wait(self.wait_for) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/tools.py", line 623, in wait Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: raise self.exception Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/tools.py", line 540, in _run Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: val = self.task.fn(*self.task.fn_args, **self.task.fn_kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/iscsi.py", line 286, in set Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: portals, disks, clients, groups) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/controllers/iscsi.py", line 331, in _delete Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: client_iqn) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/rest_client.py", line 507, in func_wrapper Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: **kwargs) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/services/iscsi_client.py", line 166, in delete_client Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: return request() Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/rest_client.py", line 313, in __call__ Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: data, raw_content) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: File "/usr/share/ceph/mgr/dashboard/rest_client.py", line 433, in do_request Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: resp.content) Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: dashboard.rest_client.RequestException: iscsi REST API failed request with status code 400 Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: (b'{\n "message": "Client \'iqn.1994-05.com.yyyyyy:xxxxxxx025\' is logged in to' Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: b" iqn.2001-07.com.ceph:1577083503381- unable to delete until it's logged " Dec 25 10:45:00 xxxxxxx005 ceph-mgr[14248]: b'out"\n}\n')
Updated by Volker Theile over 4 years ago
I'm not familar with iSCSI in Dashboard, but looking into 'master' it looks to me that the code checks if there are open sessions and throws an error, see https://github.com/ceph/ceph/blob/master/src/pybind/mgr/dashboard/controllers/iscsi.py#L261.
Have you tested this using Nautilus? The code from master does not exist there, so maybe the behaviour is different.
Updated by Ernesto Puerta over 4 years ago
Volker Theile wrote:
I'm not familar with iSCSI in Dashboard, but looking into 'master' it looks to me that the code checks if there are open sessions and throws an error, see https://github.com/ceph/ceph/blob/master/src/pybind/mgr/dashboard/controllers/iscsi.py#L261.
Have you tested this using Nautilus? The code from master does not exist there, so maybe the behaviour is different.
You're right, the fix is there in master (in Nautilus is still open: https://github.com/ceph/ceph/pull/32304)! Thanks, I'll mark this as duplicate of https://tracker.ceph.com/issues/38332.
Updated by Ernesto Puerta over 4 years ago
- Is duplicate of Feature #38332: mgr/dashboard: Prevent deletion of iSCSI IQNs with open sessions added
Updated by Ernesto Puerta about 3 years ago
- Project changed from mgr to Dashboard
- Category changed from 141 to Component - iSCSI