mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
rbd: no need to create a snapshot on a thick-provisioned volume
When cloning a volume from a (CSI) snapshot, we use DeepCopy() and do not need an RBD snapshot as source. Suggested-by: Madhu Rajanna <madhupr007@gmail.com> Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
d2c4cacb39
commit
eeec4471c5
@ -1047,7 +1047,6 @@ func (cs *ControllerServer) doSnapshotClone(ctx context.Context, parentVol *rbdV
|
||||
// parent volume of the clone to check thick provision during CreateVolume
|
||||
// from snapshot operation because the parent volume can be deleted anytime
|
||||
// after snapshot is created.
|
||||
// TODO: copy thick provision config
|
||||
thick, err := parentVol.isThickProvisioned()
|
||||
if err != nil {
|
||||
return ready, nil, status.Errorf(codes.Internal, "failed checking thick-provisioning of %q: %s", parentVol, err)
|
||||
@ -1058,14 +1057,14 @@ func (cs *ControllerServer) doSnapshotClone(ctx context.Context, parentVol *rbdV
|
||||
if err != nil {
|
||||
return ready, nil, status.Errorf(codes.Internal, "failed mark %q thick-provisioned: %s", cloneRbd, err)
|
||||
}
|
||||
}
|
||||
|
||||
err = cloneRbd.createSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
// update rbd image name for logging
|
||||
rbdSnap.RbdImageName = cloneRbd.RbdImageName
|
||||
util.ErrorLog(ctx, "failed to create snapshot %s: %v", rbdSnap, err)
|
||||
return ready, cloneRbd, err
|
||||
} else {
|
||||
err = cloneRbd.createSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
// update rbd image name for logging
|
||||
rbdSnap.RbdImageName = cloneRbd.RbdImageName
|
||||
util.ErrorLog(ctx, "failed to create snapshot %s: %v", rbdSnap, err)
|
||||
return ready, cloneRbd, err
|
||||
}
|
||||
}
|
||||
|
||||
err = cloneRbd.getImageID()
|
||||
|
Loading…
Reference in New Issue
Block a user