uvol: fix emmitting ubus event when removing UBI volume
In case a volume which is down is removed, no ubus event needs to be fired. Don't try. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
794cf3ac59
commit
816c41b6fc
2 changed files with 4 additions and 3 deletions
|
@ -119,14 +119,14 @@ removevol() {
|
||||||
local voldev=$(getdev "$@")
|
local voldev=$(getdev "$@")
|
||||||
local evdata
|
local evdata
|
||||||
[ "$voldev" ] || return 2
|
[ "$voldev" ] || return 2
|
||||||
local volnum=${voldev#${ubidev}_}
|
|
||||||
if vol_is_mode $voldev rw ; then
|
if vol_is_mode $voldev rw ; then
|
||||||
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/$voldev\"}"
|
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/$voldev\"}"
|
||||||
elif vol_is_mode $voldev ro ; then
|
elif vol_is_mode $voldev ro && [ -e "/dev/ubiblock${voldev:3}" ]; then
|
||||||
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/ubiblock${voldev:3}\"}"
|
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/ubiblock${voldev:3}\"}"
|
||||||
fi
|
fi
|
||||||
|
local volnum=${voldev#${ubidev}_}
|
||||||
ubirmvol /dev/$ubidev -n $volnum || return $?
|
ubirmvol /dev/$ubidev -n $volnum || return $?
|
||||||
ubus send block.volume "$evdata"
|
[ "$evdata" ] && ubus send block.volume "$evdata"
|
||||||
}
|
}
|
||||||
|
|
||||||
activatevol() {
|
activatevol() {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# uvol prototype
|
# uvol prototype
|
||||||
# future development roadmap (aka. to-do):
|
# future development roadmap (aka. to-do):
|
||||||
# * re-implement in C (use libubox, execve lvm/ubi*)
|
# * re-implement in C (use libubox, execve lvm/ubi*)
|
||||||
|
# * hash to validate volume while writing
|
||||||
# * add atomic batch processing for use by container/package manager
|
# * add atomic batch processing for use by container/package manager
|
||||||
|
|
||||||
if [ -z "$1" ]; then cat <<EOF
|
if [ -z "$1" ]; then cat <<EOF
|
||||||
|
|
Loading…
Reference in a new issue