ia64/xen-unstable

changeset 16799:2ac0fd9fd4b4

qemu-dm: Nicely terminate the device model script, to let it properly
clean resources.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 18 13:35:05 2008 +0000 (2008-01-18)
parents a1a3fe600ef3
children 80ea335cf209
files tools/ioemu/target-i386-dm/helper2.c tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Fri Jan 18 13:33:37 2008 +0000
     1.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Fri Jan 18 13:35:05 2008 +0000
     1.3 @@ -637,6 +637,7 @@ int main_loop(void)
     1.4      int evtchn_fd = xce_handle == -1 ? -1 : xc_evtchn_fd(xce_handle);
     1.5      char qemu_file[PATH_MAX];
     1.6      fd_set fds;
     1.7 +    int ret = 0;
     1.8  
     1.9      buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
    1.10  				       cpu_single_env);
    1.11 @@ -647,10 +648,15 @@ int main_loop(void)
    1.12  
    1.13      xenstore_record_dm_state("running");
    1.14      while (1) {
    1.15 -        while (!(vm_running && suspend_requested))
    1.16 +        while (!((vm_running && suspend_requested) || shutdown_requested))
    1.17              /* Wait up to 10 msec. */
    1.18              main_loop_wait(10);
    1.19  
    1.20 +        if (shutdown_requested) {
    1.21 +            ret = EXCP_INTERRUPT;
    1.22 +            break;
    1.23 +        }
    1.24 +
    1.25          fprintf(logfile, "device model saving state\n");
    1.26  
    1.27          /* Pull all outstanding ioreqs through the system */
    1.28 @@ -676,7 +682,7 @@ int main_loop(void)
    1.29          xenstore_record_dm_state("running");
    1.30      }
    1.31  
    1.32 -    return 0;
    1.33 +    return ret;
    1.34  }
    1.35  
    1.36  void destroy_hvm_domain(void)
     2.1 --- a/tools/python/xen/xend/image.py	Fri Jan 18 13:33:37 2008 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Fri Jan 18 13:35:05 2008 +0000
     2.3 @@ -321,7 +321,7 @@ class ImageHandler:
     2.4              return
     2.5          if self.pid:
     2.6              try:
     2.7 -                os.kill(self.pid, signal.SIGKILL)
     2.8 +                os.kill(self.pid, signal.SIGTERM)
     2.9              except OSError, exn:
    2.10                  log.exception(exn)
    2.11              try: