mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
rbd: resize the volume created from snapshot
If the requested volume size is greater than the snapshot size, resize the cloned volume after creating a clone from a snapshot. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
a28a4a4285
commit
69ae19e0cb
@ -389,6 +389,14 @@ func (cs *ControllerServer) repairExistingVolume(ctx context.Context, req *csi.C
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// expand the image if the requested size is greater than the current size
|
||||
err = rbdVol.expand()
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to resize volume %s: %v", rbdVol, err)
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// rbdVol is a clone from parentVol
|
||||
case vcs.GetVolume() != nil:
|
||||
// When cloning into a thick-provisioned volume was happening,
|
||||
@ -590,6 +598,15 @@ func (cs *ControllerServer) createVolumeFromSnapshot(
|
||||
|
||||
log.DebugLog(ctx, "create volume %s from snapshot %s", rbdVol.RequestName, rbdSnap.RbdSnapName)
|
||||
|
||||
// resize the volume if the size is different
|
||||
// expand the image if the requested size is greater than the current size
|
||||
err = rbdVol.expand()
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to resize volume %s: %v", rbdVol, err)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user