mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: provide option to disable setting metadata on rbd images
As we added support to set the metadata on the rbd images created for the PVC and volume snapshot, by default metadata is set on all the images. As we have seen we are hitting issues#2327 a lot of times with this, we start to leave a lot of stale images. Currently, we rely on `--extra-create-metadata=true` to decide to set the metadata or not, we cannot set this option to false to disable setting metadata because we use this for encryption too. This changes is to provide an option to disable setting the image metadata when starting cephcsi. Fixes: #3009 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
8a47904e8f
commit
caf4090657
@ -55,6 +55,9 @@ type ControllerServer struct {
|
||||
|
||||
// Cluster name
|
||||
ClusterName string
|
||||
|
||||
// Set metadata on volume
|
||||
SetMetadata bool
|
||||
}
|
||||
|
||||
func (cs *ControllerServer) validateVolumeReq(ctx context.Context, req *csi.CreateVolumeRequest) error {
|
||||
@ -173,7 +176,10 @@ func (cs *ControllerServer) parseVolCreateRequest(
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
// set cluster name on volume
|
||||
rbdVol.ClusterName = cs.ClusterName
|
||||
// set metadata on volume
|
||||
rbdVol.EnableMetadata = cs.SetMetadata
|
||||
|
||||
// if the KMS is of type VaultToken, additional metadata is needed
|
||||
// depending on the tenant, the KMS can be configured with other
|
||||
@ -1061,6 +1067,7 @@ func (cs *ControllerServer) CreateSnapshot(
|
||||
|
||||
return nil, err
|
||||
}
|
||||
rbdVol.EnableMetadata = cs.SetMetadata
|
||||
|
||||
// Check if source volume was created with required image features for snaps
|
||||
if !rbdVol.hasSnapshotFeature() {
|
||||
|
Reference in New Issue
Block a user