]> git.proxmox.com Git - mirror_lxc.git/commitdiff
python3: Add reboot() to the binding
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 27 Nov 2013 18:31:05 +0000 (13:31 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 27 Nov 2013 22:44:41 +0000 (17:44 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/python-lxc/lxc.c

index 05fbff8d5e3aec1e04e891ebafea6d6e0da5ee90..0604ec7bf3a50f535fd09132832ff2491330d432 100644 (file)
@@ -597,6 +597,16 @@ Container_load_config(Container *self, PyObject *args, PyObject *kwds)
     Py_RETURN_FALSE;
 }
 
+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)
 {
@@ -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"