rbd: Use EncryptionTypeNone

Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
This commit is contained in:
Marcel Lauhoff 2022-09-06 18:46:56 +02:00 committed by mergify[bot]
parent 2abfafdf3f
commit dc7ba684e3
2 changed files with 6 additions and 6 deletions

View File

@ -309,8 +309,6 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str
kmsID, encType, err := ParseEncryptionOpts(ctx, volOptions, rbdDefaultEncryptionType) kmsID, encType, err := ParseEncryptionOpts(ctx, volOptions, rbdDefaultEncryptionType)
if err != nil { if err != nil {
return err return err
} else if kmsID == "" {
return nil
} }
switch encType { switch encType {
@ -320,6 +318,8 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str
err = ri.configureFileEncryption(kmsID, credentials) err = ri.configureFileEncryption(kmsID, credentials)
case util.EncryptionTypeInvalid: case util.EncryptionTypeInvalid:
return fmt.Errorf("invalid encryption type") return fmt.Errorf("invalid encryption type")
case util.EncryptionTypeNone:
return nil
} }
if err != nil { if err != nil {
@ -342,7 +342,7 @@ func ParseEncryptionOpts(
) )
encrypted, ok = volOptions["encrypted"] encrypted, ok = volOptions["encrypted"]
if !ok { if !ok {
return "", util.EncryptionTypeInvalid, err return "", util.EncryptionTypeNone, nil
} }
kmsID, err = util.FetchEncryptionKMSID(encrypted, volOptions["encryptionKMSID"]) kmsID, err = util.FetchEncryptionKMSID(encrypted, volOptions["encryptionKMSID"])
if err != nil { if err != nil {

View File

@ -94,7 +94,7 @@ func getEncryptionConfig(rbdVol *rbdVolume) (string, util.EncryptionType) {
case rbdVol.isFileEncrypted(): case rbdVol.isFileEncrypted():
return rbdVol.fileEncryption.GetID(), util.EncryptionTypeFile return rbdVol.fileEncryption.GetID(), util.EncryptionTypeFile
default: default:
return "", util.EncryptionTypeInvalid return "", util.EncryptionTypeNone
} }
} }
@ -141,7 +141,7 @@ func checkSnapCloneExists(
defer j.Destroy() defer j.Destroy()
snapData, err := j.CheckReservation(ctx, rbdSnap.JournalPool, snapData, err := j.CheckReservation(ctx, rbdSnap.JournalPool,
rbdSnap.RequestName, rbdSnap.NamePrefix, rbdSnap.RbdImageName, "", util.EncryptionTypeInvalid) rbdSnap.RequestName, rbdSnap.NamePrefix, rbdSnap.RbdImageName, "", util.EncryptionTypeNone)
if err != nil { if err != nil {
return false, err return false, err
} }
@ -572,7 +572,7 @@ func RegenerateJournal(
rbdVol.Owner = owner rbdVol.Owner = owner
kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeInvalid) kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeNone)
if err != nil { if err != nil {
return "", err return "", err
} }