mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: fail fast in create volume for missmatch encryption
CreateVolume will fail in below cases * If the snapshot is encrypted and requested volume is not encrypted * If the snapshot is not encrypted and requested volume is encrypted * If the parent volume is encrypted and requested volume is not encrypted * If the parent volume is not encrypted and requested volume is encrypted Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
538e36f7a7
commit
7b5c78ec7c
@ -1528,3 +1528,15 @@ func (rv *rbdVolume) getOrigSnapName(snapID uint64) (string, error) {
|
||||
|
||||
return origSnapName, nil
|
||||
}
|
||||
|
||||
func (ri *rbdImage) isCompatibleEncryption(dst *rbdImage) error {
|
||||
switch {
|
||||
case ri.isEncrypted() && !dst.isEncrypted():
|
||||
return fmt.Errorf("encrypted volume %q does not match unencrypted volume %q", ri, dst)
|
||||
|
||||
case !ri.isEncrypted() && dst.isEncrypted():
|
||||
return fmt.Errorf("unencrypted volume %q does not match encrypted volume %q", ri, dst)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user