[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 10/13] python: remove vcpu related libxc python bindings
Mostly for historical reasons Xen includes Python bindings for libxc. They have been used by xm/xend in the past but nowadays there is no user of vcpu related python binding left. Remove them. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- tools/python/xen/lowlevel/xc/xc.c | 134 -------------------------------------- 1 file changed, 134 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 5146a2d..5fcee3f 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -75,57 +75,6 @@ static PyObject *pyxc_error_to_exception(xc_interface *xch) return NULL; } -static PyObject *pyxc_vcpu_setaffinity(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - int vcpu = 0, i; - xc_cpumap_t cpumap; - PyObject *cpulist = NULL; - int nr_cpus; - - static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list, - &dom, &vcpu, &cpulist) ) - return NULL; - - nr_cpus = xc_get_max_cpus(self->xc_handle); - if ( nr_cpus < 0 ) - return pyxc_error_to_exception(self->xc_handle); - - cpumap = xc_cpumap_alloc(self->xc_handle); - if(cpumap == NULL) - return pyxc_error_to_exception(self->xc_handle); - - if ( (cpulist != NULL) && PyList_Check(cpulist) ) - { - for ( i = 0; i < PyList_Size(cpulist); i++ ) - { - long cpu = PyInt_AsLong(PyList_GetItem(cpulist, i)); - if ( cpu < 0 || cpu >= nr_cpus ) - { - free(cpumap); - errno = EINVAL; - PyErr_SetFromErrno(xc_error_obj); - return NULL; - } - cpumap[cpu / 8] |= 1 << (cpu % 8); - } - } - - if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap, - NULL, XEN_VCPUAFFINITY_HARD) != 0 ) - { - free(cpumap); - return pyxc_error_to_exception(self->xc_handle); - } - Py_INCREF(zero); - free(cpumap); - return zero; -} - static PyObject *pyxc_domain_getinfo(XcObject *self, PyObject *args, PyObject *kwds) @@ -197,66 +146,6 @@ static PyObject *pyxc_domain_getinfo(XcObject *self, return list; } -static PyObject *pyxc_vcpu_getinfo(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - PyObject *info_dict, *cpulist; - - uint32_t dom, vcpu = 0; - xc_vcpuinfo_t info; - int rc, i; - xc_cpumap_t cpumap; - int nr_cpus; - - static char *kwd_list[] = { "domid", "vcpu", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, - &dom, &vcpu) ) - return NULL; - - nr_cpus = xc_get_max_cpus(self->xc_handle); - if ( nr_cpus < 0 ) - return pyxc_error_to_exception(self->xc_handle); - - rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); - if ( rc < 0 ) - return pyxc_error_to_exception(self->xc_handle); - - cpumap = xc_cpumap_alloc(self->xc_handle); - if(cpumap == NULL) - return pyxc_error_to_exception(self->xc_handle); - - rc = xc_vcpu_getaffinity(self->xc_handle, dom, vcpu, cpumap, - NULL, XEN_VCPUAFFINITY_HARD); - if ( rc < 0 ) - { - free(cpumap); - return pyxc_error_to_exception(self->xc_handle); - } - - info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", - "online", info.online, - "blocked", info.blocked, - "running", info.running, - "cpu_time", info.cpu_time, - "cpu", info.cpu); - cpulist = PyList_New(0); - for ( i = 0; i < nr_cpus; i++ ) - { - if (*(cpumap + i / 8) & 1 ) { - PyObject *pyint = PyInt_FromLong(i); - PyList_Append(cpulist, pyint); - Py_DECREF(pyint); - } - cpumap[i / 8] >>= 1; - } - PyDict_SetItemString(info_dict, "cpumap", cpulist); - Py_DECREF(cpulist); - free(cpumap); - return info_dict; -} - static PyObject *pyxc_hvm_param_get(XcObject *self, PyObject *args, PyObject *kwds) @@ -982,15 +871,6 @@ static PyObject *pyxc_dom_set_memshr(XcObject *self, PyObject *args) } static PyMethodDef pyxc_methods[] = { - { "vcpu_setaffinity", - (PyCFunction)pyxc_vcpu_setaffinity, - METH_VARARGS | METH_KEYWORDS, "\n" - "Pin a VCPU to a specified set CPUs.\n" - " dom [int]: Identifier of domain to which VCPU belongs.\n" - " vcpu [int, 0]: VCPU being pinned.\n" - " cpumap [list, []]: list of usable CPUs.\n\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - { "domain_getinfo", (PyCFunction)pyxc_domain_getinfo, METH_VARARGS | METH_KEYWORDS, "\n" @@ -1017,20 +897,6 @@ static PyMethodDef pyxc_methods[] = { "reason why it shut itself down.\n" " cpupool [int] Id of cpupool domain is bound to.\n" }, - { "vcpu_getinfo", - (PyCFunction)pyxc_vcpu_getinfo, - METH_VARARGS | METH_KEYWORDS, "\n" - "Get information regarding a VCPU.\n" - " dom [int]: Domain to retrieve info about.\n" - " vcpu [int, 0]: VCPU to retrieve info about.\n\n" - "Returns: [dict]\n" - " online [int]: Bool - Is this VCPU currently online?\n" - " blocked [int]: Bool - Is this VCPU blocked waiting for an event?\n" - " running [int]: Bool - Is this VCPU currently running on a CPU?\n" - " cpu_time [long]: CPU time consumed, in nanoseconds\n" - " cpumap [int]: Bitmap of CPUs this VCPU can run on\n" - " cpu [int]: CPU that this VCPU is currently bound to\n" }, - { "gnttab_hvm_seed", (PyCFunction)pyxc_gnttab_hvm_seed, METH_KEYWORDS, "\n" -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |