mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: update namespace name in rados object
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>
(cherry picked from commit 07aa9dea5c
)
This commit is contained in:
committed by
mergify[bot]
parent
787d54fa6a
commit
b33d9ee583
@ -535,7 +535,7 @@ func undoVolReservation(ctx context.Context, rbdVol *rbdVolume, cr *util.Credent
|
||||
// Generate new volume Handler
|
||||
// The volume handler won't remain same as its contains poolID,clusterID etc
|
||||
// which are not same across clusters.
|
||||
// nolint:gocyclo,cyclop // TODO: reduce complexity
|
||||
// nolint:gocyclo,cyclop,nestif // TODO: reduce complexity
|
||||
func RegenerateJournal(
|
||||
volumeAttributes map[string]string,
|
||||
claimName,
|
||||
@ -621,6 +621,12 @@ func RegenerateJournal(
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
if rbdVol.Owner != owner {
|
||||
err = j.ResetVolumeOwner(ctx, rbdVol.JournalPool, rbdVol.ReservedID, owner)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
// Update Metadata on reattach of the same old PV
|
||||
parameters := k8s.PrepareVolumeMetadata(claimName, owner, "")
|
||||
err = rbdVol.setAllMetadata(parameters)
|
||||
|
Reference in New Issue
Block a user