mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-31 09:09:29 +00:00
rbd: use rbd.Manager
within ControllerServer.DeleteVolume()
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
075abcac67
commit
923e1e3af5
@ -957,12 +957,17 @@ func (cs *ControllerServer) DeleteVolume(
|
|||||||
return &csi.DeleteVolumeResponse{}, nil
|
return &csi.DeleteVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
|
mgr := NewManager(cs.Driver.GetInstanceID(), nil, req.GetSecrets())
|
||||||
defer func() {
|
defer mgr.Destroy(ctx)
|
||||||
if rbdVol != nil {
|
|
||||||
rbdVol.Destroy(ctx)
|
vol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||||
|
if vol != nil {
|
||||||
|
defer vol.Destroy(ctx)
|
||||||
|
}
|
||||||
|
rbdVol, ok := vol.(*rbdVolume) // FIXME: temporary cast until rbdVolume is cleaned up
|
||||||
|
if !ok {
|
||||||
|
return nil, status.Error(codes.Internal, "BUG: failed to cast Volume to rbdVolume")
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
|
return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user