mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-31 00:59:30 +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
|
||||
}
|
||||
|
||||
rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
|
||||
defer func() {
|
||||
if rbdVol != nil {
|
||||
rbdVol.Destroy(ctx)
|
||||
}
|
||||
}()
|
||||
mgr := NewManager(cs.Driver.GetInstanceID(), nil, req.GetSecrets())
|
||||
defer mgr.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 {
|
||||
return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user