"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/share/drivers/helpers.py" between
manila-8.1.2.tar.gz and manila-8.1.3.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Stein" series (maintained release).

helpers.py  (manila-8.1.2):helpers.py  (manila-8.1.3)
skipping to change at line 527 skipping to change at line 527
def disable_access_for_maintenance(self, server, share_name): def disable_access_for_maintenance(self, server, share_name):
maintenance_file = self._get_maintenance_file_path(share_name) maintenance_file = self._get_maintenance_file_path(share_name)
allowed_hosts = " ".join(self._get_allow_hosts(server, share_name)) allowed_hosts = " ".join(self._get_allow_hosts(server, share_name))
backup_exports = [ backup_exports = [
'echo', "'%s'" % allowed_hosts, '|', 'sudo', 'tee', 'echo', "'%s'" % allowed_hosts, '|', 'sudo', 'tee',
maintenance_file maintenance_file
] ]
self._ssh_exec(server, backup_exports) self._ssh_exec(server, backup_exports)
self._set_allow_hosts(server, [], share_name) self._set_allow_hosts(server, [], share_name)
self._kick_out_users(server, share_name)
def _kick_out_users(self, server, share_name):
"""Kick out all users of share"""
(out, _) = self._ssh_exec(server, ['sudo', 'smbstatus', '-S'])
shares = []
header = True
regexp = r"^(?P<share>[^ ]+)\s+(?P<pid>[0-9]+)\s+(?P<machine>[^ ]+).*"
for line in out.splitlines():
line = line.strip()
if not header and line:
match = re.match(regexp, line)
if match:
shares.append(match.groupdict())
else:
raise exception.ShareBackendException(
msg="Failed to obtain smbstatus for %s!" % share_name)
elif line.startswith('----'):
header = False
to_kill = [s['pid'] for s in shares if
share_name == s['share'] or share_name is None]
if to_kill:
self._ssh_exec(server, ['sudo', 'kill', '-15'] + to_kill)
def restore_access_after_maintenance(self, server, share_name): def restore_access_after_maintenance(self, server, share_name):
maintenance_file = self._get_maintenance_file_path(share_name) maintenance_file = self._get_maintenance_file_path(share_name)
(exports, __) = self._ssh_exec(server, ['cat', maintenance_file]) (exports, __) = self._ssh_exec(server, ['cat', maintenance_file])
self._set_allow_hosts(server, exports.split(), share_name) self._set_allow_hosts(server, exports.split(), share_name)
self._ssh_exec(server, ['sudo', 'rm', '-f', maintenance_file]) self._ssh_exec(server, ['sudo', 'rm', '-f', maintenance_file])
class CIFSHelperUserAccess(CIFSHelperIPAccess): class CIFSHelperUserAccess(CIFSHelperIPAccess):
"""Manage shares in samba server by net conf tool. """Manage shares in samba server by net conf tool.
 End of changes. 1 change blocks. 
0 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)