]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
hotplug/NetBSD: check type of file to attach from params
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 31 Aug 2012 09:42:07 +0000 (10:42 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Fri, 31 Aug 2012 09:42:07 +0000 (10:42 +0100)
xend used to set the xenbus backend entry "type" to either "phy" or
"file", but now libxl sets it to "phy" for both file and block device.
We have to manually check for the type of the "param" field in order
to detect if we are trying to attach a file or a block device.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/hotplug/NetBSD/block

index 2c10ed70ab5ed48103a865bb413bb48e0ee91fe8..f1146b51c1eb605ee03221812a9a5189cf555d67 100644 (file)
@@ -20,8 +20,17 @@ error() {
 
 xpath=$1
 xstatus=$2
-xtype=$(xenstore-read "$xpath/type")
 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)