rbd: unset PVC metadata on CreateSnapshot

Unset the PVC metadata on the rbd image created for the snapshot

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever 2022-04-04 17:23:50 +05:30 committed by mergify[bot]
parent bac33262ae
commit d89c5fb39f

View File

@ -971,7 +971,7 @@ func (cs *ControllerServer) ValidateVolumeCapabilities(
}
// CreateSnapshot creates the snapshot in backend and stores metadata in store.
// nolint:cyclop // TODO: reduce complexity
// nolint:gocyclo,cyclop // TODO: reduce complexity.
func (cs *ControllerServer) CreateSnapshot(
ctx context.Context,
req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
@ -1074,6 +1074,10 @@ func (cs *ControllerServer) CreateSnapshot(
// Update the metadata on snapshot not on the original image
rbdVol.RbdImageName = rbdSnap.RbdSnapName
err = rbdVol.unsetAllMetadata(k8s.GetVolumeMetadataKeys())
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
// Set snapshot-name/snapshot-namespace/snapshotcontent-name details
// on RBD backend image as metadata on create
metadata := k8s.GetSnapshotMetadata(req.GetParameters())