[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1 of 3] Let xend choose to do hard or soft domain resumption depending on
# HG changeset patch # User Brendan Cully <brendan@xxxxxxxxx> # Date 1172543764 28800 # Node ID b2edb7f3393255f7b51af7fe688de687233b525e # Parent e7b2a282c9e70fbadd38ccc7cc7d1fcb6a32b886 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@xxxxxxxxxx> diff -r e7b2a282c9e7 -r b2edb7f33932 tools/libxc/xc_resume.c --- a/tools/libxc/xc_resume.c Mon Feb 26 17:20:36 2007 +0000 +++ b/tools/libxc/xc_resume.c Mon Feb 26 18:36:04 2007 -0800 @@ -169,13 +169,9 @@ static int xc_domain_resume_any(int xc_h * (2) should be used only for guests which cannot handle the special * new return code. (1) is always safe (but slower). */ -int xc_domain_resume(int xc_handle, uint32_t domid) +int xc_domain_resume(int xc_handle, uint32_t domid, int fast) { - /* - * XXX: Implement a way to select between options (1) and (2). - * Or expose the options as two different methods to Python. - */ - return (0 + return (fast ? xc_domain_resume_cooperative(xc_handle, domid) : xc_domain_resume_any(xc_handle, domid)); } diff -r e7b2a282c9e7 -r b2edb7f33932 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Mon Feb 26 17:20:36 2007 +0000 +++ b/tools/libxc/xenctrl.h Mon Feb 26 18:36:04 2007 -0800 @@ -243,10 +243,12 @@ int xc_domain_destroy(int xc_handle, * * @parm xc_handle a handle to an open hypervisor interface * @parm domid the domain id to resume + * @parm fast use cooperative resume (guest must support this) * return 0 on success, -1 on failure */ int xc_domain_resume(int xc_handle, - uint32_t domid); + uint32_t domid, + int fast); /** * This function will shutdown a domain. This is intended for use in diff -r e7b2a282c9e7 -r b2edb7f33932 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Mon Feb 26 17:20:36 2007 +0000 +++ b/tools/python/xen/lowlevel/xc/xc.c Mon Feb 26 18:36:04 2007 -0800 @@ -178,7 +178,17 @@ static PyObject *pyxc_domain_shutdown(Xc static PyObject *pyxc_domain_resume(XcObject *self, PyObject *args) { - return dom_op(self, args, xc_domain_resume); + uint32_t dom; + int fast; + + if (!PyArg_ParseTuple(args, "ii", &dom, &fast)) + return NULL; + + if (xc_domain_resume(self->xc_handle, dom, fast) != 0) + return pyxc_error_to_exception(); + + Py_INCREF(zero); + return zero; } static PyObject *pyxc_vcpu_setaffinity(XcObject *self, @@ -1124,7 +1134,8 @@ static PyMethodDef pyxc_methods[] = { (PyCFunction)pyxc_domain_resume, METH_VARARGS, "\n" "Resume execution of a suspended domain.\n" - " dom [int]: Identifier of domain to be resumed.\n\n" + " dom [int]: Identifier of domain to be resumed.\n" + " fast [int]: Use cooperative resume.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, { "domain_shutdown", diff -r e7b2a282c9e7 -r b2edb7f33932 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Mon Feb 26 17:20:36 2007 +0000 +++ b/tools/python/xen/xend/XendCheckpoint.py Mon Feb 26 18:36:04 2007 -0800 @@ -137,23 +137,6 @@ def save(fd, dominfo, network, live, dst log.exception("Save failed on domain %s (%s).", domain_name, dominfo.getDomid()) - dominfo._releaseDevices() - dominfo.testDeviceComplete() - dominfo.testvifsComplete() - log.debug("XendCheckpoint.save: devices released") - - dominfo._resetChannels() - - dominfo._removeDom('control/shutdown') - dominfo._removeDom('device-misc/vif/nextDeviceID') - - dominfo._createChannels() - dominfo._introduceDomain() - dominfo._storeDomDetails() - - dominfo._createDevices() - log.debug("XendCheckpoint.save: devices created") - dominfo.resumeDomain() log.debug("XendCheckpoint.save: resumeDomain") diff -r e7b2a282c9e7 -r b2edb7f33932 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Mon Feb 26 17:20:36 2007 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Mon Feb 26 18:36:04 2007 -0800 @@ -1662,10 +1662,31 @@ class XendDomainInfo: def resumeDomain(self): log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid)) + if self.domid is None: + return try: - if self.domid is not None: - xc.domain_resume(self.domid) - ResumeDomain(self.domid) + # could also fetch a parsed key from xenstore + fast = 'suspend_cancel' in self.info.get_notes().get('FEATURES', '').split('|') + if not fast: + self._releaseDevices() + self.testDeviceComplete() + self.testvifsComplete() + log.debug("XendDomainInfo.resumeDomain: devices released") + + self._resetChannels() + + self._removeDom('control/shutdown') + self._removeDom('device-misc/vif/nextDeviceID') + + self._createChannels() + self._introduceDomain() + self._storeDomDetails() + + self._createDevices() + log.debug("XendDomainInfo.resumeDomain: devices created") + + xc.domain_resume(self.domid, fast) + ResumeDomain(self.domid) except: log.exception("XendDomainInfo.resume: xc.domain_resume failed on domain %s." % (str(self.domid))) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |