mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: add validation for thick restore/clone
added validation to allow only Restore of Thick PVC snapshot to a thick clone and creation of thick clone from thick PVC. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
fc442221e4
commit
7966d2e5c1
@ -1613,3 +1613,19 @@ func (ri *rbdImage) isCompatibleEncryption(dst *rbdImage) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ri *rbdImage) isCompatibleThickProvision(dst *rbdVolume) error {
|
||||
thick, err := ri.isThickProvisioned()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch {
|
||||
case thick && !dst.ThickProvision:
|
||||
return fmt.Errorf("cannot create thin volume from thick volume %q", ri)
|
||||
|
||||
case !thick && dst.ThickProvision:
|
||||
return fmt.Errorf("cannot create thick volume from thin volume %q", ri)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user