[lxc-devel] [PATCH 3/7] python3: Add reboot() to the binding

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


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

diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
index 05fbff8..0604ec7 100644
--- a/src/python-lxc/lxc.c
+++ b/src/python-lxc/lxc.c
@@ -598,6 +598,16 @@ Container_load_config(Container *self, PyObject *args, PyObject *kwds)
 }
 
 static PyObject *
+Container_reboot(Container *self, PyObject *args, PyObject *kwds)
+{
+    if (self->container->reboot(self->container)) {
+        Py_RETURN_TRUE;
+    }
+
+    Py_RETURN_FALSE;
+}
+
+static PyObject *
 Container_save_config(Container *self, PyObject *args, PyObject *kwds)
 {
     static char *kwlist[] = {"path", NULL};
@@ -1195,6 +1205,12 @@ static PyMethodDef Container_methods[] = {
      "Read the container configuration from its default "
      "location or from an alternative location if provided."
     },
+    {"reboot", (PyCFunction)Container_reboot,
+     METH_NOARGS,
+     "reboot() -> boolean\n"
+     "\n"
+     "Ask the container to reboot."
+    },
     {"save_config", (PyCFunction)Container_save_config,
      METH_VARARGS|METH_KEYWORDS,
      "save_config(path = DEFAULT) -> boolean\n"
-- 
1.8.4.4





More information about the lxc-devel mailing list