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

@ -68,7 +68,7 @@ func (rscs *ReclaimSpaceControllerServer) ControllerReclaimSpace(
if err != nil {
return nil, status.Errorf(codes.Aborted, "failed to find volume with ID %q: %s", volumeID, err.Error())
}
defer rbdVol.Destroy()
defer rbdVol.Destroy(ctx)
err = rbdVol.Sparsify()
if errors.Is(err, rbdutil.ErrImageInUse) {

View File

@ -273,7 +273,7 @@ func (rs *ReplicationServer) EnableVolumeReplication(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {
@ -350,7 +350,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {
@ -425,7 +425,7 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {
@ -525,7 +525,7 @@ func (rs *ReplicationServer) DemoteVolume(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {
@ -642,7 +642,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {
@ -856,7 +856,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
rbdVol, err := corerbd.GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
rbdVol.Destroy(ctx)
}
}()
if err != nil {