summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lvmetad: refresh content at command startdev-dct-lvmetad5David Teigland2015-10-207-14/+134
| | | | | | | | | | | | | | | | | At the start of the command, check if the lvmetad content needs updating (token not matching), and if so do the scan and update it. This gets the updating done right at the beginning, before command processing is started. The early scan already exists for the foreign VGs case, so this is added to it. Previously, the command would be part way through its own processing before discovering via lvmetad_send that lvmetad needed updating. It's not good to interrupt a command, insert a 'pvscan --cache', then continue on with the original command. The pvscan is likely to interfere with the original command.
* lvmcache: change log_verbose to log_warnDavid Teigland2015-10-201-3/+3
|
* pvscan: --cache should scan all devicesDavid Teigland2015-10-202-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running pvscan --cache, the intention is to scan all devices, i.e. the equivalent of running 'pvscan --cache dev' for each device. But, some devices holding duplicate PVs were being skipped, and lvmetad was not being told about them. This was a side effect of the fact that the lvmcache layer is used internally during scanning (it's used to transfer info between the different stages of the command: label reading, vg reading, sending the vg.) An unwanted side effect of using lvmcache is that it eliminates duplicate PVs if it sees them. This prevented the command from sending some duplicate PVs to lvmetad (when the first duplicate was preferred over the second.) The fix is to drop the lvmcache state between scanning each PV. There is no need to keep any cache state between each PV being scanned (there's nothing being reused), and the unneeded state is causing lvmcache to eliminate duplicates which is harmful for pvscan --cache. Also, remove clvm locking from pvscan_lvmetad. This is not needed since lvmetad cannot be used with clvm. It was interfering with clearing the cache.
* lvmetad: warn about all duplicate PVs in commandDavid Teigland2015-10-201-3/+8
| | | | | | | When the command gets a list of alternate devices from lvmetad, warn about them all directly. This is not the same as the warnings when adding lvmcache, which are related to which duplicate is preferred.
* lvmetad: rewrite update codeDavid Teigland2015-10-201-282/+1472
| | | | | | | | | | | | | | | | | | | update_metadata and pv_found update the cached metadata; rewrite both of these to improve the code, make it much more clear what they do, more thoroughly cover possible combinations/transitions, add more error checking and handling, add comments. The state and content of the cache (hash tables) does not change (apart from things that didn't work before), and the transfers to/from commands do not change. The implementation and organization of the code making the state changes does change significantly. One detail related to the content of the cache does change: different hash tables do not reference the same memory any more; the target values in each hash table are allocated and freed individually.
* lvmetad: fix update_metadata with new vgidDavid Teigland2015-10-201-0/+13
| | | | | | | | | | | | | | | | | | | When vgchange -u changes the vgid in an existing VG, it invokes update_metadata() in lvmetad with the existing VG name but a new vgid. update_metadata() doesn't recognize this condition, and ends up with in correct state, e.g. the existing name is missing in the vgname_to_vgid hash table. This fixes update_metadata() to recognize when an existing VG name is being updated with a new vgid, and in that case first calls remove_metadata() on the old vgid, before continuing with update_metadata() which will add the updated VG as if it were new. One known shortcoming of this approach is that the VG is missing from lvmetad hash tables completely in the short time between the remove and adding it again. Other commands that look up the VG in that window will not find it.
* tests: add lvmetad shutdown on idle testOndrej Kozina2015-10-201-0/+56
|
* lvmetad.8.in: update man page with timeout infoOndrej Kozina2015-10-201-0/+6
|
* lvmetad: add optional timeout optionOndrej Kozina2015-10-202-4/+37
|
* tests: add test for missing mirror in-sync infoOndrej Kozina2015-10-201-1/+8
|
* polldaemon: fix missing mirror in-sync info with lvmpolldOndrej Kozina2015-10-202-1/+7
| | | | | | | | | | | | | | | | | | CONVERTING status flag is a tricky one. It's not set when converting a non-mirror LV type to the mirror type, i.e.: linear -> two leg mirror. Also the conversion itself is instant and doesn't require to be polled. When mirror reaches sync state there's no final update on VG metadata for lvmpolld to be made thereby report_progress in fact doesn't report percentage of mirror being converted but percentage of mirror being in sync. Perhaps we should reword the lvconvert output here. On the other hand CONVERTING is set while we upconvert the mirror from i.e. two leg mirror to four leg mirror. In such case the operation is required to be polled so that lvmpolld can cleanup temporary conversion log when the conversion is over. Ignore CONVERTING lv_type for the moment and match LVs only by uuids during 'mirror conversion'/'waiting for a sync to finish'.
* conf: clarify compact output settingsPeter Rajnoha2015-10-202-18/+24
|
* pvscan: use process_each_pvDavid Teigland2015-10-193-99/+107
| | | | | | | | | | | | | | | The old code made two loops through the PVs: in the first loop it found the max PV and VG name lengths, and in the second loop it printed each PV using the name lengths as field widths for aligning columns. The new code uses process_each_pv() which makes one loop through the PVs. In the *first* call to pvscan_single(), the max name lengths are found by looping through the lvmcache entries which have been populated by the generic process_each code prior to calling any _single functions. Subsequent calls to pvscan_single() reuse the max lengths that were found by the first call.
* conf: regeneratePeter Rajnoha2015-10-191-2/+2
|
* cleanup: typo in comment: compact_output_fields should be compact-output_colsPeter Rajnoha2015-10-192-2/+2
|
* config: add report/compact_output_cols to control which columns to compact ↵Peter Rajnoha2015-10-166-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in report output The new report/compact_output_cols setting has exactly the same effect as report/compact_output setting. The difference is that with the new setting it's possible to define which cols should be compacted exactly in contrast to all cols in case of report/compact_output. In case both compact_output and compact_output_cols is enabled/set, the compact_output prevails. For example: $ lvmconfig --type full report/compact_output report/compact_output_cols compact_output=0 compact_output_cols="" $ lvs vg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lvol0 vg -wi-a----- 4.00m --- $ lvmconfig --type full report/compact_output report/compact_output_cols compact_output=0 compact_output_cols="data_percent,metadata_percent,pool_lv,move_pv,origin" $ lvs vg LV VG Attr LSize Log Cpy%Sync Convert lvol0 vg -wi-a----- 4.00m --- $ lvmconfig --type full report/compact_output report/compact_output_cols compact_output=1 compact_output_cols="data_percent,metadata_percent,pool_lv,move_pv,origin" $ lvs vg LV VG Attr LSize lvol0 vg -wi-a----- 4.00m
* libdm: add dm_report_compact_given_fieldsPeter Rajnoha2015-10-164-2/+69
| | | | | | dm_report_compact_given_fields is the same as dm_report_compact_fields, but it processes only given fields, not all the fields in the report like dm_report_compact_field does.
* lvmlockd: use flag to avoid blocking in sanlock_acquireDavid Teigland2015-10-141-0/+29
| | | | | | | | | | | | If a host failed while holding a sanlock lease, sanlock_acquire will by default block and wait for the lease to expire before returning. We want it to return with an error so we can retry instead of blocking, which allows us to process other lock operations. (Enclose this in an ifdef until the new flag appears in a sanlock release.)
* dmeventd: use matching functionZdenek Kabelac2015-10-141-1/+7
| | | | | | Respect lvm2_log_fn prototype. The idea of 'reusing' print_log with plain cast is causing very strange crashes with some older 'gcc' compilers. So just do it cleanly...
* thin: enforce local activation when creation new thinZdenek Kabelac2015-10-141-6/+13
| | | | | As we need to check how full thin-pool is - require thin-pool is locally active.
* makefiles: switch to rpath-linkZdenek Kabelac2015-10-141-2/+2
| | | | | Plain rpath is to invasive and gets into binary. We only want to provide hint for linker.
* dmeventd: fix missing '!'Zdenek Kabelac2015-10-131-1/+1
| | | | During recent code changes '!' was badly converted.
* makefiles: older gcc needs hint with rpathZdenek Kabelac2015-10-131-0/+3
| | | | | gcc 4.3 seems not to be able to find linked library without specifying -rpath to linker (plain -L) is not enough.
* dmeventd: compilable without DEBUG CFLAGZdenek Kabelac2015-10-131-3/+6
| | | | Missed compilability without DEBUG.
* Revert "log: no file for external logging"Alasdair G Kergon2015-10-132-5/+0
| | | | | | | | This reverts commit 1b1c01a27b359f8e91c3c9e08684c435d8fd51c2. This caused messages to get dropped instead of logged into the log file. (The log file and log function are independent at the moment.)
* tests: more extend testingZdenek Kabelac2015-10-131-4/+47
|
* tests: wait for initial syncZdenek Kabelac2015-10-131-0/+1
| | | | Raid should be in-sync ATM for any gaming.
* tests: start logging dmeventd outputZdenek Kabelac2015-10-131-1/+1
| | | | | Log dmeventd output from test - keep output logging in test and avoid sending messages to syslog.
* tests: better regex checkZdenek Kabelac2015-10-131-1/+1
| | | | Enhance check for matching prefix.
* tests: show status in in_syncZdenek Kabelac2015-10-131-11/+14
| | | | | Make visible actual status line when returing 'raid' is in sync. Useful to prove when kernel is wrong.
* makefiles: src dirs have depth 5Zdenek Kabelac2015-10-131-1/+1
| | | | For tags generation scan depth 5.
* makefiles: drop explicit linkingZdenek Kabelac2015-10-131-5/+0
| | | | Nothing in /sscripts needs devmapper-event library so drop its linking.
* makefiles: generate LocalZdenek Kabelac2015-10-131-1/+3
| | | | | | | | | | Use same exported symbols list for other generated symfile as it appeared to be the right way for libdm. Local { local: *; };
* dmeventd: rework raid pluginZdenek Kabelac2015-10-132-88/+29
| | | | | Switch to per-thread mem-pool and lock only for lvm2 calls. Use libdm parser for raid status line.
* dmeventd: less locking mirrorZdenek Kabelac2015-10-132-24/+10
| | | | | Rework mirror plugin to use per-thread mem-pool. This allows to use locking only for lvm2 library calls.
* dmeventd: less locking for snapshot and thinZdenek Kabelac2015-10-133-17/+11
| | | | | | | Use lvm lock for lvm library calls. dm functions in-use are 'thread-safe' since we use local per-thread mem pool.
* dmeventd: add local mempool for raid and mirrorZdenek Kabelac2015-10-133-6/+62
| | | | Using local mempools allows to drop locks when such memory is needed.
* dmeventd: use new macros to init mempoolZdenek Kabelac2015-10-132-34/+18
| | | | | For thin and snapshot use new macros to simplify mempool init and destroy
* dmeventd: introduce macro for initZdenek Kabelac2015-10-131-1/+33
| | | | Simplify commonly used pool creation.
* dmeventd: new initialization of plugin threadsZdenek Kabelac2015-10-132-85/+86
| | | | | | | | | | | | Rework thread creation code to better use resources. New code will not leak 'timeout' registered thread on error path. Also if the thread already exist - avoid creation of thread object and it's later destruction. If the race is noticed during adding new monitoring thread, such thread is put on cleanup list and -EEXIST is reported.
* cleanup: typo in commentZdenek Kabelac2015-10-131-1/+1
|
* cleanup: move system defines before structsZdenek Kabelac2015-10-131-12/+10
|
* cleanup: avoid using privateZdenek Kabelac2015-10-134-18/+18
| | | | Switch private to user.
* cleanup: remove multilogZdenek Kabelac2015-10-131-6/+0
|
* cleanup: always set nsecZdenek Kabelac2015-10-131-1/+1
|
* cleanup: more readable codeZdenek Kabelac2015-10-132-6/+3
|
* dmeventd: support logging on stdoutZdenek Kabelac2015-10-132-7/+33
| | | | | | Add new supported option '-l' log to stdout/stderr. It has to be paired with '-f' (foreground run).
* cleanup: static with _Zdenek Kabelac2015-10-131-8/+9
| | | | Document ? is printing to stderr.
* dmeventd: handle snapshot overflowZdenek Kabelac2015-10-132-2/+3
| | | | | When snapshot reports overflow, handle it in the same way as Invalid. Until better ideas are implemented.
* man: dmeventd updateZdenek Kabelac2015-10-131-27/+65
|