util: add logging when OpenEncryptedVolume() encounters an error

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2021-04-01 16:28:47 +02:00 committed by mergify[bot]
parent bd1388fb96
commit 151d066938

View File

@ -243,7 +243,10 @@ func EncryptVolume(ctx context.Context, devicePath, passphrase string) error {
// OpenEncryptedVolume opens volume so that it can be used by the client.
func OpenEncryptedVolume(ctx context.Context, devicePath, mapperFile, passphrase string) error {
DebugLog(ctx, "Opening device %s with LUKS on %s", devicePath, mapperFile)
_, _, err := LuksOpen(devicePath, mapperFile, passphrase)
_, stderr, err := LuksOpen(devicePath, mapperFile, passphrase)
if err != nil {
WarningLog(ctx, "failed to open LUKS device %q: %s", devicePath, stderr)
}
return err
}