mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
blkdeactivate: check for lvm binary and skip LVM processing if not present
This removes dependency on lvm binary - if it's not present, all LVM processing is skipped (shouldn't normally happen because if lvm binary is missing then there's obviously nothing that would activate it, but let's make sure). Without this tight dependency on lvm, the blkdeactivate script can be packaged with libdevmapper/dmsetup (in contrast to lvm as it was before) and as such the script can still be used to handle other DM devices.
This commit is contained in:
parent
d1a770107d
commit
7a4e27eee5
@ -1,5 +1,6 @@
|
||||
Version 2.02.119 -
|
||||
==================================
|
||||
Check for lvm binary in blkdeactivate and skip LVM processing if not present.
|
||||
Add --enable-halvm and --disable-halvm options to lvmconf script.
|
||||
Add --services, --mirrorservice and --startstopservices option to lvmconf.
|
||||
Use proper default value of global/use_lvmetad when processing lvmconf script.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2012-2015 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@ -18,8 +18,10 @@
|
||||
#
|
||||
# Requires:
|
||||
# bash >= 4.0 (associative array support)
|
||||
# lsblk >= 2.22 (lsblk -s support)
|
||||
# umount
|
||||
# util-linux {
|
||||
# lsblk >= 2.22 (lsblk -s support)
|
||||
# umount
|
||||
# }
|
||||
# dmsetup >= 1.02.68 (--retry option support)
|
||||
# lvm >= 2.2.89 (activation/retry_deactivation config support)
|
||||
#
|
||||
@ -212,6 +214,11 @@ deactivate_lvm () {
|
||||
test -z ${SKIP_VG_LIST["$DM_VG_NAME"]} || return 1
|
||||
|
||||
if test $LVM_DO_WHOLE_VG -eq 0; then
|
||||
# Skip LVM device deactivation if LVM tools missing.
|
||||
test $LVM_AVAILABLE -eq 0 && {
|
||||
add_device_to_skip_list
|
||||
return 1
|
||||
}
|
||||
# Deactivating only the LV specified
|
||||
deactivate_holders "$DEV_DIR/$DM_VG_NAME/$DM_LV_NAME" || {
|
||||
add_device_to_skip_list
|
||||
@ -227,6 +234,11 @@ deactivate_lvm () {
|
||||
fi
|
||||
|
||||
else
|
||||
# Skip LVM VG deactivation if LVM tools missing.
|
||||
test $LVM_AVAILABLE -eq 0 && {
|
||||
add_vg_to_skip_list
|
||||
return 1
|
||||
}
|
||||
# Deactivating the whole VG the LV is part of
|
||||
lv_list=$(eval $LVM vgs --config "$LVM_CONFIG" --noheadings --rows -o lv_name $DM_VG_NAME $ERR)
|
||||
for lv in $lv_list; do
|
||||
@ -383,6 +395,12 @@ set_env() {
|
||||
else
|
||||
OUT="1>$DEV_DIR/null"
|
||||
fi
|
||||
|
||||
if test -f $LVM; then
|
||||
LVM_AVAILABLE=1
|
||||
else
|
||||
LVM_AVAILABLE=0
|
||||
fi
|
||||
}
|
||||
|
||||
while test $# -ne 0; do
|
||||
|
Loading…
Reference in New Issue
Block a user