summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* dev-cache: remove spurious error msg if no value found in ↵dev-prajnoha-various-dev-cache-fixes-for-recent-changesPeter Rajnoha2016-03-302-5/+8
| | | | | | | | | | | | | | | | | | | | | | /sys/dev/block/<major>:<minor>/dm/uuid during dev scan It's correct to have a DM device that has no DM UUID assigned so no need to issue error message in this case. Also, if the device doesn't have DM UUID, it's also clear it's not an LVM LV (...when looking for VGID/LVID while creating VGID/LVID indices in dev cache). For example: $ dmsetup create test --table "0 1 linear /dev/sda 0" And there's no PV in the system. Before this patch (spurious error message issued): $ pvs _get_sysfs_value: /sys/dev/block/253:2/dm/uuid: no value With this patch applied (no spurious error message): $ pvs
* dev-cache: also index VGIDs and LVIDs if using persistent .cache filePeter Rajnoha2016-03-304-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're using persistent .cache file, we're reading this file instead of traversing the /dev content. Fix missing indexing by VGID and LVID here - hook this into persistent_filter_load where we populate device cache from persistent .cache file instead of scanning /dev. For example, inducing situation in which we warn about different device actually used than what LVM thinks should be used based on metadata: $ lsblk -s /dev/vg/lvol0 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vg-lvol0 253:4 0 124M 0 lvm `-loop1 7:1 0 128M 0 loop $ lvmconfig --type diff global { use_lvmetad=0 } devices { obtain_device_list_from_udev=0 } (obtain_device_list_from_udev=0 also means the persistent .cache file is used) Before this patch - pvs is fine as it does the dev scan, but lvs relies on persistent .cache file and it misses the VGID/LVID indices to check and warn about incorrect devices used: $ pvs Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1 Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1 WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0. PV VG Fmt Attr PSize PFree /dev/loop0 vg lvm2 a-- 124.00m 0 $ lvs Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1 Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1 LV VG Attr LSize lvol0 vg -wi-a----- 124.00m With this patch applied - both pvs and lvs is fine - the indices are always created correctly (lvs just an example here, other LVM commands that rely on persistent .cache file are fixed with this patch too): $ pvs Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1 Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1 WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0. PV VG Fmt Attr PSize PFree /dev/loop0 vg lvm2 a-- 124.00m 0 $ lvs Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1 Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1 WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0. LV VG Attr LSize lvol0 vg -wi-a----- 124.00m
* dev-cache: handle situation where device is referenced in sysfs, but the ↵Peter Rajnoha2016-03-302-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | node is not yet in dev dir It's possible that while a device is already referenced in sysfs, the node is not yet in /dev directory. This may happen in some rare cases right after LVs get created - we sync with udev (or alternatively we create /dev content ourselves) while VG lock is held. However, dev scan is done without VG lock so devices may already be in sysfs, but /dev may not be updated yet if we call LVM command right after LV creation (so the fact that fs_unlock is done within VG lock is not usable here much). This is not a problem with devtmpfs as there's at least kernel name for device in /dev as soon as the sysfs item exists, but we still support environments without devtmpfs or where different directory for dev nodes is used (e.g. our test suite). This patch covers these situations by tracking such devices in _cache.sysfs_only_names helper hash for the vgid/lvid check to work still. This also resolves commit 6129d2e64d14047169048775dc7081135c0fcc50 which was then reverted by commit 109b7e2095a7bc5603bf79db0224b8399463af7c due to performance issues it may have brought (...and it didn't resolve the problem fully anyway).
* test: Add missing directoryMarian Csontos2016-03-291-1/+1
| | | | Fix commit bb93a28bc1
* post-commitAlasdair G Kergon2016-03-264-2/+8
|
* pre-releasev2_02_148Alasdair G Kergon2016-03-264-4/+6
|
* libdm: Raid status region units are sectorsAlasdair G Kergon2016-03-241-2/+2
|
* lvmdbusd: Add '-' to allowable PV device path charsTony Asleson2016-03-241-1/+1
|
* revert: 6129d2e64d14047169048775dc7081135c0fcc50Peter Rajnoha2016-03-242-7/+0
| | | | | Unfortunately, commit 6129d2e64d14047169048775dc7081135c0fcc50 may cause performance issue. There's going to be a better fix...
* WHATS_NEW: commit 6129d2e64d14047169048775dc7081135c0fcc50Peter Rajnoha2016-03-241-0/+1
|
* monitoring: sync /dev content before contacting dmeventd for monitor/unmonitorPeter Rajnoha2016-03-241-0/+6
| | | | | | | | | | | | | | | | | | | | dmeventd daemon may call further code itself that looks at /dev, e.g. via dmeventd_lvm2_command call. We need to have a consistent view of the /dev content at that time. Therefore, sync /dev content before calling monitoring hook which contacts dmeventd. This problem was quite hidden before, but now it has manifested itself because of recent additions to dev-cache code where we started looking at device holders as seen in sysfs. What happened here was that the device was already in sysfs, but not yet under /dev and this triggered the new error message sometimes: log_error("%s: failed to find associated device structure for holder %s.", devname, devpath); This problem has manifested recently in our api/pytest.sh test from testsuite where we create thin pool LVs and thin LVs and hence it also causes dmeventd to be used as well and these error messages were visible there.
* test: Move bus configuration to prepare functionMarian Csontos2016-03-232-9/+8
|
* test: Remove pidfile after killing the processMarian Csontos2016-03-231-0/+1
| | | | | Though unlikely keeping files in place may result in random process killed.
* test: Fix lvmdbusd tests to work with installed testsuiteMarian Csontos2016-03-233-9/+17
|
* test: Fix checks to skip lvmdbusd testsMarian Csontos2016-03-231-2/+4
| | | | | The executable is always present in the tree, need to check the runtime dependencies.
* properties: use proper 'get' variant for unimplemented _pv_major_get and ↵Peter Rajnoha2016-03-231-2/+2
| | | | _pv_minor_get fns
* raid: Tidy dm_get_status_raid. [HM]Alasdair G Kergon2016-03-221-34/+53
|
* libdm: Move _skip_fields within file.Alasdair G Kergon2016-03-221-11/+12
|
* libdm: Change _advance_to_next_word to _skip_fieldsAlasdair G Kergon2016-03-221-16/+15
|
* activate: Use macros for target and module names.Alasdair G Kergon2016-03-2212-43/+69
|
* coverity: fix some issues reported by coverity for recent codePeter Rajnoha2016-03-222-14/+20
|
* tests: update vg-check-devs-used.shPeter Rajnoha2016-03-221-2/+2
| | | | Snapshot needs to be activated exclusively in cluster...
* tests: update vg-check-devs-used.shPeter Rajnoha2016-03-221-1/+11
|
* dev: also count with suffixes in UUID for LVs when constructing VGID and ↵Peter Rajnoha2016-03-221-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LVID index UUID for LV is either "LVM-<vg_uuid><lv_uuid>" or "LVM-<vg_uuid><lv_uuid>-<suffix>". The code before just checked the length of the UUID based on the first template, not the variant with suffix - so LVs with this suffix were not processed properly. For example a thin pool LV (as an example of an LV that contains sub LVs where UUIDs have suffixes): [0] fedora/~ # lsblk -s /dev/vg/lvol1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vg-lvol1 253:8 0 4M 0 lvm `-vg-pool-tpool 253:6 0 116M 0 lvm |-vg-pool_tmeta 253:2 0 4M 0 lvm | `-sda 8:0 0 128M 0 disk `-vg-pool_tdata 253:3 0 116M 0 lvm `-sda 8:0 0 128M 0 disk Before this patch (spurious warning message about device mismatch): [0] fedora/~ # pvs WARNING: Device mismatch detected for vg/lvol1 which is accessing /dev/mapper/vg-pool-tpool instead of (null). PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 124.00m 0 With this patch applied (no spurious warning message about device mismatch): [0] fedora/~ # pvs PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 124.00m 0
* dev: also check for blank sysfs value containing only '\n'Peter Rajnoha2016-03-221-1/+1
|
* report: Add pv_major, pv_minor to reports.Alasdair G Kergon2016-03-224-0/+25
|
* lvmdbusd: Change print statements to log_errorTony Asleson2016-03-211-6/+6
| | | | | | Should not be using print() in the service code. Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lvmdbusd: Add lvm flight recorderTony Asleson2016-03-213-3/+47
| | | | | | | | To help out with debug, when an exception is thrown in the dbus service we will dump all the information we have on the last 16 commands that were executed along with the stack strace. Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lvmdbusd: Allow PV devices to be referenced by symlink(s)Tony Asleson2016-03-212-8/+29
| | | | | | See: https://bugzilla.redhat.com/show_bug.cgi?id=1318754 Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lvmdbusd: Remove --udev in service fileTony Asleson2016-03-211-1/+1
| | | | | | | | With commit 2d5dc6512e10924ab68e6a139081d7121bc3f7d6 the dbus server no longer needs to utilize udev to know when to update its internal state. Signed-off-by: Tony Asleson <tasleson@redhat.com>
* tests: add vg-check-devs-used.shPeter Rajnoha2016-03-211-0/+24
|
* dev: be safer when reading sysfs propertiesPeter Rajnoha2016-03-211-1/+8
| | | | | | Check if the value we read from sysfs is not blank and replace the '\n' at the end only when needed ('\n' should usually be there for sysfs values, but better check this).
* test: Turn on dbus testMarian Csontos2016-03-211-1/+1
| | | | (cherry picked from commit f1ea96c6c1dc6414169bda1a18cf14cd9ebb1493)
* metadata: use own mem pool to report PV device mismatch in VGPeter Rajnoha2016-03-211-3/+10
|
* dev: detect mismatch between devices used and devices assumed for an LVPeter Rajnoha2016-03-215-2/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible for an LVM LV to use a device during activation which then differs from device which LVM assumes based on metadata later on. For example, such device mismatch can occur if LVM doesn't have complete view of devices during activation or if filters are misbehaving or they're incorrectly set during activation. This patch adds code that can detect this mismatch by creating VG UUID and LV UUID index while scanning devices for device cache. The VG UUID index maps VG UUID to a device list. Each device in the list has a device layered above as a holder which is an LVM LV device and for which we know the VG UUID (and similarly for LV UUID index). We can acquire VG and LV UUID by reading /sys/block/<dm_dev_name>/dm/uuid. So these indices represent the actual state of PV device use in the system by LVs and then we compare that to what LVM assumes based on metadata. For example: [0] fedora/~ # lsblk /dev/sdq /dev/sdr /dev/sds /dev/sdt NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdq 65:0 0 104M 0 disk |-vg-lvol0 253:2 0 200M 0 lvm `-mpath_dev1 253:3 0 104M 0 mpath sdr 65:16 0 104M 0 disk `-mpath_dev1 253:3 0 104M 0 mpath sds 65:32 0 104M 0 disk |-vg-lvol0 253:2 0 200M 0 lvm `-mpath_dev2 253:4 0 104M 0 mpath sdt 65:48 0 104M 0 disk `-mpath_dev2 253:4 0 104M 0 mpath In this case the vg-lvol0 is mapped onto sdq and sds becauset this is what was available and seen during activation. Then later on, sdr and sdt appeared and mpath devices were created out of sdq+sdr (mpath_dev1) and sds+sdt (mpath_dev2). Now, LVM assumes (correctly) that mpath_dev1 and mpath_dev2 are the PVs that should be used, not the mpath components (sdq/sdr, sds/sdt). [0] fedora/~ # pvs Found duplicate PV xSUix1GJ2SK82ACFuKzFLAQi8xMfFxnO: using /dev/mapper/mpath_dev1 not /dev/sdq Using duplicate PV /dev/mapper/mpath_dev1 from subsystem DM, replacing /dev/sdq Found duplicate PV MvHyMVabtSqr33AbkUrobq1LjP8oiTRm: using /dev/mapper/mpath_dev2 not /dev/sds Using duplicate PV /dev/mapper/mpath_dev2 from subsystem DM, ignoring /dev/sds WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/sdq, /dev/sds instead of /dev/mapper/mpath_dev1, /dev/mapper/mpath_dev2. PV VG Fmt Attr PSize PFree /dev/mapper/mpath_dev1 vg lvm2 a-- 100.00m 0 /dev/mapper/mpath_dev2 vg lvm2 a-- 100.00m 0
* device: add DEV_OPEN_FAILURE flagPeter Rajnoha2016-03-212-0/+4
| | | | | DEV_OPEN_FAILURE flag is set if the most recent "open" for a device failed and it's unset if any subsequent "open" succeeds.
* post-releaseAlasdair G Kergon2016-03-194-2/+8
|
* pre-releasev2_02_147Alasdair G Kergon2016-03-194-6/+3
|
* fsadm: use stat to get major:minor pair for non-standard /dev layoutsPeter Rajnoha2016-03-181-0/+7
| | | | | | | If we're using non-standard /dev layout so we can't get the dm-X name easily, we can't also look at the /sys/blocl/dm-X/dev to get the major:minor pair. Use "stat" in this case even though it triggers automounts (but there's no better way for now).
* fsadm: if available, use /proc/self/mountinfo to detect mounted volumePeter Rajnoha2016-03-182-4/+26
| | | | | | | | | | | The /proc/self/mountinfo is not bound to device names like /proc/mounts and it uses major:minor pairs instead. This fixes a situation in which a volume is mounted and then renamed later on - that makes /proc/mounts unreliable when detecting mounted volumes. See also https://bugzilla.redhat.com/show_bug.cgi?id=1196910.
* tests: stacked resize of thin on raidZdenek Kabelac2016-03-151-0/+35
|
* lvresize: fix stacked resizeZdenek Kabelac2016-03-152-15/+29
| | | | | | | | Commit b64703401da1f4bef60579a0b3766c087fcfe96a cause regression when handling stacked resize of pool metadata volume that would be a raid LV. Fix it by properly setting up size also for layer extension.
* tests: update lvconvert testZdenek Kabelac2016-03-141-1/+8
|
* tests: use own PID path for lvmetad checkingZdenek Kabelac2016-03-141-0/+1
| | | | Do not try to check PID of running lvmetad and use own path.
* lvconvert: fix error path testZdenek Kabelac2016-03-142-1/+2
| | | | | lvremove_single toollib function returns ECMD_FAILED or ECMD_PROCESSED.
* report: Use default vg_name field width too.Alasdair G Kergon2016-03-141-1/+1
|
* post-releaseAlasdair G Kergon2016-03-114-2/+8
|
* pre-releasev2_02_146Alasdair G Kergon2016-03-118-8/+130
|
* man: vgcreate sharedDavid Teigland2016-03-101-1/+2
|
* pvchange, pvresize: move exported VG checkDavid Teigland2016-03-102-3/+12
| | | | | | | | | | | | | Allow pvchange and pvresize to process exported VGs, and have them check for the exported state in their single function. Previously, the exported VG state would trigger a failure in vg_read()/ignore_vg() because the VGs are being read with READ_FOR_UPDATE. Because these commands read all VGs to search for the intended PVs, any exported VG would trigger a failure, even if it was not related to the intended PV.