ia64/xen-unstable

changeset 19725:265de5701b82

xm: Don't die when trying to conect the console to short-lived domains

As observed by Mick Joran, if short-lived domain exits cleanly
then os.waitpid() will throw the following exception. This appears
to be because the child process that is used to start the domain
has detached from its parent.

OSError: [Errno 10] No child processes

Cc: Mick Jordan <Mick.Jordan@sun.com>
Signed-off-by: Simon Horman <horms@verge.ent.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:46:13 2009 +0100 (2009-06-04)
parents 2c1d94eb996f
children d8b7b51f482b
files tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Thu Jun 04 10:45:24 2009 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Thu Jun 04 10:46:13 2009 +0100
     1.3 @@ -1400,6 +1400,13 @@ def do_console(domain_name):
     1.4          for i in range(10):
     1.5              # Catch failure of the create process 
     1.6              time.sleep(1)
     1.7 +            try:
     1.8 +                (p, rv) = os.waitpid(cpid, os.WNOHANG)
     1.9 +            except OSError:
    1.10 +                # Domain has started cleanly and then exiting,
    1.11 +                # the child process used to do this has detached
    1.12 +                print("Domain has already finished");
    1.13 +                break
    1.14              (p, rv) = os.waitpid(cpid, os.WNOHANG)
    1.15              if os.WIFEXITED(rv):
    1.16                  if os.WEXITSTATUS(rv) != 0: