Bug 1384418

Summary: Move blkdeactivate script and blk-availability.service from lvm2 to device-mapper package
Product: Red Hat Enterprise Linux 6 Reporter: Peter Rajnoha <prajnoha>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Scripts / lvmdump / vgimportclone (RHEL6) QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: agk, bmarzins, cluster-qe, cmarthal, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, rbednar, zkabelac
Version: 6.9   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.143-9.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1209855 Environment:
Last Closed: 2017-03-21 12:03:49 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: 1209855    
Bug Blocks: 1201030, 1344381    

Description Peter Rajnoha 2016-10-13 09:17:58 UTC
Do the same move in RHEL6 as we did in RHEL7 so others can use this script as a dependency on device-mapper instead of lvm2 package (e.g. multipath, see also bug #1209855).

+++ This bug was initially created as a clone of Bug #1209855 +++

The blkdeactivate should be moved to device-mapper package from lvm2 package as blkdeactivate handles also deactivation of other device-mapper based devices, not just LVM ones (e.g. multipath and cryptsetup).

The blkdeactivate script should be patched so that it checks in runtime for presence of tools needed to do the proper deactivation and it should handle specific device-mapper subsystem only if there's higher level subsystem tool present as well to do the action properly (for example, handle LVM devices only if "lvm" binary is present and skip them otherwise).

We need this move because other device-mapper based subsystems may require blkdeactivate to handle subsystem's devices properly. See also bug #1201030 for an example where this script would help multipath to do shutdown properly - mutlipath does not need LVM for it to work properly, but it surely requires libdevmapper and it needs blkdeactivate to shut down this subsystem's devices at least.

For now, this is just a quick workaround, until we have bug #1201737 properly resolved ("Add better separation of various blkdeactivate parts handling various device types - make it pluggable").

--- Additional comment from Peter Rajnoha on 2015-04-14 13:44:35 CEST ---

I've added a runtime check for lvm binary - if it's not present, no LVM handling is done with blkdeactivate script. This removes the static dependency on lvm and so we can move it to libdevmapper/device-mapper package so other DM subsystems can still make use of the general routine to deactivate DM devices.

But as stated in comment #0 above, the aim for the future is for DM subsystems (and others maybe) to provides plugins for blkdeactivate script instead of hardcoding the functionality into blkdeactivate directly - this will remove the deps altogether and such runtime checks won't be necessary anymore...

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=7a4e27eee51e89a550bc55f78daea6d943293202

!!!
Don't forget to move the blkdeactivate script from lvm2 to device-mapper package!!!
!!!

Comment 1 Peter Rajnoha 2016-10-13 09:19:07 UTC
This is a change in spec file only.

Comment 5 Roman Bednář 2016-11-15 14:01:30 UTC
Marking verified. 'blkdeactivate' binary and 'blk-availability' init script has been moved to device-mapper package.

Before patch:

# yum provides /etc/init.d/blk-availability
...
lvm2-2.02.143-7.el6_8.1.x86_64 : Userland logical volume management tools
Repo        : installed
Matched from:
Other       : Provides-match: /etc/init.d/blk-availability


# rpm -qf /sbin/blkdeactivate
lvm2-2.02.143-7.el6_8.1.x86_64



After patch:

# yum provides /etc/init.d/blk-availability
...
device-mapper-1.02.117-9.el6.x86_64 : Device mapper utility
Repo        : installed
Matched from:
Other       : Provides-match: /etc/init.d/blk-availability

# rpm -qf /sbin/blkdeactivate
device-mapper-1.02.117-9.el6.x86_64

Comment 7 errata-xmlrpc 2017-03-21 12:03:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0798.html