cleanup: pass context to rbdImage.Destroy()

In the future we'll introduce a more standard interface for objects like
Volumes and Snapshots. It is useful to have the context passed as 1st
argument to all functions of those objects, including their Destroy()
function.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2024-03-21 15:01:56 +01:00
committed by mergify[bot]
parent d5849a4801
commit 3aece2f38e
8 changed files with 37 additions and 37 deletions

View File

@ -198,7 +198,7 @@ func (ns *NodeServer) populateRbdVol(
} else {
rv, err = GenVolFromVolID(ctx, volID, cr, req.GetSecrets())
if err != nil {
rv.Destroy()
rv.Destroy(ctx)
log.ErrorLog(ctx, "error generating volume %s: %v", volID, err)
return nil, status.Errorf(codes.Internal, "error generating volume %s: %v", volID, err)
@ -221,7 +221,7 @@ func (ns *NodeServer) populateRbdVol(
// in case of any error call Destroy for cleanup.
defer func() {
if err != nil {
rv.Destroy()
rv.Destroy(ctx)
}
}()
// get the image details from the ceph cluster.
@ -345,7 +345,7 @@ func (ns *NodeServer) NodeStageVolume(
if err != nil {
return nil, err
}
defer rv.Destroy()
defer rv.Destroy(ctx)
rv.NetNamespaceFilePath, err = util.GetRBDNetNamespaceFilePath(util.CsiConfigFile, rv.ClusterID)
if err != nil {