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

rbd: modified logic to check image watchers #1991

Merged
merged 1 commit into from
Apr 19, 2021
Merged

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented Apr 19, 2021

Before RBD map operation, we do check the watchers on the RBD image. In the case of RWO volume. cephcsi makes sure only one client is using the RBD image. If the rbd image is mirrored, by default mirroring daemon will add a watcher on the image and as we are using go-ceph a watcher will be added as we have opened the image So we will have two watchers on an image if
mirroring is enabled. This holds when the rbd mirror daemon is running, In case if the mirror daemon is not running there will be only one watcher on the rbd image (which is placed by go-ceph image open) we should not block the map operation if the mirroring daemon is not running as its Async mirroring. This commit adds a check to make sure no more than 2 watchers
if the image is mirrored or no more than 1 watcher if it is not mirrored image.

Signed-off-by: Madhu Rajanna madhupr007@gmail.com

@@ -439,10 +439,11 @@ func (rv *rbdVolume) isInUse() (bool, error) {
// because we opened the image, there is at least one watcher
defaultWatchers := 1
if rv.Primary {
// a watcher will be added by the rbd mirror daemon if the image is primary
// if rbd mirror daemon is running, a watcher will be added by the rbd
// mirror daemon for mirrored images.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this should be an improvement.

However, I wonder of there is an issue when mirroring has not been started (or is currently active), an other rbd client could connect to the image. Should this be something to look into?

Copy link
Collaborator Author

@Madhu-1 Madhu-1 Apr 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes just had the same discussion with @ShyamsundarR, It's difficult to identify the watcher is added by rbd mirror daemon or not. this issue exists only for RBD mirrored PVC and the watcher is extra protection from the cephcsi side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than this observation LGTM!

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Apr 19, 2021

/test ci/centos/upgrade-tests-rbd

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Apr 19, 2021

/test ci/centos/upgrade-tests-rbd

Apr 19 13:39:34.710: failed to create vault configmap error running /usr/bin/kubectl --server=https://xx.xx.xx --kubeconfig=/root/.kube/config --namespace=cephcsi-e2e-f731ad1d create --namespace=cephcsi-e2e-f731ad1d -f -:
Command stdout:
stderr:
Error from server: error when creating "STDIN": etcdserver: request timed out
error:
exit status 1

Before RBD map operation, we do check the
watchers on the RBD image. In the case of
RWO volume. cephcsi makes sure only one
client is using the RBD image. If the rbd
image is mirrored, by default mirroring
daemon will add a watcher on the image
and as we are using go-ceph a watcher will
be added as we have opened the image So
we will have two watchers on an image if
mirroring is enabled. This holds when the
rbd mirror daemon is running, In case if
the mirror daemon is not running there will
be only one watcher on the rbd image
(which is placed by go-ceph image open)
we should not block the map operation if
the mirroring daemon is not running as
its Async mirroring. This commit adds a
check to make sure no more than 2 watchers
if the image is mirrored or no more than 1
watcher if it is not mirrored image.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@mergify mergify bot merged commit 5229033 into ceph:devel Apr 19, 2021
@mergify
Copy link
Contributor

mergify bot commented Apr 19, 2021

This pull request has been merged with the
unsupported configuration option bot_account.

This option will be ignored starting May 1st, 2021, and removed
on June 1st, 2021.

This option can be replaced by update_bot_account, merge_bot_account or both
depending on your use-case (https://docs.mergify.io/actions/merge/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants