cleanup: remove unneeded updateSnapshotDetails() function

`updateSnapshotDetails()` just calls `getImageInfo()` on an `rbdVolume`
created from the `rbdSnapshot`. `getImageInfo()` is a function of the
base `rbdImage` struct, so there really is no need for this indirection.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-09-16 14:30:24 +02:00
parent a7959d4721
commit 9b0383ce6c

View File

@ -1080,7 +1080,7 @@ func genSnapFromSnapID(
} }
} }
err = updateSnapshotDetails(ctx, rbdSnap) err = rbdSnap.getImageInfo()
if err != nil { if err != nil {
return rbdSnap, fmt.Errorf("failed to update snapshot details for %q: %w", rbdSnap, err) return rbdSnap, fmt.Errorf("failed to update snapshot details for %q: %w", rbdSnap, err)
} }
@ -1088,25 +1088,6 @@ func genSnapFromSnapID(
return rbdSnap, err return rbdSnap, err
} }
// updateSnapshotDetails will copy the details from the rbdVolume to the
// rbdSnapshot. example copying size from rbdVolume to rbdSnapshot.
func updateSnapshotDetails(ctx context.Context, rbdSnap *rbdSnapshot) error {
vol := rbdSnap.toVolume()
err := vol.Connect(rbdSnap.conn.Creds)
if err != nil {
return err
}
defer vol.Destroy(ctx)
err = vol.getImageInfo()
if err != nil {
return err
}
rbdSnap.VolSize = vol.VolSize
return nil
}
// generateVolumeFromVolumeID generates a rbdVolume structure from the provided identifier. // generateVolumeFromVolumeID generates a rbdVolume structure from the provided identifier.
func generateVolumeFromVolumeID( func generateVolumeFromVolumeID(
ctx context.Context, ctx context.Context,