* [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode
@ 2011-10-28 19:38 John Baboval
2011-11-07 16:43 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: John Baboval @ 2011-10-28 19:38 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode
2011-10-28 19:38 [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode John Baboval
@ 2011-11-07 16:43 ` Stefano Stabellini
2011-11-07 16:44 ` John Baboval
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2011-11-07 16:43 UTC (permalink / raw)
To: John Baboval; +Cc: qemu-devel@nongnu.org
On Fri, 28 Oct 2011, John Baboval wrote:
> Call xc_domain_shutdown with the reboot flag when the guest requests a
> reboot.
Thanks for the patch!
Sorry for the delay in replaying but away for XenSummit Asia.
> 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);
> + }
> +}
I think that what you are doing is correct but I couldn't help but
notice that reboot_hvm_domain is very similar to destroy_hvm_domain.
I would rather unify the two functions and have a single shutdown_domain
function with two arguments: a reboot/destroy argument and xc_handle
(we don't need to open a new one, we can reuse state->xce_handle).
Are you OK with submitting a new version of this patch with these
changes?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode
2011-11-07 16:43 ` Stefano Stabellini
@ 2011-11-07 16:44 ` John Baboval
0 siblings, 0 replies; 3+ messages in thread
From: John Baboval @ 2011-11-07 16:44 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: qemu-devel@nongnu.org
On 11/07/2011 11:43 AM, Stefano Stabellini wrote:
> On Fri, 28 Oct 2011, John Baboval wrote:
>> Call xc_domain_shutdown with the reboot flag when the guest requests a
>> reboot.
> Thanks for the patch!
> Sorry for the delay in replaying but away for XenSummit Asia.
>
>> 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);
>> + }
>> +}
> I think that what you are doing is correct but I couldn't help but
> notice that reboot_hvm_domain is very similar to destroy_hvm_domain.
> I would rather unify the two functions and have a single shutdown_domain
> function with two arguments: a reboot/destroy argument and xc_handle
> (we don't need to open a new one, we can reuse state->xce_handle).
> Are you OK with submitting a new version of this patch with these
> changes?
Sounds good to me. I have a huge backlog of stuff to debug and test
though, so it'll be a few days before I get to this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-07 16:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 19:38 [Qemu-devel] [PATCH 1/3] Support guest reboots when in Xen HVM mode John Baboval
2011-11-07 16:43 ` Stefano Stabellini
2011-11-07 16:44 ` John Baboval
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).