mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-23 21:40:20 +00:00
rbd: update size for rbdSnapshot struct
we need actual size of the rbdVolume created for the snapshot, as we are not storing the size of the snapshot in OMAP we need to fetch the size from ceph cluster and update the same on rbdSnapshot struct. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
6a82baf5d3
commit
da60d221df
@ -1055,9 +1055,33 @@ func genSnapFromSnapID(
|
||||
}
|
||||
}
|
||||
|
||||
err = updateSnapshotDetails(rbdSnap)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update snapshot details for %q: %w", rbdSnap, err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// updateSnapshotDetails will copies the details from the rbdVolume to the
|
||||
// rbdSnapshot. example copying size from rbdVolume to rbdSnapshot.
|
||||
func updateSnapshotDetails(rbdSnap *rbdSnapshot) error {
|
||||
vol := generateVolFromSnap(rbdSnap)
|
||||
err := vol.Connect(rbdSnap.conn.Creds)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer vol.Destroy()
|
||||
|
||||
err = vol.getImageInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rbdSnap.VolSize = vol.VolSize
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// generateVolumeFromVolumeID generates a rbdVolume structure from the provided identifier.
|
||||
func generateVolumeFromVolumeID(
|
||||
ctx context.Context,
|
||||
|
Loading…
Reference in New Issue
Block a user