psss / rpms / libguestfs

Forked from rpms/libguestfs 5 years ago
Clone
Blob Blame History Raw
From aa1ffc6d2bab0d3b0b9f71987e74dea6803f4bb7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Feb 2016 13:41:26 +0000
Subject: [PATCH 2/2] 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.

(cherry picked from commit 2e16e3e99324112845446c82b6a6e8b3e652e10d)
---
 daemon/lvm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/daemon/lvm.c b/daemon/lvm.c
index 501c967..83cc6f8 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