-
Couldn't load subscription status.
- Fork 580
RBD: check for volume group existence #5184
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: check for volume group existence #5184
Conversation
f05f221 to
ca306ac
Compare
42537fd to
bbb8f40
Compare
|
@iPraveenParihar , the new |
9630c7c to
6323c99
Compare
|
Waiting on @Nikhil-Ladha, for the testing result. |
8a7f9aa to
813266f
Compare
|
/test ci/centos/mini-e2e/k8s-1.30 |
Tested with different pool ids on both the clusters (and the cluster had other pools too) and, everything looks good. |
813266f to
882cefc
Compare
Thanks @Nikhil-Ladha for the testing! I could think of using the |
882cefc to
ce63858
Compare
2be7a44 to
eedbfb3
Compare
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.
LGTM, Thanks
| "errors" | ||
|
|
||
| "github.com/ceph/ceph-csi/internal/rbd" | ||
| rbderrors "github.com/ceph/ceph-csi/internal/rbd/errors" |
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.
maybe it makes sense to move common RBD errors to internal/rbd/types/errors.go? That is what I decided to do with #5221.
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.
IMO, rbd/errors is more suitable than rbd/types (which should be just for the interface and struct definition?)
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.
That is fine with me too. I just wanted to locate the errors that are documented at the types/interfaces together. I' can move it to internal/rbd/errors too.
| cvg.pool = pool | ||
|
|
||
| // Check if the volume group exists in the journal. | ||
| _, err = cvg.getVolumeGroupAttributes(ctx) |
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.
Does this need to be called here? The initialization of the struct does not need to guarantee that the volume group is recorded in the journal.
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.
I tried to keep it similar to what we have for generateVolumeFromVolumeID. Here to, we initialise the rbdVol struct and fetch details from journal. Calling outside, made it little complex for readability.
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.
Ok. I just wonder about possible side-effects in case a volumegroup does not exist, or was in the process of getting deleted. I think it should be fine, but maybe you can check that?
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.
just wonder about possible side-effects in case a volumegroup does not exist
initCommonVolumeGroup is only been called after a VolumeGroup is created, we are good here.
was in the process of getting deleted
operation locks will prevent this case, but actually I don't see operationa locks on /DeleteVolumeGroup & /CreateVolumeGroup, was that missed or not required at all?
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.
initCommonVolumeGroup is only been called after a VolumeGroup is created, we are good here.
Actually, we can. For example, if we try to delete an already deleted (or non-existent) volume. Though, looking at the code it would still fail with the same error i.e, ErrGroupNotFound but after going through some more function calls.
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, that should be fine.
internal/rbd/group/util.go
Outdated
|
|
||
| // generateVolumeGroupFromMapping checks the clusterID and poolID mapping and | ||
| // generates commonVolumeGroup structure for the mapped clusterID and poolID. | ||
| // If the mapping is not found, it returns ErrRBDGroupNotFound. |
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.
the comment still contains ErrRBDGroupNotFound -> ErrGroupNotFound
eedbfb3 to
6ba791d
Compare
Pull request has been modified.
|
@Mergifyio rebase |
Signed-off-by: Praveen M <[email protected]>
Signed-off-by: Praveen M <[email protected]>
VolumeGroup interface has more than 10 methods and it causes golangci-lint to fail. Moving the `Destroy()` method to a base interface journalledObject. Signed-off-by: Praveen M <[email protected]>
✅ Branch has been successfully rebased |
6ba791d to
4d7e636
Compare
|
/test ci/centos/mini-e2e-helm/k8s-1.32 |
|
/test ci/centos/mini-e2e-helm/k8s-1.31 |
|
/test ci/centos/mini-e2e-helm/k8s-1.30 |
|
/test ci/centos/mini-e2e/k8s-1.32 |
|
/test ci/centos/mini-e2e/k8s-1.31 |
|
/test ci/centos/mini-e2e/k8s-1.30 |
|
/test ci/centos/k8s-e2e-external-storage/1.32 |
|
/test ci/centos/k8s-e2e-external-storage/1.31 |
|
/test ci/centos/k8s-e2e-external-storage/1.30 |
|
/test ci/centos/upgrade-tests |
Describe what this PR does
This PR adds a check for Volume Group existence in
generateVolumeGroupcall.Checklist:
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>: retest the<job-name>after unrelatedfailure (please report the failure too!)