summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* commands: add NO_METADATA_PROCESSING command flagdev-prajnoha-avoid-some-init-for-simple-commandsPeter Rajnoha2015-07-244-15/+25
| | | | | | | | | | | | | | | | | Mark commands that do not handle LVM metadata with the new NO_METADATA_PROCESSING flag: - lvmconfig (config, dumpconfig) - devtypes - formats - segtypes - systemid - tags - version Recognize this flag during command/context initialization and skip init for lvmetad, lvmpolld, lvmlockd and switch to using "no locking" (locking_type=0) for such commands.
* toolcontext: move lvmetad, lvmpolld and filter init to lvm_run_command and ↵Peter Rajnoha2015-07-246-54/+110
| | | | | | | | | | | | | | | | _lvm_init Move lvmetad, lvmpolld and filter initialization out of create_toolcontext to lvm_run_command (for LVM commands) and to _lvm_init (for lvm2app). This makes it possible to avoid this initialization in case we're processing a simple command that doesn't process metadata in any way (e.g. lvmconfig). These simple commands do not need daemons (lvmetad, lvmpolld, lvmlockd, clvmd) running and they do not need to communicate with them. So we don't need to initialize them uselessly.
* clvmd: Fix freeze if client dies holding locks.Alasdair G Kergon2015-07-233-25/+47
| | | | | | | | | | | | | | | | Simply running concurrent copies of 'pvscan | true' is enough to make clvmd freeze: pvscan exits on the EPIPE without first releasing the global lock. clvmd notices the client disappear but because the cleanup code that releases the locks is triggered from within some processing after the next select() returns, and that processing can 'break' after doing just one action, it sometimes never releases the locks to other clients. Move the cleanup code before the select. Check all fds after select(). Improve some debug messages and warn in the unlikely event that select() capacity could soon be exceeded.
* lvmlockd: improve check for duplicate global locksDavid Teigland2015-07-233-20/+24
| | | | | | | | When there are duplicate global locks, check if the gl is still enabled each time a gl or vg lock is acquired in the lockspace. Once one of the duplicates is disabled, then other hosts will recognize that the issue is resolved without needing to restart the lockspaces.
* libdm: Use wrappers for all malloc functions.Alasdair G Kergon2015-07-225-34/+130
| | | | | | Move the DEBUG_MEM decision inside libdevmapper.so instead of exposing it in libdevmapper.h which causes failures if the binary and library were compiled with opposite debugging settings.
* pvscan: skip autoactivation for lockd VGsDavid Teigland2015-07-221-0/+45
| | | | | | | | | | pvscan autoactivation does not work for lockd VGs because lock start is needed on a lockd VG before locking can be done for it. Add a check to skip the attempt at autoactivate rather than calling it, knowing it will fail. Add a comment explaining why pvscan --cache works fine for lockd VGs without locks, and why autoactivate is not done.
* lvconvert: merge polling fixes for lockdDavid Teigland2015-07-222-35/+36
| | | | | | | | | | | . the poll check will eventually call finish which will write the VG, so an ex VG lock is needed from lvmlockd. . fix missing unlock on poll error path . remove the lockd locking while monitoring the progress of the command, as suggested by the earlier FIXME comment, as it's not needed.
* config: add CFG_SECTION_NO_CHECK flagPeter Rajnoha2015-07-223-6/+9
| | | | | | | | | | | | | | | | | The CFG_SECTION_NO_CHECK flag can be used to mark a section and its whole subtree as containing settings where checks won't be made (lvmconfig --validate). These are setting where we don't know the names and and type in advance and they're recognized in runtime. As we don't know the type and name in advance, we can't do any checks here of course. Use this flag with great care as it disables config checks for the whole config subtree found under such section. This flag is going to be used by subsequent patches from Zdenek to support some cache settings...
* lvconvert: remove unused struct membersOndrej Kozina2015-07-221-3/+0
|
* lvconvert: retain retcode consistencyOndrej Kozina2015-07-221-14/+12
| | | | | | Always return the highest retcode caught during convert command (regression in commit ae88bf03a1d109a342a8ad31196c3ef8fa1a5b65). Also minor code cleanup.
* lvconvert: fix polling outside of core lvconvertDavid Teigland2015-07-222-101/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | Recent change to move the polling outside of core lvconvert code was wrongly using 'lv' and 'vg' structs which can't be used outside of the core code, which caused seg fault. Properly isolate all use of lv structs within the core of the lvconvert code, saving any information necessary, (esp lvid). After the core of lvconvert is done, use the saved information to do polling. FIXME: the need for is_merging_origin and is_merging_origin_thin in this patch is ugly, and a cleaner way should be found to deal with that than what is done here. Also it effectively removed all hacks in _lvconvert_merge_single performing ugly: VG reread, unlock, polling, lock sequence. Moreover all polling operations are postponed after all conversions are finished. lvm2 (while locking via lvmlockd) should now be able to run with or without lvmpolld while performing poll operations originating in lvconvert command. Signed-off-by: Ondrej Kozina <okozina@redhat.com>
* wiping: add "Wiping skipped." for the message context to be completePeter Rajnoha2015-07-211-4/+5
|
* wiping: log_warn instead of log_error if blkid wipe ignored for a signaturePeter Rajnoha2015-07-211-10/+31
| | | | | | | | | | | | | Comply with the rules we have for log_error and log_warn... $ pvcreate /dev/sda1 Failed to get offset of the xfs_external_log signature on /dev/sda1. 1 existing signature left on the device. Aborting pvcreate on /dev/sda1. $ pvcreate /dev/sda1 --force WARNING: Failed to get offset of the xfs_external_log signature on /dev/sda1. Physical volume "/dev/sda1" successfully created
* wiping: ignore errors during detection if use_blkid_wiping=1 and --force is usedPeter Rajnoha2015-07-212-4/+5
| | | | | | | | | | | | | | | | | | | | | libblkid may return the list of signatures found, but it may not provide offset and size for each signature detected. This may happen in case signatures are mixed up or there are more, possibly overlapping, signatures found. Make lvm commands pass if such situation happens and we're using --force (or any stronger force method). For example: $ pvcreate /dev/sda1 Failed to get offset of the xfs_external_log signature on /dev/sda1. 1 existing signature left on the device. Aborting pvcreate on /dev/sda1. $ pvcreate --force /dev/sda1 Failed to get offset of the xfs_external_log signature on /dev/sda1. Physical volume "/dev/sda1" successfully created
* log: Add DM_ABORT_ON_INTERNAL_ERRORS lvm override.Alasdair G Kergon2015-07-202-3/+19
| | | | | Recognise DM_ABORT_ON_INTERNAL_ERRORS in the lvm logging function as well as the default dm function it replaces.
* vgchange/lvchange: enforce the shared VG lock from lvmlockdDavid Teigland2015-07-174-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The vgchange/lvchange activation commands read the VG, and don't write it, so they acquire a shared VG lock from lvmlockd. When other commands fail to acquire a shared VG lock from lvmlockd, a warning is printed and they continue without it. (Without it, the VG metadata they display from lvmetad may not be up to date.) vgchange/lvchange -a shouldn't continue without the shared lock for a couple reasons: . Usually they will just continue on and fail to acquire the LV locks for activation, so continuing is pointless. . More importantly, without the sh VG lock, the VG metadata used by the command may be stale, and the LV locks shown in the VG metadata may no longer be current. In the case of sanlock, this would result in odd, unpredictable errors when lvmlockd doesn't find the expected lock on disk. In the case of dlm, the invalid LV lock could be granted for the non-existing LV. The solution is to not continue after the shared lock fails, in the same way that a command fails if an exclusive lock fails.
* test: Help, default and relative paths in runnerMarian Csontos2015-07-171-24/+114
| | | | | | Add help message. Handle relative paths first. Use `.` for OUTDIR instead of `/` if empty.
* test: Fix hardcoded /usr/share in testsuiteMarian Csontos2015-07-174-1/+29
|
* lvmlockd: improve errors when lvm is built without a lock managerDavid Teigland2015-07-173-5/+49
| | | | | | When lvmlockd is compiled without support for one of the lock managers (sanlock or dlm), and a command tries to use one of them, explain that in the error message.
* test: Ignore known concurrent VG clvmd failure.Alasdair G Kergon2015-07-171-0/+4
| | | | | Don't abort test when clvmd processes two VGs concurrently. CLVMD: ioctl/libdm-iface.c:1940 Internal error: Performing unsafe table load while 3 device(s) are known to be suspended: (253:19)
* lockd: fix error cases when built without lvmlockdDavid Teigland2015-07-163-4/+23
| | | | | | | | | | | When lvm is built without lvmlockd support, vgcreate using a shared lock type would succeed and create a local VG (the --shared option was effectively ignored). Make it fail. Fix the same issue when using vgchange to change a VG to a shared lock type. Make the error messages consistent.
* alloc: Fix lvextend failure when varying stripes.Alasdair G Kergon2015-07-152-32/+43
| | | | | | | | | | | | | | | | | | | A segfault was reported when extending an LV with a smaller number of stripes than originally used. Under unusual circumstances, the cling detection code could successfully find a match against the excess stripe positions and think it had finished prematurely leading to an allocation being pursued with a length of zero. Rename ix_offset to num_positional_areas and move it to struct alloc_state so that _is_condition() can obtain access to it. In _is_condition(), areas_size can no longer be assumed to match the number of positional slots being filled so check this newly-exposed num_positional_areas directly instead. If the slot is outside the range we are trying to fill, just ignore the match for now. (Also note that the code still only performs cling detection against the first segment of the LV.)
* vgimport: fix the all VGs caseDavid Teigland2015-07-151-1/+1
| | | | | The ALL_VGS_IS_DEFAULT flag was wrongly removed; it is needed for vgimport -a to work.
* vgexport: fix the all VGs caseDavid Teigland2015-07-151-1/+1
| | | | | The ALL_VGS_IS_DEFAULT flag was wrongly removed; it is needed for vgexport -a to work.
* config: make a difference between "not found" and "is empty" in log msg for ↵Peter Rajnoha2015-07-151-2/+4
| | | | | | | | | | | | | | devices/preferred_names Replace misleading "not found" in the log message when devices/preferred_names is set to empty array: Really not found: device/dev-cache.c:689 devices/preferred_names not found in config: using built-in preferences Found, but empty: config/config.c:1431 Setting devices/preferred_names to preferred_names = [ ] device/dev-cache.c:689 devices/preferred_names is empty: using built-in preferences
* config: also log the value used if defined in config, not just defaultsPeter Rajnoha2015-07-151-16/+37
| | | | | | | | | | | | | | | | | | Commit 7e728fe1a164cc5d4f64e46fcfcbb224c22b2457 added a log call directly in find_config_tree_array when defaults are used. This patch also adds the log for the value which is found in existing configuration and for which defaults are not used. For example: Defaults used: config/config.c:1428 devices/scan not found in config: defaulting to scan = [ "/dev" ] Value defined in configuration used: config/config.c:1431 Setting devices/scan to scan = [ "/dev", "/mydev", "/abc" ] This makes the logging consistent with the other find_config_tree_* functions.
* cleanup: drop unused header fileZdenek Kabelac2015-07-151-1/+0
|
* cleanup: avoid double assignZdenek Kabelac2015-07-151-3/+3
| | | | Variable n1 is assigned without using n1 before.
* cleanup: drop duplicated seg testZdenek Kabelac2015-07-152-3/+2
| | | | | Test is already in seg_is_pool() if branch. and one minor indent fix.
* makefiles: adding target for generating ctagsZdenek Kabelac2015-07-151-0/+10
| | | | make tags generates traditional tags ctags ref list.
* cache: enhance cache-pool validationZdenek Kabelac2015-07-152-10/+11
| | | | Capture cache-pool without cache policy name set.
* cache: capture missing policy nameZdenek Kabelac2015-07-151-4/+12
| | | | | | | | Policy name has to be always defined. Capture it as an internal error before write. When reading metadata without defined policy name, use default defined policy. TODO: Unsure, but it might have to be actually always 'mq' in this case.
* cache: handle policy_name separatelyZdenek Kabelac2015-07-159-56/+66
| | | | | | Keep policy name separate from policy settings and avoid to mangling and demangling this string from same config tree. Ensure policy_name is always defined.
* cache: move setting of cache policyZdenek Kabelac2015-07-152-7/+3
| | | | | Set policy before saving 1st. metadata and avoid unnecessary reload. Fixes problem when we stored cache-pool without cache-policy set.
* thin: fix warning for overprovisioningZdenek Kabelac2015-07-153-1/+5
| | | | | When lvm.conf is properly configure for auto resize of overprovisioned thin-pool volume, avoid showing any warning (2.02.124).
* config: use find_config_tree_array for all arraysPeter Rajnoha2015-07-152-9/+9
| | | | | | | | Use find_config_tree_array for all config arrays. Also, add INTERNAL_ERROR in case there should have been at least default value defined for a setting but it was not returned for some reason (either config_settings.h misconfiguration or other config tree error printed by functions called by find_config_tree_array).
* config: add "defaulting to" message in case we fall back to defaults in ↵Peter Rajnoha2015-07-151-2/+36
| | | | find_config_tree_array
* metadata: change function name to _allow_extra_system_idDavid Teigland2015-07-141-2/+2
| | | | | The previous name was misleading since this is not the primary system_id check, only the "extra" check.
* vgchange: fix lock-start filtering and waitingDavid Teigland2015-07-141-5/+12
| | | | | | | | | | | | | | | Both lock_start filters were being skipped when any lock-opt values were used. The "auto" lock-opt should cause the auto_lock_start_list to be used. The lock_start_list should always be used. The behavior of lock_start_list/auto_lock_start_list are tested and verified to behave like volume_list/auto_activation_volume_list. Since the default was changed to wait for lock-start to finish, the "wait" and "autowait" lock-opt values are not needed, but a new "autonowait" is added to the existing "nowait" avoid the default waiting.
* lockd: fix error message after a failing to get lockDavid Teigland2015-07-143-6/+17
| | | | | | | | There are two different failure conditions detected in access_vg_lock_type() that should have different error messages. This adds another failure flag so the two cases can be distinguished to avoid printing a misleading error message.
* config: {thin,cache}_{check,repair}_options are never undefinedPeter Rajnoha2015-07-145-14/+18
| | | | | | | | | | | | | | | | | | | Require global/{thin,cache}_{check,repair}_options to be always defined. If not defined directly by user in the configuration and if there's no concrete default option to use, make "" (empty string) the default one - it's then clearly visible in the "lvmconfig --type default" (and generated lvm.conf) and also it makes its handling in the code more straightforward so we don't need to handle undefined values. This means, if there are no default values for these settings defined, we end up with this generated now: {thin,cache}_{check,repair}_options = [ "" ] So the value is never undefined and if it is, it's an error. (The cache_repair_options is actually not used in the code at the moment, but once the code using this setting is in, it will follow the same logic as used for thin_repair_options.)
* man lvmlockd: update method for changing lock typeDavid Teigland2015-07-131-7/+30
| | | | The old description did not work.
* lockd: allow vgexport and vgimportDavid Teigland2015-07-134-13/+32
| | | | | | | | | | | The "exported" state of the VG can be useful with lockd VGs because the exported state keeps a VG from being used in general. It's a way to keep a VG protected and out of the way. Also fix the command flags: ALL_VGS_IS_DEFAULT is not true for vgimport/vgexport, since they both return errors immediately if no VG args are specified. LOCKD_VG_SH is not true for vgexport beause it must use an ex lock to write the VG.
* lockd: allow nolocking and readonly optionsDavid Teigland2015-07-132-1/+47
| | | | | | | | | | | | | | | | | | | | | | | When --nolocking is used (by vgs, lvs, pvs): . don't use lvmlockd at all (set use_lvmlockd to 0) . allow lockd VGs to be read When --readonly is used (by vgs, lvs, pvs, vgdisplay, lvdisplay, pvdisplay, lvmdiskscan, lvscan, pvscan, vgcfgbackup): . skip actual lvmlockd locking calls . allow lockd VGs to be read . check that only shared gl/vg locks are being requested (even though the actually locking is being skipped) . check that no LV locks are requested, because no LVs should be activated or used in readonly mode . disable using lvmetad so VGs are read from disk It is important to note the limited commands that accept the --nolocking and --readonly options, i.e. no commands that change/write a VG or change/activate LVs accept these options, only commands that read VGs.
* vgexport: do not allow lockd VG to be exportedDavid Teigland2015-07-101-0/+7
| | | | vgexport and vgimport have no use for a shared VG.
* lockd: note that external origins don't work in lockd VGsDavid Teigland2015-07-102-0/+12
| | | | | in a comment at the point where it fails, and in the lvmlockd man page.
* vgchange: allow changing to lockd type when mirrors existDavid Teigland2015-07-102-20/+1
| | | | | and update lvmlockd man page to reflect the fact that mirror LVs work correctly in lockd VGs.
* lvconvert: disallow splitting in lockd VGsDavid Teigland2015-07-101-0/+12
| | | | | | A new lockd lock needs to be created for the new LV created by split mirror and split snapshot. Disallow these options in lockd VGs until that is implemented.
* lockd: disable part of lock_args validationDavid Teigland2015-07-102-12/+83
| | | | | | | | There are at least a couple instances where the lock_args check does not work correctly, (listed in the comment), so disable the NULL check for lock_args until those are resolved.
* lvmpolld: Fix segfault on 32 bit architecturesMarian Csontos2015-07-103-4/+5
| | | | | Explicit conversions are needed to align writes and reads on the stack. int64_t is popped from stack while int was pushed.