[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/3] hotplug/NetBSD: check type of file to attach from params
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. Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> --- Changes since v4: * Push the xenstore_write fix to a separate pre-patch Changes since v3: * Add $xparams (that contains the path to the disk file) to the error message. Changes since v2: * Better error messages. * Check if params is empty. * Replace xenstore_write with xenstore-write in error function. * Add quotation marks to xparams when testing. Changes since v1: * Check that file is either a block special file or a regular file and report error otherwise. --- tools/hotplug/NetBSD/block | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/tools/hotplug/NetBSD/block b/tools/hotplug/NetBSD/block index 2c10ed7..f1146b5 100644 --- a/tools/hotplug/NetBSD/block +++ b/tools/hotplug/NetBSD/block @@ -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) -- 1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |