diff options
author | John V. Baboval <john.baboval@virtualcomputer.com> | 2012-05-17 10:33:09 +0000 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2012-05-17 10:52:38 +0000 |
commit | 180640ea071c98739b6cc55b8d03367bcb442b94 (patch) | |
tree | 85694bf55d7a9aec7cc732d0589372560b3afb34 /xen-all.c | |
parent | a4f1a7589ad0926fc8db1a6c56d1c3e015be565c (diff) |
Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
Signed-off-by: Tom Goetz <tom.goetz@virtualcomputer.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'xen-all.c')
-rw-r--r-- | xen-all.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -860,7 +860,7 @@ static void cpu_handle_ioreq(void *opaque) "data: %"PRIx64", count: %" FMT_ioreq_size ", size: %" FMT_ioreq_size "\n", req->state, req->data_is_ptr, req->addr, req->data, req->count, req->size); - destroy_hvm_domain(); + destroy_hvm_domain(false); return; } @@ -874,10 +874,11 @@ static void cpu_handle_ioreq(void *opaque) */ if (runstate_is_running()) { if (qemu_shutdown_requested_get()) { - destroy_hvm_domain(); + destroy_hvm_domain(false); } if (qemu_reset_requested_get()) { qemu_system_reset(VMRESET_REPORT); + destroy_hvm_domain(true); } } @@ -1163,7 +1164,7 @@ int xen_hvm_init(void) return 0; } -void destroy_hvm_domain(void) +void destroy_hvm_domain(bool reboot) { XenXC xc_handle; int sts; @@ -1172,12 +1173,15 @@ void destroy_hvm_domain(void) if (xc_handle == XC_HANDLER_INITIAL_VALUE) { fprintf(stderr, "Cannot acquire xenctrl handle\n"); } else { - sts = xc_domain_shutdown(xc_handle, xen_domid, SHUTDOWN_poweroff); + sts = xc_domain_shutdown(xc_handle, xen_domid, + reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff); if (sts != 0) { - fprintf(stderr, "? xc_domain_shutdown failed to issue poweroff, " - "sts %d, %s\n", sts, strerror(errno)); + fprintf(stderr, "xc_domain_shutdown failed to issue %s, " + "sts %d, %s\n", reboot ? "reboot" : "poweroff", + sts, strerror(errno)); } else { - fprintf(stderr, "Issued domain %d poweroff\n", xen_domid); + fprintf(stderr, "Issued domain %d %s\n", xen_domid, + reboot ? "reboot" : "poweroff"); } xc_interface_close(xc_handle); } |