qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Baboval <john.baboval@virtualcomputer.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode
Date: Fri, 28 Oct 2011 15:38:17 -0400	[thread overview]
Message-ID: <4EAB04A9.9080509@virtualcomputer.com> (raw)

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>
---
  xen-all.c |   22 ++++++++++++++++++++++
  1 files changed, 22 insertions(+), 0 deletions(-)

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)
          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);
+    }
+}
+
-- 
1.7.4.1

             reply	other threads:[~2011-10-28 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 19:38 John Baboval [this message]
2011-11-07 16:43 ` [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode Stefano Stabellini
2011-11-07 16:44   ` John Baboval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EAB04A9.9080509@virtualcomputer.com \
    --to=john.baboval@virtualcomputer.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).