[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hotplug/NetBSD: check type of file to attach from params


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 04 Sep 2012 14:44:10 +0000
  • Delivery-date: Tue, 04 Sep 2012 14:44:37 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxx>
# Date 1346406127 -3600
# Node ID e23bbadd1ad7fdaaee3a7355c20ba3c17e71d297
# Parent  e1f6699e54f4cd6d3c284913a332c4e9d648f550
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.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r e1f6699e54f4 -r e23bbadd1ad7 tools/hotplug/NetBSD/block
--- a/tools/hotplug/NetBSD/block        Fri Aug 31 10:42:06 2012 +0100
+++ b/tools/hotplug/NetBSD/block        Fri Aug 31 10:42:07 2012 +0100
@@ -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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.