summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* test: lvmetad-warningdev-dct-lvmetad-disabled-dups-16David Teigland2016-04-182-36/+91
| | | | | | | | | | | | The test was a weak attempt at verifying the special combination of lvchange/vgchange -aay --sysinit, but was only looking for lvmetad connection warnings. Update the warning checks, and check the LV activation state directly which is the main point. Rename the test to reflect its purpose of checking the -aay --sysinit combination.
* test: lvmetad-overrideDavid Teigland2016-04-181-5/+27
|
* test: lvmetad-no-clusterDavid Teigland2016-04-181-3/+2
| | | | Update warning message check
* test: update lvmetad-disabledDavid Teigland2016-04-181-5/+61
| | | | | | | | | Update the check about lvmetad running but not used. Also add tests related to the new lvmetad disabled state. lvm1 metadata is used here to test the disabled state because lvm1 metadata is the first condition using the disabled state.
* lvmetad: disable if device scan failsDavid Teigland2016-04-182-15/+31
| | | | | | | | If a command begins repopulating the lvmetad cache, and fails part way through, it should set the disabled state in lvmetad so other commands don't use bad data. If a subsequent scan succeeds, the disabled state is cleared.
* lvmcache: prefer duplicate device used by LVsDavid Teigland2016-04-181-8/+16
|
* lvmcache: process duplicate PVs directlyDavid Teigland2016-04-186-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-186-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: remove client side altdev codeDavid Teigland2016-04-183-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-181-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-181-0/+5
| | | | | When devices are being scanned, if duplicate PVs are seen, tell lvmetad to set its disabled flag because of duplicate PVs.
* lvmetad: rework command lvmetad connection setupDavid Teigland2016-04-1818-185/+157
| | | | and reconnect to lvmetad if the connection is broken.
* toollib: remove unneeded call in process_each_pvDavid Teigland2016-04-181-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.
* tests: update lvm1 testDavid Teigland2016-04-181-7/+3
| | | | | | Make it a generic lvm1 test, which should work with or without lvmetad now that lvmetad is just disabled when lvm1 is used.
* lvmetad: disable if command uses lvm1David Teigland2016-04-181-0/+8
| | | | | Alternatively, a command could return an error saying that lvm1 and lvmetad are not compatible.
* lvmetad: clear the disabled flag in lvmetadDavid Teigland2016-04-182-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-186-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: set disabled flag in lvmetad if lvm1 metadata is foundDavid Teigland2016-04-182-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-184-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)
* metadata: don't repair shared VGsDavid Teigland2016-04-181-0/+8
| | | | When the in-use flag looks like it needs to be repaired.
* lvmlockd: skip unnecessary lvmetad cache updateDavid Teigland2016-04-181-12/+18
| | | | | | In cases where a VG is reread from disk, but the seqno matches what is currently in lvmetad, the metadata in lvmetad doesn't need to be updated.
* debug: use display_lvnameZdenek Kabelac2016-04-181-4/+6
|
* debug: update message in libdmZdenek Kabelac2016-04-182-1/+2
| | | | | | | | When dm_tree_find_node_by_uuid() fails to find passed uuid, report in lof_debug the complete original uuid, not the one stripped of LVM- prefix. TODO: inspect manipulation with LVM- prefix here.
* debug: fix error messageZdenek Kabelac2016-04-181-3/+3
| | | | | log_error is replaced with warn since the result of function is not result in command error.
* thin: improve recognizing of merge in progressZdenek Kabelac2016-04-181-16/+43
| | | | | | Rewrite too condensed condition in more readable form, wher decision are clearly separated and commented and also add debug messages for them.
* thin: check runtime table line for mergingZdenek Kabelac2016-04-182-1/+65
| | | | | | | To recognize in runtime if we are merging or not to make consistent decision between suspend and resume add function to parse thin table line when add merging thin device to the table.
* tests: fix check_lvmlockd_testDavid Teigland2016-04-151-1/+1
|
* activate: Improve snapshot merge initiationAlasdair G Kergon2016-04-154-11/+32
| | | | | | | | | | A snapshot merge into its origin cannot be initiated while the devices are in use. If there is outside interference (such as from udev), the suspend (preload) and resume stages can reach conflicting decisions about whether or not to proceed. Try to make the logic more robust by checking the inactive or live table during resume. (This is still not perfect.)
* activation: Log when pending snap merge postponed.Alasdair G Kergon2016-04-141-1/+3
|
* WHATS_NEW for lvmetad scanning changesDavid Teigland2016-04-141-0/+3
|
* activation: Add LV name to a debug message.Alasdair G Kergon2016-04-141-1/+1
|
* snapshot: Don't deactivate fictional snapshot LV.Alasdair G Kergon2016-04-142-2/+5
| | | | | | | Commit 971ab733b74e0ffecc3f9f60af48628cd3fba1db ("thin: activation of merging thin snapshot") also added an incorrect deactivation attempt for non-thin LVs: find_snapshot(lv)->lv is not designed to be activated and any attempt to deactivate it is incorrect.
* toollib: Fix misleading message when forking.Alasdair G Kergon2016-04-141-1/+1
| | | | | Commands like pvscan --background run entirely in the background, but others fork only for polling.
* refactor: factor out vg/lv/pv handling part from report_for_selection fnPeter Rajnoha2016-04-141-64/+96
| | | | | Functionality will be reused by future patches. Also, it makes the code more readable.
* tests: lvmetad-lvm1 fixDavid Teigland2016-04-131-2/+2
| | | | | workaround this test failure until the proper lvmetad/lvm1 fixes arrive shortly.
* 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.