You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When restoring a Samba share export using the Backup & Restore feature, it (silently) errors out as it is still based on share name instead of share id.
Upon restore of a config backup containing the Samba export of the share named common_share, we have the following error in the logs:
[08/Jun/2019 16:54:32] ERROR [storageadmin.middleware:32] Exception occurred while processing a request. Path: /api/samba method: POST
[08/Jun/2019 16:54:32] ERROR [storageadmin.middleware:33] invalid literal for int() with base 10: 'common_share'
Traceback (most recent call last):
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/build/eggs/djangorestframework-3.1.1-py2.7.egg/rest_framework/views.py", line 452, in dispatch
response = self.handle_exception(exc)
File "/opt/build/eggs/djangorestframework-3.1.1-py2.7.egg/rest_framework/views.py", line 449, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/utils/decorators.py", line 145, in inner
return func(*args, **kwargs)
File "/opt/build/src/rockstor/storageadmin/views/samba.py", line 136, in post
request.data['shares']]
File "/opt/build/src/rockstor/storageadmin/views/share.py", line 78, in _validate_share
share = Share.objects.get(id=sid)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/query.py", line 325, in get
clone = self.filter(*args, **kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/query.py", line 679, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/query.py", line 697, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/sql/query.py", line 1310, in add_q
clause, require_inner = self._add_q(where_part, self.used_aliases)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/sql/query.py", line 1338, in _add_q
allow_joins=allow_joins, split_subq=split_subq,
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/sql/query.py", line 1209, in build_filter
condition = self.build_lookup(lookups, col, value)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/sql/query.py", line 1102, in build_lookup
return final_lookup(lhs, rhs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/lookups.py", line 105, in __init__
self.rhs = self.get_prep_lookup()
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/lookups.py", line 143, in get_prep_lookup
return self.lhs.output_field.get_prep_lookup(self.lookup_name, self.rhs)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/fields/__init__.py", line 727, in get_prep_lookup
return self.get_prep_value(value)
File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/fields/__init__.py", line 985, in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: 'common_share'
Indeed, samba share restore process still relies on the share name, which inevitably leads to an error when the samba share creation process tries to look up the share using its name while its id is expected.
I suspect this results from the share API change (#1808), and could be resolved by altering restore_samba_exports() to use the share id instead of its name:
When restoring a Samba share export using the Backup & Restore feature, it (silently) errors out as it is still based on share name instead of share id.
Upon restore of a config backup containing the Samba export of the share named common_share, we have the following error in the logs:
Indeed, samba share restore process still relies on the share name, which inevitably leads to an error when the samba share creation process tries to look up the share using its name while its id is expected.
I suspect this results from the share API change (#1808), and could be resolved by altering
restore_samba_exports()
to use the share id instead of its name:rockstor-core/src/rockstor/storageadmin/views/config_backup.py
Line 85 in 1102e28
The text was updated successfully, but these errors were encountered: