diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 20:24:47 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 20:25:20 +0100 |
commit | da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6 (patch) | |
tree | 5555f9addd140af8cf2b40c9526d1b1837abdd7f /python | |
parent | 662617ae725c5e41c24128a037060419fbe4b026 (diff) | |
download | libguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.tar.gz libguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.tar.xz libguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.zip |
Generated code for the 'mkswap*' commands.
Diffstat (limited to 'python')
-rw-r--r-- | python/guestfs-py.c | 80 | ||||
-rw-r--r-- | python/guestfs.py | 15 |
2 files changed, 95 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c index 6a81349b..340beebe 100644 --- a/python/guestfs-py.c +++ b/python/guestfs-py.c @@ -4928,6 +4928,83 @@ py_guestfs_mount_loop (PyObject *self, PyObject *args) return py_r; } +static PyObject * +py_guestfs_mkswap (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_mkswap", + &py_g, &device)) + return NULL; + g = get_handle (py_g); + + r = guestfs_mkswap (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 PyObject * +py_guestfs_mkswap_L (PyObject *self, PyObject *args) +{ + PyObject *py_g; + guestfs_h *g; + PyObject *py_r; + int r; + const char *label; + const char *device; + + if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mkswap_L", + &py_g, &label, &device)) + return NULL; + g = get_handle (py_g); + + r = guestfs_mkswap_L (g, label, 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 PyObject * +py_guestfs_mkswap_U (PyObject *self, PyObject *args) +{ + PyObject *py_g; + guestfs_h *g; + PyObject *py_r; + int r; + const char *uuid; + const char *device; + + if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mkswap_U", + &py_g, &uuid, &device)) + return NULL; + g = get_handle (py_g); + + r = guestfs_mkswap_U (g, uuid, 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 }, @@ -5112,6 +5189,9 @@ static PyMethodDef methods[] = { { (char *) "du", py_guestfs_du, METH_VARARGS, NULL }, { (char *) "initrd_list", py_guestfs_initrd_list, METH_VARARGS, NULL }, { (char *) "mount_loop", py_guestfs_mount_loop, METH_VARARGS, NULL }, + { (char *) "mkswap", py_guestfs_mkswap, METH_VARARGS, NULL }, + { (char *) "mkswap_L", py_guestfs_mkswap_L, METH_VARARGS, NULL }, + { (char *) "mkswap_U", py_guestfs_mkswap_U, METH_VARARGS, NULL }, { NULL, NULL, 0, NULL } }; diff --git a/python/guestfs.py b/python/guestfs.py index 46b02a48..aa3572bf 100644 --- a/python/guestfs.py +++ b/python/guestfs.py @@ -1863,3 +1863,18 @@ class GuestFS: """ return libguestfsmod.mount_loop (self._o, file, mountpoint) + def mkswap (self, device): + u"""Create a swap partition on "device". + """ + return libguestfsmod.mkswap (self._o, device) + + def mkswap_L (self, label, device): + u"""Create a swap partition on "device" with label "label". + """ + return libguestfsmod.mkswap_L (self._o, label, device) + + def mkswap_U (self, uuid, device): + u"""Create a swap partition on "device" with UUID "uuid". + """ + return libguestfsmod.mkswap_U (self._o, uuid, device) + |