Bug 1410768

Summary: Convert dmeventd thin plugin event reaction code to configurable internal or external command.
Product: [Community] LVM and device-mapper Reporter: Zdenek Kabelac <zkabelac>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: dmeventd QA Contact: cluster-qe <cluster-qe>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, prajnoha, thornber, zkabelac
Version: 2.02.169Flags: rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 2.02.169 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1442992 (view as bug list) Environment:
Last Closed: 2017-05-10 22:43:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1370490, 1442992    

Description Zdenek Kabelac 2017-01-06 12:11:29 UTC
Description of problem:

When 'dmeventd' plugin calls 'lvconvert'  it provides implicit and unconfigurable reaction when called command fails.
i.e. in case of thin-pool failing resize, it will try to umount
unconditionally all thin volumes associated with such thin pool
when compile-time defined threshold (>95%) is reached.

This reaction is not likely wanted for newer kernels and there are users wishing to operate full thin-pool without umount disruption.

As 'dmeventd' has no configuration, we need to provide some policy configurable knobs for lvm2 command a somewhat sacrifice certain 'error paths' in commands
as unhandled.

As a simple mechanism it seems to come in mind simple setting:

thin_pool_lazy_umount_threshold = 100

(meaning do NOTHING)
values in range: <thin_pool_autoextend_threshold, 100) 
will cause call of umount in case autoextend has failed.


Version-Release number of selected component (if applicable):
2.02.169

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Zdenek Kabelac 2017-01-06 12:22:38 UTC
Maybe we go with 'more' generic logic:

thin_pool_fail_autoextend_threshold = XXX
thin_pool_fail_autoextend_command = [ ""..... ]

which will call some preconfigured 'command'  when configured 'threshold' passed
with the last passed argument being  thin-pool  vgname/lvname
(or maybe  user can use user  %thinpool  in arglist....)


Add more....

Comment 2 Zdenek Kabelac 2017-01-10 09:37:29 UTC
It seems we should try to  let whole  'command' for extend to be fully configure - so i.e.  plugin for thin-pool dmeventd gets this new field:


dmeventd {

thin_pool_command = [ ] 

}


Defaulting to  existing  'lvextend --use-policies....'
(with dropped umount at dmeventd plugin part)


This let user to gain full configuration for any percentage value of thin-pool from range of 50%, 55,...100% and appropriate reaction.


Otherwise we would facing non-trivial troubles to solve with VG locking.

This way user may plug-in just place-in any shell script and do query and change VG or any LV as need - even far before failure (i.e. dropping  some  unneeded thin LVs at some 'fullness' level.

In general we would support much wider range or policies.

The 'easiest' looks like passing in command with new API functions:

dm_event_handler_set_command
dm_event_handler_get_command

We may also convert other plugins (mirror, raid, snapshot...)

Comment 3 Zdenek Kabelac 2017-01-10 21:50:56 UTC
So the API of dmeventd is not good for this, it's not extensible unless major rework would be made.

So the new plan is to introduce 'smarter' command -  plugin will use this command which then according to lvm.conf will run the configured action
(i.e. old  lvextend or some new script...)

Comment 4 Zdenek Kabelac 2017-02-20 10:15:27 UTC
So this is now resolved upstream and the behavior is documented in 'dmeventd' man page for thin plugin which needs to be checked for full description.

We have either internal or external command

lvm  <-  internal command (which no longer umounts volumes on error)
/fullpath   <-  external command

In the future we may add systemd service usage for this to avoid dmeventd forking.