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

nautilus: mgr/volumes: background purge queue for subvolumes #29079

Merged
merged 15 commits into from Jul 18, 2019

Conversation

@ajarr
Copy link
Contributor

commented Jul 17, 2019

Fixes: http://tracker.ceph.com/issues/40796

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug
vshankar and others added 15 commits Jun 17, 2019
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>
(cherry picked from commit 5c41e94)
mgr / volumes: purge queue for async subvolume delete
Support asynchronous subvolume deletes by handing off the delete
operation to a dedicated set of threads. A subvolume delete operation
renames the subvolume (subdirectory) to a unique trash path entry
and signals the set of worker threads to pick up entries from the
trash directory for background removal.

This commit implements a `thread pool` strategy as a class mixin.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 483a214)
mgr / volumes: schedule purge job for volumes on init
So as to kickstart leftover subvolume purges.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 06e44be)
test: add basic purge queue validation test
.. and since we have async subvolume deletes now, check
trash directory for emptiness in other tests.

Fixes: http://tracker.ceph.com/issues/40036
Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit aec1d90)
mgr/volumes: do not import unused module
cephfs is not used in this module, so drop its `import`

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit bc13b79)
mgr / volumes: use negative error codes everywhere
cephfs python binding returns positive error code. mgr/volumes
incorrectly does error code checks assuming the error codes to
be negative.

this was not an issue till now since mgr/volumes mostly does a
`raise VolumeException()` for the most part followed by the exception
being displayed to the operator (one exception is catching cephfs
ObjectNotFound error, in which case -errno.ENOENT is returned
(and checked whereever required)).

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit dd569e2)
mgr / volumes: wrap rmtree() call within try..except block
This will be invoked by purge threads, so be sure to catch all
exceptions and return proper error codes appropriately.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 04547c9)
test: cleanup removing all subvolumes before removing subvolume group
Test `test_subvolume_create_with_desired_mode_in_group()` creates three
subvolume in a subvolume group. During cleanup, it only removed two of
the three subvolumes. This causes failure when removing the subvolume
group since it's not empty.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit ae470a6)
pybind/mgr/subvolumes: use bytes for paths
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 3d63cd9)
pybind/mgr/volumes: remove unused property
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit f7987f5)
pybind/mgr/volumes: cleanup fs removal
In Nautilus, the simplest sequence is:

    fs fail name
    fs rm name --yes-i-really-mean-it

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 7cc4b72)
pybind/mgr/volumes: use existing client provided recursive mkdir
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit e9c314a)
pybind/mgr/volumes: refactor trash readdir
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit e71e918)
pybind/mgr/volumes: print exceptions in purge thread
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit ecf8502)
client: do not return EEXIST for mkdirs
Behavior should be similar to `mkdir -p`.

Introduced-by: 26905ca
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit b049eb9)

@ajarr ajarr requested a review from batrick Jul 17, 2019

@ajarr ajarr added this to the nautilus milestone Jul 17, 2019

@batrick

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

retest this please

@batrick

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

This is good to merge as soon as nautilus is unfrozen.

@batrick batrick merged commit 2bc3a8b into ceph:nautilus Jul 18, 2019

3 of 4 checks passed

Docs: build check Docs: failed with errors
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
batrick added a commit that referenced this pull request Jul 18, 2019
Merge PR #29079 into nautilus
* refs/pull/29079/head:
	client: do not return EEXIST for mkdirs
	pybind/mgr/volumes: print exceptions in purge thread
	pybind/mgr/volumes: refactor trash readdir
	pybind/mgr/volumes: use existing client provided recursive mkdir
	pybind/mgr/volumes: cleanup fs removal
	pybind/mgr/subvolumes: use bytes for paths
	pybind/mgr/volumes: remove unused property
	test: cleanup removing all subvolumes before removing subvolume group
	mgr / volumes: wrap rmtree() call within try..except block
	mgr / volumes: use negative error codes everywhere
	test: add basic purge queue validation test
	mgr / volumes: schedule purge job for volumes on init
	mgr / volumes: purge queue for async subvolume delete
	mgr / volumes: maintain connection pool for fs volumes
	mgr/volumes: do not import unused module

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.