From 170f262f0413de843af62b968f6d12c1c476ae7f Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 20 Apr 2009 00:22:02 +0100 Subject: Implement upload and download commands. --- python/guestfs-py.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ python/guestfs.py | 16 ++++++++++++++++ 2 files changed, 66 insertions(+) (limited to 'python') diff --git a/python/guestfs-py.c b/python/guestfs-py.c index 69446aee..9969c538 100644 --- a/python/guestfs-py.c +++ b/python/guestfs-py.c @@ -795,6 +795,54 @@ py_guestfs_get_state (PyObject *self, PyObject *args) return py_r; } +static PyObject * +py_guestfs_set_busy (PyObject *self, PyObject *args) +{ + PyObject *py_g; + guestfs_h *g; + PyObject *py_r; + int r; + + if (!PyArg_ParseTuple (args, (char *) "O:guestfs_set_busy", + &py_g)) + return NULL; + g = get_handle (py_g); + + r = guestfs_set_busy (g); + if (r == -1) { + PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g)); + return NULL; + } + + Py_INCREF (Py_None); + py_r = Py_None; + return py_r; +} + +static PyObject * +py_guestfs_set_ready (PyObject *self, PyObject *args) +{ + PyObject *py_g; + guestfs_h *g; + PyObject *py_r; + int r; + + if (!PyArg_ParseTuple (args, (char *) "O:guestfs_set_ready", + &py_g)) + return NULL; + g = get_handle (py_g); + + r = guestfs_set_ready (g); + if (r == -1) { + PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g)); + return NULL; + } + + Py_INCREF (Py_None); + py_r = Py_None; + return py_r; +} + static PyObject * py_guestfs_mount (PyObject *self, PyObject *args) { @@ -2508,6 +2556,8 @@ static PyMethodDef methods[] = { { (char *) "is_launching", py_guestfs_is_launching, METH_VARARGS, NULL }, { (char *) "is_busy", py_guestfs_is_busy, METH_VARARGS, NULL }, { (char *) "get_state", py_guestfs_get_state, METH_VARARGS, NULL }, + { (char *) "set_busy", py_guestfs_set_busy, METH_VARARGS, NULL }, + { (char *) "set_ready", py_guestfs_set_ready, METH_VARARGS, NULL }, { (char *) "mount", py_guestfs_mount, METH_VARARGS, NULL }, { (char *) "sync", py_guestfs_sync, METH_VARARGS, NULL }, { (char *) "touch", py_guestfs_touch, METH_VARARGS, NULL }, diff --git a/python/guestfs.py b/python/guestfs.py index fd495fdb..416404b5 100644 --- a/python/guestfs.py +++ b/python/guestfs.py @@ -234,6 +234,22 @@ class GuestFS: """ return libguestfsmod.get_state (self._o) + def set_busy (self): + u"""This sets the state to "BUSY". This is only used when + implementing actions using the low-level API. + + For more information on states, see guestfs(3). + """ + return libguestfsmod.set_busy (self._o) + + def set_ready (self): + u"""This sets the state to "READY". This is only used when + implementing actions using the low-level API. + + For more information on states, see guestfs(3). + """ + return libguestfsmod.set_ready (self._o) + def mount (self, device, mountpoint): u"""Mount a guest disk at a position in the filesystem. Block devices are named "/dev/sda", "/dev/sdb" and so -- cgit