Skip to contentSkip to conversation

Improve xm error if booted native

PATCH In review Jim Fehlig 2 participants 2 messages Feb 3, 2009 – Feb 4, 2009

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 Improve xm error if booted native

Another trivial "user experience" patch that's been requested one too many times ...

-----------------------------------------

How to reproduce:
i) boot default kernel (i.e. not xen kernel)
ii) run xm list

Actual Result:
calculon:/tmp # uname -a
Linux calculon.suse.cz 2.6.27.11-1-default #1 SMP 2009-01-14 23:28:13 +0100 x86_64 x86_64 x86_64 GNU/Linux
calculon:/tmp # xm list
ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
Traceback (most recent call last):
File "/usr/sbin/xm", line 8, in <module>
from xen.xm import main
File "/usr/lib64/python2.6/site-packages/xen/xm/main.py", line 61, in
<module>
xc = xen.lowlevel.xc.xc()
xen.lowlevel.xc.Error: (1, 'Internal error', 'Could not obtain handle on privileged command interface (2 = No such file or directory)') calculon:/tmp #

Expected result:
A more descriptive error message and no python traceback.

-----------------------------------------

Looking at the various xc_interface_open() impls in tools/libxc/xc_{linux,minios,netbsd,solaris}.c, it seems the most likely reason to fail is not booted xen. I added a comment in the error suggesting this to user, e.g.

xen67:~ # xm li
ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
Is xen kernel running?

The suggestion can go if you like but IMO we should suppress the traceback :-).

tools/python/xen/xm/main.py +5 -1
Index: xen-3.3.1-testing/tools/python/xen/xm/main.py
===================================================================
@@ -58,7 +58,11 @@ from xen.util.acmpolicy import ACM_LABEL
 import XenAPI
 
 import xen.lowlevel.xc
-xc = xen.lowlevel.xc.xc()
+try:
+    xc = xen.lowlevel.xc.xc()
+except Exception, ex:
+    print >>sys.stderr, ("Is xen kernel running?")
+    sys.exit(1)
 
 import inspect
 from xen.xend import XendOptions

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

#1 lore raw

hi jim/dexuan,

I think using xen.lowlevel.xc here is totally wrong.

xm is client that designed to run on any host.

we should first try to replace the xc with other other functions. or add a XenAPI/legacyAPI to use by xm.

thanks,

zhigang

Quoted 53 lines · Jim Fehlig

Another trivial "user experience" patch that's been requested one too many times ...

-----------------------------------------

How to reproduce:
i) boot default kernel (i.e. not xen kernel)
ii) run xm list

Actual Result:
calculon:/tmp # uname -a
Linux calculon.suse.cz 2.6.27.11-1-default #1 SMP 2009-01-14 23:28:13 +0100 x86_64 x86_64 x86_64 GNU/Linux
calculon:/tmp # xm list
ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
Traceback (most recent call last):
File "/usr/sbin/xm", line 8, in <module>
from xen.xm import main
File "/usr/lib64/python2.6/site-packages/xen/xm/main.py", line 61, in
<module>
xc = xen.lowlevel.xc.xc()
xen.lowlevel.xc.Error: (1, 'Internal error', 'Could not obtain handle on privileged command interface (2 = No such file or directory)') calculon:/tmp #

Expected result:
A more descriptive error message and no python traceback.

-----------------------------------------

Looking at the various xc_interface_open() impls in tools/libxc/xc_{linux,minios,netbsd,solaris}.c, it seems the most likely reason to fail is not booted xen. I added a comment in the error suggesting this to user, e.g.

xen67:~ # xm li
ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
Is xen kernel running?

The suggestion can go if you like but IMO we should suppress the traceback :-).

------------------------------------------------------------------------

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