[lxc-devel] [PATCH 6/7] python3: Add controllable property to the binding

Stéphane Graber stgraber at ubuntu.com
Wed Nov 27 22:04:55 UTC 2013


Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 src/python-lxc/lxc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
index 7c28607..43e571d 100644
--- a/src/python-lxc/lxc.c
+++ b/src/python-lxc/lxc.c
@@ -456,6 +456,16 @@ Container_config_file_name(Container *self, void *closure)
 }
 
 static PyObject *
+Container_controllable(Container *self, void *closure)
+{
+    if (self->container->may_control(self->container)) {
+        Py_RETURN_TRUE;
+    }
+
+    Py_RETURN_FALSE;
+}
+
+static PyObject *
 Container_defined(Container *self, void *closure)
 {
     if (self->container->is_defined(self->container)) {
@@ -1101,6 +1111,10 @@ static PyGetSetDef Container_getseters[] = {
      (getter)Container_config_file_name, NULL,
      "Path to the container configuration",
      NULL},
+    {"controllable",
+     (getter)Container_controllable, NULL,
+     "Boolean indicating whether the container may be controlled",
+     NULL},
     {"defined",
      (getter)Container_defined, NULL,
      "Boolean indicating whether the container configuration exists",
-- 
1.8.4.4





More information about the lxc-devel mailing list