ia64/xen-unstable

changeset 13530:dcb145f858e3

Add resumedomain domctl to resume a domain after checkpoint.
Export resumedomain domctl to libxc, xend.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
author kfraser@localhost.localdomain
date Fri Jan 19 15:23:41 2007 +0000 (2007-01-19)
parents 9a0b157a0ab0
children 9a1809ce711b 56228886421d
files 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
line diff
     1.1 --- a/tools/libxc/xc_domain.c	Fri Jan 19 15:11:44 2007 +0000
     1.2 +++ b/tools/libxc/xc_domain.c	Fri Jan 19 15:23:41 2007 +0000
     1.3 @@ -89,6 +89,16 @@ int xc_domain_shutdown(int xc_handle,
     1.4  }
     1.5  
     1.6  
     1.7 +int xc_domain_resume(int xc_handle,
     1.8 +                      uint32_t domid)
     1.9 +{
    1.10 +    DECLARE_DOMCTL;
    1.11 +    domctl.cmd = XEN_DOMCTL_resumedomain;
    1.12 +    domctl.domain = (domid_t)domid;
    1.13 +    return do_domctl(xc_handle, &domctl);
    1.14 +}
    1.15 +
    1.16 +
    1.17  int xc_vcpu_setaffinity(int xc_handle,
    1.18                          uint32_t domid,
    1.19                          int vcpu,
     2.1 --- a/tools/libxc/xenctrl.h	Fri Jan 19 15:11:44 2007 +0000
     2.2 +++ b/tools/libxc/xenctrl.h	Fri Jan 19 15:23:41 2007 +0000
     2.3 @@ -236,6 +236,18 @@ int xc_domain_unpause(int xc_handle,
     2.4  int xc_domain_destroy(int xc_handle,
     2.5                        uint32_t domid);
     2.6  
     2.7 +
     2.8 +/**
     2.9 + * This function resumes a suspended domain. The domain should have
    2.10 + * been previously suspended.
    2.11 + *
    2.12 + * @parm xc_handle a handle to an open hypervisor interface
    2.13 + * @parm domid the domain id to resume
    2.14 + * return 0 on success, -1 on failure
    2.15 + */
    2.16 +int xc_domain_resume(int xc_handle,
    2.17 +                      uint32_t domid);
    2.18 +
    2.19  /**
    2.20   * This function will shutdown a domain. This is intended for use in
    2.21   * fully-virtualized domains where this operation is analogous to the
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Jan 19 15:11:44 2007 +0000
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Jan 19 15:23:41 2007 +0000
     3.3 @@ -174,6 +174,10 @@ static PyObject *pyxc_domain_shutdown(Xc
     3.4      return zero;
     3.5  }
     3.6  
     3.7 +static PyObject *pyxc_domain_resume(XcObject *self, PyObject *args)
     3.8 +{
     3.9 +    return dom_op(self, args, xc_domain_resume);
    3.10 +}
    3.11  
    3.12  static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
    3.13                                         PyObject *args,
    3.14 @@ -1042,6 +1046,13 @@ static PyMethodDef pyxc_methods[] = {
    3.15        "Destroy a domain.\n"
    3.16        " dom [int]:    Identifier of domain to be destroyed.\n\n"
    3.17        "Returns: [int] 0 on success; -1 on error.\n" },
    3.18 +    
    3.19 +    { "domain_resume", 
    3.20 +      (PyCFunction)pyxc_domain_resume, 
    3.21 +      METH_VARARGS, "\n"
    3.22 +      "Resume execution of a suspended domain.\n"
    3.23 +      " dom [int]: Identifier of domain to be resumed.\n\n"
    3.24 +      "Returns: [int] 0 on success; -1 on error.\n" },
    3.25  
    3.26      { "domain_shutdown", 
    3.27        (PyCFunction)pyxc_domain_shutdown,
     4.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jan 19 15:11:44 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Jan 19 15:23:41 2007 +0000
     4.3 @@ -1539,6 +1539,15 @@ class XendDomainInfo:
     4.4          self.cleanupDomain()
     4.5  
     4.6  
     4.7 +    def resumeDomain(self):
     4.8 +        log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid))
     4.9 +
    4.10 +        try:
    4.11 +            if self.domid is not None:
    4.12 +                xc.domain_resume(self.domid)
    4.13 +        except:
    4.14 +            log.exception("XendDomainInfo.resume: xc.domain_resume failed on domain %s." % (str(self.domid)))
    4.15 +
    4.16      #
    4.17      # Channels for xenstore and console
    4.18      # 
     5.1 --- a/xen/common/domctl.c	Fri Jan 19 15:11:44 2007 +0000
     5.2 +++ b/xen/common/domctl.c	Fri Jan 19 15:23:41 2007 +0000
     5.3 @@ -286,6 +286,23 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
     5.4      }
     5.5      break;
     5.6  
     5.7 +    case XEN_DOMCTL_resumedomain:
     5.8 +    {
     5.9 +        struct domain *d = find_domain_by_id(op->domain);
    5.10 +        struct vcpu *v;
    5.11 +
    5.12 +        ret = -ESRCH;
    5.13 +        if ( d != NULL )
    5.14 +        {
    5.15 +            ret = 0;
    5.16 +            if ( test_and_clear_bit(_DOMF_shutdown, &d->domain_flags) )
    5.17 +                for_each_vcpu ( d, v )
    5.18 +                    vcpu_wake(v);
    5.19 +            put_domain(d);
    5.20 +        }
    5.21 +    }
    5.22 +    break;
    5.23 +
    5.24      case XEN_DOMCTL_createdomain:
    5.25      {
    5.26          struct domain *d;
     6.1 --- a/xen/include/public/domctl.h	Fri Jan 19 15:11:44 2007 +0000
     6.2 +++ b/xen/include/public/domctl.h	Fri Jan 19 15:23:41 2007 +0000
     6.3 @@ -63,6 +63,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_creat
     6.4  #define XEN_DOMCTL_destroydomain      2
     6.5  #define XEN_DOMCTL_pausedomain        3
     6.6  #define XEN_DOMCTL_unpausedomain      4
     6.7 +#define XEN_DOMCTL_resumedomain      27
     6.8  
     6.9  #define XEN_DOMCTL_getdomaininfo      5
    6.10  struct xen_domctl_getdomaininfo {