mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
rbd: delete volume if setallmetadata fails
If any operations fails after the volume creation we will cleanup the omap objects, but it is missing if setAllMetadata fails. This commits adds the code to cleanup the rbd image if metadata operation fails. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
b40e8894f8
commit
01d4a614c3
@ -384,6 +384,10 @@ func (cs *ControllerServer) CreateVolume(
|
|||||||
metadata := k8s.GetVolumeMetadata(req.GetParameters())
|
metadata := k8s.GetVolumeMetadata(req.GetParameters())
|
||||||
err = rbdVol.setAllMetadata(metadata)
|
err = rbdVol.setAllMetadata(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if deleteErr := rbdVol.deleteImage(ctx); deleteErr != nil {
|
||||||
|
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v", rbdVol, deleteErr)
|
||||||
|
}
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user