[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/13] python: remove cpupool 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 any cpupool related python binding left. Remove them.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/python/xen/lowlevel/xc/xc.c | 224 --------------------------------------
 1 file changed, 224 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c 
b/tools/python/xen/lowlevel/xc/xc.c
index c904627..9d82579 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1682,175 +1682,6 @@ static PyObject *pyxc_dom_set_memshr(XcObject *self, 
PyObject *args)
     return zero;
 }
 
-static PyObject *cpumap_to_cpulist(XcObject *self, xc_cpumap_t cpumap)
-{
-    PyObject *cpulist = NULL;
-    int i;
-    int nr_cpus;
-
-    nr_cpus = xc_get_max_cpus(self->xc_handle);
-    if ( nr_cpus < 0 )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    cpulist = PyList_New(0);
-    for ( i = 0; i < nr_cpus; i++ )
-    {
-        if ( *cpumap & (1 << (i % 8)) )
-        {
-            PyObject* pyint = PyInt_FromLong(i);
-
-            PyList_Append(cpulist, pyint);
-            Py_DECREF(pyint);
-        }
-        if ( (i % 8) == 7 )
-            cpumap++;
-    }
-    return cpulist;
-}
-
-static PyObject *pyxc_cpupool_create(XcObject *self,
-                                     PyObject *args,
-                                     PyObject *kwds)
-{
-    uint32_t cpupool = 0, sched = XEN_SCHEDULER_CREDIT;
-
-    static char *kwd_list[] = { "pool", "sched", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, &cpupool,
-                                      &sched))
-        return NULL;
-
-    if ( xc_cpupool_create(self->xc_handle, &cpupool, sched) < 0 )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    return PyInt_FromLong(cpupool);
-}
-
-static PyObject *pyxc_cpupool_destroy(XcObject *self,
-                                      PyObject *args)
-{
-    uint32_t cpupool;
-
-    if (!PyArg_ParseTuple(args, "i", &cpupool))
-        return NULL;
-
-    if (xc_cpupool_destroy(self->xc_handle, cpupool) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_cpupool_getinfo(XcObject *self)
-{
-    PyObject *list, *info_dict;
-
-    uint32_t pool;
-    xc_cpupoolinfo_t *info;
-
-    list = PyList_New(0);
-    for (pool = 0;;)
-    {
-        info = xc_cpupool_getinfo(self->xc_handle, pool);
-        if (info == NULL)
-            break;
-        info_dict = Py_BuildValue(
-            "{s:i,s:i,s:i,s:N}",
-            "cpupool",         (int)info->cpupool_id,
-            "sched",           info->sched_id,
-            "n_dom",           info->n_dom,
-            "cpulist",         cpumap_to_cpulist(self, info->cpumap));
-        pool = info->cpupool_id + 1;
-        xc_cpupool_infofree(self->xc_handle, info);
-
-        if ( info_dict == NULL )
-        {
-            Py_DECREF(list);
-            return NULL;
-        }
-
-        PyList_Append(list, info_dict);
-        Py_DECREF(info_dict);
-    }
-
-    return list;
-}
-
-static PyObject *pyxc_cpupool_addcpu(XcObject *self,
-                                     PyObject *args,
-                                     PyObject *kwds)
-{
-    uint32_t cpupool;
-    int cpu = -1;
-
-    static char *kwd_list[] = { "cpupool", "cpu", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
-                                      &cpupool, &cpu) )
-        return NULL;
-
-    if (xc_cpupool_addcpu(self->xc_handle, cpupool, cpu) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_cpupool_removecpu(XcObject *self,
-                                        PyObject *args,
-                                        PyObject *kwds)
-{
-    uint32_t cpupool;
-    int cpu = -1;
-
-    static char *kwd_list[] = { "cpupool", "cpu", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
-                                      &cpupool, &cpu) )
-        return NULL;
-
-    if (xc_cpupool_removecpu(self->xc_handle, cpupool, cpu) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_cpupool_movedomain(XcObject *self,
-                                         PyObject *args,
-                                         PyObject *kwds)
-{
-    uint32_t cpupool, domid;
-
-    static char *kwd_list[] = { "cpupool", "domid", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
-                                      &cpupool, &domid) )
-        return NULL;
-
-    if (xc_cpupool_movedomain(self->xc_handle, cpupool, domid) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_cpupool_freeinfo(XcObject *self)
-{
-    xc_cpumap_t cpumap;
-    PyObject *info = NULL;
-
-    cpumap = xc_cpupool_freeinfo(self->xc_handle);
-    if (!cpumap)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    info = cpumap_to_cpulist(self, cpumap);
-
-    free(cpumap);
-
-    return info;
-}
-
 static PyMethodDef pyxc_methods[] = {
     { "domain_create", 
       (PyCFunction)pyxc_domain_create, 
@@ -2344,61 +2175,6 @@ static PyMethodDef pyxc_methods[] = {
       " enable  [int,0|1]:    Disable or enable?\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "cpupool_create",
-      (PyCFunction)pyxc_cpupool_create,
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Create new cpupool.\n"
-      " pool    [int, 0]: cpupool identifier to use (allocated if zero).\n"
-      " sched   [int]: scheduler to use (credit if unspecified).\n\n"
-      "Returns: [int] new cpupool identifier; -1 on error.\n" },
-
-    { "cpupool_destroy",
-      (PyCFunction)pyxc_cpupool_destroy,
-      METH_VARARGS, "\n"
-      "Destroy a cpupool.\n"
-      " pool [int]:    Identifier of cpupool to be destroyed.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "cpupool_getinfo",
-      (PyCFunction)pyxc_cpupool_getinfo,
-      METH_NOARGS, "\n"
-      "Get information regarding a set of cpupools, in increasing id order.\n"
-      "Returns: [list of dicts]\n"
-      " pool     [int]: Identifier of cpupool to which this info pertains\n"
-      " sched    [int]:  Scheduler used for this cpupool\n"
-      " n_dom    [int]:  Number of Domains in this cpupool\n"
-      " cpulist  [list]: List of CPUs this cpupool is using\n" },
-
-    { "cpupool_addcpu",
-       (PyCFunction)pyxc_cpupool_addcpu,
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Add a cpu to a cpupool.\n"
-      " pool    [int]: Identifier of cpupool.\n"
-      " cpu     [int, -1]: Cpu to add (lowest free if -1)\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "cpupool_removecpu",
-       (PyCFunction)pyxc_cpupool_removecpu,
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Remove a cpu from a cpupool.\n"
-      " pool    [int]: Identifier of cpupool.\n"
-      " cpu     [int, -1]: Cpu to remove (highest used if -1)\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "cpupool_movedomain",
-       (PyCFunction)pyxc_cpupool_movedomain,
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Move a domain to another cpupool.\n"
-      " pool    [int]: Identifier of cpupool to move domain to.\n"
-      " dom     [int]: Domain to move\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "cpupool_freeinfo",
-      (PyCFunction)pyxc_cpupool_freeinfo,
-      METH_NOARGS, "\n"
-      "Get info about cpus not in any cpupool.\n"
-      "Returns: [list]: List of CPUs\n" },
-
     { NULL, NULL, 0, NULL }
 };
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.