summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* toollib: remove unneeded call in process_each_pvdev-dct-lvmetad-disabled-dups-13David Teigland2016-04-131-6/+0
| | | | | | | | | | | | | | | | | | | process_each_pv was doing: 1. lvmcache_seed_infos_from_lvmetad() sends pv_list request to lvmetad. 2. get_vgnameids() sends vg_list request to lvmetad. 3. _get_all_devices() first calls lvmcache_seed_infos_from_lvmetad(), which is a no-op if it's already been called. Because get_vgnameids() does not use the information from lvmcache_seed_infos_from_lvmetad(), it does not need to be called prior to get_all_devices where it is actually needed.
* lvmetad: disable if command uses lvm1David Teigland2016-04-131-0/+8
| | | | | Alternatively, a command could return an error saying that lvm1 and lvmetad are not compatible.
* lvmcache: prefer duplicate device used by LVsDavid Teigland2016-04-131-8/+16
|
* lvmcache: process duplicate PVs directlyDavid Teigland2016-04-136-124/+171
| | | | | | | | | | | | | | | | | | | | 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-04-136-222/+371
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 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
* lvmetad: clear the disabled flag in lvmetadDavid Teigland2016-04-132-0/+39
| | | | | | | | | After a device rescan that repopulates lvmetad, if no reason for disabling lvmetad was seen (lvm1 metadata or duplicate PVs), then clear the disabled flag in lvmetad. This allows commands to resume using the lvmetad cache after the cause for disabling it has been removed.
* lvmetad: use the disabled flag in commandsDavid Teigland2016-04-136-4/+123
| | | | | | | | | Commands already check if the lvmetad token is valid, and if not, they rescan devices to repopulate lvmetad before running. Now, in addition to checking the lvmetad token, they also check if the lvmetad disabled flag is set. If so, they do not use the lvmetad cache and revert to disk scanning.
* lvmetad: remove client side altdev codeDavid Teigland2016-04-133-85/+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.
* lvmetad: set disabled flag when duplicate PVs are seenDavid Teigland2016-04-131-152/+31
| | | | | | | | | | | | | | | | When duplicate PVs are detected, set the disabled flag so that commands will disable use of lvmetad. This duplicate detection is done by lvmetad itself when it's told about a single new PV with a PVID that matches an existing PV on another device. (This is different from the case where the command is scanning all devices and detects the duplicate.) 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.
* lvmetad: set disabled flag in lvmetad if duplicate PVs are foundDavid Teigland2016-04-131-0/+5
| | | | | When devices are being scanned, if duplicate PVs are seen, tell lvmetad to set its disabled flag because of duplicate PVs.
* lvmetad: set disabled flag in lvmetad if lvm1 metadata is foundDavid Teigland2016-04-132-0/+30
| | | | | When devices are being scanned, if lvm1 metadata is seen, tell lvmetad to set its disabled flag because of lvm1 metadata.
* lvmetad: add disabled stateDavid Teigland2016-04-134-5/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 will check these flags after connecting to lvmetad. If the disabled flag is set, the command will not use the lvmetad cache, but revert to disk scanning. 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: Not using 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: add FIXME to commentDavid Teigland2016-04-131-2/+2
|
* lvmetad: preemptively check and rescan in commandsDavid Teigland2016-04-1312-125/+593
| | | | | | | | | | | | | | | | | | | | | | | | | | 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). The commands pvscan/vgscan/lvscan/vgimport are excluded from this preemptive checking/rescanning for lvmetad because they want to do rescanning themselves explicitly. If rescanning devices fails, then lvmetad has not been correctly repopulated and should not be used, so make the command revert to not using lvmetad.
* debug: unify some tracing messagesZdenek Kabelac2016-04-123-22/+24
| | | | | | | Introduce FMTVGID - although it might be possibly better to ensure vgid is always \0 ended string. Unify some lvmcache reported messages.
* cleanup: gcc warn about comparing int with uintZdenek Kabelac2016-04-123-6/+6
|
* cleanup: avoid declaring var in the middle of codeZdenek Kabelac2016-04-121-4/+4
| | | | Easier to read code.
* rename function read_vgname to read_vgsummaryDavid Teigland2016-04-114-11/+15
| | | | The name did not clearly represent what it does.
* devcache: do not insert devices without device nodeZdenek Kabelac2016-04-112-0/+10
| | | | | | | | | | | | | | | When not obtaining device from udev, we are doing deep devdir scan, and at the same time we try to insert everything what /sys/dev/block knows about. However in case lvm2 is configured to use nonstardard devdir this way it will see (and scan) devices from a real system. lvm2 test suite is using its own test devdir with its own device nodes. To avoid touching real /dev devices, validate the device node exist in give dir and do not insert such device into a cache. With obtain list from udev this patch has no effect (the normal user path).
* devcache: index devices also without udevZdenek Kabelac2016-04-112-2/+6
| | | | | | | We have _insert_dirs() for udev and non-udev compilation. Compiling without udev missed to call dev_cache_index_devs(). Move the call after _insert_dirs() call so both compilation gets it.
* post-releaseAlasdair G Kergon2016-04-092-2/+2
|
* pre-releasev2_02_150Alasdair G Kergon2016-04-094-6/+6
|
* cleanup: avoid gcc warnsZdenek Kabelac2016-04-085-6/+6
| | | | | Some older systems may had global declaration to cause gcc warning. Rename for cases we don't care...
* cleanup: simplier to read conditionZdenek Kabelac2016-04-081-4/+5
| | | | | Make more readable what we are looking for and just test for KERNEL version at one place.
* cleanup: reuse _setup_taskZdenek Kabelac2016-04-081-42/+16
| | | | | | Shorten code and use common code from _setup_task. Reorder naming of major:minor sscanf (as later it's been also used swapped there was no real bug).
* dev_manager: device_is_usable does not flushZdenek Kabelac2016-04-082-1/+9
| | | | | | | When scanning if device is being usable as PV, we call STATUS - but this status should not cause any flushing. Skip also open_count information as it's not needed.
* activation: Skip another non-prefixed info ioctl.Alasdair G Kergon2016-04-083-29/+36
| | | | | _percent() also does a lookup by dm uuid. Also get kernel version from cmd->kernel_vsn.
* test: Fix testing of installed lvmdbusdMarian Csontos2016-04-081-1/+1
| | | | | If lvmdbusd is missing expression triggers ERR trap instead of skipping the test.
* report: remove superfluous SEGSSTATUS report typePeter Rajnoha2016-04-083-10/+6
| | | | | | | | | We don't have any report field of this type yet. Return this patch into the play if we really need that. Currenly we always report status (result of "status" dm ioctl) for an LV as a whole where we choose segment which represents the LV, not calling status for each possible segment it contains - we don't need this now so I'm removing it to not make the code more complex uselessly.
* cleanup: use common init/destroy_processing_handle in _report fn and cleanup ↵Peter Rajnoha2016-04-081-28/+30
| | | | error paths
* cleanup: use #define for field's quote and pair character and also for the ↵Peter Rajnoha2016-04-081-13/+18
| | | | error msg while extending output line
* tests: require newer cache targetZdenek Kabelac2016-04-081-1/+1
| | | | Older cache target is likely not updating status at all...
* tests: use mkfs.ext3Zdenek Kabelac2016-04-071-3/+7
| | | | | mkfs.ext4 is not really needed so use more widespread mkfs.ext3 so test runs on older system.
* activation: do not check for devs without LVM-Zdenek Kabelac2016-04-072-0/+24
| | | | | | | | | | | | | | | | | Devices without "LVM-" uuid prefix have been generated by very old version of lvm2 2.00 and 2.01. Since version 2.02 all lvm2 devices are using prefix "LVM-". However checking for present of ancient non prefixed devices does take extra IOCTL per every call and for majority of todays user it will not find anything new. So use the assumption that users with kernel 3.X and newer are not really using such old versions of lvm2 (year <2005) and with their new kernel they are also using new version of lvm2 and skip checking for them. This change also makes trace logs more readable.
* lvcreate: %FREE -> %PVSZdenek Kabelac2016-04-072-1/+2
| | | | | | | | | | This is hotfix for RHBZ: https://bugzilla.redhat.com/1324537 However already the %FREE is not a good fit and we need something better. Meanwhile make -l%PVS work at least as good as %FREE for thin-pool. TODO: this needs rework - it should be allocator to do all the size decisions at one place.
* WHATS_NEW: updateZdenek Kabelac2016-04-072-0/+3
| | | | doc for previous commits.
* libdm: Correct typo.Alasdair G Kergon2016-04-071-1/+1
|
* lvmdump: If dir exists check dir perms too.Alasdair G Kergon2016-04-061-1/+2
|
* lvmdump: Allow dir to exist already if it is emptyAlasdair G Kergon2016-04-062-2/+7
|
* tests: do not break teardown on failing losetupZdenek Kabelac2016-04-061-1/+1
| | | | Ignore failing 'losetup -d' - i.e. device may have disappeared...
* tests: verify repair of failing mirrorZdenek Kabelac2016-04-061-0/+75
| | | | | | | Improved test script to verify lost mirror image does not cause mirror corruption while mirror is in use. TODO: add more cases (lost mlog...), lost image from 3leg mirror...
* cleanup: indentZdenek Kabelac2016-04-061-1/+1
|
* lvconvert: show percent with %.2Zdenek Kabelac2016-04-062-4/+4
| | | | | lvm2 shows percent values with 2 decimal digits elsewhere so use it consistently also for this output.
* libdm: improve debug message with ioctlZdenek Kabelac2016-04-061-10/+10
| | | | | Make the debug message a less difficult to read: Ioctl shows [ noopencount flush ] instead of cryptic [NF].
* preload: preserve flushing stateZdenek Kabelac2016-04-061-0/+2
| | | | | | | | | When leaving preload routine it should not altet state of flush required when it's been already set to 1 and drop it to 0. The API here is unclean, but current usage expects the same variable pointer is for all preload calls and combines 'flush_required' across all of them.
* suspend: fix suspend with noflush limitationZdenek Kabelac2016-04-062-1/+11
| | | | | | | | | Commit 844b00958492224c448b30f89ae5532bb6591fd2 tried to move limit for usage of noflush to 'preload' however this was not correctly processed. Intead explicitly check for which types we do not want noflush and also add debug message in this case.
* mirror: fix flushing for mirror targetZdenek Kabelac2016-04-061-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Fix regression caused by commit ba41ee1dc94264f7ac8e61f8b1d56b10225b0d2f. The idea was to use no_flush for changed device only for thin volumes and thin pools but also to merge this with change made in commit 844b00958492224c448b30f89ae5532bb6591fd2. However the resulting condition has caused misbehavior for the mirror suspend - as that has been before the ONLY allowed target type that could have been suspended with noflush. Result was badly working repair for --type mirror that has been passing 'flush' to the repaired mirror target whenever preload wrongly set flush_required. The origin code has required the flush_required to be set whenever deivce size is changed. Now it first detects if device size got smaller 'dm_tree_node_size_changed(root) < 0' - this requires flush. Otherwise it checks device is not thin volume nor thin pool and its size has changed (got bigger) and requires flush. This mean upsize of thin-pool or thin volume will not require flush.
* post-releaseAlasdair G Kergon2016-04-014-2/+8
|
* pre-releasev2_02_149Alasdair G Kergon2016-04-015-8/+5
|
* Revert "thin: display highest mapped sector"Alasdair G Kergon2016-04-013-14/+6
| | | | | | | This reverts commit fc7dacaa4c6bf0af4c5a457c098da26d7cc71f9c. Let's put this information into a separate field. It doesn't meet the definition of the existing field.