Skip to contentSkip to conversation

Add xl python bindings for cpumap

PATCH Applied Juergen Gross 2 participants 2 messages Nov 22, 2010 – Nov 23, 2010 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add xl python bindings for cpumap

Signed-off-by [email protected]
1 file changed, 21 insertions(+), 2 deletions(-)

tools/python/xen/lowlevel/xl/xl.c | 23 +++++++++++++++++++++--

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1290428619 -3600
# Node ID eb50c4e522e19b5b1a0fcddb50319c31ea589df9 # Parent 117d82dcd6ba785a702e2d0cfdb93642d84da1b9 Add xl python bindings for cpumap

Signed-off-by [email protected]
tools/python/xen/lowlevel/xl/xl.c +21 -2
diff -r 117d82dcd6ba -r eb50c4e522e1 tools/python/xen/lowlevel/xl/xl.c
@@ -214,7 +214,14 @@
 
 int attrib__libxl_cpumap_set(PyObject *v, libxl_cpumap *pptr)
 {
-    return -1;
+    int i;
+    long cpu;
+
+    for (i = 0; i < PyList_Size(v); i++) {
+        cpu = PyInt_AsLong(PyList_GetItem(v, i));
+        libxl_cpumap_set(pptr, cpu);
+    }
+    return 0;
 }
 
 int attrib__libxl_domain_build_state_ptr_set(PyObject *v, libxl_domain_build_state **pptr)
@@ -264,7 +271,19 @@
 
 PyObject *attrib__libxl_cpumap_get(libxl_cpumap *pptr)
 {
-    return NULL;
+    PyObject *cpulist = NULL;
+    int i;
+
+    cpulist = PyList_New(0);
+    libxl_for_each_cpu(i, *pptr) {
+        if ( libxl_cpumap_test(pptr, i) ) {
+            PyObject* pyint = PyInt_FromLong(i);
+
+            PyList_Append(cpulist, pyint);
+            Py_DECREF(pyint);
+        }
+    }
+    return cpulist;
 }
 
 PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state **pptr)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw

Juergen Gross writes ("[Xen-devel] [PATCH] Add xl python bindings for cpumap"):

Quoted 1 line
Signed-off-by [email protected]

Applied, thanks.

Ian.