openvstorage / framework

The Framework is a set of components and tools which brings the user an interface (GUI / API) to setup, extend and manage an Open vStorage platform.
Other
27 stars 23 forks source link

Clients cannot be deleted if they have still rights assigned (e.g. towards a backend) #825

Closed JeffreyDevloo closed 8 years ago

JeffreyDevloo commented 8 years ago

Problem description

The problem in /var/log/upstart/ovs-webapp-api.log:

2016-08-19 14:19:12 59700 +0200 - ovs-node1 - 2856/140358885441360 - log/api - 260 - INFO - [clients.destroy] - e648a208-7a3f-46fa-aee8-34a75b2246c0 - [] - {"pk": "6b7a0798-647d-4c92-98a3-112a07990812"} - {"cookies": {}, "meta": {"HTTP_AUTHORIZATION": "Bearer Hjwy-rx-q>}B-q6R,_L<LjaI|!#bBJV]c:h\"b4e\"Q|_MEGaOMu~4LAy6*Xww6~.U", "wsgi.multiprocess": "True", "HTTP_REFERER": "https://10.100.199.151/", "SERVER_PROTOCOL": "HTTP/1.0", "SERVER_SOFTWARE": "gunicorn/17.5", "SCRIPT_NAME": "/api", "REQUEST_METHOD": "DELETE", "PATH_INFO": "/clients/6b7a0798-647d-4c92-98a3-112a07990812/", "HTTP_ORIGIN": "https://10.100.199.151", "HTTP_X_FORWARDED_SSL": "on", "QUERY_STRING": "timestamp=1471609152607", "HTTP_X_REAL_IP": "192.168.11.106", "HTTP_USER_AGENT": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36", "HTTP_CONNECTION": "close", "SERVER_NAME": "10.100.199.151", "REMOTE_PORT": "60232", "wsgi.url_scheme": "https", "SERVER_PORT": "443", "HTTP_X_SCHEME": "https", "HTTP_X_REQUESTED_WITH": "XMLHttpRequest", "wsgi.input": "<gunicorn.http.body.Body object at 0x7fa7d96d9090>", "HTTP_HOST": "10.100.199.151", "wsgi.multithread": "False", "HTTP_ACCEPT": "application/json; version=*", "wsgi.version": "(1, 0)", "RAW_URI": "/clients/6b7a0798-647d-4c92-98a3-112a07990812/?timestamp=1471609152607", "wsgi.run_once": "False", "wsgi.errors": "<open file '<stderr>', mode 'w' at 0x7fa7efabc1e0>", "REMOTE_ADDR": "127.0.0.1", "HTTP_ACCEPT_LANGUAGE": "en-US,en;q=0.8", "gunicorn.socket": "<socket fileno=16 sock=127.0.0.1:8002 peer=127.0.0.1:60232>", "CONTENT_TYPE": "application/json", "wsgi.file_wrapper": "gunicorn.http.wsgi.FileWrapper", "CSRF_COOKIE": "TLMJtudYXz8iMNLMslPX0wRsSe697JuU", "HTTP_ACCEPT_ENCODING": "gzip, deflate, sdch, br"}, "request": {"timestamp": "1471609152607"}}
2016-08-19 14:19:12 61500 +0200 - ovs-node1 - 2856/140358885441360 - api/middleware - 261 - ERROR - An unhandled exception occurred: There is 1 item left in self.backend_rights
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/rest_framework/viewsets.py", line 78, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/rest_framework/views.py", line 399, in dispatch
    response = self.handle_exception(exc)
  File "/usr/lib/python2.7/dist-packages/rest_framework/views.py", line 396, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/OpenvStorage/webapps/api/backend/decorators.py", line 461, in new_function
    return_value = f(*args, **kwargs)
  File "/opt/OpenvStorage/webapps/api/backend/decorators.py", line 79, in new_function
    return f(*args, **kw)
  File "/opt/OpenvStorage/webapps/api/backend/decorators.py", line 200, in new_function
    return f(args[0], **new_kwargs)
  File "/opt/OpenvStorage/webapps/api/backend/views/clients.py", line 122, in destroy
    client.delete()
  File "/opt/OpenvStorage/ovs/dal/dataobject.py", line 700, in delete
    raise LinkedObjectException('There {0} left in self.{1}'.format(multi, key))
LinkedObjectException: There is 1 item left in self.backend_rights

Possible root of the problem

Steps to reproduce the issue

Disable the deletion when the access rights have been set for the user/client.

Additional information

Setup

Hyperconverged setup

wimpers commented 8 years ago

To be tackled in broader FR: https://github.com/openvstorage/framework/issues/836