summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/guestfs-py.c53
-rw-r--r--python/guestfs.py13
2 files changed, 66 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index e967bd94..cd1014fc 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -3612,6 +3612,57 @@ py_guestfs_vg_activate (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_lvresize (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *device;
+ int mbytes;
+
+ if (!PyArg_ParseTuple (args, (char *) "Osi:guestfs_lvresize",
+ &py_g, &device, &mbytes))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_lvresize (g, device, mbytes);
+ 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_resize2fs (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *device;
+
+ if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_resize2fs",
+ &py_g, &device))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_resize2fs (g, device);
+ 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 PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -3743,6 +3794,8 @@ static PyMethodDef methods[] = {
{ (char *) "sfdisk_disk_geometry", py_guestfs_sfdisk_disk_geometry, METH_VARARGS, NULL },
{ (char *) "vg_activate_all", py_guestfs_vg_activate_all, METH_VARARGS, NULL },
{ (char *) "vg_activate", py_guestfs_vg_activate, METH_VARARGS, NULL },
+ { (char *) "lvresize", py_guestfs_lvresize, METH_VARARGS, NULL },
+ { (char *) "resize2fs", py_guestfs_resize2fs, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 4a2804b4..77c29895 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1423,3 +1423,16 @@ class GuestFS:
"""
return libguestfsmod.vg_activate (self._o, activate, volgroups)
+ def lvresize (self, device, mbytes):
+ u"""This resizes (expands or shrinks) an existing LVM
+ logical volume to "mbytes". When reducing, data in the
+ reduced part is lost.
+ """
+ return libguestfsmod.lvresize (self._o, device, mbytes)
+
+ def resize2fs (self, device):
+ u"""This resizes an ext2 or ext3 filesystem to match the
+ size of the underlying device.
+ """
+ return libguestfsmod.resize2fs (self._o, device)
+