# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1169220221 0
# Node ID dcb145f858e32a1d310a5558d4e12bb0521a625d
# Parent 9a0b157a0ab0f0472dcfd08be69a5e16edf4143d
Add resumedomain domctl to resume a domain after checkpoint.
Export resumedomain domctl to libxc, xend.
Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
---
tools/libxc/xc_domain.c | 10 ++++++++++
tools/libxc/xenctrl.h | 12 ++++++++++++
tools/python/xen/lowlevel/xc/xc.c | 11 +++++++++++
tools/python/xen/xend/XendDomainInfo.py | 9 +++++++++
xen/common/domctl.c | 17 +++++++++++++++++
xen/include/public/domctl.h | 1 +
6 files changed, 60 insertions(+)
diff -r 9a0b157a0ab0 -r dcb145f858e3 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Fri Jan 19 15:11:44 2007 +0000
+++ b/tools/libxc/xc_domain.c Fri Jan 19 15:23:41 2007 +0000
@@ -86,6 +86,16 @@ int xc_domain_shutdown(int xc_handle,
out1:
return ret;
+}
+
+
+int xc_domain_resume(int xc_handle,
+ uint32_t domid)
+{
+ DECLARE_DOMCTL;
+ domctl.cmd = XEN_DOMCTL_resumedomain;
+ domctl.domain = (domid_t)domid;
+ return do_domctl(xc_handle, &domctl);
}
diff -r 9a0b157a0ab0 -r dcb145f858e3 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Fri Jan 19 15:11:44 2007 +0000
+++ b/tools/libxc/xenctrl.h Fri Jan 19 15:23:41 2007 +0000
@@ -236,6 +236,18 @@ int xc_domain_destroy(int xc_handle,
int xc_domain_destroy(int xc_handle,
uint32_t domid);
+
+/**
+ * This function resumes a suspended domain. The domain should have
+ * been previously suspended.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm domid the domain id to resume
+ * return 0 on success, -1 on failure
+ */
+int xc_domain_resume(int xc_handle,
+ uint32_t domid);
+
/**
* This function will shutdown a domain. This is intended for use in
* fully-virtualized domains where this operation is analogous to the
diff -r 9a0b157a0ab0 -r dcb145f858e3 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 15:11:44 2007 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 15:23:41 2007 +0000
@@ -174,6 +174,10 @@ static PyObject *pyxc_domain_shutdown(Xc
return zero;
}
+static PyObject *pyxc_domain_resume(XcObject *self, PyObject *args)
+{
+ return dom_op(self, args, xc_domain_resume);
+}
static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
PyObject *args,
@@ -1041,6 +1045,13 @@ static PyMethodDef pyxc_methods[] = {
METH_VARARGS, "\n"
"Destroy a domain.\n"
" dom [int]: Identifier of domain to be destroyed.\n\n"
+ "Returns: [int] 0 on success; -1 on error.\n" },
+
+ { "domain_resume",
+ (PyCFunction)pyxc_domain_resume,
+ METH_VARARGS, "\n"
+ "Resume execution of a suspended domain.\n"
+ " dom [int]: Identifier of domain to be resumed.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_shutdown",
diff -r 9a0b157a0ab0 -r dcb145f858e3 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Jan 19 15:11:44 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Jan 19 15:23:41 2007 +0000
@@ -1539,6 +1539,15 @@ class XendDomainInfo:
self.cleanupDomain()
+ def resumeDomain(self):
+ log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid))
+
+ try:
+ if self.domid is not None:
+ xc.domain_resume(self.domid)
+ except:
+ log.exception("XendDomainInfo.resume: xc.domain_resume failed on
domain %s." % (str(self.domid)))
+
#
# Channels for xenstore and console
#
diff -r 9a0b157a0ab0 -r dcb145f858e3 xen/common/domctl.c
--- a/xen/common/domctl.c Fri Jan 19 15:11:44 2007 +0000
+++ b/xen/common/domctl.c Fri Jan 19 15:23:41 2007 +0000
@@ -286,6 +286,23 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
}
break;
+ case XEN_DOMCTL_resumedomain:
+ {
+ struct domain *d = find_domain_by_id(op->domain);
+ struct vcpu *v;
+
+ ret = -ESRCH;
+ if ( d != NULL )
+ {
+ ret = 0;
+ if ( test_and_clear_bit(_DOMF_shutdown, &d->domain_flags) )
+ for_each_vcpu ( d, v )
+ vcpu_wake(v);
+ put_domain(d);
+ }
+ }
+ break;
+
case XEN_DOMCTL_createdomain:
{
struct domain *d;
diff -r 9a0b157a0ab0 -r dcb145f858e3 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Fri Jan 19 15:11:44 2007 +0000
+++ b/xen/include/public/domctl.h Fri Jan 19 15:23:41 2007 +0000
@@ -63,6 +63,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_creat
#define XEN_DOMCTL_destroydomain 2
#define XEN_DOMCTL_pausedomain 3
#define XEN_DOMCTL_unpausedomain 4
+#define XEN_DOMCTL_resumedomain 27
#define XEN_DOMCTL_getdomaininfo 5
struct xen_domctl_getdomaininfo {
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|