Skip to content

Commit

Permalink
rbd: Use EncryptionTypeNone
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
  • Loading branch information
Marcel Lauhoff authored and mergify[bot] committed Oct 17, 2022
1 parent 2abfafd commit dc7ba68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions internal/rbd/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str
kmsID, encType, err := ParseEncryptionOpts(ctx, volOptions, rbdDefaultEncryptionType)
if err != nil {
return err
} else if kmsID == "" {
return nil
}

switch encType {
Expand All @@ -320,6 +318,8 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str
err = ri.configureFileEncryption(kmsID, credentials)
case util.EncryptionTypeInvalid:
return fmt.Errorf("invalid encryption type")
case util.EncryptionTypeNone:
return nil
}

if err != nil {
Expand All @@ -342,7 +342,7 @@ func ParseEncryptionOpts(
)
encrypted, ok = volOptions["encrypted"]
if !ok {
return "", util.EncryptionTypeInvalid, err
return "", util.EncryptionTypeNone, nil
}
kmsID, err = util.FetchEncryptionKMSID(encrypted, volOptions["encryptionKMSID"])
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/rbd/rbd_journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func getEncryptionConfig(rbdVol *rbdVolume) (string, util.EncryptionType) {
case rbdVol.isFileEncrypted():
return rbdVol.fileEncryption.GetID(), util.EncryptionTypeFile
default:
return "", util.EncryptionTypeInvalid
return "", util.EncryptionTypeNone
}
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func checkSnapCloneExists(
defer j.Destroy()

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 {
return false, err
}
Expand Down Expand Up @@ -572,7 +572,7 @@ func RegenerateJournal(

rbdVol.Owner = owner

kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeInvalid)
kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeNone)
if err != nil {
return "", err
}
Expand Down

0 comments on commit dc7ba68

Please sign in to comment.