Richard W.M. Jones
2016-Feb-12 13:44 UTC
[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
Pino Toscano
2016-Feb-12 14:33 UTC
Re: [Libguestfs] [PATCH] daemon: lvm: Ignore LVs with the activationskip flag set (RHBZ#1306666).
On Friday 12 February 2016 13:44:19 Richard W.M. Jones wrote:> 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) {LGTM. Thanks, -- Pino Toscano
Apparently Analagous Threads
- [PATCH] lvm: support lvm2 older than 2.02.107
- [PATCH 14/27] daemon: Reimplement ‘lvs’ API in OCaml.
- [PATCH v2] lvm: support lvm2 older than 2.02.107
- [PATCH 0/5] Improve LVM handling in the appliance
- [PATCH] daemon: lvm: Only return public LVs from guestfs_lvs API (RHBZ#1278878).