diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/guestfs-py.c | 25 | ||||
-rw-r--r-- | python/guestfs.py | 12 |
2 files changed, 37 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c index 24f9ff8b..dd9f4ca3 100644 --- a/python/guestfs-py.c +++ b/python/guestfs-py.c @@ -3181,6 +3181,30 @@ py_guestfs_drop_caches (PyObject *self, PyObject *args) return py_r; } +static PyObject * +py_guestfs_dmesg (PyObject *self, PyObject *args) +{ + PyObject *py_g; + guestfs_h *g; + PyObject *py_r; + char *r; + + if (!PyArg_ParseTuple (args, (char *) "O:guestfs_dmesg", + &py_g)) + return NULL; + g = get_handle (py_g); + + r = guestfs_dmesg (g); + if (r == NULL) { + PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g)); + return NULL; + } + + py_r = PyString_FromString (r); + free (r); + return py_r; +} + static PyMethodDef methods[] = { { (char *) "create", py_guestfs_create, METH_VARARGS, NULL }, { (char *) "close", py_guestfs_close, METH_VARARGS, NULL }, @@ -3295,6 +3319,7 @@ static PyMethodDef methods[] = { { (char *) "cp_a", py_guestfs_cp_a, METH_VARARGS, NULL }, { (char *) "mv", py_guestfs_mv, METH_VARARGS, NULL }, { (char *) "drop_caches", py_guestfs_drop_caches, METH_VARARGS, NULL }, + { (char *) "dmesg", py_guestfs_dmesg, METH_VARARGS, NULL }, { NULL, NULL, 0, NULL } }; diff --git a/python/guestfs.py b/python/guestfs.py index 6c425bc2..e2989223 100644 --- a/python/guestfs.py +++ b/python/guestfs.py @@ -1221,3 +1221,15 @@ class GuestFS: """ return libguestfsmod.drop_caches (self._o, whattodrop) + def dmesg (self): + u"""This returns the kernel messages ("dmesg" output) from + the guest kernel. This is sometimes useful for extended + debugging of problems. + + Another way to get the same information is to enable + verbose messages with "g.set_verbose" or by setting the + environment variable "LIBGUESTFS_DEBUG=1" before running + the program. + """ + return libguestfsmod.dmesg (self._o) + |