mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
blkdeactivate: add blkdeactivate -r wait option to wait for MD resync/recovery/reshape
The new blkdeactivate -r|mdraidoption wait causes blkdeactivate to wait for any resync/recovery/reshape that is currently in progress before deactivating the device. If this option is used, blkdeactivate calls mdadm -W|--wait before mdadm -S|--stop.
This commit is contained in:
parent
7fa0d52262
commit
95087c8f96
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.144 -
|
Version 1.02.144 -
|
||||||
======================================
|
======================================
|
||||||
|
Add blkdeactivate -r wait option to wait for MD resync/recovery/reshape.
|
||||||
Fix blkdeactivate regression with failing DM/MD devs deactivation (1.02.142).
|
Fix blkdeactivate regression with failing DM/MD devs deactivation (1.02.142).
|
||||||
Fix typo in blkdeactivate's '--{dm,lvm,mpath}options' option name.
|
Fix typo in blkdeactivate's '--{dm,lvm,mpath}options' option name.
|
||||||
Correct return value testing when get reserved values for reporting.
|
Correct return value testing when get reserved values for reporting.
|
||||||
|
@ -8,6 +8,7 @@ blkdeactivate \(em utility to deactivate block devices
|
|||||||
.RB [ -h ]
|
.RB [ -h ]
|
||||||
.RB [ -l \ \fIlvm_options\fP ]
|
.RB [ -l \ \fIlvm_options\fP ]
|
||||||
.RB [ -m \ \fImpath_options\fP ]
|
.RB [ -m \ \fImpath_options\fP ]
|
||||||
|
.RB [ -r \ \fImdraid_options\fP ]
|
||||||
.RB [ -u ]
|
.RB [ -u ]
|
||||||
.RB [ -v ]
|
.RB [ -v ]
|
||||||
.RI [ device ]
|
.RI [ device ]
|
||||||
@ -62,6 +63,14 @@ all the paths are unavailable for any underlying device-mapper multipath
|
|||||||
device.
|
device.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
.BR -r ", " --mdraidoption \ \fImdraid_options\fP
|
||||||
|
Comma-separated list of MD RAID specific options:
|
||||||
|
.RS
|
||||||
|
.IP \fIwait\fP
|
||||||
|
Wait MD device's resync, recovery or reshape action to complete
|
||||||
|
before deactivation.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.BR -u ", " --umount
|
.BR -u ", " --umount
|
||||||
Unmount a mounted device before trying to deactivate it.
|
Unmount a mounted device before trying to deactivate it.
|
||||||
Without this option used, a device that is mounted is not deactivated.
|
Without this option used, a device that is mounted is not deactivated.
|
||||||
|
@ -71,6 +71,9 @@ LVM_DO_WHOLE_VG=0
|
|||||||
# Do not retry LV deactivation by default.
|
# Do not retry LV deactivation by default.
|
||||||
LVM_CONFIG="activation{retry_deactivation=0}"
|
LVM_CONFIG="activation{retry_deactivation=0}"
|
||||||
|
|
||||||
|
# Do not wait for MD RAID device resync, recovery or reshape.
|
||||||
|
MDRAID_DO_WAIT=0
|
||||||
|
|
||||||
# Do not disable queueing if set on multipath devices.
|
# Do not disable queueing if set on multipath devices.
|
||||||
MPATHD_DO_DISABLEQUEUEING=0
|
MPATHD_DO_DISABLEQUEUEING=0
|
||||||
|
|
||||||
@ -113,13 +116,14 @@ usage() {
|
|||||||
echo " If devices are specified, deactivate only supplied devices and their holders."
|
echo " If devices are specified, deactivate only supplied devices and their holders."
|
||||||
echo
|
echo
|
||||||
echo " Options:"
|
echo " Options:"
|
||||||
echo " -e | --errors Show errors reported from tools"
|
echo " -e | --errors Show errors reported from tools"
|
||||||
echo " -h | --help Show this help message"
|
echo " -h | --help Show this help message"
|
||||||
echo " -d | --dmoptions DM_OPTIONS Comma separated DM specific options"
|
echo " -d | --dmoptions DM_OPTIONS Comma separated DM specific options"
|
||||||
echo " -l | --lvmoptions LVM_OPTIONS Comma separated LVM specific options"
|
echo " -l | --lvmoptions LVM_OPTIONS Comma separated LVM specific options"
|
||||||
echo " -m | --mpathoptions MPATH_OPTIONS Comma separated DM-multipath specific options"
|
echo " -m | --mpathoptions MPATH_OPTIONS Comma separated DM-multipath specific options"
|
||||||
echo " -u | --umount Unmount the device if mounted"
|
echo " -r | --mdraidoptions MDRAID_OPTIONS Comma separated MD RAID specific options"
|
||||||
echo " -v | --verbose Verbose mode (also implies -e)"
|
echo " -u | --umount Unmount the device if mounted"
|
||||||
|
echo " -v | --verbose Verbose mode (also implies -e)"
|
||||||
echo
|
echo
|
||||||
echo " Device specific options:"
|
echo " Device specific options:"
|
||||||
echo " DM_OPTIONS:"
|
echo " DM_OPTIONS:"
|
||||||
@ -128,6 +132,8 @@ usage() {
|
|||||||
echo " LVM_OPTIONS:"
|
echo " LVM_OPTIONS:"
|
||||||
echo " retry retry removal several times in case of failure"
|
echo " retry retry removal several times in case of failure"
|
||||||
echo " wholevg deactivate the whole VG when processing an LV"
|
echo " wholevg deactivate the whole VG when processing an LV"
|
||||||
|
echo " MDRAID_OPTIONS:"
|
||||||
|
echo " wait wait for resync, recovery or reshape to complete first"
|
||||||
echo " MPATH_OPTIONS:"
|
echo " MPATH_OPTIONS:"
|
||||||
echo " disablequeueing disable queueing on all DM-multipath devices first"
|
echo " disablequeueing disable queueing on all DM-multipath devices first"
|
||||||
|
|
||||||
@ -275,6 +281,7 @@ deactivate_lvm () {
|
|||||||
|
|
||||||
deactivate_md () {
|
deactivate_md () {
|
||||||
local name=$(printf "%s" "$name")
|
local name=$(printf "%s" "$name")
|
||||||
|
local sync_action
|
||||||
test -b "$DEV_DIR/$name" || return 0
|
test -b "$DEV_DIR/$name" || return 0
|
||||||
test -z "${SKIP_DEVICE_LIST["$kname"]}" || return 1
|
test -z "${SKIP_DEVICE_LIST["$kname"]}" || return 1
|
||||||
|
|
||||||
@ -287,6 +294,19 @@ deactivate_md () {
|
|||||||
deactivate_holders "$DEV_DIR/$name" || return 1
|
deactivate_holders "$DEV_DIR/$name" || return 1
|
||||||
|
|
||||||
echo -n " [MD]: deactivating $devtype device $kname... "
|
echo -n " [MD]: deactivating $devtype device $kname... "
|
||||||
|
|
||||||
|
test "$MDRAID_DO_WAIT" -eq 1 && {
|
||||||
|
sync_action="$(cat $SYS_BLK_DIR/$kname/md/sync_action)"
|
||||||
|
test "$sync_action" != "idle" && {
|
||||||
|
echo -n "$sync_action action in progress... "
|
||||||
|
if eval "$MDADM" $MDADM_OPTS -W "$DEV_DIR/$kname" "$OUT" "$ERR"; then
|
||||||
|
echo -n "complete... "
|
||||||
|
else
|
||||||
|
test $? -ne 1 && echo -n "failed to wait for $sync_action action... "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if eval "$MDADM" $MDADM_OPTS -S "$name" "$OUT" "$ERR"; then
|
if eval "$MDADM" $MDADM_OPTS -S "$name" "$OUT" "$ERR"; then
|
||||||
echo "done"
|
echo "done"
|
||||||
else
|
else
|
||||||
@ -427,6 +447,20 @@ get_lvmopts() {
|
|||||||
IFS=$ORIG_IFS
|
IFS=$ORIG_IFS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_mdraidopts() {
|
||||||
|
ORIG_IFS=$IFS; IFS=','
|
||||||
|
|
||||||
|
for opt in $1; do
|
||||||
|
case "$opt" in
|
||||||
|
"") ;;
|
||||||
|
"wait") MDRAID_DO_WAIT=1 ;;
|
||||||
|
*) echo "$opt: unknown MD RAID option"
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS=$ORIG_IFS
|
||||||
|
}
|
||||||
|
|
||||||
get_mpathopts() {
|
get_mpathopts() {
|
||||||
ORIG_IFS=$IFS; IFS=','
|
ORIG_IFS=$IFS; IFS=','
|
||||||
|
|
||||||
@ -489,6 +523,7 @@ while test $# -ne 0; do
|
|||||||
"-d"|"--dmoptions") get_dmopts "$2" ; shift ;;
|
"-d"|"--dmoptions") get_dmopts "$2" ; shift ;;
|
||||||
"-l"|"--lvmoptions") get_lvmopts "$2" ; shift ;;
|
"-l"|"--lvmoptions") get_lvmopts "$2" ; shift ;;
|
||||||
"-m"|"--mpathoptions") get_mpathopts "$2" ; shift ;;
|
"-m"|"--mpathoptions") get_mpathopts "$2" ; shift ;;
|
||||||
|
"-r"|"--mdraidoptions") get_mdraidopts "$2"; shift ;;
|
||||||
"-u"|"--umount") DO_UMOUNT=1 ;;
|
"-u"|"--umount") DO_UMOUNT=1 ;;
|
||||||
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
|
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
|
||||||
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
|
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user