summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-06-02 14:25:25 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-06-02 14:25:25 +0100
commitd1a1ab972bb22f4c38a21fcc73f81650aaa03b4e (patch)
tree48c33472221810fbe42a515b217f82d3da3bd04f /python
parentbfdc03be234d6d95f18450846433bce4f97e184c (diff)
downloadlibguestfs-d1a1ab972bb22f4c38a21fcc73f81650aaa03b4e.tar.gz
libguestfs-d1a1ab972bb22f4c38a21fcc73f81650aaa03b4e.tar.xz
libguestfs-d1a1ab972bb22f4c38a21fcc73f81650aaa03b4e.zip
Generated code for 'add_drive_ro' call.
Diffstat (limited to 'python')
-rw-r--r--python/guestfs-py.c26
-rw-r--r--python/guestfs.py34
2 files changed, 60 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index 6ac3bd97..71ef85e7 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -1179,6 +1179,31 @@ py_guestfs_add_cdrom (PyObject *self, PyObject *args)
}
static PyObject *
+py_guestfs_add_drive_ro (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *filename;
+
+ if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_add_drive_ro",
+ &py_g, &filename))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_add_drive_ro (g, filename);
+ 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_config (PyObject *self, PyObject *args)
{
PyObject *py_g;
@@ -4416,6 +4441,7 @@ static PyMethodDef methods[] = {
{ (char *) "kill_subprocess", py_guestfs_kill_subprocess, METH_VARARGS, NULL },
{ (char *) "add_drive", py_guestfs_add_drive, METH_VARARGS, NULL },
{ (char *) "add_cdrom", py_guestfs_add_cdrom, METH_VARARGS, NULL },
+ { (char *) "add_drive_ro", py_guestfs_add_drive_ro, METH_VARARGS, NULL },
{ (char *) "config", py_guestfs_config, METH_VARARGS, NULL },
{ (char *) "set_qemu", py_guestfs_set_qemu, METH_VARARGS, NULL },
{ (char *) "get_qemu", py_guestfs_get_qemu, METH_VARARGS, NULL },
diff --git a/python/guestfs.py b/python/guestfs.py
index 4f32ae72..a75148e5 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -198,6 +198,12 @@ class GuestFS:
This is equivalent to the qemu parameter "-drive
file=filename".
+
+ Note that this call checks for the existence of
+ "filename". This stops you from specifying other types
+ of drive which are supported by qemu such as "nbd:" and
+ "http:" URLs. To specify those, use the general
+ "g.config" call instead.
"""
return libguestfsmod.add_drive (self._o, filename)
@@ -207,9 +213,37 @@ class GuestFS:
This is equivalent to the qemu parameter "-cdrom
filename".
+
+ Note that this call checks for the existence of
+ "filename". This stops you from specifying other types
+ of drive which are supported by qemu such as "nbd:" and
+ "http:" URLs. To specify those, use the general
+ "g.config" call instead.
"""
return libguestfsmod.add_cdrom (self._o, filename)
+ def add_drive_ro (self, filename):
+ u"""This adds a drive in snapshot mode, making it
+ effectively read-only.
+
+ Note that writes to the device are allowed, and will be
+ seen for the duration of the guestfs handle, but they
+ are written to a temporary file which is discarded as
+ soon as the guestfs handle is closed. We don't currently
+ have any method to enable changes to be committed,
+ although qemu can support this.
+
+ This is equivalent to the qemu parameter "-drive
+ file=filename,snapshot=on".
+
+ Note that this call checks for the existence of
+ "filename". This stops you from specifying other types
+ of drive which are supported by qemu such as "nbd:" and
+ "http:" URLs. To specify those, use the general
+ "g.config" call instead.
+ """
+ return libguestfsmod.add_drive_ro (self._o, filename)
+
def config (self, qemuparam, qemuvalue):
u"""This can be used to add arbitrary qemu command line
parameters of the form "-param value". Actually it's not