Fix(zfs_volume); Volume mount/unmount with encryption

- Fix consistent use of fully qualified dataset path
- Add idempotent unmounting with encryption keys
This commit is contained in:
Bert Proesmans authored and Michael Hoang committed 2026-05-29 08:41:07 +02:00
1 parent 03e19b4f67
commit 5c7406ecc5
1 file changed
+7 -5
+7 -5
View File
@@ -88,8 +88,8 @@
default = { default = {
dev = '' dev = ''
${lib.optionalString (config.options.keylocation or "none" != "none") '' ${lib.optionalString (config.options.keylocation or "none" != "none") ''
if [ "$(zfs get keystatus ${config.name} -H -o value)" == "unavailable" ]; then if [ "$(zfs get keystatus ${config._name} -H -o value)" == "unavailable" ]; then
zfs load-key ${config.name} zfs load-key ${config._name}
fi fi
''} ''}
@@ -102,9 +102,11 @@
inherit config options; inherit config options;
default = { default = {
dev = '' dev = ''
${lib.optionalString ( ${lib.optionalString (config.options.keylocation or "none" != "none") ''
config.options.keylocation or "none" != "none" if [ "$(zfs get keystatus ${config._name} -H -o value)" == "available" ]; then
) "zfs unload-key ${config.name}"} zfs unload-key ${config._name}
fi
''}
${config.content._unmount.dev or ""} ${config.content._unmount.dev or ""}
''; '';