summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* pvcreate, vgcreate, vgextend: restructuring to use toollibdev-dct-pvcreate-7David Teigland2016-01-0619-282/+969
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Pull out the hidden equivalent of process_each_pv into an actual top level process_each_pv. - Pull the prompts to the top level, and do not run any prompts while locks are held. The orphan lock is reacquired after the prompts are done, and the devices being created are checked for any change made while the lock was not held. Previously, pvcreate_vol() was the shared function for creating a PV for pvcreate, vgcreate, vgextend. Now, it will be toollib function pvcreate_each_device(). pvcreate_vol() was called effectively as a helper, from within vgcreate and vgextend code paths. pvcreate_each_device() will be called at the same level as other process_each functions. One of the main problems with pvcreate_vol() is that it included a hidden equivalent of process_each_pv for each device being created: pvcreate_vol() -> _pvcreate_check() -> find_pv_by_name() -> get_pvs() -> get_pvs_internal() -> _get_pvs() -> get_vgids() -> /* equivalent to process_each_pv */ dm_list_iterate_items(vgids) vg = vg_read_internal() dm_list_iterate_items(&vg->pvs) pvcreate_each_device() reorganizes the code so that each-VG-each-PV loop is done once, and uses the standard process_each_pv function at the top level of the function.
* lvmdump: also add lvm2-activation{-early,-net}.service systemd status for ↵Peter Rajnoha2016-01-042-0/+4
| | | | | | | | lvmdump -s The lvm2-activation{-early,-net}.service systemd unit statuses were missing in dump gathered by lvmdump -s. These are quite important when debugging scenarios with systemd environment and where lvmetad is not used.
* lvmlockd: update VG lock version earlierDavid Teigland2015-12-152-3/+18
| | | | | | | | | Have commands send lvmlockd the update message in vg_write instead of vg_commit, so that it's not done while LVs are suspended. If the vg_write is not committed, and the seqno sent to lvmlockd is not used, then lvmlockd can detect this when the next update uses the same seqno.
* vgrename: use process_each_vgdev-dct-vgrenameDavid Teigland2015-12-1412-163/+242
| | | | | | | | | | | | | | | | | | | | Use process_each_vg() to lock and read the old VG, and then call the main vgrename code. When real VG names are used (not a UUID in place of the old name), the command still pre-locks the new name (when strcmp wants it locked first), before calling process_each_vg on the old name. In the case where the old name is replaced with a UUID, process_each_vg now translates that UUID into the real VG name, which it locks and reads. In this case, we cannot do pre-locking to maintain lock ordering because the old name is unknown. So, in this case the strcmp based lock ordering is suppressed and the old name is always locked first. This opens a remote chance for lock ordering conflict between racing vgrenames between two names where one or both commands use the UUID.
* pvscan: Remove duplicate filter wipe.Alasdair G Kergon2015-12-142-5/+4
| | | | | | Also always clear the internal lvmcache after rescanning, and reinstate a test for --trustcache so that 'pvs --trustcache' (for example) avoids rescanning.
* process_each_pv: do full scan earlier to find new devicesDavid Teigland2015-12-144-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before commit c1f246fedfc349c25749da501e68a7f70bd122b0, _get_all_devices() did a full device scan before get_vgnameids() was called. The full scan in _get_all_devices() is from calling dev_iter_create(f, 1). The '1' arg forces a full scan. By doing a full scan in _get_all_devices(), new devices were added to dev-cache before get_vgnameids() began scanning labels. So, labels would be read from new devices. (e.g. by the first 'pvs' command after the new device appeared.) After that commit, _get_all_devices() was called after get_vgnameids() was finished scanning labels. So, new devices would be missed while scanning labels. When _get_all_devices() saw the new devices (after labels were scanned), those devices were added to the .cache file. This meant that the second 'pvs' command would see the devices because they would be in .cache. Now, the full device scan is factored out of _get_all_devices() and called by itself at the start of the command so that new devices will be known before get_vgnameids() scans labels.
* post-releaseAlasdair G Kergon2015-12-144-2/+8
|
* pre-releasev2_02_138Alasdair G Kergon2015-12-144-6/+6
|
* Change messages from verbose to debugDavid Teigland2015-12-111-2/+2
| | | | | | These messages about outdated PVs should not be verbose because they always appear, even when there are no outdated PVs.
* cleanup: add missing WHATS_NEWZdenek Kabelac2015-12-111-0/+2
|
* tests: check lvrename of stacked cache poolZdenek Kabelac2015-12-111-0/+48
|
* fix static linkingRiku Voipio2015-12-112-1/+2
| | | | | | | | | | | | | | | | | Static linking fails currently, as -lm and -lpthread are missing: gcc -O2 -fPIC -O2 -L../libdm -L../lib -L../libdaemon/client -static -L../libdm/ioctl \ -o dmsetup.static dmsetup.o -ldevmapper -lrt ../libdm/ioctl/libdevmapper.a(libdm-stats.o): In function `dm_stats_create_region': libdm-stats.c:(.text+0x2d69): undefined reference to `log10' libdm-stats.c:(.text+0x2d6e): undefined reference to `lround' ../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_create': pool.c:(.text+0x134): undefined reference to `pthread_mutex_lock' pool.c:(.text+0x14f): undefined reference to `pthread_mutex_unlock' Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* tests: fix loggingZdenek Kabelac2015-12-102-2/+2
| | | | Actually file redirection must be before stderr redir.
* lvrename: always allow to rename poolsZdenek Kabelac2015-12-101-3/+7
| | | | | | | | Since we mark cache-pool as 'hidden/private' while it is in-use, we may still allow user to change it's name. It should not cause any harm and user may prefer better naming for a cache-pool in use.
* cache: support stacked renameZdenek Kabelac2015-12-101-6/+6
| | | | | | Preserve skip_pool flag when running for_each_sub_lv() so lvrename continues to work when thin-pool is using cached data LV.
* lvmlockd: reconnect to lvmetad if it's restartedDavid Teigland2015-12-101-28/+52
| | | | | If lvmetad is restarted after lvmlockd has connected to it, then lvmlockd should reconnect.
* lvrename: move the lvmlockd LV lockDavid Teigland2015-12-092-12/+12
| | | | | | The function it was in is used for various internal renaming of hidden LVs where a lock from lvmlockd does not apply.
* dmeventd: Don't trust fifo with wrong attrs.Alasdair G Kergon2015-12-081-9/+25
| | | | | | | | If an existing fifo has the wrong attributes it cannot be trusted so we must unlink it and recreate it correctly. (Replaces 2c8d6f5c90d5be62b48ba2881f2a6631091dc5af: if the other end of the fifo already got opened while its mode was insecure, delaying the chmod isn't going to make any difference!)
* dmeventd: Extend checks on client socket.Alasdair G Kergon2015-12-082-2/+34
| | | | | | | | | Reinstate and extend checks removed by e1b111b02accb4145b82b8b47ce57ed93b1a7184. The code has always assumed that only root has access to the directory containing the fifos and that they are under the complete control of dmeventd code. If anything is found not to be as expected, then open() should certainly not be attempted!
* post-releaseAlasdair G Kergon2015-12-054-2/+8
|
* pre-releasev2_02_137Alasdair G Kergon2015-12-054-6/+11
|
* tests: extend testZdenek Kabelac2015-12-041-4/+16
|
* archiver: fix reporting for check_current_backupZdenek Kabelac2015-12-041-10/+14
| | | | | | | | | | | | | It's getting a bit more complex here. Basic idea behind is - check_current_backup() should not log error when a user is using a read-only filesystem, so e.g. vgscan will not report any error when it tries to take missing backup. We still have cases when error could be reported though, e.g. the backup this would be a symbolic link, but these are rather misconfiguration and unexpected case.
* debug: correct stack tracingZdenek Kabelac2015-12-041-1/+2
| | | | | | | Here the 'goto' is correct path, as !device_is_usable is traceable with <backtrace>. Keep the 'stack' for unusable device.
* libdm: add some doc for mirror statusZdenek Kabelac2015-12-041-5/+5
| | | | Comment content of struct for mirror status.
* lvconvert: Reinstate raid merge after splitmirror.Alasdair G Kergon2015-12-031-1/+1
| | | | | After commit 46c8d6bb8ae91ee67c8633496cc6c3d92bb4f3ce (lvconvert: Improve message for raid without -m)
* tests: check read-only backup archiveZdenek Kabelac2015-12-031-0/+70
|
* vgextend: reinstantiate archivingZdenek Kabelac2015-12-032-0/+7
| | | | | Since commit f5d06efbab4c7c77298b18b95c23111575a8db1a we lost archiving. Restore it now with process_each_vg.
* cleanup: drop log_suppress(2) usageZdenek Kabelac2015-12-033-18/+17
| | | | No longer need to use log_suppress(2) instance so dropped.
* archiver: inital change toward proper loggingZdenek Kabelac2015-12-031-27/+37
| | | | | | | | | | | | | | We have to modes of 'archive()' usage - 1. compulsory - fail stops command and user may try '-An' option to do a command. 2. non-compulsory - some fails in archiving are ignorable (i.e. read-only filesystem where archive dir is located). Those 2 cases needs to be properly handle - i.e. the non-compulsory logging should not be tampering error logging message production. So more work here is needed
* log: use full buffer size for printfZdenek Kabelac2015-12-032-11/+14
| | | | | | | | | | | Pass full buffer size to printf() function - no reason to make buffer 1 char smaller. Also rename locn buffer to message buffer directly since it's not used for anything else. TODO: we may use same buffer also for 'buf[]' since there is no collision - so may safe 1K on stack usage.
* cleanup: use try_id_read_formatZdenek Kabelac2015-12-032-8/+3
| | | | Better then using log_suppress in this case.
* uuid: add id_read_format_tryZdenek Kabelac2015-12-033-7/+31
| | | | | | | Provide id_read_format() functionality without log_error when ID is not valid one - it will just return 0. Does not need to use log_suppress() then.
* lvconvert: Reinstate mirror to raid conversions.Alasdair G Kergon2015-12-031-2/+7
| | | | | | Reinstate conversions from mirror to raid stopped by commit 46c8d6bb8ae91ee67c8633496cc6c3d92bb4f3ce (lvconvert: Improve message for raid without -m).
* man lvm: add section about unique VG namesDavid Teigland2015-12-021-0/+22
|
* toollib: only interpret vgname arg as uuid for vgrenamedev-dct-process-each-2David Teigland2015-12-013-8/+7
| | | | | | In general, --select should be used to specify a VG by UUID, but vgrename already allows a uuid to be substituted for the name, so continue to allow it in that case.
* toollib: allow VG UUID to be used in place of VG namedev-dct-process-each-1David Teigland2015-12-011-0/+39
| | | | | | | | If the VG arg from the command line does not match the name of any known VGs, then check if the arg looks like a UUID. If it's a valid UUID, then compare it to the UUID of known VGs. If it matches the UUID of a known VG, then process that VG.
* lvresize: use process_each_vgDavid Teigland2015-12-011-29/+34
| | | | No functional change.
* lvrename: use process_each_vgDavid Teigland2015-12-011-36/+57
| | | | No functional change.
* lvcreate: use process_each_vgDavid Teigland2015-12-011-52/+71
| | | | No functional change.
* vgextend: pass single vgname as process_each_vg argDavid Teigland2015-12-0116-34/+37
| | | | | | | | | Pass the single vgname as a new process_each_vg arg instead of setting a cmd flag to tell process_each_vg to take only the first vgname arg from argv. Other commands with different argv formats will be able to use it this way.
* lvmcache: change duplicate VG name warnings to verbosedev-dct-dupvgnamesEDavid Teigland2015-12-011-20/+33
| | | | | | | | | When two different VGs with the same name exist, they are both stored in lvmcache using the vginfo->next list. Previously, the code would print warnings (sometimes) when adding VGs to this list. Now the duplicate VG names are handled by higher level code, so this list no longer needs to print warnings about duplicate VG names being found.
* vg_read: look up vgid from nameDavid Teigland2015-12-013-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | After recent changes to process_each, vg_read() is usually given both the vgname and vgid for the intended VG. However, in some cases vg_read() is given a vgid with no vgname, or is given a vgname with no vgid. When given a vgid with no vgname, vg_read() uses lvmcache to look up the vgname using the vgid. If the vgname is not found, vg_read() fails. When given a vgname with no vgid, vg_read() should also use lvmcache to look up the vgid using the vgname. If the vgid is not found, vg_read() fails. If the lvmcache lookup finds multiple vgids for the vgname, then the lookup fails, causing vg_read() to fail because the intended VG is uncertain. Usually, both vgname and vgid for the intended VG are passed to vg_read(), which means the lvmcache translations between vgname and vgid are not done.
* toollib: remove unused functionDavid Teigland2015-12-011-29/+0
|
* process_each: resolve duplicate VG namesDavid Teigland2015-12-011-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If two different VGs with the same name exist on the system, a command that just specifies that ambiguous name will fail with a new error: $ vgs -o name,uuid ... foo qyUS65-vn32-TuKs-a8yF-wfeQ-7DkF-Fds0uf foo vfhKCP-mpc7-KLLL-Uh08-4xPG-zLNR-4cnxJX $ lvs foo Multiple VGs found with the same name: foo Use the --select option with VG UUID (vg_uuid). $ vgremove foo Multiple VGs found with the same name: foo Use the --select option with VG UUID (vg_uuid). $ lvs -S vg_uuid=qyUS65-vn32-TuKs-a8yF-wfeQ-7DkF-Fds0uf lv1 foo ... This is implemented for process_each_vg/lv, and works with or without lvmetad. It does not work for commands that do not use process_each. This change includes one exception to the behavior shown above. If one of the VGs is foreign, and the other is not, then the command assumes that the intended VG is the local one and uses it.
* process_each: always use list of vgnames on systemDavid Teigland2015-12-011-50/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes process_each_vg/lv always use the list of vgnames on the system. When specific VGs are named on the command line, the corresponding entries from vgnameids_on_system are moved to vgnameids_to_process. Previously, when specific VGs were named on the command line, the vgnameids_on_system list was not created, and vgnameids_to_process was created from the arg_vgnames list (which is only names, without vgids). Now, vgnameids_on_system is always created, and entries are moved from that list to vgnameids_to_process -- either some (when arg_vgnames specifies only some), or all (when the command is processing all VGs, or needs to look at all VGs for checking tags/selection). This change adds one new lvmetad lookup (vg_list) to a command that specifies VG names. It adds no new work for other commands, e.g. non-lvmetad commands, or commands that look at all VGs. When using lvmetad, 'lvs foo' previously sent one request to lvmetad: 'vg_lookup foo'. Now, 'lvs foo' sends two requests to lvmetad: 'vg_list' and 'vg_lookup foo <uuid>'. (The lookup can now always include the uuid in the request because the initial vg_list contains name/vgid pairs.)
* mirror: fix conditionZdenek Kabelac2015-12-011-1/+1
| | | | Recent patch tested wrong condition for error
* cleanup: use dm_get_status_mirrorZdenek Kabelac2015-12-015-280/+118
| | | | Use libdm function to parse mirror status report.
* lib: pass mem pool to check_transient_statusZdenek Kabelac2015-12-014-3/+5
| | | | | check_transient_status() may need to allocate some memory, so pass in already existing mem pool.
* tests: unit test for mirror statusZdenek Kabelac2015-12-014-2/+77
|