|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] NetBSD hotplug: fix block unconfigure on destroy
commit 82ed3155fe72a7e15ab28f86a3c1eb970a92d2f6
Author: Manuel Bouyer <bouyer@xxxxxxxxxx>
AuthorDate: Tue Jan 26 23:47:49 2021 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jan 29 22:50:08 2021 +0000
NetBSD hotplug: fix block unconfigure on destroy
When a domain is destroyed, xparams may not be available any more when
the block script is called to unconfigure the vnd.
Check xparam only at configure time, and just unconfigure any vnd present
in the xenstore.
Signed-off-by: Manuel Bouyer <bouyer@xxxxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
tools/hotplug/NetBSD/block | 37 ++++++++++++++-----------------------
1 file changed, 14 insertions(+), 23 deletions(-)
diff --git a/tools/hotplug/NetBSD/block b/tools/hotplug/NetBSD/block
index 0acaab10ec..eb5e80d640 100644
--- a/tools/hotplug/NetBSD/block
+++ b/tools/hotplug/NetBSD/block
@@ -21,37 +21,28 @@ error() {
xpath=$1
xstatus=$2
xparams=$(xenstore-read "$xpath/params")
-if [ -b "$xparams" ]; then
- xtype="phy"
-elif [ -f "$xparams" ]; then
- xtype="file"
-elif [ -z "$xparams" ]; then
- error "$xpath/params is empty, unable to attach block device."
-else
- error "$xparams is not a valid file type to use as block device." \
- "Only block and regular image files accepted."
-fi
case $xstatus in
6)
# device removed
- case $xtype in
- file)
- vnd=$(xenstore-read "$xpath/vnd" || echo none)
- if [ $vnd != none ]; then
- vnconfig -u $vnd
- fi
- ;;
- phy)
- ;;
- *)
- echo "unknown type $xtype" >&2
- ;;
- esac
+ vnd=$(xenstore-read "$xpath/vnd" || echo none)
+ if [ $vnd != none ]; then
+ vnconfig -u $vnd
+ fi
xenstore-rm $xpath
exit 0
;;
2)
+ if [ -b "$xparams" ]; then
+ xtype="phy"
+ elif [ -f "$xparams" ]; then
+ xtype="file"
+ elif [ -z "$xparams" ]; then
+ error "$xpath/params is empty, unable to attach block device."
+ else
+ error "$xparams is not a valid file type to use as block
device." \
+ "Only block and regular image files accepted."
+ fi
case $xtype in
file)
# Store the list of available vnd(4) devices in
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |