direct-io.hg

changeset 14160:270a5e2ead43

Let xend choose to do hard or soft domain resumption depending on
whether the domain advertises support for soft resumption in its
elfnotes.

Signed-off-by: Brendan Cully <brendan@kublai.com>
author kfraser@localhost.localdomain
date Wed Feb 28 09:39:03 2007 +0000 (2007-02-28)
parents 8939316a0735
children 0ba4f202d504
files tools/libxc/xc_resume.c tools/libxc/xenctrl.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/libxc/xc_resume.c	Wed Feb 28 09:38:14 2007 +0000
     1.2 +++ b/tools/libxc/xc_resume.c	Wed Feb 28 09:39:03 2007 +0000
     1.3 @@ -169,13 +169,9 @@ static int xc_domain_resume_any(int xc_h
     1.4   * (2) should be used only for guests which cannot handle the special
     1.5   * new return code. (1) is always safe (but slower).
     1.6   */
     1.7 -int xc_domain_resume(int xc_handle, uint32_t domid)
     1.8 +int xc_domain_resume(int xc_handle, uint32_t domid, int fast)
     1.9  {
    1.10 -    /*
    1.11 -     * XXX: Implement a way to select between options (1) and (2).
    1.12 -     * Or expose the options as two different methods to Python.
    1.13 -     */
    1.14 -    return (0
    1.15 +    return (fast
    1.16              ? xc_domain_resume_cooperative(xc_handle, domid)
    1.17              : xc_domain_resume_any(xc_handle, domid));
    1.18  }
     2.1 --- a/tools/libxc/xenctrl.h	Wed Feb 28 09:38:14 2007 +0000
     2.2 +++ b/tools/libxc/xenctrl.h	Wed Feb 28 09:39:03 2007 +0000
     2.3 @@ -243,10 +243,12 @@ int xc_domain_destroy(int xc_handle,
     2.4   *
     2.5   * @parm xc_handle a handle to an open hypervisor interface
     2.6   * @parm domid the domain id to resume
     2.7 + * @parm fast use cooperative resume (guest must support this)
     2.8   * return 0 on success, -1 on failure
     2.9   */
    2.10  int xc_domain_resume(int xc_handle,
    2.11 -                      uint32_t domid);
    2.12 +		     uint32_t domid,
    2.13 +		     int fast);
    2.14  
    2.15  /**
    2.16   * This function will shutdown a domain. This is intended for use in
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 28 09:38:14 2007 +0000
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 28 09:39:03 2007 +0000
     3.3 @@ -178,7 +178,17 @@ static PyObject *pyxc_domain_shutdown(Xc
     3.4  
     3.5  static PyObject *pyxc_domain_resume(XcObject *self, PyObject *args)
     3.6  {
     3.7 -    return dom_op(self, args, xc_domain_resume);
     3.8 +    uint32_t dom;
     3.9 +    int fast;
    3.10 +
    3.11 +    if (!PyArg_ParseTuple(args, "ii", &dom, &fast))
    3.12 +        return NULL;
    3.13 +
    3.14 +    if (xc_domain_resume(self->xc_handle, dom, fast) != 0)
    3.15 +        return pyxc_error_to_exception();
    3.16 +
    3.17 +    Py_INCREF(zero);
    3.18 +    return zero;
    3.19  }
    3.20  
    3.21  static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
    3.22 @@ -1124,7 +1134,8 @@ static PyMethodDef pyxc_methods[] = {
    3.23        (PyCFunction)pyxc_domain_resume,
    3.24        METH_VARARGS, "\n"
    3.25        "Resume execution of a suspended domain.\n"
    3.26 -      " dom [int]: Identifier of domain to be resumed.\n\n"
    3.27 +      " dom [int]: Identifier of domain to be resumed.\n"
    3.28 +      " fast [int]: Use cooperative resume.\n\n"
    3.29        "Returns: [int] 0 on success; -1 on error.\n" },
    3.30  
    3.31      { "domain_shutdown", 
     4.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Wed Feb 28 09:38:14 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Wed Feb 28 09:39:03 2007 +0000
     4.3 @@ -137,23 +137,6 @@ def save(fd, dominfo, network, live, dst
     4.4          log.exception("Save failed on domain %s (%s).", domain_name,
     4.5                        dominfo.getDomid())
     4.6  
     4.7 -        dominfo._releaseDevices()
     4.8 -        dominfo.testDeviceComplete()
     4.9 -        dominfo.testvifsComplete()
    4.10 -        log.debug("XendCheckpoint.save: devices released")
    4.11 -
    4.12 -        dominfo._resetChannels()
    4.13 -
    4.14 -        dominfo._removeDom('control/shutdown')
    4.15 -        dominfo._removeDom('device-misc/vif/nextDeviceID')
    4.16 -
    4.17 -        dominfo._createChannels()
    4.18 -        dominfo._introduceDomain()
    4.19 -        dominfo._storeDomDetails()
    4.20 -
    4.21 -        dominfo._createDevices()
    4.22 -        log.debug("XendCheckpoint.save: devices created")
    4.23 -
    4.24          dominfo.resumeDomain()
    4.25          log.debug("XendCheckpoint.save: resumeDomain")
    4.26  
     5.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Feb 28 09:38:14 2007 +0000
     5.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Feb 28 09:39:03 2007 +0000
     5.3 @@ -1662,10 +1662,31 @@ class XendDomainInfo:
     5.4      def resumeDomain(self):
     5.5          log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid))
     5.6  
     5.7 +        if self.domid is None:
     5.8 +            return
     5.9          try:
    5.10 -            if self.domid is not None:
    5.11 -                xc.domain_resume(self.domid)
    5.12 -                ResumeDomain(self.domid)
    5.13 +            # could also fetch a parsed note from xenstore
    5.14 +            fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0
    5.15 +            if not fast:
    5.16 +                self._releaseDevices()
    5.17 +                self.testDeviceComplete()
    5.18 +                self.testvifsComplete()
    5.19 +                log.debug("XendDomainInfo.resumeDomain: devices released")
    5.20 +
    5.21 +                self._resetChannels()
    5.22 +
    5.23 +                self._removeDom('control/shutdown')
    5.24 +                self._removeDom('device-misc/vif/nextDeviceID')
    5.25 +
    5.26 +                self._createChannels()
    5.27 +                self._introduceDomain()
    5.28 +                self._storeDomDetails()
    5.29 +
    5.30 +                self._createDevices()
    5.31 +                log.debug("XendDomainInfo.resumeDomain: devices created")
    5.32 +
    5.33 +            xc.domain_resume(self.domid, fast)
    5.34 +            ResumeDomain(self.domid)
    5.35          except:
    5.36              log.exception("XendDomainInfo.resume: xc.domain_resume failed on domain %s." % (str(self.domid)))
    5.37