[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC/WIP 3/4] libxl: add SHUTDOWN_kexec state support



Add kexec to domain suspend state and treat a domain as already suspended
and successfully responded to suspend request if the flag is set.

Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
---
 tools/libxl/libxl.c          | 1 +
 tools/libxl/libxl.h          | 1 +
 tools/libxl/libxl_dom.c      | 6 ++++++
 tools/libxl/libxl_internal.h | 1 +
 4 files changed, 9 insertions(+)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 2d29ad2..0ba3285 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -786,6 +786,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, 
int fd, int flags,
     dss->type = type;
     dss->live = flags & LIBXL_SUSPEND_LIVE;
     dss->debug = flags & LIBXL_SUSPEND_DEBUG;
+    dss->kexec = flags & LIBXL_SUSPEND_KEXEC;
 
     libxl__domain_suspend(egc, dss);
     return AO_INPROGRESS;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 06bbca6..c8185f9 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -689,6 +689,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, 
int fd,
                          LIBXL_EXTERNAL_CALLERS_ONLY;
 #define LIBXL_SUSPEND_DEBUG 1
 #define LIBXL_SUSPEND_LIVE 2
+#define LIBXL_SUSPEND_KEXEC 4
 
 /* @param suspend_cancel [from xenctrl.h:xc_domain_resume( @param fast )]
  *   If this parameter is true, use co-operative resume. The guest
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 69e6088..b2f3a09 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1038,6 +1038,12 @@ int libxl__domain_suspend_common_callback(void *user)
     /* Convenience aliases */
     const uint32_t domid = dss->domid;
 
+    if (dss->kexec) {
+        /* No suspend required if we're in SHUTDOWN_kexec */
+        dss->guest_responded = 1;
+        goto guest_suspended;
+    }
+
     if (dss->hvm) {
         xc_get_hvm_param(CTX->xch, domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv);
         xc_get_hvm_param(CTX->xch, domid, HVM_PARAM_ACPI_S_STATE, 
&hvm_s_state);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 9d17586..cdef241 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2314,6 +2314,7 @@ struct libxl__domain_suspend_state {
     libxl_domain_type type;
     int live;
     int debug;
+    int kexec;
     const libxl_domain_remus_info *remus;
     /* private */
     xc_evtchn *xce; /* event channel handle */
-- 
1.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.