Re: [Xen-ia64-devel] [PATCH] add SATA support in x86_64 and fix error handling in xm create

2006-05-23 Thread Daniel Miles
On Mon, 2006-05-22 at 17:59 -0600, Alex Williamson wrote:

Did you mean to send this to xen-devel?
heh... yes, I did. I apologize.


signature.asc
Description: This is a digitally signed message part
___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel

[Xen-ia64-devel] [PATCH] add SATA support in x86_64 and fix error handling in xm create

2006-05-22 Thread Daniel Miles
This patch changes two files: First, the x86_64 build config file,
turning on SATA support. Second, tools/python/xen/xm/create.py. In the
tools/python/xen/xm directory, main.py has good error messages that let
the user know what failed; the other 'sub-command' classes don't always
have such good messages which can lead to some inexplicable failures by
the user-space tools.

Standard practice is to except each error by type and react accordingly
but in case the programmer does not anticipate a type of exception,
standard practice is to put in a catch-all exception handler that
excepts an 'Exception' object. Often in this case, the system will print
out the exception and exit.

If a sub-command excepts an 'Exception' object and the error is not
specific to that sub-command, it should pass the exception up for main
to handle. Especially in light of the fact that there is already a broad
collection of good error messages in main, I believe that this will lead
to better code re-use in the form of a one-stop-shop for error messages.

In this patch I've changed only one of the general case exception
handlers in one of the sub-commands (xm create) as a test-balloon to see
if the xen community will accept future patches of this type.

Singed-off-by: Daniel Miles [EMAIL PROTECTED]
diff -r 7cbc1fc8dbea buildconfigs/linux-defconfig_xen_x86_64
--- a/buildconfigs/linux-defconfig_xen_x86_64	Tue May 16 18:54:41 2006
+++ b/buildconfigs/linux-defconfig_xen_x86_64	Mon May 22 17:23:31 2006
@@ -934,8 +934,8 @@
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
-# CONFIG_BLK_DEV_IDE_SATA is not set
-# CONFIG_BLK_DEV_HD_IDE is not set
+CONFIG_BLK_DEV_IDE_SATA=y
+CONFIG_BLK_DEV_HD_IDE=y
 CONFIG_BLK_DEV_IDEDISK=m
 CONFIG_IDEDISK_MULTI_MODE=y
 # CONFIG_BLK_DEV_IDECS is not set
diff -r 7cbc1fc8dbea tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py	Tue May 16 18:54:41 2006
+++ b/tools/python/xen/xm/create.py	Mon May 22 17:23:31 2006
@@ -903,10 +903,15 @@
 else:
 err(%s % ex.faultString)
 except Exception, ex:
+#main.py has good error messages that let the user know what failed.
+#unless the error is a create.py specific thing, it should be handled
+#at main. The purpose of this general-case 'Exception' handler is to
+#clean up create.py specific processes/data but since create.py does
+#not know what to do with the error, it should pass it up.
 import signal
 if vncpid:
 os.kill(vncpid, signal.SIGKILL)
-err(str(ex))
+raise ex
 
 dom = sxp.child_value(dominfo, 'name')
 


signature.asc
Description: This is a digitally signed message part
___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel

Re: [Xen-ia64-devel] [PATCH] add SATA support in x86_64 and fix error handling in xm create

2006-05-22 Thread Aron Griffis
Hi Dan,

Daniel Miles wrote:  [Mon May 22 2006, 07:47:16PM EDT]
 -# CONFIG_BLK_DEV_IDE_SATA is not set
 -# CONFIG_BLK_DEV_HD_IDE is not set
 +CONFIG_BLK_DEV_IDE_SATA=y
 +CONFIG_BLK_DEV_HD_IDE=y

Are you sure this is what you want?  BLK_DEV_IDE_SATA is deprecated in
favor of libsata.  (Search for SCSI_SATA in menuconfig to see what I'm
referring to.)

 +#main.py has good error messages that let the user know what failed.
 +#unless the error is a create.py specific thing, it should be handled
 +#at main. The purpose of this general-case 'Exception' handler is to
 +#clean up create.py specific processes/data but since create.py does
 +#not know what to do with the error, it should pass it up.

Style request: could you put a space between the comment marker (#)
and the comment?

Aron


pgpIWEnb5imKt.pgp
Description: PGP signature
___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel