diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 28 | ||||
-rw-r--r-- | tools/python/xen/xend/XendConstants.py | 7 | ||||
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 11 |
3 files changed, 41 insertions, 5 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 975b7d3a38..c40a900cb3 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -467,6 +467,26 @@ static PyObject *pyxc_linux_build(XcObject *self, return pyxc_error_to_exception(); } +static PyObject *pyxc_get_hvm_param(XcObject *self, + PyObject *args, + PyObject *kwds) +{ + uint32_t dom; + int param; + unsigned long value; + + static char *kwd_list[] = { "domid", "param", NULL }; + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, + &dom, ¶m) ) + return NULL; + + if ( xc_get_hvm_param(self->xc_handle, dom, param, &value) != 0 ) + return pyxc_error_to_exception(); + + return Py_BuildValue("i", value); + +} + static PyObject *pyxc_hvm_build(XcObject *self, PyObject *args, PyObject *kwds) @@ -1225,6 +1245,14 @@ static PyMethodDef pyxc_methods[] = { " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, + { "hvm_get_param", + (PyCFunction)pyxc_get_hvm_param, + METH_VARARGS | METH_KEYWORDS, "\n" + "get a parameter of HVM guest OS.\n" + " dom [int]: Identifier of domain to build into.\n" + " param [int]: No. of HVM param.\n" + "Returns: [int] value of the param.\n" }, + { "sched_id_get", (PyCFunction)pyxc_sched_id_get, METH_NOARGS, "\n" diff --git a/tools/python/xen/xend/XendConstants.py b/tools/python/xen/xend/XendConstants.py index e6bc787340..d7469ce5fe 100644 --- a/tools/python/xen/xend/XendConstants.py +++ b/tools/python/xen/xend/XendConstants.py @@ -37,6 +37,13 @@ DOMAIN_SHUTDOWN_REASONS = { REVERSE_DOMAIN_SHUTDOWN_REASONS = \ dict([(y, x) for x, y in DOMAIN_SHUTDOWN_REASONS.items()]) +HVM_PARAM_CALLBACK_IRQ = 0 +HVM_PARAM_STORE_PFN = 1 +HVM_PARAM_STORE_EVTCHN = 2 +HVM_PARAM_PAE_ENABLED = 4 +HVM_PARAM_IOREQ_PFN = 5 +HVM_PARAM_BUFIOREQ_PFN = 6 + restart_modes = [ "restart", "destroy", diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 4b155c3dac..3fdba4d8f2 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -448,11 +448,12 @@ class XendDomainInfo: self._removeVm('xend/previous_restart_time') self.storeDom("control/shutdown", reason) - ## shutdown hypercall for hvm domain desides xenstore write - if self.info.is_hvm(): - for code in DOMAIN_SHUTDOWN_REASONS.keys(): - if DOMAIN_SHUTDOWN_REASONS[code] == reason: - break + ## HVM domain shutdown itself if has PV driver, + ## otherwise remote shutdown it + hvm_pvdrv = xc.hvm_get_param(self.domid, HVM_PARAM_CALLBACK_IRQ) + if self.info.is_hvm() and not hvm_pvdrv: + code = REVERSE_DOMAIN_SHUTDOWN_REASONS[reason] + log.info("HVM save:remote shutdown dom %d!", self.domid) xc.domain_shutdown(self.domid, code) |