summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: for devices filedev-dct-deviceid-21David Teigland2020-12-182-0/+1067
|
* tests: allow tests to use real devicesDavid Teigland2020-12-184-2/+75
| | | | | | | | user creates a file listing real devices they want lvm tests to use, and sets LVM_TEST_DEVICE_LIST. lvm tests can use these with prepare_real_devs and get_real_devs. Other aux functions do not work with these devs.
* device usage based on devices fileDavid Teigland2020-12-1850-177/+3712
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devices file /etc/lvm/devices/system.devices is a list of devices that lvm can use. This is the default system devices file, which is specified in lvm.conf devices/devicesfile. The command option --devicesfile <filename> allows lvm to be used with a different set of devices. This allows different applications to use lvm on different sets of devices, e.g. system devices do not need to be exposed to an application using lvm on its own devices, and application devices do not need to be exposed to the system. In most cases (with limited exceptions), lvm will not read or use a device not listed in the devices file. When the devices file is used, the regex filter is not used, and the filter settings in lvm.conf are ignored. filter-deviceid is used when the devices file is enabled, and rejects any device that does not match an entry in the devices file. Set use_devicesfile=0 in lvm.conf or set --devicesfile "" on the command line to disable the use of a devices file. When disabled, lvm will see and use any device on the system that passes the regex filter (and other standard filters.) A device ID, e.g. wwid or serial number from sysfs, is a unique ID that identifies a device. The device ID is generally independent of the device content, and lvm can get the device ID without reading the device. The device ID is used in the devices file as the primary method of identifying device entries, and is also included in VG metadata for PVs. Each device_id has a device_id_type which indicates where the device_id comes from, e.g. "sys_wwid" means the device_id comes from the sysfs wwid file. Others are sys_serial, mpath_uuid, loop_file, md_uuid, devname. (devname is the device path, which is a fallback when no other proper device_id_type is available.) filter-deviceid permits lvm to use only devices on the system that have a device_id matching a devices file entry. Using the device_id, lvm can determine the set of devices to use without reading any devices, so the devices file will constrain lvm in two ways: 1. it limits the devices that lvm will read. 2. it limits the devices that lvm will use. In some uncommon cases, e.g. when devices have no unique ID and device_id has to fall back to using the devname, lvm may need to read all devices on the system to determine which ones correspond to the devices file entries. In this case, the devices file does not limit the devices that lvm reads, but it does limit the devices that lvm uses. pvcreate/vgcreate/vgextend are not constrained by the devices file, and will look outside it to find the new PV. They assign the new PV a device_id and add it to the devices file. It is also possible to explicitly add new PVs to the devices file before using them in pvcreate/etc, in which case these commands would not need to look outside the devices file for the new device. vgimportdevices VG looks at all devices on the system to find an existing VG and add its devices to the devices file. The command is not limited by an existing devices file. The command will also add device_ids to the VG metadata if the VG does not yet include device_ids. vgimportdevices -a imports devices for all accessible VGs. Since vgimportdevices does not limit itself to devices in an existing devices file, the lvm.conf regex filter applies. Adding --foreign will import devices for foreign VGs, but device_ids are not added to foreign VGs. Incomplete VGs are not imported. The lvmdevices command manages the devices file. The primary purpose is to edit the devices file, but it will read PV headers to find/check PVIDs. (It does not read, process or modify VG metadata.) lvmdevices . Displays devices file entries. lvmdevices --check . Checks devices file entries. lvmdevices --update . Updates devices file entries. lvmdevices --adddev <devname> . Adds devices_file entry (reads pv header). lvmdevices --deldev <devname> . Removes devices file entry. lvmdevices --addpvid <pvid> . Reads pv header of all devices to find <pvid>, and if found adds devices file entry. lvmdevices --delpvid <pvid> . Removes devices file entry. The vgimportclone command has a new option --importdevices that does the equivalent of vgimportdevices with the cloned devices that are being imported. The devices are "uncloned" (new vgname and pvids) while at the same time adding the devices to the devices file. This allows cloned PVs to be imported without duplicate PVs ever appearing on the system. The command option --devices <devnames> allows a specific list of devices to be exposed to the lvm command, overriding the devices file. TODO: . device_id_type for other special devices (nbd, drbd, others?) . dmeventd run commands with --devicesfile dmeventd.devices . allow operations with duplicate pvs if device id and size match only one dev search_for_devnames
* lvm.conf: remove reference to locking_typeDavid Teigland2020-11-171-2/+1
|
* man: vgsplit source and destination VGsDavid Teigland2020-11-171-3/+4
| | | | make clearer which is source and which is destination
* lvchange: fix error for foreign vg activationDavid Teigland2020-11-171-1/+1
| | | | was using ECMD_FAILED instead of 0.
* tests: integrity mismatch checks for all raid levelsDavid Teigland2020-11-112-21/+41
| | | | | | | | | | | | | | Verify that corruption is corrected for raid levels other than raid1. For other raid levels, attempt to corrupt the given file pattern on each underlying device, since we don't know which device contains the file being corrupted. This ensures that corruption is actually be introduced when testing the other raid levels. Verify that corruption is being corrected by checking the integritymismatches count is non-zero for the raid LV, which includes the total from all images (since we don't know which image will have the corruption.)
* integrity: display total mismatches at raid LV levelDavid Teigland2020-11-113-0/+45
| | | | | | | | | | | | | | | | Each integrity image in a raid LV reports its own number of integrity mismatches, e.g. lvs -o integritymismatches vg/lv_rimage_0 lvs -o integritymismatches vg/lv_rimage_1 In addition to this, allow the total number of integrity mismatches from all images to be displayed for the raid LV. lvs -o integritymismatches vg/lv shows the number of mismatches from both lv_rimage_0 and lv_rimage_1.
* tests: update integrity testsDavid Teigland2020-11-102-217/+275
| | | | | | simplified the method of corrupting data, the old method was not working reliably. moved syncation tests to a different file
* writecache: supported in dm-writecache version 3David Teigland2020-11-091-1/+1
| | | | not version 2
* man: update vdoZdenek Kabelac2020-11-031-87/+88
| | | | | | | | | | | Enhance VDO man page with description of memory usage and space requirements chapter. Remove some unneeded blank lines in man page. Use more precise terminology. Correct examples since cpool and vpool are protected names.
* pvck: fix previous commitDavid Teigland2020-10-281-2/+2
| | | | | line to setup bcache was misplaced in commit 5a94126e7a28
* Revert "tests: revert lvm shell use in pvck-dump"David Teigland2020-10-281-1/+1
| | | | | | This reverts commit 05d23b2dd80919ebd2239cfd7f8e08d5de9ebace. this required enabling editline in configure
* tests: revert lvm shell use in pvck-dumpDavid Teigland2020-10-271-1/+1
| | | | doesn't work on my machine
* pvck: fix dev filteringDavid Teigland2020-10-271-10/+21
| | | | | | | filters needing io weren't being run because bcache wasn't set up. Read the first 4k of the device before doing filtering or reading ondisk structs to reduce reads.
* pvck: handle first mda at non-4096 offsetDavid Teigland2020-10-271-5/+6
| | | | | | | | | It's possible for a machine with a non-4k page size to create a PV with an mda_header at an offset other than 4k. Fix pvck --dump to work with these other mda offsets. pvck --repair will write a new first mda at 4096 but lvm with other page sizes will work with this.
* writecache: disallow partial or degraded activationDavid Teigland2020-10-262-0/+37
| | | | when either main or fast lvs are incomplete
* lvchange: allow syncaction check with integrityDavid Teigland2020-10-262-13/+146
| | | | syncaction check will detect and correct integrity checksum mismatches.
* pvcreate: clean up opening and filtering of argsDavid Teigland2020-10-264-39/+120
| | | | | | | | | | | | | | | | | | | | | | | | | The args for pvcreate/pvremove (and vgcreate/vgextend when applicable) were not efficiently opened, scanned, and filtered. This change reorganizes the opening and filtering in the following steps: - label scan and filter all devs . open ro . standard label scan at the start of command - label scan and filter dev args . open ro . uses full md component check . typically the first scan and filter of pvcreate devs - close and reopen dev args . open rw and excl - repeat label scan and filter dev args . using reopened rw excl fd - wipe and write new headers . using reopened rw excl fd
* gcc: cleanup warns from older gccZdenek Kabelac2020-10-262-3/+3
|
* tests: minor updateZdenek Kabelac2020-10-261-2/+2
|
* fsadm: better check for getsize64 supportZdenek Kabelac2020-10-261-8/+5
| | | | | | | | | | Older blockdev tool return failure error code with --help, and since now the tool abort on command failure, lets detect missing --getsize64 support directly by running command and check if it returns something usable. It's likely very hard to have the system with such old blockdev tool and newer lvm2 compiled.
* WHATS_NEW: updateZdenek Kabelac2020-10-241-0/+2
|
* man: regenerateZdenek Kabelac2020-10-2443-129/+86
|
* man: more precise UNITZdenek Kabelac2020-10-241-3/+2
| | | | | | | | Since 'kilobytes' could be seen in 2 way - SI as '1000', while all programmers sees it as '1024' - switch to commonly acceptted KiB, MiB.... Resolves RHBZ 1496255.
* lv_manip: add space into messageZdenek Kabelac2020-10-241-1/+1
| | | | Just add space between %s(.
* tests: fsadm test continue after fs repairZdenek Kabelac2020-10-241-1/+26
| | | | | | Test case where filesystem has been corrected via fsck. In such case fsck returns '1' as success and should be handled in a same way as '0' since fs is correct.
* fsadm: enhance error handlingZdenek Kabelac2020-10-241-19/+28
| | | | | | | Set more secure bash failure mode for pipilines. Avoid using unset variables. Enhnace error reporting for failing command. Avoid using error via 'case..esac || error'.
* fsadm: handle fsck return 1 for corrected fsZdenek Kabelac2020-10-241-7/+18
|
* fsadm: use NULLZdenek Kabelac2020-10-241-10/+10
| | | | Use consistently $NULL as in other places.
* get dev size when setting pv deviceDavid Teigland2020-10-221-2/+6
| | | | | | In some cases the dev size may not have been read yet in set_pv_devices(). In this case get the dev size before comparing the dev size with the pv size.
* pvscan: rework to improve PVs without metadataDavid Teigland2020-10-224-618/+733
| | | | | | | | | | | | | | | Restructure the pvscan code, and add new temporary files that list pvids in a VG, used for processing PVs that have no metadata. The new temp files, in /run/lvm/pvs_lookup/<vgname>, allow a proper pvscan --cache to be done on PVs that have no metadata. pvscan --cache <dev> is only supposed to read <dev>, but when <dev> has no metadata, this had not been possible. The command had to fall back to scanning all devices to read all VG metadata to get the list of all PVIDs needed to check for a complete VG. Now, the temp file can be used in place of reading metadata from all PVs on the system.
* add label_scan_devs_cachedDavid Teigland2020-10-212-0/+16
| | | | | | label_scan_devs without invalidating data first for cases where the caller wants to use any bcache data they have already read.
* add label_read_pvidDavid Teigland2020-10-212-0/+49
| | | | | | | To read the lvm headers and set dev->pvid if the device is a PV. Difference from label_scan_ functions is this does not read any vg metadata or add any info to lvmcache.
* lvmcache: rename label_read label_scan_devDavid Teigland2020-10-214-6/+5
| | | | for consistent naming with other similar functions
* lvmcache: add lvmcache_get_dev_mdaDavid Teigland2020-10-212-0/+17
| | | | for future patch
* scanning: improve filtering controlDavid Teigland2020-10-211-48/+70
| | | | | | | | | | | | | | | | | | | | | Filtering in label_scan was controlled indirectly by the fact that bcache was not yet set up when label_scan first ran. The result is that filters that needed data would not run and would return -EAGAIN, which would result in the dev flag FILTER_AFTER_SCAN being set. After the dev header was read for checking the label, filters would be rechecked because of FILTER_AFTER_SCAN. All filters would be checked this time because bcache was now set up, and the filters needing data would largely use data already scanned for reading the label. This design worked but is hard to adjust for future cases where bcache is already set up. Replace this method (based on setting up bcache, or not) with a new cmd flag filter_nodata_only. When this flag is set filters that need data will not run. This allows the same label_scan behavior when bcache has been set up. There are no expected changes in behavior.
* filters: nodata optionDavid Teigland2020-10-215-0/+16
| | | | | When filter_nodata_only is set, a filter that uses data is skipped.
* filters: allow filter wipe for one deviceDavid Teigland2020-10-213-6/+15
| | | | as passes_filter already does
* tests: writecache-misc disable with lvmlockdDavid Teigland2020-10-211-1/+2
| | | | in a shared vg pvmove requires a named lv
* tests: check dmevent with bigger reserved_stackZdenek Kabelac2020-10-201-3/+6
| | | | | Check dmeventd remains working when reserved_stack is above 300KiB.
* memlock: allocate at most halve of rlimit stackZdenek Kabelac2020-10-201-4/+7
| | | | | | Touch of stack allocation validated given size with rlimit and if the reserved_stack was above rlimit, its been completely ignored - now we will always touch stack upto rlimit/2 size.
* lvmcmdlib: lvm2_init_threadedZdenek Kabelac2020-10-207-10/+28
| | | | | | | | | | | | | cmd context has 'threaded' value that used be set by clvmd - and allowed proper memory locking management. Reuse same bit for dmeventd. Since dmeventd is using 300KiB stack per thread, we will ignore any user settings for allocation/reserved_stack until some better solution is find. This avoids crashing of dmevend when user changes this value and because in most cases lvm2 should work ok with 64K stack size, this change should not cause any problems.
* libdm: relocate code for sending messagesZdenek Kabelac2020-10-191-11/+11
| | | | | | To be able to send messages for recently resumed devices, move code into inner loop. Matching commit c1a6b10d09aae6179e4f08c7d8c03d5e3068ad94.
* cov: split check for type assignmentZdenek Kabelac2020-10-191-4/+5
| | | | | | | Check that type is always defined, if not make it explicit internal error (although logged as debug - so catched only with proper lvm.conf setting). This ensures later type being NULL can't be dereferenced with coredump.
* dm: remove created devices on error pathZdenek Kabelac2020-10-193-106/+51
| | | | | | | | DM tree keeps track of created device while preloading a device tree. When fail occures during such preload, it will now try to remove all created and preloaded device. This makes it easier to maintain stacking of device, since we do not need to check in-depth for existance of all possible created devices during the failure.
* debug: shorten error messageZdenek Kabelac2020-10-191-18/+8
| | | | Just check for sigint during log_error().
* libdm: validate thin-pool before sending messagesZdenek Kabelac2020-10-191-0/+9
| | | | | Alhtough lvm2 does validation on its side, ensure DM code is not sending messages to failed thin pool.
* libdm: enhance error messageZdenek Kabelac2020-10-191-2/+31
|
* libdm: split code for sending messageZdenek Kabelac2020-10-191-26/+36
| | | | | Move message sending from _thin_pool_node_message to new _node_message for possible better code sharing.