mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
cephfs: set metadata on restart of provisioner pod
Make sure to set metadata when subvolume exist, i.e. if the provisioner pod is restarted while createVolume is in progress, say it created the subvolume but didn't yet set the metadata. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
parent
6bcb8ecc68
commit
466bdf97b2
@ -287,9 +287,10 @@ func (cs *ControllerServer) CreateVolume(
|
|||||||
}
|
}
|
||||||
// TODO return error message if requested vol size greater than found volume return error
|
// TODO return error message if requested vol size greater than found volume return error
|
||||||
|
|
||||||
|
metadata := k8s.GetVolumeMetadata(req.GetParameters())
|
||||||
if vID != nil {
|
if vID != nil {
|
||||||
|
volClient := core.NewSubVolume(volOptions.GetConnection(), &volOptions.SubVolume, volOptions.ClusterID)
|
||||||
if sID != nil || pvID != nil && !volOptions.BackingSnapshot {
|
if sID != nil || pvID != nil && !volOptions.BackingSnapshot {
|
||||||
volClient := core.NewSubVolume(volOptions.GetConnection(), &volOptions.SubVolume, volOptions.ClusterID)
|
|
||||||
err = volClient.ExpandVolume(ctx, volOptions.Size)
|
err = volClient.ExpandVolume(ctx, volOptions.Size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
purgeErr := volClient.PurgeVolume(ctx, false)
|
purgeErr := volClient.PurgeVolume(ctx, false)
|
||||||
@ -311,6 +312,14 @@ func (cs *ControllerServer) CreateVolume(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !volOptions.BackingSnapshot {
|
||||||
|
// Set metadata on restart of provisioner pod when subvolume exist
|
||||||
|
err = volClient.SetAllMetadata(metadata)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove kubernetes csi prefixed parameters.
|
// remove kubernetes csi prefixed parameters.
|
||||||
volumeContext := k8s.RemoveCSIPrefixedParameters(req.GetParameters())
|
volumeContext := k8s.RemoveCSIPrefixedParameters(req.GetParameters())
|
||||||
volumeContext["subvolumeName"] = vID.FsSubvolName
|
volumeContext["subvolumeName"] = vID.FsSubvolName
|
||||||
@ -388,7 +397,6 @@ func (cs *ControllerServer) CreateVolume(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set Metadata on PV Create
|
// Set Metadata on PV Create
|
||||||
metadata := k8s.GetVolumeMetadata(req.GetParameters())
|
|
||||||
err = volClient.SetAllMetadata(metadata)
|
err = volClient.SetAllMetadata(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user