1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/tools
Peter Rajnoha e52c998c49 toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs)
When lvmetad is used and at the same time we're getting list of all
PV-capable devices, we can't use cmd->filter (which is used to filter
out lvmetad responses - so we're sure that the devices are PVs already).

To get the list of PV-capable devices, we're bypassing lvmetad (since
lvmetad only caches PVs, not all the other devices which are not PVs).
For this reason, we have to use the "full_filter" filter chain (just
like we do when we're running without lvmetad).

Example scenario:
- sdo and sdp components of MD device md0
- sdq, sdr and sds components of mpatha multipath device
- mpatha multipath device partitioned
- vda device partitioned

=> sdo,sdp,sdr,sds, mpatha and vda should be filtered!

$ lsblk -o NAME,TYPE
NAME            TYPE
sdn             disk
sdo             disk
`-md0           raid0
sdp             disk
`-md0           raid0
sdq             disk
`-mpatha        mpath
  `-mpatha1     part
sdr             disk
`-mpatha        mpath
  `-mpatha1     part
sds             disk
`-mpatha        mpath
  `-mpatha1     part
vda             disk
|-vda1          part
`-vda2          part
  |-fedora-swap lvm
  `-fedora-root lvm

Before this patch:
==================
use_lvmetad=0 (correct behaviour!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

use_lvmetad=1 (incorrect behaviour - sdo,sdp,sdq,sdr,sds and mpatha not filtered!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha              ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/sdo                        ---     0     0
  /dev/sdp                        ---     0     0
  /dev/sdq                        ---     0     0
  /dev/sdr                        ---     0     0
  /dev/sds                        ---     0     0
  /dev/vda                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

With this patch applied:
========================
use_lvmetad=1
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0
2015-02-12 13:46:11 +01:00
..
.exported_symbols generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
.gitignore More .gitignore files for an in-source-tree build. 2012-06-08 16:34:43 +01:00
args.h thin: errrorwhenfull support 2015-01-14 14:52:05 +01:00
cmdnames.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
commands.h tools: allow -S|--select for vgexport and vgimport 2015-02-10 16:10:17 +01:00
dmsetup.c cleanup: validate pointers 2014-11-13 17:49:42 +01:00
dumpconfig.c dumpconfig: add --type profilable-command/profilable-metadata, --metadataprofile/--commandprofile 2014-05-20 16:27:07 +02:00
errors.h lvresize: separate validation from action 2013-07-06 03:28:21 +01:00
formats.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
lvchange.c tools: allow -S|--select for vgchange, lvchange and pvchange 2015-02-10 16:08:04 +01:00
lvconvert.c toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns 2015-02-10 16:05:29 +01:00
lvcreate.c thin: support errorwhenfull with thin creation 2015-01-20 15:43:16 +01:00
lvdisplay.c tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C 2015-02-10 16:09:40 +01:00
lvextend.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvm2cmd-static.c Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
lvm2cmd.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
lvm2cmd.h lvresize: separate validation from action 2013-07-06 03:28:21 +01:00
lvm2cmdline.h Support repetition of --addtag and --deltag arguments. 2010-11-11 17:29:05 +00:00
lvm-static.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
lvm.c readline: switch to new-style readline typedef 2014-03-06 17:28:40 +01:00
lvmchange.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
lvmcmdlib.c cleanup: drop unneeded included header files 2012-08-23 14:37:20 +02:00
lvmcmdline.c lvm: recognize LVM_COMMAND_PROFILE env var for default command profile to use in LVM commands 2015-02-09 14:16:30 +01:00
lvmdiskscan.c filters: add cmd->full_filter - composite of cmd->filter and cmd->lvmetad_filter 2014-10-02 13:06:46 +02:00
lvreduce.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvremove.c tools: allow -S|--select for vgremove and lvremove 2015-02-10 16:08:42 +01:00
lvrename.c cleanup: Use lv_is_ macros. 2014-09-15 21:33:53 +01:00
lvresize.c cleanup: use logical_volume* directly 2014-11-03 14:19:34 +01:00
lvscan.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
Makefile.in makefiles: link blkid library only to lvm 2014-03-06 17:30:10 +01:00
polldaemon.c toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns 2015-02-10 16:05:29 +01:00
polldaemon.h cleanup: constify activation usage of lv pointer 2014-09-24 10:54:47 +02:00
pvchange.c select: initialize selection handle for process_each_* fns with initial report type 2015-02-10 16:10:17 +01:00
pvck.c pvck: Use non-zero exit status after failure. 2014-11-13 12:26:43 +00:00
pvcreate.c pvcreate: Fix cache state with filters/sig wiping. 2014-08-14 01:30:01 +01:00
pvdisplay.c tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C 2015-02-10 16:09:40 +01:00
pvmove.c cleanup: Remove metadata.h from tools dir. 2014-09-17 15:50:24 +01:00
pvremove.c pvremove: Avoid metadata re-reads & related error messages. 2015-01-06 14:27:30 +01:00
pvresize.c toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns 2015-02-10 16:05:29 +01:00
pvscan.c pvscan: notify lvmetad about device that is gone and pvscan is run with device path instead of major:minor pair 2015-01-12 13:59:51 +01:00
reporter.c tools: allow -S|--select for vgremove and lvremove 2015-02-10 16:08:42 +01:00
segtypes.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
stub.h Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
tags.c tools: Add internal tags command. 2014-01-30 13:09:15 +00:00
toollib.c toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs) 2015-02-12 13:46:11 +01:00
toollib.h select: initialize selection handle for process_each_* fns with initial report type 2015-02-10 16:10:17 +01:00
tools.h lvmcmdline: support size_mb_arg_with_percent 2014-10-30 23:58:49 +01:00
vgcfgbackup.c toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns 2015-02-10 16:05:29 +01:00
vgcfgrestore.c vgcfgrestore: return invalid cmd line 2014-05-21 23:14:41 +02:00
vgchange.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgck.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgconvert.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgcreate.c conf: add allocation/physical_extent_size config option for default PE size of VGs. 2014-09-12 10:09:21 +02:00
vgdisplay.c tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C 2015-02-10 16:09:40 +01:00
vgexport.c tools: allow -S|--select for vgexport and vgimport 2015-02-10 16:10:17 +01:00
vgextend.c vgextend: allow --yes to skip prompt 2014-05-23 23:35:40 +02:00
vgimport.c tools: allow -S|--select for vgexport and vgimport 2015-02-10 16:10:17 +01:00
vgmerge.c vgsplit: Fix VG component of lvid. 2014-07-03 19:06:04 +01:00
vgmknodes.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgreduce.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgremove.c tools: allow -S|--select for vgremove and lvremove 2015-02-10 16:08:42 +01:00
vgrename.c report: select: refactor: move str_list to libdm 2014-06-17 16:27:20 +02:00
vgscan.c toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related) 2015-02-10 16:05:24 +01:00
vgsplit.c cleanup: Remove metadata.h from tools dir. 2014-09-17 15:50:24 +01:00