Add a mechanism to detect block device setup failure
PATCH 1/1 Add a mechanism to detect block device setup failure
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
@@ -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
@@ -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
@@ -54,3 +54,5 @@ ip r ${ipcmd} ${ip} dev ${vif} src ${main_ip} handle_iptable() + +success
tools/examples/vif-route +2 -0
@@ -46,3 +46,5 @@ fi handle_iptable() + +success
tools/examples/xen-hotplug-common.sh +6 -0
@@ -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
Quoted 4 lines · Murillo Fernandes Bernardes
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.
Quoted 8 lines
I handling this problem in the way suggested by aliguori:
- hotplug scripts write a "hotplug-status" node on store
- XendDevController.createDevice()check verify this node and return success or throw an exception on failure.
- If no changes in "hotplug-status" node afterDEVICE_CREATE_TIMEOUTseconds Xend throw an exception showing the problem with hotplug scripts.Comments?
Thanks a lot for this, Murillo. I have a concern that this patch only protects us against failure of hotplugging, and not, for example, a failure of the backend driver, but it's certainly a good step in the right direction, so I've applied it. I'll be working myself in this area over the next day or two to improve this further.
Thanks again,
Ewan.