ia64/xen-unstable

changeset 7346:1d8933fa01d2

Issue diagnostics if xm is being run as a non-root user. This used to happen,
but the triggering error has moved, so the diagnostics were broken.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Wed Oct 12 10:07:04 2005 +0100 (2005-10-12)
parents e89a7279d602
children 00a24908057f
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Wed Oct 12 09:34:27 2005 +0100
     1.2 +++ b/tools/python/xen/xm/main.py	Wed Oct 12 10:07:04 2005 +0100
     1.3 @@ -688,11 +688,16 @@ def main(argv=sys.argv):
     1.4              if rc:
     1.5                  usage()
     1.6          except socket.error, ex:
     1.7 -            print >>sys.stderr, ex
     1.8 -            err("Error connecting to xend, is xend running?")
     1.9 +            if os.geteuid() != 0:
    1.10 +                err("Most commands need root access.  Please try again as root.")
    1.11 +            else:
    1.12 +                err("Error connecting to xend: %s.  Is xend running?" % ex[1])
    1.13              sys.exit(1)
    1.14          except IOError:
    1.15 -            err("Most commands need root access.  Please try again as root")
    1.16 +            if os.geteuid() != 0:
    1.17 +                err("Most commands need root access.  Please try again as root.")
    1.18 +            else:
    1.19 +                err("Error connecting to xend: %s." % ex[1])
    1.20              sys.exit(1)
    1.21          except xen.xend.XendError.XendError, ex:
    1.22              if len(args) > 0: