summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* report: support "-o #field_name1,field_name2,..."dev-prajnoha-extended-report-optionsPeter Rajnoha2015-10-232-5/+30
| | | | | | | | | | | | | | The "-o #" replaces the report/compact_output_cols setting set in lvm.conf in case it's needed for individual report commands directly on command line: $ lvs vg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert LV Tags lvol0 vg -wi-a----- 4.00m $ lvs vg -o#name,vg_name,pool_lv,origin,data_percent,metadata_percent LV VG Attr LSize Move Log Cpy%Sync Convert LV Tags lvol0 vg -wi-a----- 4.00m
* report: recognize known prefix when processing "-o -field_name1,field_name2,..."Peter Rajnoha2015-10-231-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ lvs LV VG Attr LSize root fedora -wi-ao---- 19.00g swap fedora -wi-ao---- 500.00m lvol0 vg -wi-a----- 4.00m All alternatives of the the field name is recognized (just like we already do for the "-o +"): $ lvs -o-lv_attr LV VG LSize root fedora 19.00g swap fedora 500.00m lvol0 vg 4.00m $ lvs -o-attr LV VG LSize root fedora 19.00g swap fedora 500.00m lvol0 vg 4.00m $ lvs -o-lvattr LV VG LSize root fedora 19.00g swap fedora 500.00m lvol0 vg 4.00m
* report: add report_get_field_prefix functionPeter Rajnoha2015-10-232-0/+16
|
* report: support "-o -field_name1,field_name2,...."Peter Rajnoha2015-10-232-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | $ lvs vg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert LV Tags lvol0 vg -wi-a----- 4.00m Remove fields which should not be displayed at all directly on cmd line: $ lvs vg -o-tags,pool_lv,origin,data_percent,metadata_percent LV VG Attr LSize Move Log Cpy%Sync Convert lvol0 vg -wi-a----- 4.00m The "-o -" and "-o +" can be combined: $ lvs vg -o-tags,pool_lv,origin,data_percent,metadata_percent -o+layout,role LV VG Attr LSize Move Log Cpy%Sync Convert Layout Role lvol0 vg -wi-a----- 4.00m linear public When "-o -" and "-o +" is combined, it's evaluated from left to right so if the same field appears in both lists, it's properly canceled out if such situation happens (here the "vg_size" that appears in both "-o +" and "-o -"): $ lvs vg -o+vg_size -o-vg_size,tags,pool_lv,origin,data_percent,metadata_percent -o+layout,role LV VG Attr LSize Move Log Cpy%Sync Convert Layout Role lvol0 vg -wi-a----- 4.00m linear public
* report: make report options defined by "-o" groupablePeter Rajnoha2015-10-232-16/+47
| | | | | | | | | | | Making the "-o" option groupable allows for definition of more field switches and formatting besides the "-o+" we already have. Also, besides making "-o" groupable, use string lists to store lists of options temporarily while processing all instances of the "-o" group. This will make it easier to concatenate all the option lists defined on command line as well as removing entries or putting these options in groups we need.
* refactor: move code detecting report options to a separate functionPeter Rajnoha2015-10-231-19/+27
|
* str_list: add str_list_destroy functionPeter Rajnoha2015-10-232-0/+15
| | | | | | The str_list_destroy function may be called to cleanup memory when the list is not used anymore and the list itself was not allocated from the memory pool.
* str_list: add str_list_to_str and str_to_str_list functionsPeter Rajnoha2015-10-232-0/+89
| | | | | The str_list_to_str and str_to_str_list are helper functions to convert string list to a single string and vice versa.
* str_list: also allow memory allocation without memory poolPeter Rajnoha2015-10-231-2/+4
|
* lvmcache: update cached info properly when moving from VG to orphan while ↵Peter Rajnoha2015-10-232-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lvmetad is used When lvmetad is used and lvmcache update function (lvmcache_update_vgname_and_id) was called to update existing lvmcache records, a condition was met which made to retun from the update function immediately, effectively making it NOOP. It seems there's no reason for such condition and lvmcache should be update appropriately even when lvmetad used as lvmcache may be reused, most notably in lvm shell. It's possible this is a remnant of the lvmetad development code which didn't get removed for some reason and the bug didn't get spotted because lvm shell is not used often (the condition dates back to 2012 or so). Example, lvmetad and lvm shell used: lvm> pvs PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 124.00m 124.00m Before this patch: ================== lvm> vgremove vg Volume group "vg" successfully removed lvm> pvs With this patch applied: ======================== lvm> vgremove vg Volume group "vg" successfully removed lvm> pvs PV VG Fmt Attr PSize PFree /dev/sda lvm2 --- 128.00m 128.00m
* pvremove: make sure even invalid info is removed from lvmcache on pvremovePeter Rajnoha2015-10-232-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lvmcache info might be resued, most notably in lvm shell. We need to be sure that even lvmcache_info marked as invalid is removed from the lvmcache so it does not confuse any subsequent code/commands executed later on. Problematic example with the lvm shell: lvm> pvs PV VG Fmt Attr PSize PFree /dev/sda lvm2 --- 128.00m 128.00m Before this patch (/dev/sda still displayed in a way): ====================================================== lvm> pvremove /dev/sda Labels on physical volume "/dev/sda" successfully wiped (without lvmetad) lvm> pvs No physical volume label read from /dev/sda (with lvmetad) lvm> pvs PV VG Fmt Attr PSize PFree /dev/sda lvm2 --- 128.00m 128.00m With this patch applied: ======================== lvm> pvremove /dev/sda Labels on physical volume "/dev/sda" successfully wiped (without lvmetad) lvm> pvs (with lvmetad) lvm> pvs
* cleanup: drop debugZdenek Kabelac2015-10-231-1/+0
|
* cleanup: fix gcc compile with older pthreadZdenek Kabelac2015-10-231-0/+3
| | | | | | | | | | Older pthread library was missing 'trick' in pthread_cleanup_pop() which lead to compilation error: error: label at end of compound statement Use explicit ';' to fix it.
* cleanup: gcc warning for old-styleZdenek Kabelac2015-10-231-1/+1
|
* tools: update for lvm2_disable_dmeventd_monitoringZdenek Kabelac2015-10-233-4/+12
| | | | | | | | | | | | | | | Make lvm2_disable_dmeventd_monitoring() more explicit. As memlock_inc_daemon() is also used by clvmd, which does changes dmeventd and suspend ignore state at some stages - make updates of these 2 variable tied to the call of lvm2_disable_dmeventd_monitoring(). Once this call is made dmeventd monitoring and suspended devices are ignored. TODO: all lvm-global settings should really be moved to command context.
* dmeventd: ensure filter is emptyZdenek Kabelac2015-10-231-0/+1
| | | | | | On some error path we could have left filter set to some value. Not a big issue - but lets make reporting correct as soon as we can.
* dmeventd: debug error pathsZdenek Kabelac2015-10-231-4/+9
|
* tests: enable raid test on 4.3Zdenek Kabelac2015-10-221-2/+1
| | | | | | | With kernel -rc6 it's passing our raid tests again - so enable it in tests. Note: related only to Fedora rawhide kernels...
* cleanup: indentsZdenek Kabelac2015-10-223-7/+7
|
* cleanup: drop uneeded header fileZdenek Kabelac2015-10-221-2/+0
|
* cleanup: easier to read codeZdenek Kabelac2015-10-221-10/+4
| | | | Avoid using #ifdef code and use 'cmd' instead of 'die'.
* cleanup: declare vars before codeZdenek Kabelac2015-10-221-6/+3
|
* dmeventd: exit on idleZdenek Kabelac2015-10-222-8/+28
| | | | | | | | | | | | Implementing exit when 'dmeventd' is idle. Default idle timeout set to 1 hour - after this time period dmeventd will cleanly exit. On systems with 'systemd' - service is automatically started with next contact on dmeventd communication socket/fifo. On other systems - new dmeventd starts again when lvm2 command detects its missing and monitoring is needed.
* dmeventd: debug signalsZdenek Kabelac2015-10-221-0/+20
|
* dmeventd: snapshot plugin unmonitorZdenek Kabelac2015-10-221-0/+10
| | | | | Send signal to itself to mark plugin as 'finished' as the watching rule is no longer usable.
* dmeventd: handle signal from pluginZdenek Kabelac2015-10-222-1/+13
| | | | | | | Add support to unmonitor device when monitor recognizes there is nothing to monitor anymore. TODO: possibly API change with return value could be also used.
* dmeventd: rework locking codeZdenek Kabelac2015-10-222-267/+231
| | | | | | | | | | | | | | | | | | | | | Redesign threading code: - plugin registration runs within its new created thread for improved parallel usage. - wait task is created just once and used during whole plugin lifetime. - event thread is based over 'events' filter being set - when filter is 0, such thread is 'unused'. - event loop is simplified. - timeout thread is never signaling 'processing' thread. - pending of events filter cnange is properly reported and running event thread is signalled when possible. - helgrind is not reporting problems.
* cleanup: use enumsZdenek Kabelac2015-10-221-4/+6
|
* dmeventd: code mode _get_device_statusZdenek Kabelac2015-10-222-20/+25
| | | | | | Move _get_device_status() in code. Use dm_task_no_flush() function when reading status. (e.g. none blocking for thins pool)
* dmeventd: minimize locking time for get_imeoutZdenek Kabelac2015-10-221-9/+9
| | | | | | Don't hold lock when creating message (allocating memory). Thread cannot dissapear as it's only the same thread which may clean it.
* dmeventd: drop unneded testZdenek Kabelac2015-10-221-3/+0
| | | | Function is never called without device.uuid.
* dmeventd: wake up timer when setting new timeoutZdenek Kabelac2015-10-221-3/+12
|
* dmeventd: use dm_hold_control_devZdenek Kabelac2015-10-222-0/+14
| | | | | | | Need here to keep control device opened while there is 'any' dso plugin loaded - otherwise there would a race closing controlfd inside lvm2 plugin while some other monitoring thread would tried to execute another WAITEVENT task.
* dmeventd: move dso handling into single code sectionZdenek Kabelac2015-10-221-114/+122
| | | | | | | | | | Move all DSO related function in front, so they could be easily referenced from rest of code. Add proper error paths with logging and error reporting. Drop mutex locking when releasing DSO - since DSO is always allocated and released in main 'event' processing thread.
* dmeventd: using warning levelZdenek Kabelac2015-10-221-3/+3
| | | | | When dmevend notices problems, but continues to operate normally change log level to warning.
* dmeventd: no registering of 0 event maskZdenek Kabelac2015-10-221-0/+2
| | | | Whenever user tries to register 0 mask report this as EINVAL.
* dmeventd: thin plugin updateZdenek Kabelac2015-10-222-43/+44
| | | | | | Use dm_make_percent for percentage calculation like lvm2 command. Use a single call for resize.
* dmeventd: snapshot plugin device removalZdenek Kabelac2015-10-221-0/+39
| | | | | Add #ifdef-ed code to have ability to even remove unusable device. For now purely experimental.
* dmeventd: snapshot plugin updatesZdenek Kabelac2015-10-222-22/+21
| | | | | | | Improve test for invalid snapshot. Use dm_make_percent() to manipulate with exactly same percentage as lvm2 command is using.
* dmeventd: mirror plugin updateZdenek Kabelac2015-10-221-2/+1
| | | | Don't use --config - this requires reload of lvm.conf
* dmeventd: raid plugin reportingZdenek Kabelac2015-10-221-3/+6
| | | | Fix raid logging introduced with last updating commit.
* dmeventd: lvm2 plugin correctly debugZdenek Kabelac2015-10-221-4/+4
| | | | | Fix debug message and report exit when really doing it. Also add missing '_' to static function.
* dmeventd: check for malloc returnZdenek Kabelac2015-10-221-3/+6
|
* libdm: add dm_hold_control_devZdenek Kabelac2015-10-224-1/+16
| | | | | Support hold of control device open. Useful for daemons so the control device is not frequently reopenned.
* tools: do not change signals for memlocked daemonsZdenek Kabelac2015-10-221-0/+12
|
* tools: preselect some setting for memlocked daemonsZdenek Kabelac2015-10-222-4/+8
| | | | | | When our daemon is locked into memory - avoid communication with dmeventd and also skip suspended devices.
* memlock: report memlock daemon counterZdenek Kabelac2015-10-223-0/+7
| | | | | | | Add internal memlock_count_daemon(). Function can be used to recognize it's being executed from daemon restricted execution inside /lib code.
* lib: better reporting of thresholdZdenek Kabelac2015-10-221-7/+20
| | | | Simplify code reporting warning about incorrect thresholds.
* man: document possible lvmetad -l valuesDavid Teigland2015-10-213-11/+8
| | | | In the man page and the lvmetad help output.
* libdaemon: fix typo in last log enable commitDavid Teigland2015-10-211-1/+1
|