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 14 commits into from Jul 16, 2019
Changes from 1 commit
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now


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 <>
  • 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...")
log.debug("CephFS mounting...")
log.debug("Connection to cephfs complete")

def disconnect(self):"disconnect")
if self.fs:
log.debug("Disconnecting cephfs...")
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 Jun 16, 2019


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 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).

return self

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

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