rbd: correct return error for isCompatibleEncryption

isCompatibleEncryption is used to validate the
requested volume and the existing volume and
the destination volume name wont be generated yet
and logging the destination volume prints the empty
image name with pool name.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-06-17 12:08:21 +05:30 committed by mergify[bot]
parent 9fde4f7f18
commit 367eb9f748

View File

@ -1562,10 +1562,10 @@ func (rv *rbdVolume) getOrigSnapName(snapID uint64) (string, error) {
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)
return fmt.Errorf("cannot create unencrypted volume from encrypted volume %q", ri)
case !ri.isEncrypted() && dst.isEncrypted():
return fmt.Errorf("unencrypted volume %q does not match encrypted volume %q", ri, dst)
return fmt.Errorf("cannot create encrypted volume from unencrypted volume %q", ri)
}
return nil