Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 689292 - sys-fs/lvm2: lvm runscript: change "need lvmetad lvmlockd" to "use lvmetad lvmlockd"
Summary: sys-fs/lvm2: lvm runscript: change "need lvmetad lvmlockd" to "use lvmetad lv...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-04 23:48 UTC by Thomas Deutschmann (RETIRED)
Modified: 2020-04-14 18:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2019-07-04 23:48:46 UTC
Dear maintainer,

can we please use "use" instead of "need" in lvm runscript for lvmetad and lvmlockd? I am proposing the following change:

> --- lvm.rc-2.02.184-r3	2019-05-09 21:40:59.624155893 +0200
> +++ lvm.rc-2.02.184-r4	2019-07-05 01:41:45.154816338 +0200
> @@ -10,14 +10,14 @@
>  	echo "${lvm_path}"
>  }
>  
> -_need_lvmetad()
> +_use_lvmetad()
>  {
>  	local lvm_path="$(_get_lvm_path)"
>  	[ ! -x "${lvm_path}" ] && return 1
>  	${lvm_path} dumpconfig global 2>/dev/null | grep -q 'use_lvmetad=1'
>  }
>  
> -_need_lvmlockd()
> +_use_lvmlockd()
>  {
>  	local lvm_path="$(_get_lvm_path)"
>  	[ ! -x "${lvm_path}" ] && return 1
> @@ -32,20 +32,23 @@
>  	# more common case, if its disabled in the config we aren't dependent
>  	# on it.
>  	config /etc/lvm/lvm.conf
> -	local _need=
> +	local _use=
>  	if service_started; then
> -		_need=$(service_get_value need)
> +		_use=$(service_get_value use)
>  	else
> -		if _need_lvmetad; then
> -			_need="${_need} lvmetad"
> +		if _use_lvmetad; then
> +			_use="${_use} lvmetad"
>  		fi
> -		if _need_lvmlockd; then
> -			_need="${_need} lvmlockd"
> +		if _use_lvmlockd; then
> +			_use="${_use} lvmlockd"
>  		fi
>  	fi
>  	# Make sure you review /etc/conf.d/lvm as well!
>  	# Depending on your system, it might also introduce udev & mdraid
> -	need sysfs ${_need}
> +	need sysfs
> +	if [ -n "${_use}" ]; then
> +		use ${_use}
> +	fi
>  }
>  
>  config='global { locking_dir = "/run/lock/lvm" }'
> @@ -88,7 +91,7 @@
>  			lvm_commands="${lvm_commands}vgscan --config '${config}' --mknodes\n"
>  			# And turn them on!
>  			lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ly\n"
> -			if _need_lvmlockd; then
> +			if _use_lvmlockd; then
>  				# Start lockd VGs as required
>  				lvm_commands="${lvm_commands}vgchange --config '${config}' --lock-start --lock-opt auto\n"
>  			fi
> @@ -101,9 +104,9 @@
>  
>  start_post()
>  {
> -	# Save if we needed lvmetad
> -	if _need_lvmetad; then
> -		service_set_value need lvmetad
> +	# Save if we used lvmetad
> +	if _use_lvmetad; then
> +		service_set_value use lvmetad
>  	fi
>  }
>  

Reason:

- "use" will do the same like "need", i.e. it will make sure that lvmetad/lvmlockd will get started before lvm.

- However, when restarting lvmetad/lvmlockd, i.e. after upgrading lvm2 package, we won't longer try to stop lvm service (keep in mind that lvm service is not a real daemon...) which will always fail if LVM volumes are still in use.
Comment 1 Larry the Git Cow gentoo-dev 2020-04-14 18:34:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=265392d1454bc2d73c546a748e95ddd076bdfa06

commit 265392d1454bc2d73c546a748e95ddd076bdfa06
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-04-14 14:11:18 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-04-14 18:34:14 +0000

    sys-fs/lvm2: change "need lvmetad lvmlockd" to "use lvmetad lvmlockd"
    
    Closes: https://bugs.gentoo.org/689292
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 sys-fs/lvm2/files/lvm.rc-2.02.187   | 163 +++++++++++++++++++++
 sys-fs/lvm2/lvm2-2.02.187-r1.ebuild | 279 ++++++++++++++++++++++++++++++++++++
 2 files changed, 442 insertions(+)