GNU bug report logs - #41143
[PATCH 1/2] Add 'lvm-device-mapping'

Previous Next

Package: guix-patches;

Reported by: tsmish <tsymsh <at> gmail.com>

Date: Sat, 9 May 2020 01:13:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: tsmish <tsymsh <at> gmail.com>
Subject: bug#41143: closed (Re: [PATCH v3 1/2] mapped-devices: Allow
 target to be list of strings.)
Date: Wed, 25 Nov 2020 23:10:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#41143: [PATCH 1/2] Add 'lvm-device-mapping'

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 41143 <at> debbugs.gnu.org.

-- 
41143: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41143
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Mikhail Tsykalov <tsymsh <at> gmail.com>
Cc: 41143-done <at> debbugs.gnu.org
Subject: Re: [PATCH v3 1/2] mapped-devices: Allow target to be list of strings.
Date: Thu, 26 Nov 2020 00:09:32 +0100
Hi Mikhail,

Mikhail Tsykalov <tsymsh <at> gmail.com> skribis:

> * gnu/system/mapped-devices.scm (<mapped-device>): Rename constructor to
> %mapped-device.
> [target]: Remove field.
> [targets]: New field. Adjust users.
> (mapped-device-compatibility-helper, mapped-device): New macros.
> (mapped-device-target): New deprecated procedure.

[...]

> * gnu/system/mapped-devices.scm (lvm-device-mapping, open-lvm-device,
> close-lvm-device): New variables.
>
> * gnu/tests/install.scm (%lvm-separate-home-os,
> %lvm-separate-home-os-source, %lvm-separate-home-installation-script,
> %test-lvm-separate-home-os): New variables.
>
> * gnu/system/linux-initrd.scm (raw-initrd): Add (srfi srfi-1) to initrd expression.

Pushed as a9a2fdaabcc78e7a54d9a6bcfa4ee3de308e9a90!

Sorry for the delay, the release process took longer than one could hope
for.  :-)

I added a news entry so users will learn about it upon ‘guix pull’.

Thank you!

Ludo’.

[Message part 3 (message/rfc822, inline)]
From: tsmish <tsymsh <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH 1/2] mapped-devices: Allow target to be list of strings
Date: Sat, 9 May 2020 01:12:43 +0000
(let ...) stuff should be in function, but I don't know in which
module it should go.
Code is somewhat untested, proceed with caution.

---
 gnu/services/base.scm         |  5 ++++-
 gnu/system.scm                | 13 ++++++++-----
 gnu/system/mapped-devices.scm |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 0c154d1c4e..3d09e8220c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -408,7 +408,10 @@ FILE-SYSTEM."
 (define (mapped-device->shepherd-service-name md)
   "Return the symbol that denotes the shepherd service of MD, a
<mapped-device>."
   (symbol-append 'device-mapping-
-                 (string->symbol (mapped-device-target md))))
+                 (string->symbol (string-join
+                                  (let ((t (mapped-device-target md)))
+                                    (if (list? t) t (list t)))
+                                  "-"))))

 (define dependency->shepherd-service-name
   (match-lambda
diff --git a/gnu/system.scm b/gnu/system.scm
index 01baa248a2..75632c5e8a 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -390,9 +390,10 @@ marked as 'needed-for-boot'."
     (let ((device (file-system-device fs)))
       (if (string? device)                        ;title is 'device
           (filter (lambda (md)
-                    (string=? (string-append "/dev/mapper/"
-                                             (mapped-device-target md))
-                              device))
+                    (any (cut string=? device <>)
+                         (map (cut string-append "/dev/mapper" <>)
+                              (let ((t (mapped-device-target md)))
+                                (if (list? t) t (list t))))))
                   (operating-system-mapped-devices os))
           '())))

@@ -412,11 +413,13 @@ marked as 'needed-for-boot'."

 (define (mapped-device-users device file-systems)
   "Return the subset of FILE-SYSTEMS that use DEVICE."
-  (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
+  (let ((targets (map (cut string-append "/dev/mapper/" <>)
+                      (let ((t (mapped-device-target device)))
+                        (if (list? t) t (list t))))))
     (filter (lambda (fs)
               (or (member device (file-system-dependencies fs))
                   (and (string? (file-system-device fs))
-                       (string=? (file-system-device fs) target))))
+                       (any (cut string=? (file-system-device fs) <>)
targets))))
             file-systems)))

 (define (operating-system-user-mapped-devices os)
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 7c58f876a3..3339e509e0 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -72,7 +72,7 @@
   make-mapped-device
   mapped-device?
   (source    mapped-device-source)                ;string | list of strings
-  (target    mapped-device-target)                ;string
+  (target    mapped-device-target)                ;string | list of strings
   (type      mapped-device-type)                  ;<mapped-device-kind>
   (location  mapped-device-location
              (default (current-source-location)) (innate)))
-- 
2.26.2



This bug report was last modified 4 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.