Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr / volumes: background purge queue for subvolumes #28003

Merged
merged 14 commits into from Jul 16, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

mgr / volumes: maintain connection pool for fs volumes

Right now every [sub]volume call does a connect/disconnect to the
cephfs filesystem. This is unnecessary and can be optimized by
caching the filesystem handle in a connection pool and (re)using
the handle for subsequent [sub]volume operations.

This would be useful for implementing features such as purge queue
for asynchronous subvolume deletes.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
  • Loading branch information
vshankar committed Jun 17, 2019
commit 5c41e949af9acabd612b0644de0603e374b4b42a
@@ -33,11 +33,8 @@ class SubVolume(object):
"""


def __init__(self, mgr, fs_name=None):
self.fs = None
self.fs_name = fs_name
self.connected = False

def __init__(self, mgr, fs_handle):
self.fs = fs_handle
self.rados = mgr.rados

def _mkdir_p(self, path, mode=0o755):
@@ -261,29 +258,8 @@ def remove_group_snapshot(self, spec, snapname, force):

### context manager routines

def connect(self):
log.debug("Connecting to cephfs...")
self.fs = cephfs.LibCephFS(rados_inst=self.rados)
log.debug("CephFS initializing...")
self.fs.init()
log.debug("CephFS mounting...")
self.fs.mount(filesystem_name=self.fs_name.encode('utf-8'))
log.debug("Connection to cephfs complete")

def disconnect(self):
log.info("disconnect")
if self.fs:
log.debug("Disconnecting cephfs...")
self.fs.shutdown()
self.fs = None
log.debug("Disconnecting cephfs complete")

def __enter__(self):
This conversation was marked as resolved by ajarr

This comment has been minimized.

Copy link
@ajarr

ajarr Jun 16, 2019

Contributor

Do we need to implement the enter and exit methods anymore? Does the class Subvolume need to be a context manager?

This comment has been minimized.

Copy link
@vshankar

vshankar Jun 17, 2019

Author Contributor

It need not be -- I still kept it as it for future cases (maybe we still require some auto-fu method which would make sense via context managers).

self.connect()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
self.disconnect()

def __del__(self):
self.disconnect()
pass
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.