From patchwork Fri Oct 28 19:38:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baboval X-Patchwork-Id: 122489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 15FDBB6F81 for ; Sat, 29 Oct 2011 06:38:43 +1100 (EST) Received: from localhost ([::1]:36461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJsG6-0006dk-86 for incoming@patchwork.ozlabs.org; Fri, 28 Oct 2011 15:38:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJsFy-0006Vn-8r for qemu-devel@nongnu.org; Fri, 28 Oct 2011 15:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJsFx-00033w-27 for qemu-devel@nongnu.org; Fri, 28 Oct 2011 15:38:22 -0400 Received: from server514d.exghost.com ([72.32.253.69]:2238 helo=server514.appriver.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJsFw-00033p-Qe for qemu-devel@nongnu.org; Fri, 28 Oct 2011 15:38:20 -0400 X-Note-AR-ScanTimeLocal: 10/28/2011 2:38:19 PM X-Policy: GLOBAL - virtualcomputer.com X-Primary: john.baboval@virtualcomputer.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: @virtualcomputer.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: PRIVATE->UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 72.32.253.65 X-Note-Reverse-DNS: X-Note-WHTLIST: john.baboval@virtualcomputer.com X-Note: User Rule Hits: X-Note: Global Rule Hits: G211 G212 G213 G214 G218 G219 G230 G320 X-Note: Encrypt Rule Hits: X-Note: Mail Class: ALLOWEDSENDER X-Note: Headers Injected Received: from [72.32.253.65] (HELO FE03.exg4.exghost.com) by server514.appriver.com (CommuniGate Pro SMTP 5.4.1) with ESMTP id 182779469 for qemu-devel@nongnu.org; Fri, 28 Oct 2011 14:38:19 -0500 Received: from FE03.exg4.exghost.com ([72.32.253.150]) by FE03.exg4.exghost.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 28 Oct 2011 14:38:19 -0500 Received: from [10.1.1.240] ([67.192.118.153]) by FE03.exg4.exghost.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 28 Oct 2011 14:38:18 -0500 Message-ID: <4EAB04A9.9080509@virtualcomputer.com> Date: Fri, 28 Oct 2011 15:38:17 -0400 From: John Baboval User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 To: qemu-devel@nongnu.org X-OriginalArrivalTime: 28 Oct 2011 19:38:19.0087 (UTC) FILETIME=[25124DF0:01CC95A9] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-Received-From: 72.32.253.69 Subject: [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Call xc_domain_shutdown with the reboot flag when the guest requests a reboot. Signed-off-by: John V. Baboval Signed-off-by: Tom Goetz --- xen-all.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) xc_interface_close(xc_handle); } } + +void reboot_hvm_domain(void) +{ + XenXC xc_handle; + int sts; + + xc_handle = xen_xc_interface_open(0, 0, 0); + if (xc_handle == XC_HANDLER_INITIAL_VALUE) { + fprintf(stderr, "Cannot acquire xenctrl handle\n"); + } else { + sts = xc_domain_shutdown(xc_handle, xen_domid, SHUTDOWN_reboot); + if (sts != 0) { + fprintf(stderr, "? xc_domain_shutdown failed to issue reboot, " + "sts %d, %s\n", sts, strerror(errno)); + } else { + fprintf(stderr, "Issued domain %d reboot\n", xen_domid); + } + xc_interface_close(xc_handle); + } +} + diff --git a/xen-all.c b/xen-all.c index b5e28ab..cd71b24 100644 --- a/xen-all.c +++ b/xen-all.c @@ -742,6 +742,7 @@ static void cpu_handle_ioreq(void *opaque) } if (qemu_reset_requested_get()) { qemu_system_reset(VMRESET_REPORT); + reboot_hvm_domain(); } } @@ -979,3 +980,24 @@ void destroy_hvm_domain(void)