-
Notifications
You must be signed in to change notification settings - Fork 547
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: fix namespace name update in metadata and rados object #3477
Conversation
@Madhu-1 Would it be good to have a testcase for this? |
i thought about it, but it required namespace creation, currently we dont create new namespaces in our E2E tests |
8cf4250
to
0b299b3
Compare
/test ci/centos/mini-e2e-helm/k8s-1.22 |
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 some minor comments, looks good functionally
e2e/rbd.go
Outdated
@@ -513,6 +513,7 @@ var _ = Describe("RBD", func() { | |||
}) | |||
|
|||
By("reattach the old PV to a new PVC and check if PVC metadata is updated on RBD image", func() { | |||
reattachPVCNamespace := "reattach-cephfs" |
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.
Can you take the current name of the namespace , and append it with -2
or something instead?
internal/journal/voljournal.go
Outdated
@@ -864,3 +864,14 @@ func (conn *Connection) ReserveNewUUIDMapping(ctx context.Context, | |||
|
|||
return setOMapKeys(ctx, conn, journalPool, cj.namespace, cj.csiDirectory, setKeys) | |||
} | |||
|
|||
// ResetVolumeOwner update the owner in the rados object. |
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.
nit/typo: ... updates ...
internal/journal/voljournal.go
Outdated
|
||
// ResetVolumeOwner update the owner in the rados object. | ||
func (conn *Connection) ResetVolumeOwner(ctx context.Context, pool, reservedUUID, owner string) error { | ||
err := setOMapKeys(ctx, conn, pool, conn.config.namespace, conn.config.cephUUIDDirectoryPrefix+reservedUUID, |
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 just return setOMapKeys(...)
?
internal/rbd/rbd_journal.go
Outdated
@@ -638,7 +644,7 @@ func RegenerateJournal( | |||
return "", err | |||
} | |||
|
|||
return rbdVol.VolID, nil | |||
return rbdVol.VolID, err |
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.
err
will always be nil
here. I prefer to have an explicit no error case, and returning err
here make it look like there could be still an error lingering, in which case the rbdVol.VolID
should not be trusted.
0b299b3
to
e3e415a
Compare
/test ci/centos/k8s-e2e-external-storage/1.22 |
/test ci/centos/k8s-e2e-external-storage/1.23 |
/test ci/centos/k8s-e2e-external-storage/1.24 |
/test ci/centos/mini-e2e-helm/k8s-1.22 |
/test ci/centos/mini-e2e-helm/k8s-1.23 |
/test ci/centos/mini-e2e-helm/k8s-1.24 |
/test ci/centos/mini-e2e/k8s-1.22 |
/test ci/centos/mini-e2e/k8s-1.23 |
/test ci/centos/mini-e2e/k8s-1.24 |
/test ci/centos/upgrade-tests-cephfs |
/test ci/centos/upgrade-tests-rbd |
@Madhu-1 the changes look good, but the 3rd commit (e2e one) does address Niels previous review comments rather than the 1st and 2nd. Will it be good to merge the changes to respective commits? |
done now, PTAL |
/test ci/centos/mini-e2e/k8s-1.22 |
/test ci/centos/mini-e2e-helm |
/test ci/centos/k8s-e2e-external-storage/k8s-1.22 |
/test ci/centos/k8s-e2e-external-storage/1.22 |
/test ci/centos/k8s-e2e-external-storage/1.23 |
/test ci/centos/k8s-e2e-external-storage/1.24 |
@Mergifyio rebase |
If a PV is reattached to a new PVC in a different namespace we need to update the namespace name in the rbd image metadata. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
If a PV is reattached to a new PVC in a different namespace we need to update the namespace name in the rados object. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Added E2E test case to verify metadata after PV is attached to a new PVC in different namespace. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
✅ Branch has been successfully rebased |
623a850
to
87056b5
Compare
/test ci/centos/k8s-e2e-external-storage/1.23 |
/test ci/centos/k8s-e2e-external-storage/1.24 |
/test ci/centos/k8s-e2e-external-storage/1.25 |
/test ci/centos/mini-e2e-helm/k8s-1.23 |
/test ci/centos/mini-e2e-helm/k8s-1.24 |
/test ci/centos/mini-e2e-helm/k8s-1.25 |
/test ci/centos/mini-e2e/k8s-1.23 |
/test ci/centos/mini-e2e/k8s-1.24 |
/test ci/centos/mini-e2e/k8s-1.25 |
/test ci/centos/upgrade-tests-cephfs |
/test ci/centos/upgrade-tests-rbd |
If a PV is reattached to a new PVC in a different namespace, we need to update the namespace name in the rbd image metadata.
If a PV is reattached to a new PVC in a different namespace, we need to update the namespace name in the rados object.
As we can notice here, only the PVC name got updated not the namespace name in both metadata and in rados object also.
With this fix even the namespace name also got updated