ia64/xen-unstable

changeset 5863:9b436c6bf2bd

This patch prevents you from getting a screen full of stack trace when
trying to run commands like xm list as a normal user, and instead provides a
helpful error message.

Signed-off-by: Sean Dague <sean@dague.net>
author kaf24@firebug.cl.cam.ac.uk
date Tue Jul 26 15:16:39 2005 +0000 (2005-07-26)
parents 6c24d2b4f3ea
children 6ac24e8a6ec4 c1c9a281eac2
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Tue Jul 26 15:16:12 2005 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Tue Jul 26 15:16:39 2005 +0000
     1.3 @@ -11,6 +11,13 @@ warnings.filterwarnings('ignore', catego
     1.4  
     1.5  from xen.xend import PrettyPrint
     1.6  from xen.xend import sxp
     1.7 +# this is a nasty place to stick this in, but required because
     1.8 +# log file access is set up via a 5 deep import chain.  This
     1.9 +# ensures the user sees a useful message instead of a stack trace
    1.10 +if os.getuid() != 0:
    1.11 +    print "xm requires root access to execute, please try again as root"
    1.12 +    sys.exit(1)
    1.13 +
    1.14  from xen.xend.XendClient import XendError, server
    1.15  from xen.xend.XendClient import main as xend_client_main
    1.16  from xen.xm import create, destroy, migrate, shutdown, sysrq