aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-03 10:17:05 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-03 13:17:12 -0700
commita6dfb56eac6e7b6b64f09df59b6ceaa1e03e3264 (patch)
tree067eeda5afc6b427d66e48c89a46c2374c5c6b2b
parent0812d212b9d8c6414bc40e6b738f4cef91adb174 (diff)
downloadconsfigurator-a6dfb56eac6e7b6b64f09df59b6ceaa1e03e3264.tar.gz
FSTAB:VOLUME->ENTRY: don't try to look up PARTUUIDs of LVM LVs
Instead, for LVM LVs, always use the canonical symlink (per lvm(8)). Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/property/fstab.lisp34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/property/fstab.lisp b/src/property/fstab.lisp
index 17749bf..5daf5c8 100644
--- a/src/property/fstab.lisp
+++ b/src/property/fstab.lisp
@@ -25,17 +25,25 @@
(defun get-findmnt-field (mountpoint field)
(stripln (run "findmnt" "-nro" field mountpoint)))
-(defmethod fs-spec ((volume filesystem))
+(defmethod fs-spec ((volume filesystem) parent)
"Default implementation: no known source.
Other properties might fill it in."
"none")
-(defmethod fs-spec ((volume mounted-ext4-filesystem))
+(defmethod fs-spec ((volume mounted-ext4-filesystem) parent)
(strcat "UUID=" (get-findmnt-field (mount-point volume) "UUID")))
-(defmethod fs-spec ((volume mounted-fat32-filesystem))
+(defmethod fs-spec ((volume mounted-fat32-filesystem) (parent partition))
(strcat "PARTUUID=" (get-findmnt-field (mount-point volume) "PARTUUID")))
+;; Filesystems of any type directly contained within LVM LVs, mounted or not.
+(defmethod fs-spec ((volume filesystem) (parent lvm-logical-volume))
+ (with-slots (volume-label lvm-volume-group) parent
+ (unix-namestring
+ (merge-pathnames volume-label
+ (ensure-directory-pathname
+ (merge-pathnames lvm-volume-group #P"/dev/"))))))
+
(defmethod fs-file ((volume filesystem))
(let* ((ns (unix-namestring (mount-point volume)))
(length (length ns)))
@@ -59,9 +67,9 @@ Other properties might fill it in."
(if (eql #P"/" (mount-point volume))
1 2))
-(defmethod volume->entry ((volume filesystem))
+(defmethod volume->entry ((volume filesystem) parent)
(format nil "~A ~A ~A ~{~A~^,~} ~A ~A"
- (fs-spec volume) (fs-file volume)
+ (fs-spec volume parent) (fs-file volume)
(fs-vfstype volume) (fs-mntops volume)
(fs-freq volume) (fs-passno volume)))
@@ -89,9 +97,11 @@ DISK:HAS-VOLUMES."
(:desc "fstab entries for host's volumes")
(:hostattrs (os:required 'os:linux))
(:apply (apply #'entries
- (mapcar #'volume->entry
- (mapcan (curry #'subvolumes-of-type 'filesystem)
- (get-hostattrs :volumes))))))
+ (apply #'mapcar #'volume->entry
+ (multiple-value-list
+ (multiple-value-mapcan
+ (curry #'subvolumes-of-type 'filesystem)
+ (get-hostattrs :volumes)))))))
(defprop entries-for-opened-volumes :posix ()
"Add or update entries in /etc/fstab for currently open volumes.
@@ -101,6 +111,8 @@ This is used when building disk images and installing operating systems."
(:hostattrs (os:required 'os:linux))
(:apply
(apply #'entries
- (mapcar #'volume->entry
- (mapcan (curry #'subvolumes-of-type 'mounted-filesystem)
- (get-connattr :opened-volumes))))))
+ (apply #'mapcar #'volume->entry
+ (multiple-value-list
+ (multiple-value-mapcan
+ (curry #'subvolumes-of-type 'mounted-filesystem)
+ (get-connattr :opened-volumes)))))))