cleanup: return error type in NodeServer.processEncryptedDevice()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-12-08 15:03:54 +01:00 committed by mergify[bot]
parent 8019e4d1bc
commit d6fb8f302d

View File

@ -796,14 +796,14 @@ func (ns *NodeServer) processEncryptedDevice(ctx context.Context, volOptions *rb
var existingFormat string var existingFormat string
existingFormat, err = diskMounter.GetDiskFormat(devicePath) existingFormat, err = diskMounter.GetDiskFormat(devicePath)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to get disk format for path %s, error: %v", devicePath, err) return "", fmt.Errorf("failed to get disk format for path %s: %w", devicePath, err)
} }
switch existingFormat { switch existingFormat {
case "": case "":
err = encryptDevice(ctx, volOptions, devicePath) err = encryptDevice(ctx, volOptions, devicePath)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to encrypt rbd image %s: %v", imageSpec, err) return "", fmt.Errorf("failed to encrypt rbd image %s: %w", imageSpec, err)
} }
case "crypt": case "crypt":
util.WarningLog(ctx, "rbd image %s is encrypted, but encryption state was not updated", util.WarningLog(ctx, "rbd image %s is encrypted, but encryption state was not updated",