* [PATCH 01/13] libxc: remove most of tools/libxc/xc_dom_compat_linux.c
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 02/13] libxc: remove xc_get_bit_size() from tools/libxc/xc_dom_compat_linux.c Juergen Gross
` (13 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
In tools/libxc/xc_dom_compat_linux.c xc_linux_build() is the only
domain building function used by an in-tree component (qemu-xen) which
is really necessary.
Remove the other domain building functions and the unused python
wrapper xc.linux_build() referencing one of the to be removed
functions.
Suggested-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/libxc/include/xc_dom.h | 5 ++
tools/libxc/include/xenguest.h | 48 -------------
tools/libxc/xc_dom_compat_linux.c | 141 ++++++++------------------------------
tools/libxl/libxl_internal.h | 1 +
tools/python/xen/lowlevel/xc/xc.c | 98 --------------------------
5 files changed, 36 insertions(+), 257 deletions(-)
diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index ccc5926..6c15589 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -13,6 +13,9 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef _XC_DOM_H
+#define _XC_DOM_H
+
#include <xen/libelf/libelf.h>
#include <xenguest.h>
@@ -406,6 +409,8 @@ static inline xen_pfn_t xc_dom_p2m(struct xc_dom_image *dom, xen_pfn_t pfn)
return dom->p2m_host[pfn - dom->rambase_pfn];
}
+#endif /* _XC_DOM_H */
+
/*
* Local variables:
* mode: C
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index ec67fbd..a9fa32c 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -151,54 +151,6 @@ int xc_linux_build(xc_interface *xch,
unsigned int console_evtchn,
unsigned long *console_mfn);
-/** The same interface, but the dom structure is managed by the caller */
-struct xc_dom_image;
-int xc_dom_linux_build(xc_interface *xch,
- struct xc_dom_image *dom,
- uint32_t domid,
- unsigned int mem_mb,
- const char *image_name,
- const char *ramdisk_name,
- unsigned long flags,
- unsigned int store_evtchn,
- unsigned long *store_mfn,
- unsigned int console_evtchn,
- unsigned long *console_mfn);
-
-/**
- * This function will create a domain for a paravirtualized Linux
- * using buffers for kernel and initrd
- *
- * @parm xch a handle to an open hypervisor interface
- * @parm domid the id of the domain
- * @parm mem_mb memory size in megabytes
- * @parm image_buffer buffer containing kernel image
- * @parm image_size size of the kernel image buffer
- * @parm initrd_buffer name of the ramdisk image file
- * @parm initrd_size size of the ramdisk buffer
- * @parm cmdline command line string
- * @parm flags domain creation flags
- * @parm store_evtchn the store event channel for this domain to use
- * @parm store_mfn returned with the mfn of the store page
- * @parm console_evtchn the console event channel for this domain to use
- * @parm conole_mfn returned with the mfn of the console page
- * @return 0 on success, -1 on failure
- */
-int xc_linux_build_mem(xc_interface *xch,
- uint32_t domid,
- unsigned int mem_mb,
- const char *image_buffer,
- unsigned long image_size,
- const char *initrd_buffer,
- unsigned long initrd_size,
- const char *cmdline,
- const char *features,
- unsigned long flags,
- unsigned int store_evtchn,
- unsigned long *store_mfn,
- unsigned int console_evtchn,
- unsigned long *console_mfn);
-
struct xc_hvm_firmware_module {
uint8_t *data;
uint32_t length;
diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c
index 5c1f043..20521cf 100644
--- a/tools/libxc/xc_dom_compat_linux.c
+++ b/tools/libxc/xc_dom_compat_linux.c
@@ -34,74 +34,26 @@
/* ------------------------------------------------------------------------ */
-static int xc_linux_build_internal(struct xc_dom_image *dom,
- xc_interface *xch, uint32_t domid,
- unsigned int mem_mb,
- unsigned long flags,
- unsigned int store_evtchn,
- unsigned long *store_mfn,
- unsigned int console_evtchn,
- unsigned long *console_mfn)
-{
- int rc;
-
- dom->flags = flags;
- dom->console_evtchn = console_evtchn;
- dom->xenstore_evtchn = store_evtchn;
-
- if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 )
- goto out;
- if ( (rc = xc_dom_parse_image(dom)) != 0 )
- goto out;
- if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 )
- goto out;
- if ( (rc = xc_dom_boot_mem_init(dom)) != 0 )
- goto out;
- if ( (rc = xc_dom_build_image(dom)) != 0 )
- goto out;
- if ( (rc = xc_dom_boot_image(dom)) != 0 )
- goto out;
- if ( (rc = xc_dom_gnttab_init(dom)) != 0)
- goto out;
-
- *console_mfn = xc_dom_p2m(dom, dom->console_pfn);
- *store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
-
- out:
- return rc;
-}
-
-int xc_linux_build_mem(xc_interface *xch, uint32_t domid,
- unsigned int mem_mb,
- const char *image_buffer,
- unsigned long image_size,
- const char *initrd,
- unsigned long initrd_len,
- const char *cmdline,
- const char *features,
- unsigned long flags,
- unsigned int store_evtchn,
- unsigned long *store_mfn,
- unsigned int console_evtchn,
- unsigned long *console_mfn)
+int xc_get_bit_size(xc_interface *xch,
+ const char *image_name, const char *cmdline,
+ const char *features, int *bit_size)
{
struct xc_dom_image *dom;
int rc;
-
- xc_dom_loginit(xch);
+ *bit_size = 0;
dom = xc_dom_allocate(xch, cmdline, features);
if (dom == NULL)
return -1;
- if ( (rc = xc_dom_kernel_mem(dom, image_buffer, image_size)) != 0 )
+ if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
goto out;
- if ( initrd && ((rc = xc_dom_ramdisk_mem(dom, initrd, initrd_len)) != 0) )
+ if ( (rc = xc_dom_parse_image(dom)) != 0 )
goto out;
-
- rc = xc_linux_build_internal(dom, xch, domid,
- mem_mb, flags,
- store_evtchn, store_mfn,
- console_evtchn, console_mfn);
-
+ if( dom->guest_type != NULL){
+ if(strstr(dom->guest_type, "x86_64") != NULL)
+ *bit_size = X86_64_B_SIZE; //64bit Guest
+ if(strstr(dom->guest_type, "x86_32") != NULL)
+ *bit_size = X86_32_B_SIZE; //32bit Guest
+ }
out:
xc_dom_release(dom);
return rc;
@@ -132,66 +84,33 @@ int xc_linux_build(xc_interface *xch, uint32_t domid,
((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) )
goto out;
- rc = xc_linux_build_internal(dom, xch, domid,
- mem_mb, flags,
- store_evtchn, store_mfn,
- console_evtchn, console_mfn);
+ dom->flags = flags;
+ dom->console_evtchn = console_evtchn;
+ dom->xenstore_evtchn = store_evtchn;
- out:
- xc_dom_release(dom);
- return rc;
-}
-int xc_get_bit_size(xc_interface *xch,
- const char *image_name, const char *cmdline,
- const char *features, int *bit_size)
-{
- struct xc_dom_image *dom;
- int rc;
- *bit_size = 0;
- dom = xc_dom_allocate(xch, cmdline, features);
- if (dom == NULL)
- return -1;
- if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
+ if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 )
goto out;
if ( (rc = xc_dom_parse_image(dom)) != 0 )
goto out;
- if( dom->guest_type != NULL){
- if(strstr(dom->guest_type, "x86_64") != NULL)
- *bit_size = X86_64_B_SIZE; //64bit Guest
- if(strstr(dom->guest_type, "x86_32") != NULL)
- *bit_size = X86_32_B_SIZE; //32bit Guest
- }
+ if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 )
+ goto out;
+ if ( (rc = xc_dom_boot_mem_init(dom)) != 0 )
+ goto out;
+ if ( (rc = xc_dom_build_image(dom)) != 0 )
+ goto out;
+ if ( (rc = xc_dom_boot_image(dom)) != 0 )
+ goto out;
+ if ( (rc = xc_dom_gnttab_init(dom)) != 0)
+ goto out;
+
+ *console_mfn = xc_dom_p2m(dom, dom->console_pfn);
+ *store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
-out:
+ out:
xc_dom_release(dom);
return rc;
}
-int xc_dom_linux_build(xc_interface *xch,
- struct xc_dom_image *dom,
- uint32_t domid,
- unsigned int mem_mb,
- const char *image_name,
- const char *initrd_name,
- unsigned long flags,
- unsigned int store_evtchn,
- unsigned long *store_mfn,
- unsigned int console_evtchn, unsigned long *console_mfn)
-{
- int rc;
-
- if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
- return rc;
- if ( initrd_name && strlen(initrd_name) &&
- ((rc = xc_dom_ramdisk_file(dom, initrd_name)) != 0) )
- return rc;
-
- return xc_linux_build_internal(dom, xch, domid,
- mem_mb, flags,
- store_evtchn, store_mfn,
- console_evtchn, console_mfn);
-}
-
/*
* Local variables:
* mode: C
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index b00add0..699de52 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -51,6 +51,7 @@
#include <xenstore.h>
#include <xenctrl.h>
#include <xenguest.h>
+#include <xc_dom.h>
#include "xentoollog.h"
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 26290a3..94f0a13 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -7,7 +7,6 @@
#include <Python.h>
#include <xenctrl.h>
#include <xenguest.h>
-#include <zlib.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -17,8 +16,6 @@
#include <netdb.h>
#include <arpa/inet.h>
-#include "xenctrl.h"
-#include <xen/elfnote.h>
#include <xen/tmem.h>
#include "xc_dom.h"
#include <xen/hvm/hvm_info_table.h>
@@ -454,90 +451,6 @@ static PyObject *pyxc_getBitSize(XcObject *self,
return info_type;
}
-static PyObject *pyxc_linux_build(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t domid;
- struct xc_dom_image *dom;
- char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
- int flags = 0;
- int store_evtchn, console_evtchn;
- unsigned int mem_mb;
- unsigned long store_mfn = 0;
- unsigned long console_mfn = 0;
- PyObject* elfnote_dict;
- PyObject* elfnote = NULL;
- PyObject* ret;
- int i;
-
- static char *kwd_list[] = { "domid", "store_evtchn", "memsize",
- "console_evtchn", "image",
- /* optional */
- "ramdisk", "cmdline", "flags",
- "features", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssis", kwd_list,
- &domid, &store_evtchn, &mem_mb,
- &console_evtchn, &image,
- /* optional */
- &ramdisk, &cmdline, &flags, &features) )
- return NULL;
-
- xc_dom_loginit(self->xc_handle);
- if (!(dom = xc_dom_allocate(self->xc_handle, cmdline, features)))
- return pyxc_error_to_exception(self->xc_handle);
-
- if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image,
- ramdisk, flags, store_evtchn, &store_mfn,
- console_evtchn, &console_mfn) != 0 ) {
- goto out;
- }
-
- if ( !(elfnote_dict = PyDict_New()) )
- goto out;
-
- for ( i = 0; i < ARRAY_SIZE(dom->parms.elf_notes); i++ )
- {
- switch ( dom->parms.elf_notes[i].type )
- {
- case XEN_ENT_NONE:
- continue;
- case XEN_ENT_LONG:
- elfnote = Py_BuildValue("k", dom->parms.elf_notes[i].data.num);
- break;
- case XEN_ENT_STR:
- elfnote = Py_BuildValue("s", dom->parms.elf_notes[i].data.str);
- break;
- }
- PyDict_SetItemString(elfnote_dict,
- dom->parms.elf_notes[i].name,
- elfnote);
- Py_DECREF(elfnote);
- }
-
- ret = Py_BuildValue("{s:i,s:i,s:N}",
- "store_mfn", store_mfn,
- "console_mfn", console_mfn,
- "notes", elfnote_dict);
-
- if ( dom->arch_hooks->native_protocol )
- {
- PyObject *native_protocol =
- Py_BuildValue("s", dom->arch_hooks->native_protocol);
- PyDict_SetItemString(ret, "native_protocol", native_protocol);
- Py_DECREF(native_protocol);
- }
-
- xc_dom_release(dom);
-
- return ret;
-
- out:
- xc_dom_release(dom);
- return pyxc_error_to_exception(self->xc_handle);
-}
-
static PyObject *pyxc_hvm_param_get(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -2269,17 +2182,6 @@ static PyMethodDef pyxc_methods[] = {
" cpumap [int]: Bitmap of CPUs this VCPU can run on\n"
" cpu [int]: CPU that this VCPU is currently bound to\n" },
- { "linux_build",
- (PyCFunction)pyxc_linux_build,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Build a new Linux guest OS.\n"
- " dom [int]: Identifier of domain to build into.\n"
- " image [str]: Name of kernel image file. May be gzipped.\n"
- " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
- " cmdline [str, n/a]: Kernel parameters, if any.\n\n"
- " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
{"getBitSize",
(PyCFunction)pyxc_getBitSize,
METH_VARARGS | METH_KEYWORDS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 02/13] libxc: remove xc_get_bit_size() from tools/libxc/xc_dom_compat_linux.c
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
2015-10-23 13:05 ` [PATCH 01/13] libxc: remove most of tools/libxc/xc_dom_compat_linux.c Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 03/13] python: remove flask related libxc python bindings Juergen Gross
` (12 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
xc_get_bit_size() is being used by the unused python wrapper
xc.getBitSize() only. Remove the wrapper and xc_get_bit_size().
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/libxc/include/xenguest.h | 4 ----
tools/libxc/xc_dom_compat_linux.c | 25 -------------------------
tools/python/xen/lowlevel/xc/xc.c | 28 ----------------------------
3 files changed, 57 deletions(-)
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index a9fa32c..8f918b1 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -184,10 +184,6 @@ int xc_await_suspend(xc_interface *xch, xc_evtchn *xce, int suspend_evtchn);
int xc_suspend_evtchn_init_sane(xc_interface *xch, xc_evtchn *xce,
int domid, int port, int *lockfd);
-int xc_get_bit_size(xc_interface *xch,
- const char *image_name, const char *cmdline,
- const char *features, int *type);
-
int xc_mark_page_online(xc_interface *xch, unsigned long start,
unsigned long end, uint32_t *status);
diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c
index 20521cf..abbc09f 100644
--- a/tools/libxc/xc_dom_compat_linux.c
+++ b/tools/libxc/xc_dom_compat_linux.c
@@ -34,31 +34,6 @@
/* ------------------------------------------------------------------------ */
-int xc_get_bit_size(xc_interface *xch,
- const char *image_name, const char *cmdline,
- const char *features, int *bit_size)
-{
- struct xc_dom_image *dom;
- int rc;
- *bit_size = 0;
- dom = xc_dom_allocate(xch, cmdline, features);
- if (dom == NULL)
- return -1;
- if ( (rc = xc_dom_kernel_file(dom, image_name)) != 0 )
- goto out;
- if ( (rc = xc_dom_parse_image(dom)) != 0 )
- goto out;
- if( dom->guest_type != NULL){
- if(strstr(dom->guest_type, "x86_64") != NULL)
- *bit_size = X86_64_B_SIZE; //64bit Guest
- if(strstr(dom->guest_type, "x86_32") != NULL)
- *bit_size = X86_32_B_SIZE; //32bit Guest
- }
- out:
- xc_dom_release(dom);
- return rc;
-}
-
int xc_linux_build(xc_interface *xch, uint32_t domid,
unsigned int mem_mb,
const char *image_name,
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 94f0a13..d75f98c 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -6,7 +6,6 @@
#include <Python.h>
#include <xenctrl.h>
-#include <xenguest.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -431,26 +430,6 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
return info_dict;
}
-static PyObject *pyxc_getBitSize(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- PyObject *info_type;
- char *image = NULL, *cmdline = "", *features = NULL;
- int type = 0;
- static char *kwd_list[] = { "image", "cmdline", "features", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "sss", kwd_list,
- &image, &cmdline, &features) )
- return NULL;
-
- xc_get_bit_size(self->xc_handle, image, cmdline, features, &type);
- if (type < 0)
- return pyxc_error_to_exception(self->xc_handle);
- info_type = Py_BuildValue("{s:i}",
- "type", type);
- return info_type;
-}
-
static PyObject *pyxc_hvm_param_get(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -2182,13 +2161,6 @@ static PyMethodDef pyxc_methods[] = {
" cpumap [int]: Bitmap of CPUs this VCPU can run on\n"
" cpu [int]: CPU that this VCPU is currently bound to\n" },
- {"getBitSize",
- (PyCFunction)pyxc_getBitSize,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Get the bitsize of a guest OS.\n"
- " image [str]: Name of kernel image file. May be gzipped.\n"
- " cmdline [str, n/a]: Kernel parameters, if any.\n\n"},
-
{ "gnttab_hvm_seed",
(PyCFunction)pyxc_gnttab_hvm_seed,
METH_KEYWORDS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 03/13] python: remove flask related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
2015-10-23 13:05 ` [PATCH 01/13] libxc: remove most of tools/libxc/xc_dom_compat_linux.c Juergen Gross
2015-10-23 13:05 ` [PATCH 02/13] libxc: remove xc_get_bit_size() from tools/libxc/xc_dom_compat_linux.c Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 04/13] python: remove cpupool " Juergen Gross
` (11 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 flask related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 238 --------------------------------------
1 file changed, 238 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index d75f98c..c904627 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -20,8 +20,6 @@
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/params.h>
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
/* Needed for Python versions earlier than 2.3. */
#ifndef PyMODINIT_FUNC
#define PyMODINIT_FUNC DL_EXPORT(void)
@@ -30,8 +28,6 @@
#define PKG "xen.lowlevel.xc"
#define CLS "xc"
-#define FLASK_CTX_LEN 1024
-
static PyObject *xc_error_obj, *zero;
typedef struct {
@@ -1855,187 +1851,6 @@ static PyObject *pyxc_cpupool_freeinfo(XcObject *self)
return info;
}
-static PyObject *pyflask_context_to_sid(PyObject *self, PyObject *args,
- PyObject *kwds)
-{
- xc_interface *xc_handle;
- char *ctx;
- uint32_t sid;
- int ret;
-
- static char *kwd_list[] = { "context", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list,
- &ctx) )
- return NULL;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_context_to_sid(xc_handle, ctx, strlen(ctx), &sid);
-
- xc_interface_close(xc_handle);
-
- if ( ret != 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return PyInt_FromLong(sid);
-}
-
-static PyObject *pyflask_sid_to_context(PyObject *self, PyObject *args,
- PyObject *kwds)
-{
- xc_interface *xc_handle;
- uint32_t sid;
- char ctx[FLASK_CTX_LEN];
- uint32_t ctx_len = FLASK_CTX_LEN;
- int ret;
-
- static char *kwd_list[] = { "sid", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list,
- &sid) )
- return NULL;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
-
- xc_interface_close(xc_handle);
-
- if ( ret != 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return Py_BuildValue("s", ctx, ctx_len);
-}
-
-static PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds)
-{
- xc_interface *xc_handle;
- char *policy;
- uint32_t len;
- int ret;
-
- static char *kwd_list[] = { "policy", NULL };
-
- if( !PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwd_list, &policy, &len) )
- return NULL;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_load(xc_handle, policy, len);
-
- xc_interface_close(xc_handle);
-
- if ( ret != 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return Py_BuildValue("i", ret);
-}
-
-static PyObject *pyflask_getenforce(PyObject *self)
-{
- xc_interface *xc_handle;
- int ret;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_getenforce(xc_handle);
-
- xc_interface_close(xc_handle);
-
- if ( ret < 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return Py_BuildValue("i", ret);
-}
-
-static PyObject *pyflask_setenforce(PyObject *self, PyObject *args,
- PyObject *kwds)
-{
- xc_interface *xc_handle;
- int mode;
- int ret;
-
- static char *kwd_list[] = { "mode", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list,
- &mode) )
- return NULL;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_setenforce(xc_handle, mode);
-
- xc_interface_close(xc_handle);
-
- if ( ret != 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return Py_BuildValue("i", ret);
-}
-
-static PyObject *pyflask_access(PyObject *self, PyObject *args,
- PyObject *kwds)
-{
- xc_interface *xc_handle;
- char *tcon, *scon;
- uint16_t tclass;
- uint32_t req, allowed, decided, auditallow, auditdeny, seqno;
- int ret;
-
- static char *kwd_list[] = { "src_context", "tar_context",
- "tar_class", "req_permissions",
- "decided", "auditallow","auditdeny",
- "seqno", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ssil|llll", kwd_list,
- &scon, &tcon, &tclass, &req, &decided,
- &auditallow, &auditdeny, &seqno) )
- return NULL;
-
- xc_handle = xc_interface_open(0,0,0);
- if (!xc_handle) {
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
- &auditallow, &auditdeny, &seqno);
-
- xc_interface_close(xc_handle);
-
- if ( ret != 0 ) {
- errno = -ret;
- return PyErr_SetFromErrno(xc_error_obj);
- }
-
- return Py_BuildValue("i",ret);
-}
-
static PyMethodDef pyxc_methods[] = {
{ "domain_create",
(PyCFunction)pyxc_domain_create,
@@ -2584,59 +2399,6 @@ static PyMethodDef pyxc_methods[] = {
"Get info about cpus not in any cpupool.\n"
"Returns: [list]: List of CPUs\n" },
- { "flask_context_to_sid",
- (PyCFunction)pyflask_context_to_sid,
- METH_KEYWORDS, "\n"
- "Convert a context string to a dynamic SID.\n"
- " context [str]: String specifying context to be converted\n"
- "Returns: [int]: Numeric SID on success; -1 on error.\n" },
-
- { "flask_sid_to_context",
- (PyCFunction)pyflask_sid_to_context,
- METH_KEYWORDS, "\n"
- "Convert a dynamic SID to context string.\n"
- " context [int]: SID to be converted\n"
- "Returns: [str]: Numeric SID on success; -1 on error.\n" },
-
- { "flask_load",
- (PyCFunction)pyflask_load,
- METH_KEYWORDS, "\n"
- "Loads a policy into the hypervisor.\n"
- " policy [str]: policy to be load\n"
- "Returns: [int]: 0 on success; -1 on failure.\n" },
-
- { "flask_getenforce",
- (PyCFunction)pyflask_getenforce,
- METH_NOARGS, "\n"
- "Returns the current mode of the Flask XSM module.\n"
- "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" },
-
- { "flask_setenforce",
- (PyCFunction)pyflask_setenforce,
- METH_KEYWORDS, "\n"
- "Modifies the current mode for the Flask XSM module.\n"
- " mode [int]: mode to change to\n"
- "Returns: [int]: 0 on success; -1 on failure.\n" },
-
- { "flask_access",
- (PyCFunction)pyflask_access,
- METH_KEYWORDS, "\n"
- "Returns whether a source context has access to target context based on \
- class and permissions requested.\n"
- " scon [str]: source context\n"
- " tcon [str]: target context\n"
- " tclass [int]: target security class\n"
- " req [int] requested permissions\n"
- " allowed [int] permissions allow for the target class between the source \
- and target context\n"
- " decided [int] the permissions that were returned in the allowed \
- parameter\n"
- " auditallow [int] permissions set to audit on allow\n"
- " auditdeny [int] permissions set to audit on deny\n"
- " seqno [int] not used\n"
- "Returns: [int]: 0 on all permission granted; -1 if any permissions are \
- denied\n" },
-
{ NULL, NULL, 0, NULL }
};
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 04/13] python: remove cpupool related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (2 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 03/13] python: remove flask related libxc python bindings Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 05/13] python: remove cpuid " Juergen Gross
` (10 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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@suse.com>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 05/13] python: remove cpuid related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (3 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 04/13] python: remove cpupool " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 06/13] python: remove device " Juergen Gross
` (9 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 cpuid related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 128 --------------------------------------
1 file changed, 128 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 9d82579..7809fc6 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -658,105 +658,6 @@ static PyObject *pyxc_get_device_group(XcObject *self,
}
#if defined(__i386__) || defined(__x86_64__)
-static void pyxc_dom_extract_cpuid(PyObject *config,
- char **regs)
-{
- const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
- PyObject *obj;
- int i;
-
- memset(regs, 0, 4*sizeof(*regs));
-
- if ( !PyDict_Check(config) )
- return;
-
- for ( i = 0; i < 4; i++ )
- if ( (obj = PyDict_GetItemString(config, regs_extract[i])) != NULL )
- regs[i] = PyString_AS_STRING(obj);
-}
-
-static PyObject *pyxc_create_cpuid_dict(char **regs)
-{
- const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
- PyObject *dict;
- int i;
-
- dict = PyDict_New();
- for ( i = 0; i < 4; i++ )
- {
- if ( regs[i] == NULL )
- continue;
- PyDict_SetItemString(dict, regs_extract[i],
- PyString_FromString(regs[i]));
- free(regs[i]);
- regs[i] = NULL;
- }
- return dict;
-}
-
-static PyObject *pyxc_dom_check_cpuid(XcObject *self,
- PyObject *args)
-{
- PyObject *sub_input, *config;
- unsigned int input[2];
- char *regs[4], *regs_transform[4];
-
- if ( !PyArg_ParseTuple(args, "iOO", &input[0], &sub_input, &config) )
- return NULL;
-
- pyxc_dom_extract_cpuid(config, regs);
-
- input[1] = XEN_CPUID_INPUT_UNUSED;
- if ( PyLong_Check(sub_input) )
- input[1] = PyLong_AsUnsignedLong(sub_input);
-
- if ( xc_cpuid_check(self->xc_handle, input,
- (const char **)regs, regs_transform) )
- return pyxc_error_to_exception(self->xc_handle);
-
- return pyxc_create_cpuid_dict(regs_transform);
-}
-
-static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self,
- PyObject *args)
-{
- int domid;
-
- if ( !PyArg_ParseTuple(args, "i", &domid) )
- return NULL;
-
- if ( xc_cpuid_apply_policy(self->xc_handle, domid) )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-
-static PyObject *pyxc_dom_set_cpuid(XcObject *self,
- PyObject *args)
-{
- PyObject *sub_input, *config;
- unsigned int domid, input[2];
- char *regs[4], *regs_transform[4];
-
- if ( !PyArg_ParseTuple(args, "IIOO", &domid,
- &input[0], &sub_input, &config) )
- return NULL;
-
- pyxc_dom_extract_cpuid(config, regs);
-
- input[1] = XEN_CPUID_INPUT_UNUSED;
- if ( PyLong_Check(sub_input) )
- input[1] = PyLong_AsUnsignedLong(sub_input);
-
- if ( xc_cpuid_set(self->xc_handle, domid, input, (const char **)regs,
- regs_transform) )
- return pyxc_error_to_exception(self->xc_handle);
-
- return pyxc_create_cpuid_dict(regs_transform);
-}
-
static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -2103,35 +2004,6 @@ static PyMethodDef pyxc_methods[] = {
" keys [str]: String of keys to inject.\n" },
#if defined(__i386__) || defined(__x86_64__)
- { "domain_check_cpuid",
- (PyCFunction)pyxc_dom_check_cpuid,
- METH_VARARGS, "\n"
- "Apply checks to host CPUID.\n"
- " input [long]: Input for cpuid instruction (eax)\n"
- " sub_input [long]: Second input (optional, may be None) for cpuid "
- " instruction (ecx)\n"
- " config [dict]: Dictionary of register\n"
- " config [dict]: Dictionary of register, use for checking\n\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-
- { "domain_set_cpuid",
- (PyCFunction)pyxc_dom_set_cpuid,
- METH_VARARGS, "\n"
- "Set cpuid response for an input and a domain.\n"
- " dom [int]: Identifier of domain.\n"
- " input [long]: Input for cpuid instruction (eax)\n"
- " sub_input [long]: Second input (optional, may be None) for cpuid "
- " instruction (ecx)\n"
- " config [dict]: Dictionary of register\n\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-
- { "domain_set_policy_cpuid",
- (PyCFunction)pyxc_dom_set_policy_cpuid,
- METH_VARARGS, "\n"
- "Set the default cpuid policy for a domain.\n"
- " dom [int]: Identifier of domain.\n\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-
{ "domain_set_machine_address_size",
(PyCFunction)pyxc_dom_set_machine_address_size,
METH_VARARGS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 06/13] python: remove device related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (4 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 05/13] python: remove cpuid " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 07/13] python: remove scheduler " Juergen Gross
` (8 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 device related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 226 --------------------------------------
1 file changed, 226 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 7809fc6..e0f1d7f 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -466,197 +466,6 @@ static PyObject *pyxc_hvm_param_set(XcObject *self,
return zero;
}
-static int token_value(char *token)
-{
- token = strchr(token, 'x') + 1;
- return strtol(token, NULL, 16);
-}
-
-static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
-{
- char *token;
-
- if ( !(*str) || !strchr(*str, ',') )
- return 0;
-
- token = *str;
- *seg = token_value(token);
- token = strchr(token, ',') + 1;
- *bus = token_value(token);
- token = strchr(token, ',') + 1;
- *dev = token_value(token);
- token = strchr(token, ',') + 1;
- *func = token_value(token);
- token = strchr(token, ',');
- *str = token ? token + 1 : NULL;
-
- return 1;
-}
-
-static PyObject *pyxc_test_assign_device(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- char *pci_str;
- int32_t sbdf = 0;
- int seg, bus, dev, func;
-
- static char *kwd_list[] = { "domid", "pci", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
- &dom, &pci_str) )
- return NULL;
-
- while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
- {
- sbdf = seg << 16;
- sbdf |= (bus & 0xff) << 8;
- sbdf |= (dev & 0x1f) << 3;
- sbdf |= (func & 0x7);
-
- if ( xc_test_assign_device(self->xc_handle, dom, sbdf) != 0 )
- {
- if (errno == ENOSYS)
- sbdf = -1;
- break;
- }
- sbdf = 0;
- }
-
- return Py_BuildValue("i", sbdf);
-}
-
-static PyObject *pyxc_assign_device(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- char *pci_str;
- int32_t sbdf = 0;
- int seg, bus, dev, func;
-
- static char *kwd_list[] = { "domid", "pci", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
- &dom, &pci_str) )
- return NULL;
-
- while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
- {
- sbdf = seg << 16;
- sbdf |= (bus & 0xff) << 8;
- sbdf |= (dev & 0x1f) << 3;
- sbdf |= (func & 0x7);
-
- if ( xc_assign_device(self->xc_handle, dom, sbdf, 0) != 0 )
- {
- if (errno == ENOSYS)
- sbdf = -1;
- break;
- }
- sbdf = 0;
- }
-
- return Py_BuildValue("i", sbdf);
-}
-
-static PyObject *pyxc_deassign_device(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- char *pci_str;
- int32_t sbdf = 0;
- int seg, bus, dev, func;
-
- static char *kwd_list[] = { "domid", "pci", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
- &dom, &pci_str) )
- return NULL;
-
- while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
- {
- sbdf = seg << 16;
- sbdf |= (bus & 0xff) << 8;
- sbdf |= (dev & 0x1f) << 3;
- sbdf |= (func & 0x7);
-
- if ( xc_deassign_device(self->xc_handle, dom, sbdf) != 0 )
- {
- if (errno == ENOSYS)
- sbdf = -1;
- break;
- }
- sbdf = 0;
- }
-
- return Py_BuildValue("i", sbdf);
-}
-
-static PyObject *pyxc_get_device_group(XcObject *self,
- PyObject *args)
-{
- uint32_t sbdf;
- uint32_t max_sdevs, num_sdevs;
- int domid, seg, bus, dev, func, rc, i;
- PyObject *Pystr;
- char *group_str;
- char dev_str[9];
- uint32_t *sdev_array;
-
- if ( !PyArg_ParseTuple(args, "iiiii", &domid, &seg, &bus, &dev, &func) )
- return NULL;
-
- /* Maximum allowed siblings device number per group */
- max_sdevs = 1024;
-
- sdev_array = calloc(max_sdevs, sizeof(*sdev_array));
- if (sdev_array == NULL)
- return PyErr_NoMemory();
-
- sbdf = seg << 16;
- sbdf |= (bus & 0xff) << 8;
- sbdf |= (dev & 0x1f) << 3;
- sbdf |= (func & 0x7);
-
- rc = xc_get_device_group(self->xc_handle,
- domid, sbdf, max_sdevs, &num_sdevs, sdev_array);
-
- if ( rc < 0 )
- {
- free(sdev_array);
- return pyxc_error_to_exception(self->xc_handle);
- }
-
- if ( !num_sdevs )
- {
- free(sdev_array);
- return Py_BuildValue("s", "");
- }
-
- group_str = calloc(num_sdevs, sizeof(dev_str));
- if (group_str == NULL)
- {
- free(sdev_array);
- return PyErr_NoMemory();
- }
-
- for ( i = 0; i < num_sdevs; i++ )
- {
- bus = (sdev_array[i] >> 16) & 0xff;
- dev = (sdev_array[i] >> 11) & 0x1f;
- func = (sdev_array[i] >> 8) & 0x7;
- snprintf(dev_str, sizeof(dev_str), "%02x:%02x.%x,", bus, dev, func);
- strcat(group_str, dev_str);
- }
-
- Pystr = Py_BuildValue("s", group_str);
-
- free(sdev_array);
- free(group_str);
-
- return Pystr;
-}
-
#if defined(__i386__) || defined(__x86_64__)
static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
PyObject *args,
@@ -1736,41 +1545,6 @@ static PyMethodDef pyxc_methods[] = {
" value [long]: Value of param.\n"
"Returns: [int] 0 on success.\n" },
- { "get_device_group",
- (PyCFunction)pyxc_get_device_group,
- METH_VARARGS, "\n"
- "get sibling devices infomation.\n"
- " dom [int]: Domain to assign device to.\n"
- " seg [int]: PCI segment.\n"
- " bus [int]: PCI bus.\n"
- " dev [int]: PCI dev.\n"
- " func [int]: PCI func.\n"
- "Returns: [string]: Sibling devices \n" },
-
- { "test_assign_device",
- (PyCFunction)pyxc_test_assign_device,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "test device assignment with VT-d.\n"
- " dom [int]: Identifier of domain to build into.\n"
- " pci_str [str]: PCI devices.\n"
- "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" },
-
- { "assign_device",
- (PyCFunction)pyxc_assign_device,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Assign device to IOMMU domain.\n"
- " dom [int]: Domain to assign device to.\n"
- " pci_str [str]: PCI devices.\n"
- "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" },
-
- { "deassign_device",
- (PyCFunction)pyxc_deassign_device,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Deassign device from IOMMU domain.\n"
- " dom [int]: Domain to deassign device from.\n"
- " pci_str [str]: PCI devices.\n"
- "Returns: [int] 0 on success, or device bdf that can't be deassigned.\n" },
-
{ "sched_id_get",
(PyCFunction)pyxc_sched_id_get,
METH_NOARGS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 07/13] python: remove scheduler related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (5 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 06/13] python: remove device " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 08/13] python: remove unused memory " Juergen Gross
` (7 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 scheduler related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 133 --------------------------------------
1 file changed, 133 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index e0f1d7f..6c4ad18 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1006,97 +1006,6 @@ static PyObject *pyxc_shadow_mem_control(PyObject *self,
return Py_BuildValue("i", mbarg);
}
-static PyObject *pyxc_sched_id_get(XcObject *self) {
-
- int sched_id;
- if (xc_sched_id(self->xc_handle, &sched_id) != 0)
- return PyErr_SetFromErrno(xc_error_obj);
-
- return Py_BuildValue("i", sched_id);
-}
-
-static PyObject *pyxc_sched_credit_domain_set(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t domid;
- uint16_t weight;
- uint16_t cap;
- static char *kwd_list[] = { "domid", "weight", "cap", NULL };
- static char kwd_type[] = "I|HH";
- struct xen_domctl_sched_credit sdom;
-
- weight = 0;
- cap = (uint16_t)~0U;
- if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
- &domid, &weight, &cap) )
- return NULL;
-
- sdom.weight = weight;
- sdom.cap = cap;
-
- if ( xc_sched_credit_domain_set(self->xc_handle, domid, &sdom) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_sched_credit_domain_get(XcObject *self, PyObject *args)
-{
- uint32_t domid;
- struct xen_domctl_sched_credit sdom;
-
- if( !PyArg_ParseTuple(args, "I", &domid) )
- return NULL;
-
- if ( xc_sched_credit_domain_get(self->xc_handle, domid, &sdom) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- return Py_BuildValue("{s:H,s:H}",
- "weight", sdom.weight,
- "cap", sdom.cap);
-}
-
-static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t domid;
- uint16_t weight;
- static char *kwd_list[] = { "domid", "weight", NULL };
- static char kwd_type[] = "I|H";
- struct xen_domctl_sched_credit2 sdom;
-
- weight = 0;
- if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
- &domid, &weight) )
- return NULL;
-
- sdom.weight = weight;
-
- if ( xc_sched_credit2_domain_set(self->xc_handle, domid, &sdom) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)
-{
- uint32_t domid;
- struct xen_domctl_sched_credit2 sdom;
-
- if( !PyArg_ParseTuple(args, "I", &domid) )
- return NULL;
-
- if ( xc_sched_credit2_domain_get(self->xc_handle, domid, &sdom) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- return Py_BuildValue("{s:H}",
- "weight", sdom.weight);
-}
-
static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)
{
uint32_t dom;
@@ -1545,48 +1454,6 @@ static PyMethodDef pyxc_methods[] = {
" value [long]: Value of param.\n"
"Returns: [int] 0 on success.\n" },
- { "sched_id_get",
- (PyCFunction)pyxc_sched_id_get,
- METH_NOARGS, "\n"
- "Get the current scheduler type in use.\n"
- "Returns: [int] sched_id.\n" },
-
- { "sched_credit_domain_set",
- (PyCFunction)pyxc_sched_credit_domain_set,
- METH_KEYWORDS, "\n"
- "Set the scheduling parameters for a domain when running with the\n"
- "SMP credit scheduler.\n"
- " domid [int]: domain id to set\n"
- " weight [short]: domain's scheduling weight\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "sched_credit_domain_get",
- (PyCFunction)pyxc_sched_credit_domain_get,
- METH_VARARGS, "\n"
- "Get the scheduling parameters for a domain when running with the\n"
- "SMP credit scheduler.\n"
- " domid [int]: domain id to get\n"
- "Returns: [dict]\n"
- " weight [short]: domain's scheduling weight\n"},
-
- { "sched_credit2_domain_set",
- (PyCFunction)pyxc_sched_credit2_domain_set,
- METH_KEYWORDS, "\n"
- "Set the scheduling parameters for a domain when running with the\n"
- "SMP credit2 scheduler.\n"
- " domid [int]: domain id to set\n"
- " weight [short]: domain's scheduling weight\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "sched_credit2_domain_get",
- (PyCFunction)pyxc_sched_credit2_domain_get,
- METH_VARARGS, "\n"
- "Get the scheduling parameters for a domain when running with the\n"
- "SMP credit2 scheduler.\n"
- " domid [int]: domain id to get\n"
- "Returns: [dict]\n"
- " weight [short]: domain's scheduling weight\n"},
-
{ "evtchn_alloc_unbound",
(PyCFunction)pyxc_evtchn_alloc_unbound,
METH_VARARGS | METH_KEYWORDS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 08/13] python: remove unused memory related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (6 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 07/13] python: remove scheduler " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 09/13] python: remove domain handling " Juergen Gross
` (6 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 most memory related python binding left. Remove them.
Especially xc.domain_set_target_mem() and xc.domain_setmaxmem() will
not be removed as there are some out of tree users.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 92 ---------------------------------------
1 file changed, 92 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 6c4ad18..02f1694 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -953,59 +953,6 @@ static PyObject *pyxc_xeninfo(XcObject *self)
"cc_compile_date", xen_cc.compile_date);
}
-static PyObject *pyxc_shadow_control(PyObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- XcObject *xc = (XcObject *)self;
-
- uint32_t dom;
- int op=0;
-
- static char *kwd_list[] = { "dom", "op", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
- &dom, &op) )
- return NULL;
-
- if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0, NULL, 0, NULL)
- < 0 )
- return pyxc_error_to_exception(xc->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_shadow_mem_control(PyObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- XcObject *xc = (XcObject *)self;
- int op;
- uint32_t dom;
- int mbarg = -1;
- unsigned long mb;
-
- static char *kwd_list[] = { "dom", "mb", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
- &dom, &mbarg) )
- return NULL;
-
- if ( mbarg < 0 )
- op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
- else
- {
- mb = mbarg;
- op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
- }
- if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0, &mb, 0, NULL) < 0 )
- return pyxc_error_to_exception(xc->xc_handle);
-
- mbarg = mb;
- return Py_BuildValue("i", mbarg);
-}
-
static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)
{
uint32_t dom;
@@ -1039,21 +986,6 @@ static PyObject *pyxc_domain_set_target_mem(XcObject *self, PyObject *args)
return zero;
}
-static PyObject *pyxc_domain_set_memmap_limit(XcObject *self, PyObject *args)
-{
- uint32_t dom;
- unsigned int maplimit_kb;
-
- if ( !PyArg_ParseTuple(args, "ii", &dom, &maplimit_kb) )
- return NULL;
-
- if ( xc_domain_set_memmap_limit(self->xc_handle, dom, maplimit_kb) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
static PyObject *pyxc_domain_ioport_permission(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -1530,22 +1462,6 @@ static PyMethodDef pyxc_methods[] = {
"Returns [dict]: information about Xen"
" [None]: on failure.\n" },
- { "shadow_control",
- (PyCFunction)pyxc_shadow_control,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Set parameter for shadow pagetable interface\n"
- " dom [int]: Identifier of domain.\n"
- " op [int, 0]: operation\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "shadow_mem_control",
- (PyCFunction)pyxc_shadow_mem_control,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Set or read shadow pagetable memory use\n"
- " dom [int]: Identifier of domain.\n"
- " mb [int, -1]: MB of shadow memory this domain should have.\n\n"
- "Returns: [int] MB of shadow memory in use by this domain.\n" },
-
{ "domain_setmaxmem",
(PyCFunction)pyxc_domain_setmaxmem,
METH_VARARGS, "\n"
@@ -1562,14 +1478,6 @@ static PyMethodDef pyxc_methods[] = {
" mem_kb [int]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
- { "domain_set_memmap_limit",
- (PyCFunction)pyxc_domain_set_memmap_limit,
- METH_VARARGS, "\n"
- "Set a domain's physical memory mappping limit\n"
- " dom [int]: Identifier of domain.\n"
- " map_limitkb [int]: .\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
{ "domain_ioport_permission",
(PyCFunction)pyxc_domain_ioport_permission,
METH_VARARGS | METH_KEYWORDS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 09/13] python: remove domain handling related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (7 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 08/13] python: remove unused memory " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 10/13] python: remove vcpu " Juergen Gross
` (5 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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@suse.com>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 10/13] python: remove vcpu related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (8 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 09/13] python: remove domain handling " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 11/13] python: remove hvm " Juergen Gross
` (4 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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@suse.com>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 11/13] python: remove hvm related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (9 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 10/13] python: remove vcpu " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 12/13] python: remove permission " Juergen Gross
` (3 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 hvm related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 92 ---------------------------------------
1 file changed, 92 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 5fcee3f..c88386f 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -146,70 +146,6 @@ static PyObject *pyxc_domain_getinfo(XcObject *self,
return list;
}
-static PyObject *pyxc_hvm_param_get(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- int param;
- uint64_t value;
-
- static char *kwd_list[] = { "domid", "param", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
- &dom, ¶m) )
- return NULL;
-
- if ( xc_hvm_param_get(self->xc_handle, dom, param, &value) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- return PyLong_FromUnsignedLongLong(value);
-
-}
-
-static PyObject *pyxc_hvm_param_set(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- int param;
- uint64_t value;
-
- static char *kwd_list[] = { "domid", "param", "value", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiL", kwd_list,
- &dom, ¶m, &value) )
- return NULL;
-
- if ( xc_hvm_param_set(self->xc_handle, dom, param, value) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom, console_domid, xenstore_domid;
- unsigned long xenstore_gmfn = 0;
- unsigned long console_gmfn = 0;
- static char *kwd_list[] = { "domid",
- "console_gmfn", "xenstore_gmfn",
- "console_domid", "xenstore_domid", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
- &dom,
- &console_gmfn, &xenstore_gmfn,
- &console_domid, &xenstore_domid) )
- return NULL;
-
- if ( xc_dom_gnttab_hvm_seed(self->xc_handle, dom,
- console_gmfn, xenstore_gmfn,
- console_domid, xenstore_domid) != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- return Py_None;
-}
-
static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -897,34 +833,6 @@ static PyMethodDef pyxc_methods[] = {
"reason why it shut itself down.\n"
" cpupool [int] Id of cpupool domain is bound to.\n" },
- { "gnttab_hvm_seed",
- (PyCFunction)pyxc_gnttab_hvm_seed,
- METH_KEYWORDS, "\n"
- "Initialise HVM guest grant table.\n"
- " dom [int]: Identifier of domain to build into.\n"
- " console_gmfn [int]: \n"
- " xenstore_gmfn [int]: \n"
- " console_domid [int]: \n"
- " xenstore_domid [int]: \n"
- "Returns: None on sucess. Raises exception on error.\n" },
-
- { "hvm_get_param",
- (PyCFunction)pyxc_hvm_param_get,
- 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: [long] value of the param.\n" },
-
- { "hvm_set_param",
- (PyCFunction)pyxc_hvm_param_set,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "set a parameter of HVM guest OS.\n"
- " dom [int]: Identifier of domain to build into.\n"
- " param [int]: No. of HVM param.\n"
- " value [long]: Value of param.\n"
- "Returns: [int] 0 on success.\n" },
-
{ "evtchn_alloc_unbound",
(PyCFunction)pyxc_evtchn_alloc_unbound,
METH_VARARGS | METH_KEYWORDS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 12/13] python: remove permission related libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (10 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 11/13] python: remove hvm " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-23 13:05 ` [PATCH 13/13] python: remove unused other " Juergen Gross
` (2 subsequent siblings)
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
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 permission related python binding left. Remove them.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 97 ---------------------------------------
1 file changed, 97 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index c88386f..5039f94 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -608,74 +608,6 @@ static PyObject *pyxc_domain_set_target_mem(XcObject *self, PyObject *args)
return zero;
}
-static PyObject *pyxc_domain_ioport_permission(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- int first_port, nr_ports, allow_access, ret;
-
- static char *kwd_list[] = { "domid", "first_port", "nr_ports", "allow_access", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list,
- &dom, &first_port, &nr_ports, &allow_access) )
- return NULL;
-
- ret = xc_domain_ioport_permission(
- self->xc_handle, dom, first_port, nr_ports, allow_access);
- if ( ret != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_domain_irq_permission(PyObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- XcObject *xc = (XcObject *)self;
- uint32_t dom;
- int pirq, allow_access, ret;
-
- static char *kwd_list[] = { "domid", "pirq", "allow_access", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
- &dom, &pirq, &allow_access) )
- return NULL;
-
- ret = xc_domain_irq_permission(
- xc->xc_handle, dom, pirq, allow_access);
- if ( ret != 0 )
- return pyxc_error_to_exception(xc->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_domain_iomem_permission(PyObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- XcObject *xc = (XcObject *)self;
- uint32_t dom;
- unsigned long first_pfn, nr_pfns, allow_access, ret;
-
- static char *kwd_list[] = { "domid", "first_pfn", "nr_pfns", "allow_access", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
- &dom, &first_pfn, &nr_pfns, &allow_access) )
- return NULL;
-
- ret = xc_domain_iomem_permission(
- xc->xc_handle, dom, first_pfn, nr_pfns, allow_access);
- if ( ret != 0 )
- return pyxc_error_to_exception(xc->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
{
uint32_t dom;
@@ -925,35 +857,6 @@ static PyMethodDef pyxc_methods[] = {
" mem_kb [int]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
- { "domain_ioport_permission",
- (PyCFunction)pyxc_domain_ioport_permission,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Allow a domain access to a range of IO ports\n"
- " dom [int]: Identifier of domain to be allowed access.\n"
- " first_port [int]: First IO port\n"
- " nr_ports [int]: Number of IO ports\n"
- " allow_access [int]: Non-zero means enable access; else disable access\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "domain_irq_permission",
- (PyCFunction)pyxc_domain_irq_permission,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Allow a domain access to a physical IRQ\n"
- " dom [int]: Identifier of domain to be allowed access.\n"
- " pirq [int]: The Physical IRQ\n"
- " allow_access [int]: Non-zero means enable access; else disable access\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "domain_iomem_permission",
- (PyCFunction)pyxc_domain_iomem_permission,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Allow a domain access to a range of IO memory pages\n"
- " dom [int]: Identifier of domain to be allowed access.\n"
- " first_pfn [long]: First page of I/O Memory\n"
- " nr_pfns [long]: Number of pages of I/O Memory (>0)\n"
- " allow_access [int]: Non-zero means enable access; else disable access\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
{ "pages_to_kib",
(PyCFunction)pyxc_pages_to_kib,
METH_VARARGS, "\n"
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 13/13] python: remove unused other libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (11 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 12/13] python: remove permission " Juergen Gross
@ 2015-10-23 13:05 ` Juergen Gross
2015-10-26 17:34 ` [PATCH 00/13] tools: do cleanups related to " Wei Liu
2015-11-09 15:19 ` Juergen Gross
14 siblings, 0 replies; 20+ messages in thread
From: Juergen Gross @ 2015-10-23 13:05 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
Cc: Juergen Gross
Mostly for historical reasons Xen includes Python bindings for libxc.
They have been used by xm/xend in the past but nowadays there are
only some few python bindings in use, most of the in out of tree
tools. Remove all unused libxc python bindings.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/python/xen/lowlevel/xc/xc.c | 484 --------------------------------------
1 file changed, 484 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 5039f94..5d79b14 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -146,148 +146,11 @@ static PyObject *pyxc_domain_getinfo(XcObject *self,
return list;
}
-static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom, remote_dom;
- int port;
-
- static char *kwd_list[] = { "domid", "remote_dom", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
- &dom, &remote_dom) )
- return NULL;
-
- if ( (port = xc_evtchn_alloc_unbound(self->xc_handle, dom, remote_dom)) < 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- return PyInt_FromLong(port);
-}
-
-static PyObject *pyxc_evtchn_reset(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
-
- static char *kwd_list[] = { "dom", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
- return NULL;
-
- if ( xc_evtchn_reset(self->xc_handle, dom) < 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_physdev_map_pirq(PyObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- XcObject *xc = (XcObject *)self;
- uint32_t dom;
- int index, pirq, ret;
-
- static char *kwd_list[] = {"domid", "index", "pirq", NULL};
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
- &dom, &index, &pirq) )
- return NULL;
- ret = xc_physdev_map_pirq(xc->xc_handle, dom, index, &pirq);
- if ( ret != 0 )
- return pyxc_error_to_exception(xc->xc_handle);
- return PyLong_FromUnsignedLong(pirq);
-}
-
-static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t dom;
- int bus, dev, func, enable, ret;
-
- static char *kwd_list[] = { "domid", "bus", "dev", "func", "enable", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
- &dom, &bus, &dev, &func, &enable) )
- return NULL;
-
- ret = xc_physdev_pci_access_modify(
- self->xc_handle, dom, bus, dev, func, enable);
- if ( ret != 0 )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_readconsolering(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- unsigned int clear = 0, index = 0, incremental = 0;
- unsigned int count = 16384 + 1, size = count;
- char *str, *ptr;
- PyObject *obj;
- int ret;
-
- static char *kwd_list[] = { "clear", "index", "incremental", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iii", kwd_list,
- &clear, &index, &incremental) ||
- !(str = malloc(size)) )
- return NULL;
-
- ret = xc_readconsolering(self->xc_handle, str, &count, clear,
- incremental, &index);
- if ( ret < 0 ) {
- free(str);
- return pyxc_error_to_exception(self->xc_handle);
- }
-
- while ( !incremental && count == size && ret >= 0 )
- {
- size += count - 1;
- if ( size < count )
- break;
-
- ptr = realloc(str, size);
- if ( !ptr )
- break;
-
- str = ptr + count;
- count = size - count;
- ret = xc_readconsolering(self->xc_handle, str, &count, clear,
- 1, &index);
- count += str - ptr;
- str = ptr;
- }
-
- obj = PyString_FromStringAndSize(str, count);
- free(str);
- return obj;
-}
-
-
static unsigned long pages_to_kib(unsigned long pages)
{
return pages * (XC_PAGE_SIZE / 1024);
}
-
-static PyObject *pyxc_pages_to_kib(XcObject *self, PyObject *args)
-{
- unsigned long pages;
-
- if (!PyArg_ParseTuple(args, "l", &pages))
- return NULL;
-
- return PyLong_FromUnsignedLong(pages_to_kib(pages));
-}
-
static PyObject *pyxc_physinfo(XcObject *self)
{
xc_physinfo_t pinfo;
@@ -360,168 +223,6 @@ static PyObject *pyxc_getcpuinfo(XcObject *self, PyObject *args, PyObject *kwds)
return cpuinfo_list_obj;
}
-static PyObject *pyxc_topologyinfo(XcObject *self)
-{
- xc_cputopo_t *cputopo = NULL;
- unsigned i, num_cpus = 0;
- PyObject *ret_obj = NULL;
- PyObject *cpu_to_core_obj, *cpu_to_socket_obj, *cpu_to_node_obj;
-
- if ( xc_cputopoinfo(self->xc_handle, &num_cpus, NULL) != 0 )
- goto out;
-
- cputopo = calloc(num_cpus, sizeof(*cputopo));
- if ( cputopo == NULL )
- goto out;
-
- if ( xc_cputopoinfo(self->xc_handle, &num_cpus, cputopo) != 0 )
- goto out;
-
- /* Construct cpu-to-* lists. */
- cpu_to_core_obj = PyList_New(0);
- cpu_to_socket_obj = PyList_New(0);
- cpu_to_node_obj = PyList_New(0);
- for ( i = 0; i < num_cpus; i++ )
- {
- if ( cputopo[i].core == XEN_INVALID_CORE_ID )
- {
- PyList_Append(cpu_to_core_obj, Py_None);
- }
- else
- {
- PyObject *pyint = PyInt_FromLong(cputopo[i].core);
- PyList_Append(cpu_to_core_obj, pyint);
- Py_DECREF(pyint);
- }
-
- if ( cputopo[i].socket == XEN_INVALID_SOCKET_ID )
- {
- PyList_Append(cpu_to_socket_obj, Py_None);
- }
- else
- {
- PyObject *pyint = PyInt_FromLong(cputopo[i].socket);
- PyList_Append(cpu_to_socket_obj, pyint);
- Py_DECREF(pyint);
- }
-
- if ( cputopo[i].node == XEN_INVALID_NODE_ID )
- {
- PyList_Append(cpu_to_node_obj, Py_None);
- }
- else
- {
- PyObject *pyint = PyInt_FromLong(cputopo[i].node);
- PyList_Append(cpu_to_node_obj, pyint);
- Py_DECREF(pyint);
- }
- }
-
- ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus + 1);
-
- PyDict_SetItemString(ret_obj, "cpu_to_core", cpu_to_core_obj);
- Py_DECREF(cpu_to_core_obj);
-
- PyDict_SetItemString(ret_obj, "cpu_to_socket", cpu_to_socket_obj);
- Py_DECREF(cpu_to_socket_obj);
-
- PyDict_SetItemString(ret_obj, "cpu_to_node", cpu_to_node_obj);
- Py_DECREF(cpu_to_node_obj);
-
-out:
- free(cputopo);
- return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle);
-}
-
-static PyObject *pyxc_numainfo(XcObject *self)
-{
- unsigned i, j, num_nodes = 0;
- uint64_t free_heap;
- PyObject *ret_obj = NULL, *node_to_node_dist_list_obj;
- PyObject *node_to_memsize_obj, *node_to_memfree_obj;
- PyObject *node_to_dma32_mem_obj, *node_to_node_dist_obj;
- xc_meminfo_t *meminfo = NULL;
- uint32_t *distance = NULL;
-
- if ( xc_numainfo(self->xc_handle, &num_nodes, NULL, NULL) != 0 )
- goto out;
-
- meminfo = calloc(num_nodes, sizeof(*meminfo));
- distance = calloc(num_nodes * num_nodes, sizeof(*distance));
- if ( (meminfo == NULL) || (distance == NULL) )
- goto out;
-
- if ( xc_numainfo(self->xc_handle, &num_nodes, meminfo, distance) != 0 )
- goto out;
-
- /* Construct node-to-* lists. */
- node_to_memsize_obj = PyList_New(0);
- node_to_memfree_obj = PyList_New(0);
- node_to_dma32_mem_obj = PyList_New(0);
- node_to_node_dist_list_obj = PyList_New(0);
- for ( i = 0; i < num_nodes; i++ )
- {
- PyObject *pyint;
- unsigned invalid_node;
-
- /* Total Memory */
- pyint = PyInt_FromLong(meminfo[i].memsize >> 20); /* MB */
- PyList_Append(node_to_memsize_obj, pyint);
- Py_DECREF(pyint);
-
- /* Free Memory */
- pyint = PyInt_FromLong(meminfo[i].memfree >> 20); /* MB */
- PyList_Append(node_to_memfree_obj, pyint);
- Py_DECREF(pyint);
-
- /* DMA memory. */
- xc_availheap(self->xc_handle, 0, 32, i, &free_heap);
- pyint = PyInt_FromLong(free_heap >> 20); /* MB */
- PyList_Append(node_to_dma32_mem_obj, pyint);
- Py_DECREF(pyint);
-
- /* Node to Node Distance */
- node_to_node_dist_obj = PyList_New(0);
- invalid_node = (meminfo[i].memsize == XEN_INVALID_MEM_SZ);
- for ( j = 0; j < num_nodes; j++ )
- {
- uint32_t dist = distance[i * num_nodes + j];
- if ( invalid_node || (dist == XEN_INVALID_NODE_DIST) )
- {
- PyList_Append(node_to_node_dist_obj, Py_None);
- }
- else
- {
- pyint = PyInt_FromLong(dist);
- PyList_Append(node_to_node_dist_obj, pyint);
- Py_DECREF(pyint);
- }
- }
- PyList_Append(node_to_node_dist_list_obj, node_to_node_dist_obj);
- Py_DECREF(node_to_node_dist_obj);
- }
-
- ret_obj = Py_BuildValue("{s:i}", "max_node_index", num_nodes + 1);
-
- PyDict_SetItemString(ret_obj, "node_memsize", node_to_memsize_obj);
- Py_DECREF(node_to_memsize_obj);
-
- PyDict_SetItemString(ret_obj, "node_memfree", node_to_memfree_obj);
- Py_DECREF(node_to_memfree_obj);
-
- PyDict_SetItemString(ret_obj, "node_to_dma32_mem", node_to_dma32_mem_obj);
- Py_DECREF(node_to_dma32_mem_obj);
-
- PyDict_SetItemString(ret_obj, "node_to_node_dist",
- node_to_node_dist_list_obj);
- Py_DECREF(node_to_node_dist_list_obj);
-
-out:
- free(meminfo);
- free(distance);
- return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle);
-}
-
static PyObject *pyxc_xeninfo(XcObject *self)
{
xen_extraversion_t xen_extra;
@@ -608,53 +309,6 @@ static PyObject *pyxc_domain_set_target_mem(XcObject *self, PyObject *args)
return zero;
}
-static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
-{
- uint32_t dom;
- int32_t offset;
-
- if (!PyArg_ParseTuple(args, "ii", &dom, &offset))
- return NULL;
-
- if (xc_domain_set_time_offset(self->xc_handle, dom, offset) != 0)
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_domain_set_tsc_info(XcObject *self, PyObject *args)
-{
- uint32_t dom, tsc_mode;
-
- if (!PyArg_ParseTuple(args, "ii", &dom, &tsc_mode))
- return NULL;
-
- if (xc_domain_set_tsc_info(self->xc_handle, dom, tsc_mode, 0, 0, 0) != 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)
-{
- char *keys;
-
- static char *kwd_list[] = { "keys", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list, &keys) )
- return NULL;
-
- if ( xc_send_debug_keys(self->xc_handle, keys) != 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)
@@ -701,43 +355,6 @@ static PyObject *pyxc_tmem_control(XcObject *self,
return zero;
}
-static PyObject *pyxc_tmem_shared_auth(XcObject *self,
- PyObject *args,
- PyObject *kwds)
-{
- uint32_t cli_id;
- uint32_t arg1;
- char *uuid_str;
- int rc;
-
- static char *kwd_list[] = { "cli_id", "uuid_str", "arg1", NULL };
-
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "isi", kwd_list,
- &cli_id, &uuid_str, &arg1) )
- return NULL;
-
- if ( (rc = xc_tmem_auth(self->xc_handle, cli_id, uuid_str, arg1)) < 0 )
- return Py_BuildValue("i", rc);
-
- Py_INCREF(zero);
- return zero;
-}
-
-static PyObject *pyxc_dom_set_memshr(XcObject *self, PyObject *args)
-{
- uint32_t dom;
- int enable;
-
- if (!PyArg_ParseTuple(args, "ii", &dom, &enable))
- return NULL;
-
- if (xc_memshr_control(self->xc_handle, dom, enable) != 0)
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
static PyMethodDef pyxc_methods[] = {
{ "domain_getinfo",
(PyCFunction)pyxc_domain_getinfo,
@@ -765,47 +382,6 @@ static PyMethodDef pyxc_methods[] = {
"reason why it shut itself down.\n"
" cpupool [int] Id of cpupool domain is bound to.\n" },
- { "evtchn_alloc_unbound",
- (PyCFunction)pyxc_evtchn_alloc_unbound,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Allocate an unbound port that will await a remote connection.\n"
- " dom [int]: Domain whose port space to allocate from.\n"
- " remote_dom [int]: Remote domain to accept connections from.\n\n"
- "Returns: [int] Unbound event-channel port.\n" },
-
- { "evtchn_reset",
- (PyCFunction)pyxc_evtchn_reset,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Reset all connections.\n"
- " dom [int]: Domain to reset.\n" },
-
- { "physdev_map_pirq",
- (PyCFunction)pyxc_physdev_map_pirq,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "map physical irq to guest pirq.\n"
- " dom [int]: Identifier of domain to map for.\n"
- " index [int]: physical irq.\n"
- " pirq [int]: guest pirq.\n"
- "Returns: [long] value of the param.\n" },
-
- { "physdev_pci_access_modify",
- (PyCFunction)pyxc_physdev_pci_access_modify,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Allow a domain access to a PCI device\n"
- " dom [int]: Identifier of domain to be allowed access.\n"
- " bus [int]: PCI bus\n"
- " dev [int]: PCI slot\n"
- " func [int]: PCI function\n"
- " enable [int]: Non-zero means enable access; else disable access\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "readconsolering",
- (PyCFunction)pyxc_readconsolering,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Read Xen's console ring.\n"
- " clear [int, 0]: Bool - clear the ring after reading from it?\n\n"
- "Returns: [str] string is empty on failure.\n" },
-
{ "physinfo",
(PyCFunction)pyxc_physinfo,
METH_NOARGS, "\n"
@@ -820,20 +396,6 @@ static PyMethodDef pyxc_methods[] = {
"Returns [list]: information about physical CPUs"
" [None]: on failure.\n" },
- { "topologyinfo",
- (PyCFunction)pyxc_topologyinfo,
- METH_NOARGS, "\n"
- "Get information about the cpu topology on the host machine\n"
- "Returns [dict]: information about the cpu topology on host"
- " [None]: on failure.\n" },
-
- { "numainfo",
- (PyCFunction)pyxc_numainfo,
- METH_NOARGS, "\n"
- "Get NUMA information on the host machine\n"
- "Returns [dict]: NUMA information on host"
- " [None]: on failure.\n" },
-
{ "xeninfo",
(PyCFunction)pyxc_xeninfo,
METH_NOARGS, "\n"
@@ -857,35 +419,6 @@ static PyMethodDef pyxc_methods[] = {
" mem_kb [int]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
- { "pages_to_kib",
- (PyCFunction)pyxc_pages_to_kib,
- METH_VARARGS, "\n"
- "Returns: [int]: The size in KiB of memory spanning the given number "
- "of pages.\n" },
-
- { "domain_set_time_offset",
- (PyCFunction)pyxc_domain_set_time_offset,
- METH_VARARGS, "\n"
- "Set a domain's time offset to Dom0's localtime\n"
- " dom [int]: Domain whose time offset is being set.\n"
- " offset [int]: Time offset from UTC in seconds.\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
- { "domain_set_tsc_info",
- (PyCFunction)pyxc_domain_set_tsc_info,
- METH_VARARGS, "\n"
- "Set a domain's TSC mode\n"
- " dom [int]: Domain whose TSC mode is being set.\n"
- " tsc_mode [int]: 0=default (monotonic, but native where possible)\n"
- " 1=always emulate 2=never emulate 3=pvrdtscp\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" },
-
{ "tmem_control",
(PyCFunction)pyxc_tmem_control,
METH_VARARGS | METH_KEYWORDS, "\n"
@@ -898,23 +431,6 @@ static PyMethodDef pyxc_methods[] = {
" buf [str]: Buffer.\n\n"
"Returns: [int] 0 or [str] tmem info on success; exception on error.\n" },
- { "tmem_shared_auth",
- (PyCFunction)pyxc_tmem_shared_auth,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "De/authenticate a shared tmem pool.\n"
- " cli_id [int]: Client identifier (-1 == all).\n"
- " uuid_str [str]: uuid.\n"
- " auth [int]: 0|1 .\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-
- { "dom_set_memshr",
- (PyCFunction)pyxc_dom_set_memshr,
- METH_VARARGS, "\n"
- "Enable/disable memory sharing for the domain.\n"
- " dom [int]: Domain identifier.\n"
- " enable [int,0|1]: Disable or enable?\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
{ NULL, NULL, 0, NULL }
};
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (12 preceding siblings ...)
2015-10-23 13:05 ` [PATCH 13/13] python: remove unused other " Juergen Gross
@ 2015-10-26 17:34 ` Wei Liu
2015-11-09 15:19 ` Juergen Gross
14 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2015-10-26 17:34 UTC (permalink / raw)
To: Juergen Gross
Cc: wei.liu2, stefano.stabellini, ian.jackson, Ian.Campbell,
xen-devel
On Fri, Oct 23, 2015 at 03:04:59PM +0200, Juergen Gross wrote:
> This series is a combination of my previous patches:
>
> "libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
> "tools: remove unused wrappers for python"
>
> I have split it up as requested by Ian Campbell, thus it consists of
> 13 patches instead just of 2, but the functionality is roughly the
> same. I have just kept more python bindings compared to the first
> version, as there have been reports of some out of tree uses. Asking
> for more such use case on xen-devel and xen-user didn't result in
> requests for more interfaces to be kept, so I delete them.
>
> Juergen Gross (13):
> libxc: remove most of tools/libxc/xc_dom_compat_linux.c
> libxc: remove xc_get_bit_size() from tools/libxc/xc_dom_compat_linux.c
> python: remove flask related libxc python bindings
> python: remove cpupool related libxc python bindings
> python: remove cpuid related libxc python bindings
> python: remove device related libxc python bindings
> python: remove scheduler related libxc python bindings
> python: remove unused memory related libxc python bindings
> python: remove domain handling related libxc python bindings
> python: remove vcpu related libxc python bindings
> python: remove hvm related libxc python bindings
> python: remove permission related libxc python bindings
> python: remove unused other libxc python bindings
>
I think it's good riddance of dead code. I only skim this series since
they look rather low risk to me. If anyone shouts we can easily
resurrect necessary bits from git history.
So whole series:
Acked-by: Wei Liu <wei.liu2@citrix.com>
Wei.
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-10-23 13:04 [PATCH 00/13] tools: do cleanups related to libxc python bindings Juergen Gross
` (13 preceding siblings ...)
2015-10-26 17:34 ` [PATCH 00/13] tools: do cleanups related to " Wei Liu
@ 2015-11-09 15:19 ` Juergen Gross
2015-11-12 13:01 ` Wei Liu
14 siblings, 1 reply; 20+ messages in thread
From: Juergen Gross @ 2015-11-09 15:19 UTC (permalink / raw)
To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
wei.liu2
On 10/23/2015 03:04 PM, Juergen Gross wrote:
> This series is a combination of my previous patches:
>
> "libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
> "tools: remove unused wrappers for python"
>
> I have split it up as requested by Ian Campbell, thus it consists of
> 13 patches instead just of 2, but the functionality is roughly the
> same. I have just kept more python bindings compared to the first
> version, as there have been reports of some out of tree uses. Asking
> for more such use case on xen-devel and xen-user didn't result in
> requests for more interfaces to be kept, so I delete them.
There have been acks and critical responses regarding this series.
What should we do?
- drop them all
- apply the first two patches only to get rid of the extra interfaces
to the domain builder as requested by Ian Campbell
- apply all of them
Juergen
>
> Juergen Gross (13):
> libxc: remove most of tools/libxc/xc_dom_compat_linux.c
> libxc: remove xc_get_bit_size() from tools/libxc/xc_dom_compat_linux.c
> python: remove flask related libxc python bindings
> python: remove cpupool related libxc python bindings
> python: remove cpuid related libxc python bindings
> python: remove device related libxc python bindings
> python: remove scheduler related libxc python bindings
> python: remove unused memory related libxc python bindings
> python: remove domain handling related libxc python bindings
> python: remove vcpu related libxc python bindings
> python: remove hvm related libxc python bindings
> python: remove permission related libxc python bindings
> python: remove unused other libxc python bindings
>
> tools/libxc/include/xc_dom.h | 5 +
> tools/libxc/include/xenguest.h | 52 -
> tools/libxc/xc_dom_compat_linux.c | 142 +-
> tools/libxl/libxl_internal.h | 1 +
> tools/python/xen/lowlevel/xc/xc.c | 2624 +++----------------------------------
> 5 files changed, 170 insertions(+), 2654 deletions(-)
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-11-09 15:19 ` Juergen Gross
@ 2015-11-12 13:01 ` Wei Liu
2015-11-16 12:09 ` Ian Campbell
0 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2015-11-12 13:01 UTC (permalink / raw)
To: Juergen Gross
Cc: wei.liu2, stefano.stabellini, ian.jackson, Ian.Campbell,
xen-devel
On Mon, Nov 09, 2015 at 04:19:24PM +0100, Juergen Gross wrote:
> On 10/23/2015 03:04 PM, Juergen Gross wrote:
> >This series is a combination of my previous patches:
> >
> >"libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
> >"tools: remove unused wrappers for python"
> >
> >I have split it up as requested by Ian Campbell, thus it consists of
> >13 patches instead just of 2, but the functionality is roughly the
> >same. I have just kept more python bindings compared to the first
> >version, as there have been reports of some out of tree uses. Asking
> >for more such use case on xen-devel and xen-user didn't result in
> >requests for more interfaces to be kept, so I delete them.
>
> There have been acks and critical responses regarding this series.
>
> What should we do?
>
> - drop them all
> - apply the first two patches only to get rid of the extra interfaces
> to the domain builder as requested by Ian Campbell
I would go for this.
Wei.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-11-12 13:01 ` Wei Liu
@ 2015-11-16 12:09 ` Ian Campbell
2015-11-16 12:30 ` Juergen Gross
0 siblings, 1 reply; 20+ messages in thread
From: Ian Campbell @ 2015-11-16 12:09 UTC (permalink / raw)
To: Wei Liu, Juergen Gross; +Cc: stefano.stabellini, ian.jackson, xen-devel
On Thu, 2015-11-12 at 13:01 +0000, Wei Liu wrote:
> On Mon, Nov 09, 2015 at 04:19:24PM +0100, Juergen Gross wrote:
> > On 10/23/2015 03:04 PM, Juergen Gross wrote:
> > > This series is a combination of my previous patches:
> > >
> > > "libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
> > > "tools: remove unused wrappers for python"
> > >
> > > I have split it up as requested by Ian Campbell, thus it consists of
> > > 13 patches instead just of 2, but the functionality is roughly the
> > > same. I have just kept more python bindings compared to the first
> > > version, as there have been reports of some out of tree uses. Asking
> > > for more such use case on xen-devel and xen-user didn't result in
> > > requests for more interfaces to be kept, so I delete them.
> >
> > There have been acks and critical responses regarding this series.
Have there? I don't have the stashed alongside the series as I would
normally, so maybe I've missed them?
> > What should we do?
> >
> > - drop them all
> > - apply the first two patches only to get rid of the extra interfaces
> > to the domain builder as requested by Ian Campbell
>
> I would go for this.
I've done this one.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-11-16 12:09 ` Ian Campbell
@ 2015-11-16 12:30 ` Juergen Gross
2015-11-16 12:37 ` Ian Campbell
0 siblings, 1 reply; 20+ messages in thread
From: Juergen Gross @ 2015-11-16 12:30 UTC (permalink / raw)
To: Ian Campbell, Wei Liu; +Cc: stefano.stabellini, ian.jackson, xen-devel
On 16/11/15 13:09, Ian Campbell wrote:
> On Thu, 2015-11-12 at 13:01 +0000, Wei Liu wrote:
>> On Mon, Nov 09, 2015 at 04:19:24PM +0100, Juergen Gross wrote:
>>> On 10/23/2015 03:04 PM, Juergen Gross wrote:
>>>> This series is a combination of my previous patches:
>>>>
>>>> "libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
>>>> "tools: remove unused wrappers for python"
>>>>
>>>> I have split it up as requested by Ian Campbell, thus it consists of
>>>> 13 patches instead just of 2, but the functionality is roughly the
>>>> same. I have just kept more python bindings compared to the first
>>>> version, as there have been reports of some out of tree uses. Asking
>>>> for more such use case on xen-devel and xen-user didn't result in
>>>> requests for more interfaces to be kept, so I delete them.
>>>
>>> There have been acks and critical responses regarding this series.
>
> Have there? I don't have the stashed alongside the series as I would
> normally, so maybe I've missed them?
At least on #xendevel there was a rather clear statement towards not
removing code without any need, even if unused. This statement has not
been rejected by others.
I still think the python wrappers used by nobody are something we
should get rid of, OTOH I don't want to fight really hard for it. :-)
>
>>> What should we do?
>>>
>>> - drop them all
>>> - apply the first two patches only to get rid of the extra interfaces
>>> to the domain builder as requested by Ian Campbell
>>
>> I would go for this.
>
> I've done this one.
Thanks.
Juergen
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 00/13] tools: do cleanups related to libxc python bindings
2015-11-16 12:30 ` Juergen Gross
@ 2015-11-16 12:37 ` Ian Campbell
0 siblings, 0 replies; 20+ messages in thread
From: Ian Campbell @ 2015-11-16 12:37 UTC (permalink / raw)
To: Juergen Gross, Wei Liu; +Cc: stefano.stabellini, ian.jackson, xen-devel
On Mon, 2015-11-16 at 13:30 +0100, Juergen Gross wrote:
> On 16/11/15 13:09, Ian Campbell wrote:
> > On Thu, 2015-11-12 at 13:01 +0000, Wei Liu wrote:
> > > On Mon, Nov 09, 2015 at 04:19:24PM +0100, Juergen Gross wrote:
> > > > On 10/23/2015 03:04 PM, Juergen Gross wrote:
> > > > > This series is a combination of my previous patches:
> > > > >
> > > > > "libxc: remove most of tools/libxc/xc_dom_compat_linux.c"
> > > > > "tools: remove unused wrappers for python"
> > > > >
> > > > > I have split it up as requested by Ian Campbell, thus it consists
> > > > > of
> > > > > 13 patches instead just of 2, but the functionality is roughly
> > > > > the
> > > > > same. I have just kept more python bindings compared to the first
> > > > > version, as there have been reports of some out of tree uses.
> > > > > Asking
> > > > > for more such use case on xen-devel and xen-user didn't result in
> > > > > requests for more interfaces to be kept, so I delete them.
> > > >
> > > > There have been acks and critical responses regarding this series.
> >
> > Have there? I don't have the stashed alongside the series as I would
> > normally, so maybe I've missed them?
>
> At least on #xendevel there was a rather clear statement towards not
> removing code without any need, even if unused. This statement has not
> been rejected by others.
Part of me thinks that such statements made on #xendevel may as well not
have been made as far as the formal review process goes.
But...
> I still think the python wrappers used by nobody are something we
> should get rid of, OTOH I don't want to fight really hard for it. :-)
... I think this is the right approach when dealing with such removals,
i.e. to try and abort upon valid complaints.
Ian.
^ permalink raw reply [flat|nested] 20+ messages in thread