Skip to contentSkip to conversation

hotplug/NetBSD: remaining block script fixes

PATCH In review Roger Pau Monne 3 participants 6 messages Aug 23, 2012 – Aug 31, 2012

lore
Share & tools
lore
#0 lore raw

cover hotplug/NetBSD: remaining block script fixes

Remaining patches from the hotplug script series for NetBSD. Expanded with Ian Campbell recommendations.

The xenstore_write fix has been moved to a pre-patch, and the error function has been expanded to write the script error to hotplug-error (in a pre-patch also).

Thanks for the review.

#1 lore raw

PATCH 1/3 hotplug/NetBSD: fix xenstore_write usage in error

xenstore_write doesn't exist, use xenstore-write instead. The error function is currently broken without this change.

---
 tools/hotplug/NetBSD/block |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/hotplug/NetBSD/block +1 -1
index cf5ff3a..28135f5 100644
@@ -12,7 +12,7 @@ export PATH
 
 error() {
 	echo "$@" >&2
-	xenstore_write $xpath/hotplug-status error
+	xenstore-write $xpath/hotplug-status error
 	exit 1
 }
 	
Signature · 1 line
1.7.7.5 (Apple Git-26)
#2 lore raw

PATCH 2/3 hotplug/NetBSD: write error message to hotplug-error

In reply to Roger Pau Monne

As recommended by Ian Campbell, write the hotplug error to hotplug-error, just as the Linux hotplug script does.

---
 tools/hotplug/NetBSD/block |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/hotplug/NetBSD/block +2 -1
index 28135f5..2c10ed7 100644
@@ -12,7 +12,8 @@ export PATH
 
 error() {
 	echo "$@" >&2
-	xenstore-write $xpath/hotplug-status error
+	xenstore-write $xpath/hotplug-status error \
+	               $xpath/hotplug-error "$@"
 	exit 1
 }
 	
Signature · 1 line
1.7.7.5 (Apple Git-26)
#3 lore raw

PATCH 3/3 hotplug/NetBSD: check type of file to attach from params

In reply to Roger Pau Monne

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.

---
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(-)
tools/hotplug/NetBSD/block +10 -1
index 2c10ed7..f1146b5 100644
@@ -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)
Signature · 1 line
1.7.7.5 (Apple Git-26)
Acked-by on the v1 series
#4 lore raw
In reply to Roger Pau Monne

Roger Pau Monne writes ("[Xen-devel] [PATCH 0/3] hotplug/NetBSD: remaining block script fixes"):

Quoted 6 lines

Remaining patches from the hotplug script series for NetBSD. Expanded with Ian Campbell recommendations.

The xenstore_write fix has been moved to a pre-patch, and the error function has been expanded to write the script error to hotplug-error (in a pre-patch also).

All three:

for 4.2.

Ia.

#5 lore raw
Quoted 8 lines · Ian Jackson

Roger Pau Monne writes ("[Xen-devel] [PATCH 0/3] hotplug/NetBSD: remaining block script fixes"):

Quoted 6 lines

Remaining patches from the hotplug script series for NetBSD. Expanded with Ian Campbell recommendations.

The xenstore_write fix has been moved to a pre-patch, and the error function has been expanded to write the script error to hotplug-error (in a pre-patch also).

Quoted 5 lines

All three:

for 4.2.

All applied, thanks.