summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lvmcache: prefer duplicate device used by LVsdev-dct-lvmetad-disabled-dups-3David Teigland2016-03-311-8/+16
|
* remove unused set_preferred_duplicatesDavid Teigland2016-03-312-44/+0
|
* lvmcache: process duplicate PVs directlyDavid Teigland2016-03-313-122/+147
| | | | | | | | | | | | | | | | | | | | Previously, duplicate PVs were processed as a side effect of processing the "chosen" PV in lvmcache. The duplicate PV would be hacked into lvmcache temporarily in place of the chosen PV. In the old way, we had to always process the "chosen" PV device, even if a duplicate of it was named on the command line. This meant we were processing a different device than was asked for. This could be worked around by naming multiple duplicate devs on the command line in which case they were swapped in and out of lvmcache for processing. Now, the duplicate devs are processed directly in their own processing loop. This means we can remove the old hacks related to processing dups as a side effect of processing the chosen device. We can now simply process the device that was named on the command line.
* lvmcache: improve duplicate PV handlingDavid Teigland2016-03-316-215/+380
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wait to compare and choose alternate duplicate devices until after all devices are scanned. During scanning, the first duplicate dev is kept in lvmcache, and others are kept in a new list (_found_duplicate_devs). After all devices are scanned, compare all the duplicates available for a given PVID and decide which is best. If the dev used in lvmcache is changed, drop the old dev from lvmcache entirely and rescan the replacement dev. Previously the VG metadata from the old dev was kept in lvmcache and only the dev was replaced. A new config setting devices/strict_pv_device can be set to 1 which will disallow modifying a VG when it contains PVs with duplicate devices. Set to 0 is the old behavior which allowed the VG to be changed. The logic for which of two devs is preferred has changed. The primary goal is to choose a device that is currently in use if the other isn't, e.g. by an active LV. . prefer dev with fs mounted if the other doesn't, else . prefer dev with holders if the other doesn't, else . prefer dev that is dm if the other isn't, else . prefer dev in subsystem if the other isn't If neither device is preferred by these rules, then don't change devices in lvmcache, leaving the one that was found first. The previous logic for preferring a device was: . prefer dev in subsystem if the other isn't, else . prefer dev *without* holders if the other has holders, else . prefer dev that is dm if the other isn't It seems that if one dev has holders and the other doesn't, the dev with holders is more likely to be currently used by an active LV, in which case it should be preferred.
* lvmetad: disable when lvm1 metadata is createdDavid Teigland2016-03-311-0/+8
| | | | We could alternatively report an error and fail the command.
* lvmetad: remove client side altdev codeDavid Teigland2016-03-311-41/+2
| | | | | | This is no longer used since lvmetad no longer keeps track of alternate devices for duplicate PVs, but is simply disabled when duplicates appear.
* pvscan: repopulate and reenable disabled lvmetadDavid Teigland2016-03-313-1/+47
| | | | | | | | | | Other commands ignore lvmetad when it's disabled, but pvscan --cache is an exception since it is populating the lvmetad cache, not using the lvmetad cache. Have 'pvscan --cache' clear the disabled flag in lvmetad if, after scanning all devices, it found no lvm1 metadata and found no duplicate PVs.
* lvmetad: disable when duplicate PVs are seenDavid Teigland2016-03-311-152/+31
| | | | | | | | | | When duplicate PVs are detected, set the disabled flag so that commands will disable use of lvmetad. Remove the "altdev" logic that attempted to keep track of multiple devices for a single PV. It is no longer used since lvmetad is disabled in this case.
* pvscan: disable lvmetad if duplicate PVs are foundDavid Teigland2016-03-311-0/+5
|
* pvscan: disable lvmetad if lvm1 metadata is foundDavid Teigland2016-03-312-0/+30
|
* lvmetad: add disabled stateDavid Teigland2016-03-315-5/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A global flag in lvmetad indicates it has been disabled. Other flags indicate the reason it was disabled. These flags can be queried using get_global_info. The lvmetactl debugging utility can set and clear the disabled flag in lvmetad. Nothing else sets the disabled flag yet. Commands check these flags after connecting to lvmetad. If the disabled flag is set, the command disables use of lvmetad (as it already does in other cases.) To test this feature: $ lvmetactl get_global_info response = "OK" global_invalid = 0 global_disable = 0 disable_reason = "none" token = "filter:3041577944" $ vgs (should report VGs from lvmetad) $ lvmetactl set_global_disable 1 $ lvmetactl get_global_info response = "OK" global_invalid = 0 global_disable = 1 disable_reason = "DIRECT" token = "filter:3041577944" $ vgs WARNING: Disabling use of lvmetad because the disable flag was set directly. (should report VGs without contacting lvmetad) $ lvmetactl set_global_disable 0 $ vgs (should report VGs from lvmetad)
* lvmetad: preemptively check and rescan in commandsDavid Teigland2016-03-316-27/+191
| | | | | | | | | | | | | | | | | | Move checking the lvmetad state, and the possible rescan, out of lvmetad_send() to the start of the command. Previously, the token mismatch and rescan would occur within lvmetad_send() for some other request. Now, the token mismatch is detected earlier, so the rescan can be done before the main command is in progress. Rescanning deep within the processing of another command will disturb the lvmcache state of that other command. A rescan already exists at the start of the command for the case where foreign VGs are going to be read. This same rescan is now also performed when there is an lvmetad token mismatch (from a changed global_filter).
* rename function read_vgname to read_vgsummaryDavid Teigland2016-03-314-11/+15
| | | | The name did not clearly represent what it does.
* tests: fixed cache target reacts fasterZdenek Kabelac2016-03-311-7/+9
| | | | | | | After kernel fixed in 4.6 cache target reacts promptly and switches to Fail-ed state when disk error is detected. Handle both cases in test...
* tests: do not test settings when MQ is emulated by SMQZdenek Kabelac2016-03-311-1/+8
|
* cleanup: use local var to read structZdenek Kabelac2016-03-311-2/+2
|
* cleanup: use TARGET defineZdenek Kabelac2016-03-311-1/+1
|
* cleanup: debug message fixZdenek Kabelac2016-03-311-1/+1
| | | | Reported-by: Ming-Hung Tsai <mingnus gmail com>
* thin: display highest mapped sectorZdenek Kabelac2016-03-313-6/+14
| | | | | | | | | | | Use meta% to expose highest mapped sector in thinLV. so showing there 100.00% means thinLV maps latest sector. Currently using a 'trick' with total_numerator to pass-in device size when 'seg==NULL' TODO: Improve device status API per target - current 'percentage' is not really extensible.
* thin: no thin-pool flush when reading metadata statusZdenek Kabelac2016-03-312-6/+6
| | | | | | | | | | | | Previous fix missed the fact the we do query for 'percent' with seg value either set or unset (API overload...) When 'seg' was unset, we still issue flush with status. Fix it by cheking segtype by target_type. As we check for segtype - we could also skip whole percentage if the 'segtype' is unknown by code directly. Reported-by: Ming-Hung Tsai <mingnus gmail com
* tests: vg-check-devs-used requires driver version 4.15 at leastPeter Rajnoha2016-03-311-0/+3
|
* dev-cache: fix check for already indexed dev in _index_dev_by_vgid_and_lvidPeter Rajnoha2016-03-301-1/+1
|
* doc: describe lvmlockd/lvmpolld features as available if LVM compiled with ↵Peter Rajnoha2016-03-307-16/+31
| | | | lockd/polld support
* dev-cache: dev_cache_index_devs fn is available unconditionallyPeter Rajnoha2016-03-301-18/+18
| | | | | The new dev_cache_index_devs fn was under ifdef UDEV_SYNC_SUPPORT by mistake, move it out of this ifdef.
* 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
|