[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] daemon: lvm: Ignore LVs with the activationskip flag set (RHBZ#1306666).



When listing logical volumes, ignore the ones which don't get
activated automatically.  No /dev/VG/LV device node is created for
these ones which confuses APIs that attempt to do 'guestfs_lvs'
followed by opening the device node.  Note that 'guestfs_lvs_full' is
unaffected by this change.
---
 daemon/lvm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/daemon/lvm.c b/daemon/lvm.c
index 8bef4d5..529e20d 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -157,6 +157,10 @@ filter_convert_old_lvs_output (char *out)
     if (lv_attr[0] == 't')
       goto skip_line;
 
+    /* Ignore activationskip (RHBZ#1306666). */
+    if (strlen (lv_attr) >= 10 && lv_attr[9] == 'k')
+      goto skip_line;
+
     /* Ignore "unknown device" message (RHBZ#1054761). */
     if (STRNEQ (p, "unknown device")) {
       char buf[256];
@@ -260,7 +264,7 @@ do_lvs (void)
     r = command (&out, &err,
                  str_lvm, "lvs",
                  "-o", "vg_name,lv_name",
-                 "-S", "lv_role=public",
+                 "-S", "lv_role=public && lv_active=active",
                  "--noheadings",
                  "--separator", "/", NULL);
     if (r == -1) {
-- 
2.5.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]