-
Notifications
You must be signed in to change notification settings - Fork 555
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
Conversation
@@ -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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
/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 -: |
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>
e81d86e
to
585c1ff
Compare
This pull request has been merged with the This option will be ignored starting May 1st, 2021, and removed This option can be replaced by |
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