mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
New dom0_op to set max vcpus for a domain.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
a442cd731d
commit
523636b3b7
16 files changed
+268
-236
No files matched your search
@@ -93,6 +93,26 @@ static PyObject *pyxc_domain_create(PyObject *self,
|
||||
return PyInt_FromLong(dom);
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_max_vcpus(PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
|
||||
uint32_t dom, max;
|
||||
|
||||
static char *kwd_list[] = { "dom", "max", NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, &dom, &max) )
|
||||
return NULL;
|
||||
|
||||
if ( xc_domain_max_vcpus(xc->xc_handle, dom, max) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
Py_INCREF(zero);
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_pause(PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
@@ -783,6 +803,14 @@ static PyMethodDef pyxc_methods[] = {
|
||||
" dom [int, 0]: Domain identifier to use (allocated if zero).\n"
|
||||
"Returns: [int] new domain identifier; -1 on error.\n" },
|
||||
|
||||
{ "domain_max_vcpus",
|
||||
(PyCFunction)pyxc_domain_max_vcpus,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
"Set the maximum number of VCPUs a domain may create.\n"
|
||||
" dom [int, 0]: Domain identifier to use.\n"
|
||||
" max [int, 0]: New maximum number of VCPUs in domain.\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "domain_dumpcore",
|
||||
(PyCFunction)pyxc_domain_dumpcore,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
|
||||
@@ -1030,6 +1030,10 @@ class XendDomainInfo:
|
||||
self.image.handleBootloading()
|
||||
|
||||
xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
|
||||
|
||||
# Set maximum number of vcpus in domain
|
||||
xc.domain_max_vcpus(self.domid, int(self.info['vcpus']));
|
||||
|
||||
# XXX Merge with configure_maxmem?
|
||||
m = self.image.getDomainMemory(self.info['memory_KiB'])
|
||||
xc.domain_setmaxmem(self.domid, m)
|
||||
|
||||