Skip to contentSkip to conversation

Add a mechanism to detect block device setup failure

PATCH New Murillo Fernandes Bernardes 1 participant 1 message Oct 28, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a mechanism to detect block device setup failure

Hi

The problem is: There is no mechanism to detect block device setup failure

Network devices have the same problem, and are fixed with this too.

I handling this problem in the way suggested by aliguori:
- hotplug scripts write a "hotplug-status" node on store
- Xend DevController.createDevice() check verify this node and return success or throw an exception on failure.
- If no changes in "hotplug-status" node after DEVICE_CREATE_TIMEOUT seconds Xend throw an exception showing the problem with hotplug scripts.

Comments?

Regards

Signature · 1 line
Murillo Fernandes Bernardes
tools/examples/block-common.sh +8 -1
diff -r 20d1a79ebe31 tools/examples/block-common.sh
@@ -42,10 +42,17 @@
   local major
   local minor
   local pdev
-	
+
   major=$(stat -L -c %t "$1")
   minor=$(stat -L -c %T "$1")
+  
+  if [ -z $major  -o -z $minor ]; then
+    fatal "Backend device does not exist"
+  fi
+  
   pdev=$(printf "0x%02x%02x" "0x$major" "0x$minor")
   xenstore_write "$XENBUS_PATH"/physical-device "$pdev" \
                  "$XENBUS_PATH"/node "$1"
+		 
+  success
 }
tools/examples/vif-bridge +2 -0
diff -r 20d1a79ebe31 tools/examples/vif-bridge
@@ -45,6 +45,7 @@
           fatal "brctl addif $bridge $vif failed"
 
         ifconfig "$vif" up || fatal "ifconfig $vif up failed"
+        success
         ;;
     down)
         # vifs are auto-removed from bridge.
@@ -55,3 +56,4 @@
 handle_iptable
 
 log debug "vif-bridge operation for $vif successful."
+
tools/examples/vif-nat +2 -0
diff -r 20d1a79ebe31 tools/examples/vif-nat
@@ -54,3 +54,5 @@
 ip r ${ipcmd} ${ip} dev ${vif} src ${main_ip}
 
 handle_iptable()
+
+success
tools/examples/vif-route +2 -0
diff -r 20d1a79ebe31 tools/examples/vif-route
@@ -46,3 +46,5 @@
 fi
 
 handle_iptable()
+
+success
tools/examples/xen-hotplug-common.sh +6 -0
diff -r 20d1a79ebe31 tools/examples/xen-hotplug-common.sh
@@ -29,8 +29,14 @@
 }
 
 fatal() {
+  xenstore_write "$XENBUS_PATH"/hotplug-status error
   log err "$@"
   exit 1
+}
+
+success() {
+  # Tell DevController that backend is "connected"
+  xenstore_write "$XENBUS_PATH"/hotplug-status connected
 }
 
 xenstore_read() {
tools/python/xen/xend/server/DevController.py +43 -1

67 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel