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

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

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

diff --git a/tools/python/xen/lowlevel/xc/xc.c 
b/tools/python/xen/lowlevel/xc/xc.c
index 02f1694..5146a2d 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -36,9 +36,6 @@ typedef struct {
 } XcObject;
 
 
-static PyObject *dom_op(XcObject *self, PyObject *args,
-                        int (*fn)(xc_interface *, uint32_t));
-
 static PyObject *pyxc_error_to_exception(xc_interface *xch)
 {
     PyObject *pyerr;
@@ -78,136 +75,6 @@ static PyObject *pyxc_error_to_exception(xc_interface *xch)
     return NULL;
 }
 
-static PyObject *pyxc_domain_dumpcore(XcObject *self, PyObject *args)
-{
-    uint32_t dom;
-    char *corefile;
-
-    if ( !PyArg_ParseTuple(args, "is", &dom, &corefile) )
-        return NULL;
-
-    if ( (corefile == NULL) || (corefile[0] == '\0') )
-        return NULL;
-
-    if ( xc_domain_dumpcore(self->xc_handle, dom, corefile) != 0 )
-        return pyxc_error_to_exception(self->xc_handle);
-    
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_domain_create(XcObject *self,
-                                    PyObject *args,
-                                    PyObject *kwds)
-{
-    uint32_t dom = 0, ssidref = 0, flags = 0, target = 0;
-    int      ret, i;
-    PyObject *pyhandle = NULL;
-    xen_domain_handle_t handle = { 
-        0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
-        0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
-
-    static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", 
"target", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list,
-                                      &dom, &ssidref, &pyhandle, &flags, 
&target))
-        return NULL;
-    if ( pyhandle != NULL )
-    {
-        if ( !PyList_Check(pyhandle) || 
-             (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
-            goto out_exception;
-
-        for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
-        {
-            PyObject *p = PyList_GetItem(pyhandle, i);
-            if ( !PyInt_Check(p) )
-                goto out_exception;
-            handle[i] = (uint8_t)PyInt_AsLong(p);
-        }
-    }
-
-    if ( (ret = xc_domain_create(self->xc_handle, ssidref,
-                                 handle, flags, &dom)) < 0 )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    if ( target )
-        if ( (ret = xc_domain_set_target(self->xc_handle, dom, target)) < 0 )
-            return pyxc_error_to_exception(self->xc_handle);
-
-
-    return PyInt_FromLong(dom);
-
-out_exception:
-    errno = EINVAL;
-    PyErr_SetFromErrno(xc_error_obj);
-    return NULL;
-}
-
-static PyObject *pyxc_domain_max_vcpus(XcObject *self, PyObject *args)
-{
-    uint32_t dom, max;
-
-    if (!PyArg_ParseTuple(args, "ii", &dom, &max))
-      return NULL;
-
-    if (xc_domain_max_vcpus(self->xc_handle, dom, max) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-    
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_domain_pause(XcObject *self, PyObject *args)
-{
-    return dom_op(self, args, xc_domain_pause);
-}
-
-static PyObject *pyxc_domain_unpause(XcObject *self, PyObject *args)
-{
-    return dom_op(self, args, xc_domain_unpause);
-}
-
-static PyObject *pyxc_domain_destroy_hook(XcObject *self, PyObject *args)
-{
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_domain_destroy(XcObject *self, PyObject *args)
-{
-    return dom_op(self, args, xc_domain_destroy);
-}
-
-static PyObject *pyxc_domain_shutdown(XcObject *self, PyObject *args)
-{
-    uint32_t dom, reason;
-
-    if ( !PyArg_ParseTuple(args, "ii", &dom, &reason) )
-      return NULL;
-
-    if ( xc_domain_shutdown(self->xc_handle, dom, reason) != 0 )
-        return pyxc_error_to_exception(self->xc_handle);
-    
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_domain_resume(XcObject *self, PyObject *args)
-{
-    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(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
 static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
                                        PyObject *args,
                                        PyObject *kwds)
@@ -259,42 +126,6 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
     return zero;
 }
 
-static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args)
-{
-    int i;
-    uint32_t dom;
-    PyObject *pyhandle;
-    xen_domain_handle_t handle;
-
-    if (!PyArg_ParseTuple(args, "iO", &dom, &pyhandle))
-        return NULL;
-
-    if ( !PyList_Check(pyhandle) || 
-         (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
-    {
-        goto out_exception;
-    }
-
-    for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
-    {
-        PyObject *p = PyList_GetItem(pyhandle, i);
-        if ( !PyInt_Check(p) )
-            goto out_exception;
-        handle[i] = (uint8_t)PyInt_AsLong(p);
-    }
-
-    if (xc_domain_sethandle(self->xc_handle, dom, handle) < 0)
-        return pyxc_error_to_exception(self->xc_handle);
-    
-    Py_INCREF(zero);
-    return zero;
-
-out_exception:
-    PyErr_SetFromErrno(xc_error_obj);
-    return NULL;
-}
-
-
 static PyObject *pyxc_domain_getinfo(XcObject *self,
                                      PyObject *args,
                                      PyObject *kwds)
@@ -466,40 +297,6 @@ static PyObject *pyxc_hvm_param_set(XcObject *self,
     return zero;
 }
 
-#if defined(__i386__) || defined(__x86_64__)
-static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
-                                                  PyObject *args,
-                                                  PyObject *kwds)
-{
-    uint32_t dom, width;
-
-    if (!PyArg_ParseTuple(args, "ii", &dom, &width))
-       return NULL;
-
-    if (xc_domain_set_machine_address_size(self->xc_handle, dom, width) != 0)
-       return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_dom_suppress_spurious_page_faults(XcObject *self,
-                                                     PyObject *args,
-                                                     PyObject *kwds)
-{
-    uint32_t dom;
-
-    if (!PyArg_ParseTuple(args, "i", &dom))
-       return NULL;
-
-    if (xc_domain_suppress_spurious_page_faults(self->xc_handle, dom) != 0)
-       return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-#endif /* __i386__ || __x86_64__ */
-
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
                                      PyObject *args,
                                      PyObject *kwds)
@@ -1083,40 +880,6 @@ static PyObject *pyxc_domain_set_tsc_info(XcObject *self, 
PyObject *args)
     return zero;
 }
 
-static PyObject *pyxc_domain_disable_migrate(XcObject *self, PyObject *args)
-{
-    uint32_t dom;
-
-    if (!PyArg_ParseTuple(args, "i", &dom))
-        return NULL;
-
-    if (xc_domain_disable_migrate(self->xc_handle, dom) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-static PyObject *pyxc_domain_send_trigger(XcObject *self,
-                                          PyObject *args,
-                                          PyObject *kwds)
-{
-    uint32_t dom;
-    int trigger, vcpu = 0;
-
-    static char *kwd_list[] = { "domid", "trigger", "vcpu", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list, 
-                                      &dom, &trigger, &vcpu) )
-        return NULL;
-
-    if (xc_domain_send_trigger(self->xc_handle, dom, trigger, vcpu) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
 static PyObject *pyxc_send_debug_keys(XcObject *self,
                                       PyObject *args,
                                       PyObject *kwds)
@@ -1135,21 +898,6 @@ static PyObject *pyxc_send_debug_keys(XcObject *self,
     return zero;
 }
 
-static PyObject *dom_op(XcObject *self, PyObject *args,
-                        int (*fn)(xc_interface*, uint32_t))
-{
-    uint32_t dom;
-
-    if (!PyArg_ParseTuple(args, "i", &dom))
-        return NULL;
-
-    if (fn(self->xc_handle, dom) != 0)
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
 static PyObject *pyxc_tmem_control(XcObject *self,
                                    PyObject *args,
                                    PyObject *kwds)
@@ -1234,73 +982,6 @@ static PyObject *pyxc_dom_set_memshr(XcObject *self, 
PyObject *args)
 }
 
 static PyMethodDef pyxc_methods[] = {
-    { "domain_create", 
-      (PyCFunction)pyxc_domain_create, 
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Create a new domain.\n"
-      " 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, "\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, "\n"
-      "Dump core of a domain.\n"
-      " dom [int]: Identifier of domain to dump core of.\n"
-      " corefile [string]: Name of corefile to be created.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_pause", 
-      (PyCFunction)pyxc_domain_pause, 
-      METH_VARARGS, "\n"
-      "Temporarily pause execution of a domain.\n"
-      " dom [int]: Identifier of domain to be paused.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_unpause", 
-      (PyCFunction)pyxc_domain_unpause, 
-      METH_VARARGS, "\n"
-      "(Re)start execution of a domain.\n"
-      " dom [int]: Identifier of domain to be unpaused.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_destroy", 
-      (PyCFunction)pyxc_domain_destroy, 
-      METH_VARARGS, "\n"
-      "Destroy a domain.\n"
-      " dom [int]:    Identifier of domain to be destroyed.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_destroy_hook", 
-      (PyCFunction)pyxc_domain_destroy_hook, 
-      METH_VARARGS, "\n"
-      "Add a hook for arch stuff before destroy a domain.\n"
-      " dom [int]:    Identifier of domain to be destroyed.\n\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_resume", 
-      (PyCFunction)pyxc_domain_resume,
-      METH_VARARGS, "\n"
-      "Resume execution of a suspended domain.\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", 
-      (PyCFunction)pyxc_domain_shutdown,
-      METH_VARARGS, "\n"
-      "Shutdown a domain.\n"
-      " dom       [int, 0]:      Domain identifier to use.\n"
-      " reason     [int, 0]:      Reason for shutdown.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
     { "vcpu_setaffinity", 
       (PyCFunction)pyxc_vcpu_setaffinity, 
       METH_VARARGS | METH_KEYWORDS, "\n"
@@ -1310,14 +991,6 @@ static PyMethodDef pyxc_methods[] = {
       " cpumap [list, []]: list of usable CPUs.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_sethandle", 
-      (PyCFunction)pyxc_domain_sethandle,
-      METH_VARARGS, "\n"
-      "Set domain's opaque handle.\n"
-      " dom [int]:            Identifier of domain.\n"
-      " handle [list of 16 ints]: New opaque handle.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
     { "domain_getinfo", 
       (PyCFunction)pyxc_domain_getinfo, 
       METH_VARARGS | METH_KEYWORDS, "\n"
@@ -1530,43 +1203,12 @@ static PyMethodDef pyxc_methods[] = {
       "                   1=always emulate 2=never emulate 3=pvrdtscp\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_disable_migrate",
-      (PyCFunction)pyxc_domain_disable_migrate,
-      METH_VARARGS, "\n"
-      "Marks domain as non-migratable AND non-restoreable\n"
-      " dom        [int]: Domain whose TSC mode is being set.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "domain_send_trigger",
-      (PyCFunction)pyxc_domain_send_trigger,
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Send trigger to a domain.\n"
-      " dom     [int]: Identifier of domain to be sent trigger.\n"
-      " trigger [int]: Trigger type number.\n"
-      " vcpu    [int]: VCPU to be sent trigger.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
     { "send_debug_keys",
       (PyCFunction)pyxc_send_debug_keys,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Inject debug keys into Xen.\n"
       " keys    [str]: String of keys to inject.\n" },
 
-#if defined(__i386__) || defined(__x86_64__)
-    { "domain_set_machine_address_size",
-      (PyCFunction)pyxc_dom_set_machine_address_size,
-      METH_VARARGS, "\n"
-      "Set maximum machine address size for this domain.\n"
-      " dom [int]: Identifier of domain.\n"
-      " width [int]: Maximum machine address width.\n" },
-
-    { "domain_suppress_spurious_page_faults",
-      (PyCFunction)pyxc_dom_suppress_spurious_page_faults,
-      METH_VARARGS, "\n"
-      "Do not propagate spurious page faults to this guest.\n"
-      " dom [int]: Identifier of domain.\n" },
-#endif
-
     { "tmem_control",
       (PyCFunction)pyxc_tmem_control,
       METH_VARARGS | METH_KEYWORDS, "\n"
-- 
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®.