Add resumedomain domctl to resume a domain after checkpoint.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 19 Jan 2007 15:23:41 +0000 (15:23 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 19 Jan 2007 15:23:41 +0000 (15:23 +0000)
Export resumedomain domctl to libxc, xend.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
tools/libxc/xc_domain.c
tools/libxc/xenctrl.h
tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/xend/XendDomainInfo.py
xen/common/domctl.c
xen/include/public/domctl.h

index 9a156ebba40b3bcb2ddfc9bb1c0f07433a9dee79..98e909d0a3d4102e13a7c3f4c3b810e5b2dec416 100644 (file)
@@ -89,6 +89,16 @@ int xc_domain_shutdown(int xc_handle,
 }
 
 
+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);
+}
+
+
 int xc_vcpu_setaffinity(int xc_handle,
                         uint32_t domid,
                         int vcpu,
index a5df681e3edad0e44f488917b7edc4d831ade30d..715764ac6e434bbbbcb0dcc601af22f14f2da81b 100644 (file)
@@ -236,6 +236,18 @@ int xc_domain_unpause(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
index fb6ee675d990e7a6abaf86244ba06cfc409bdbb6..a95b7d9bf8e5786e6f1b4cfe41a8fb2c8fc56691 100644 (file)
@@ -174,6 +174,10 @@ static PyObject *pyxc_domain_shutdown(XcObject *self, PyObject *args)
     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,
@@ -1042,6 +1046,13 @@ static PyMethodDef pyxc_methods[] = {
       "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", 
       (PyCFunction)pyxc_domain_shutdown,
index 27cba0049c00fc25c4abf3aef3423ec7f4a6d9a8..087ff0e5aaa47f4909365c26a4e46af7fb959e52 100644 (file)
@@ -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
     # 
index 230d2049121b0f85f73a0f5e1ee0506249d9ae32..a374b1ca326a171e3f1fcded391815e102fc8668 100644 (file)
@@ -286,6 +286,23 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
     }
     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;
index 0a75ef7a20def46cd11cf4620757e7945f7f1a76..fcf4fa0211c3bcc1025ccc1950f0cf5fc63219fe 100644 (file)
@@ -63,6 +63,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 #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 {