1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 get_handle (PyObject *obj)
39 assert (obj != Py_None);
40 return ((Pyguestfs_Object *) obj)->g;
44 put_handle (guestfs_h *g)
48 PyCObject_FromVoidPtrAndDesc ((void *) g, (char *) "guestfs_h", NULL);
51 /* This list should be freed (but not the strings) after use. */
53 get_string_list (PyObject *obj)
60 if (!PyList_Check (obj)) {
61 PyErr_SetString (PyExc_RuntimeError, "expecting a list parameter");
65 len = PyList_Size (obj);
66 r = malloc (sizeof (char *) * (len+1));
68 PyErr_SetString (PyExc_RuntimeError, "get_string_list: out of memory");
72 for (i = 0; i < len; ++i)
73 r[i] = PyString_AsString (PyList_GetItem (obj, i));
80 put_string_list (char * const * const argv)
85 for (argc = 0; argv[argc] != NULL; ++argc)
88 list = PyList_New (argc);
89 for (i = 0; i < argc; ++i)
90 PyList_SetItem (list, i, PyString_FromString (argv[i]));
96 put_table (char * const * const argv)
98 PyObject *list, *item;
101 for (argc = 0; argv[argc] != NULL; ++argc)
104 list = PyList_New (argc >> 1);
105 for (i = 0; i < argc; i += 2) {
106 item = PyTuple_New (2);
107 PyTuple_SetItem (item, 0, PyString_FromString (argv[i]));
108 PyTuple_SetItem (item, 1, PyString_FromString (argv[i+1]));
109 PyList_SetItem (list, i >> 1, item);
116 free_strings (char **argv)
120 for (argc = 0; argv[argc] != NULL; ++argc)
126 py_guestfs_create (PyObject *self, PyObject *args)
130 g = guestfs_create ();
132 PyErr_SetString (PyExc_RuntimeError,
133 "guestfs.create: failed to allocate handle");
136 guestfs_set_error_handler (g, NULL, NULL);
137 return put_handle (g);
141 py_guestfs_close (PyObject *self, PyObject *args)
146 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_close", &py_g))
148 g = get_handle (py_g);
157 put_lvm_pv (struct guestfs_lvm_pv *pv)
161 dict = PyDict_New ();
162 PyDict_SetItemString (dict, "pv_name",
163 PyString_FromString (pv->pv_name));
164 PyDict_SetItemString (dict, "pv_uuid",
165 PyString_FromStringAndSize (pv->pv_uuid, 32));
166 PyDict_SetItemString (dict, "pv_fmt",
167 PyString_FromString (pv->pv_fmt));
168 PyDict_SetItemString (dict, "pv_size",
169 PyLong_FromUnsignedLongLong (pv->pv_size));
170 PyDict_SetItemString (dict, "dev_size",
171 PyLong_FromUnsignedLongLong (pv->dev_size));
172 PyDict_SetItemString (dict, "pv_free",
173 PyLong_FromUnsignedLongLong (pv->pv_free));
174 PyDict_SetItemString (dict, "pv_used",
175 PyLong_FromUnsignedLongLong (pv->pv_used));
176 PyDict_SetItemString (dict, "pv_attr",
177 PyString_FromString (pv->pv_attr));
178 PyDict_SetItemString (dict, "pv_pe_count",
179 PyLong_FromLongLong (pv->pv_pe_count));
180 PyDict_SetItemString (dict, "pv_pe_alloc_count",
181 PyLong_FromLongLong (pv->pv_pe_alloc_count));
182 PyDict_SetItemString (dict, "pv_tags",
183 PyString_FromString (pv->pv_tags));
184 PyDict_SetItemString (dict, "pe_start",
185 PyLong_FromUnsignedLongLong (pv->pe_start));
186 PyDict_SetItemString (dict, "pv_mda_count",
187 PyLong_FromLongLong (pv->pv_mda_count));
188 PyDict_SetItemString (dict, "pv_mda_free",
189 PyLong_FromUnsignedLongLong (pv->pv_mda_free));
194 put_lvm_pv_list (struct guestfs_lvm_pv_list *pvs)
199 list = PyList_New (pvs->len);
200 for (i = 0; i < pvs->len; ++i)
201 PyList_SetItem (list, i, put_lvm_pv (&pvs->val[i]));
206 put_lvm_vg (struct guestfs_lvm_vg *vg)
210 dict = PyDict_New ();
211 PyDict_SetItemString (dict, "vg_name",
212 PyString_FromString (vg->vg_name));
213 PyDict_SetItemString (dict, "vg_uuid",
214 PyString_FromStringAndSize (vg->vg_uuid, 32));
215 PyDict_SetItemString (dict, "vg_fmt",
216 PyString_FromString (vg->vg_fmt));
217 PyDict_SetItemString (dict, "vg_attr",
218 PyString_FromString (vg->vg_attr));
219 PyDict_SetItemString (dict, "vg_size",
220 PyLong_FromUnsignedLongLong (vg->vg_size));
221 PyDict_SetItemString (dict, "vg_free",
222 PyLong_FromUnsignedLongLong (vg->vg_free));
223 PyDict_SetItemString (dict, "vg_sysid",
224 PyString_FromString (vg->vg_sysid));
225 PyDict_SetItemString (dict, "vg_extent_size",
226 PyLong_FromUnsignedLongLong (vg->vg_extent_size));
227 PyDict_SetItemString (dict, "vg_extent_count",
228 PyLong_FromLongLong (vg->vg_extent_count));
229 PyDict_SetItemString (dict, "vg_free_count",
230 PyLong_FromLongLong (vg->vg_free_count));
231 PyDict_SetItemString (dict, "max_lv",
232 PyLong_FromLongLong (vg->max_lv));
233 PyDict_SetItemString (dict, "max_pv",
234 PyLong_FromLongLong (vg->max_pv));
235 PyDict_SetItemString (dict, "pv_count",
236 PyLong_FromLongLong (vg->pv_count));
237 PyDict_SetItemString (dict, "lv_count",
238 PyLong_FromLongLong (vg->lv_count));
239 PyDict_SetItemString (dict, "snap_count",
240 PyLong_FromLongLong (vg->snap_count));
241 PyDict_SetItemString (dict, "vg_seqno",
242 PyLong_FromLongLong (vg->vg_seqno));
243 PyDict_SetItemString (dict, "vg_tags",
244 PyString_FromString (vg->vg_tags));
245 PyDict_SetItemString (dict, "vg_mda_count",
246 PyLong_FromLongLong (vg->vg_mda_count));
247 PyDict_SetItemString (dict, "vg_mda_free",
248 PyLong_FromUnsignedLongLong (vg->vg_mda_free));
253 put_lvm_vg_list (struct guestfs_lvm_vg_list *vgs)
258 list = PyList_New (vgs->len);
259 for (i = 0; i < vgs->len; ++i)
260 PyList_SetItem (list, i, put_lvm_vg (&vgs->val[i]));
265 put_lvm_lv (struct guestfs_lvm_lv *lv)
269 dict = PyDict_New ();
270 PyDict_SetItemString (dict, "lv_name",
271 PyString_FromString (lv->lv_name));
272 PyDict_SetItemString (dict, "lv_uuid",
273 PyString_FromStringAndSize (lv->lv_uuid, 32));
274 PyDict_SetItemString (dict, "lv_attr",
275 PyString_FromString (lv->lv_attr));
276 PyDict_SetItemString (dict, "lv_major",
277 PyLong_FromLongLong (lv->lv_major));
278 PyDict_SetItemString (dict, "lv_minor",
279 PyLong_FromLongLong (lv->lv_minor));
280 PyDict_SetItemString (dict, "lv_kernel_major",
281 PyLong_FromLongLong (lv->lv_kernel_major));
282 PyDict_SetItemString (dict, "lv_kernel_minor",
283 PyLong_FromLongLong (lv->lv_kernel_minor));
284 PyDict_SetItemString (dict, "lv_size",
285 PyLong_FromUnsignedLongLong (lv->lv_size));
286 PyDict_SetItemString (dict, "seg_count",
287 PyLong_FromLongLong (lv->seg_count));
288 PyDict_SetItemString (dict, "origin",
289 PyString_FromString (lv->origin));
290 if (lv->snap_percent >= 0)
291 PyDict_SetItemString (dict, "snap_percent",
292 PyFloat_FromDouble ((double) lv->snap_percent));
295 PyDict_SetItemString (dict, "snap_percent", Py_None); }
296 if (lv->copy_percent >= 0)
297 PyDict_SetItemString (dict, "copy_percent",
298 PyFloat_FromDouble ((double) lv->copy_percent));
301 PyDict_SetItemString (dict, "copy_percent", Py_None); }
302 PyDict_SetItemString (dict, "move_pv",
303 PyString_FromString (lv->move_pv));
304 PyDict_SetItemString (dict, "lv_tags",
305 PyString_FromString (lv->lv_tags));
306 PyDict_SetItemString (dict, "mirror_log",
307 PyString_FromString (lv->mirror_log));
308 PyDict_SetItemString (dict, "modules",
309 PyString_FromString (lv->modules));
314 put_lvm_lv_list (struct guestfs_lvm_lv_list *lvs)
319 list = PyList_New (lvs->len);
320 for (i = 0; i < lvs->len; ++i)
321 PyList_SetItem (list, i, put_lvm_lv (&lvs->val[i]));
326 put_stat (struct guestfs_stat *stat)
330 dict = PyDict_New ();
331 PyDict_SetItemString (dict, "dev",
332 PyLong_FromLongLong (stat->dev));
333 PyDict_SetItemString (dict, "ino",
334 PyLong_FromLongLong (stat->ino));
335 PyDict_SetItemString (dict, "mode",
336 PyLong_FromLongLong (stat->mode));
337 PyDict_SetItemString (dict, "nlink",
338 PyLong_FromLongLong (stat->nlink));
339 PyDict_SetItemString (dict, "uid",
340 PyLong_FromLongLong (stat->uid));
341 PyDict_SetItemString (dict, "gid",
342 PyLong_FromLongLong (stat->gid));
343 PyDict_SetItemString (dict, "rdev",
344 PyLong_FromLongLong (stat->rdev));
345 PyDict_SetItemString (dict, "size",
346 PyLong_FromLongLong (stat->size));
347 PyDict_SetItemString (dict, "blksize",
348 PyLong_FromLongLong (stat->blksize));
349 PyDict_SetItemString (dict, "blocks",
350 PyLong_FromLongLong (stat->blocks));
351 PyDict_SetItemString (dict, "atime",
352 PyLong_FromLongLong (stat->atime));
353 PyDict_SetItemString (dict, "mtime",
354 PyLong_FromLongLong (stat->mtime));
355 PyDict_SetItemString (dict, "ctime",
356 PyLong_FromLongLong (stat->ctime));
361 put_statvfs (struct guestfs_statvfs *statvfs)
365 dict = PyDict_New ();
366 PyDict_SetItemString (dict, "bsize",
367 PyLong_FromLongLong (statvfs->bsize));
368 PyDict_SetItemString (dict, "frsize",
369 PyLong_FromLongLong (statvfs->frsize));
370 PyDict_SetItemString (dict, "blocks",
371 PyLong_FromLongLong (statvfs->blocks));
372 PyDict_SetItemString (dict, "bfree",
373 PyLong_FromLongLong (statvfs->bfree));
374 PyDict_SetItemString (dict, "bavail",
375 PyLong_FromLongLong (statvfs->bavail));
376 PyDict_SetItemString (dict, "files",
377 PyLong_FromLongLong (statvfs->files));
378 PyDict_SetItemString (dict, "ffree",
379 PyLong_FromLongLong (statvfs->ffree));
380 PyDict_SetItemString (dict, "favail",
381 PyLong_FromLongLong (statvfs->favail));
382 PyDict_SetItemString (dict, "fsid",
383 PyLong_FromLongLong (statvfs->fsid));
384 PyDict_SetItemString (dict, "flag",
385 PyLong_FromLongLong (statvfs->flag));
386 PyDict_SetItemString (dict, "namemax",
387 PyLong_FromLongLong (statvfs->namemax));
392 py_guestfs_launch (PyObject *self, PyObject *args)
399 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_launch",
402 g = get_handle (py_g);
404 r = guestfs_launch (g);
406 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
416 py_guestfs_wait_ready (PyObject *self, PyObject *args)
423 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_wait_ready",
426 g = get_handle (py_g);
428 r = guestfs_wait_ready (g);
430 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
440 py_guestfs_kill_subprocess (PyObject *self, PyObject *args)
447 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_kill_subprocess",
450 g = get_handle (py_g);
452 r = guestfs_kill_subprocess (g);
454 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
464 py_guestfs_add_drive (PyObject *self, PyObject *args)
470 const char *filename;
472 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_add_drive",
475 g = get_handle (py_g);
477 r = guestfs_add_drive (g, filename);
479 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
489 py_guestfs_add_cdrom (PyObject *self, PyObject *args)
495 const char *filename;
497 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_add_cdrom",
500 g = get_handle (py_g);
502 r = guestfs_add_cdrom (g, filename);
504 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
514 py_guestfs_config (PyObject *self, PyObject *args)
520 const char *qemuparam;
521 const char *qemuvalue;
523 if (!PyArg_ParseTuple (args, (char *) "Osz:guestfs_config",
524 &py_g, &qemuparam, &qemuvalue))
526 g = get_handle (py_g);
528 r = guestfs_config (g, qemuparam, qemuvalue);
530 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
540 py_guestfs_set_qemu (PyObject *self, PyObject *args)
548 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_set_qemu",
551 g = get_handle (py_g);
553 r = guestfs_set_qemu (g, qemu);
555 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
565 py_guestfs_get_qemu (PyObject *self, PyObject *args)
572 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_qemu",
575 g = get_handle (py_g);
577 r = guestfs_get_qemu (g);
579 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
583 py_r = PyString_FromString (r);
588 py_guestfs_set_path (PyObject *self, PyObject *args)
596 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_set_path",
599 g = get_handle (py_g);
601 r = guestfs_set_path (g, path);
603 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
613 py_guestfs_get_path (PyObject *self, PyObject *args)
620 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_path",
623 g = get_handle (py_g);
625 r = guestfs_get_path (g);
627 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
631 py_r = PyString_FromString (r);
636 py_guestfs_set_autosync (PyObject *self, PyObject *args)
644 if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_set_autosync",
647 g = get_handle (py_g);
649 r = guestfs_set_autosync (g, autosync);
651 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
661 py_guestfs_get_autosync (PyObject *self, PyObject *args)
668 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_autosync",
671 g = get_handle (py_g);
673 r = guestfs_get_autosync (g);
675 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
679 py_r = PyInt_FromLong ((long) r);
684 py_guestfs_set_verbose (PyObject *self, PyObject *args)
692 if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_set_verbose",
695 g = get_handle (py_g);
697 r = guestfs_set_verbose (g, verbose);
699 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
709 py_guestfs_get_verbose (PyObject *self, PyObject *args)
716 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_verbose",
719 g = get_handle (py_g);
721 r = guestfs_get_verbose (g);
723 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
727 py_r = PyInt_FromLong ((long) r);
732 py_guestfs_is_ready (PyObject *self, PyObject *args)
739 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_is_ready",
742 g = get_handle (py_g);
744 r = guestfs_is_ready (g);
746 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
750 py_r = PyInt_FromLong ((long) r);
755 py_guestfs_is_config (PyObject *self, PyObject *args)
762 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_is_config",
765 g = get_handle (py_g);
767 r = guestfs_is_config (g);
769 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
773 py_r = PyInt_FromLong ((long) r);
778 py_guestfs_is_launching (PyObject *self, PyObject *args)
785 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_is_launching",
788 g = get_handle (py_g);
790 r = guestfs_is_launching (g);
792 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
796 py_r = PyInt_FromLong ((long) r);
801 py_guestfs_is_busy (PyObject *self, PyObject *args)
808 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_is_busy",
811 g = get_handle (py_g);
813 r = guestfs_is_busy (g);
815 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
819 py_r = PyInt_FromLong ((long) r);
824 py_guestfs_get_state (PyObject *self, PyObject *args)
831 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_get_state",
834 g = get_handle (py_g);
836 r = guestfs_get_state (g);
838 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
842 py_r = PyInt_FromLong ((long) r);
847 py_guestfs_set_busy (PyObject *self, PyObject *args)
854 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_set_busy",
857 g = get_handle (py_g);
859 r = guestfs_set_busy (g);
861 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
871 py_guestfs_set_ready (PyObject *self, PyObject *args)
878 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_set_ready",
881 g = get_handle (py_g);
883 r = guestfs_set_ready (g);
885 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
895 py_guestfs_mount (PyObject *self, PyObject *args)
902 const char *mountpoint;
904 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mount",
905 &py_g, &device, &mountpoint))
907 g = get_handle (py_g);
909 r = guestfs_mount (g, device, mountpoint);
911 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
921 py_guestfs_sync (PyObject *self, PyObject *args)
928 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_sync",
931 g = get_handle (py_g);
933 r = guestfs_sync (g);
935 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
945 py_guestfs_touch (PyObject *self, PyObject *args)
953 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_touch",
956 g = get_handle (py_g);
958 r = guestfs_touch (g, path);
960 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
970 py_guestfs_cat (PyObject *self, PyObject *args)
978 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_cat",
981 g = get_handle (py_g);
983 r = guestfs_cat (g, path);
985 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
989 py_r = PyString_FromString (r);
995 py_guestfs_ll (PyObject *self, PyObject *args)
1001 const char *directory;
1003 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_ll",
1006 g = get_handle (py_g);
1008 r = guestfs_ll (g, directory);
1010 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1014 py_r = PyString_FromString (r);
1020 py_guestfs_ls (PyObject *self, PyObject *args)
1026 const char *directory;
1028 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_ls",
1031 g = get_handle (py_g);
1033 r = guestfs_ls (g, directory);
1035 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1039 py_r = put_string_list (r);
1045 py_guestfs_list_devices (PyObject *self, PyObject *args)
1052 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_list_devices",
1055 g = get_handle (py_g);
1057 r = guestfs_list_devices (g);
1059 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1063 py_r = put_string_list (r);
1069 py_guestfs_list_partitions (PyObject *self, PyObject *args)
1076 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_list_partitions",
1079 g = get_handle (py_g);
1081 r = guestfs_list_partitions (g);
1083 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1087 py_r = put_string_list (r);
1093 py_guestfs_pvs (PyObject *self, PyObject *args)
1100 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_pvs",
1103 g = get_handle (py_g);
1105 r = guestfs_pvs (g);
1107 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1111 py_r = put_string_list (r);
1117 py_guestfs_vgs (PyObject *self, PyObject *args)
1124 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_vgs",
1127 g = get_handle (py_g);
1129 r = guestfs_vgs (g);
1131 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1135 py_r = put_string_list (r);
1141 py_guestfs_lvs (PyObject *self, PyObject *args)
1148 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_lvs",
1151 g = get_handle (py_g);
1153 r = guestfs_lvs (g);
1155 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1159 py_r = put_string_list (r);
1165 py_guestfs_pvs_full (PyObject *self, PyObject *args)
1170 struct guestfs_lvm_pv_list *r;
1172 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_pvs_full",
1175 g = get_handle (py_g);
1177 r = guestfs_pvs_full (g);
1179 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1183 py_r = put_lvm_pv_list (r);
1184 guestfs_free_lvm_pv_list (r);
1189 py_guestfs_vgs_full (PyObject *self, PyObject *args)
1194 struct guestfs_lvm_vg_list *r;
1196 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_vgs_full",
1199 g = get_handle (py_g);
1201 r = guestfs_vgs_full (g);
1203 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1207 py_r = put_lvm_vg_list (r);
1208 guestfs_free_lvm_vg_list (r);
1213 py_guestfs_lvs_full (PyObject *self, PyObject *args)
1218 struct guestfs_lvm_lv_list *r;
1220 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_lvs_full",
1223 g = get_handle (py_g);
1225 r = guestfs_lvs_full (g);
1227 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1231 py_r = put_lvm_lv_list (r);
1232 guestfs_free_lvm_lv_list (r);
1237 py_guestfs_read_lines (PyObject *self, PyObject *args)
1245 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_read_lines",
1248 g = get_handle (py_g);
1250 r = guestfs_read_lines (g, path);
1252 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1256 py_r = put_string_list (r);
1262 py_guestfs_aug_init (PyObject *self, PyObject *args)
1271 if (!PyArg_ParseTuple (args, (char *) "Osi:guestfs_aug_init",
1272 &py_g, &root, &flags))
1274 g = get_handle (py_g);
1276 r = guestfs_aug_init (g, root, flags);
1278 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1282 Py_INCREF (Py_None);
1288 py_guestfs_aug_close (PyObject *self, PyObject *args)
1295 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_aug_close",
1298 g = get_handle (py_g);
1300 r = guestfs_aug_close (g);
1302 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1306 Py_INCREF (Py_None);
1312 py_guestfs_aug_defvar (PyObject *self, PyObject *args)
1321 if (!PyArg_ParseTuple (args, (char *) "Osz:guestfs_aug_defvar",
1322 &py_g, &name, &expr))
1324 g = get_handle (py_g);
1326 r = guestfs_aug_defvar (g, name, expr);
1328 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1332 py_r = PyInt_FromLong ((long) r);
1337 py_guestfs_aug_defnode (PyObject *self, PyObject *args)
1342 struct guestfs_int_bool *r;
1347 if (!PyArg_ParseTuple (args, (char *) "Osss:guestfs_aug_defnode",
1348 &py_g, &name, &expr, &val))
1350 g = get_handle (py_g);
1352 r = guestfs_aug_defnode (g, name, expr, val);
1354 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1358 py_r = PyTuple_New (2);
1359 PyTuple_SetItem (py_r, 0, PyInt_FromLong ((long) r->i));
1360 PyTuple_SetItem (py_r, 1, PyInt_FromLong ((long) r->b));
1361 guestfs_free_int_bool (r);
1366 py_guestfs_aug_get (PyObject *self, PyObject *args)
1374 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_aug_get",
1377 g = get_handle (py_g);
1379 r = guestfs_aug_get (g, path);
1381 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1385 py_r = PyString_FromString (r);
1391 py_guestfs_aug_set (PyObject *self, PyObject *args)
1400 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_aug_set",
1401 &py_g, &path, &val))
1403 g = get_handle (py_g);
1405 r = guestfs_aug_set (g, path, val);
1407 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1411 Py_INCREF (Py_None);
1417 py_guestfs_aug_insert (PyObject *self, PyObject *args)
1427 if (!PyArg_ParseTuple (args, (char *) "Ossi:guestfs_aug_insert",
1428 &py_g, &path, &label, &before))
1430 g = get_handle (py_g);
1432 r = guestfs_aug_insert (g, path, label, before);
1434 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1438 Py_INCREF (Py_None);
1444 py_guestfs_aug_rm (PyObject *self, PyObject *args)
1452 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_aug_rm",
1455 g = get_handle (py_g);
1457 r = guestfs_aug_rm (g, path);
1459 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1463 py_r = PyInt_FromLong ((long) r);
1468 py_guestfs_aug_mv (PyObject *self, PyObject *args)
1477 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_aug_mv",
1478 &py_g, &src, &dest))
1480 g = get_handle (py_g);
1482 r = guestfs_aug_mv (g, src, dest);
1484 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1488 Py_INCREF (Py_None);
1494 py_guestfs_aug_match (PyObject *self, PyObject *args)
1502 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_aug_match",
1505 g = get_handle (py_g);
1507 r = guestfs_aug_match (g, path);
1509 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1513 py_r = put_string_list (r);
1519 py_guestfs_aug_save (PyObject *self, PyObject *args)
1526 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_aug_save",
1529 g = get_handle (py_g);
1531 r = guestfs_aug_save (g);
1533 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1537 Py_INCREF (Py_None);
1543 py_guestfs_aug_load (PyObject *self, PyObject *args)
1550 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_aug_load",
1553 g = get_handle (py_g);
1555 r = guestfs_aug_load (g);
1557 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1561 Py_INCREF (Py_None);
1567 py_guestfs_aug_ls (PyObject *self, PyObject *args)
1575 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_aug_ls",
1578 g = get_handle (py_g);
1580 r = guestfs_aug_ls (g, path);
1582 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1586 py_r = put_string_list (r);
1592 py_guestfs_rm (PyObject *self, PyObject *args)
1600 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_rm",
1603 g = get_handle (py_g);
1605 r = guestfs_rm (g, path);
1607 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1611 Py_INCREF (Py_None);
1617 py_guestfs_rmdir (PyObject *self, PyObject *args)
1625 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_rmdir",
1628 g = get_handle (py_g);
1630 r = guestfs_rmdir (g, path);
1632 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1636 Py_INCREF (Py_None);
1642 py_guestfs_rm_rf (PyObject *self, PyObject *args)
1650 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_rm_rf",
1653 g = get_handle (py_g);
1655 r = guestfs_rm_rf (g, path);
1657 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1661 Py_INCREF (Py_None);
1667 py_guestfs_mkdir (PyObject *self, PyObject *args)
1675 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_mkdir",
1678 g = get_handle (py_g);
1680 r = guestfs_mkdir (g, path);
1682 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1686 Py_INCREF (Py_None);
1692 py_guestfs_mkdir_p (PyObject *self, PyObject *args)
1700 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_mkdir_p",
1703 g = get_handle (py_g);
1705 r = guestfs_mkdir_p (g, path);
1707 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1711 Py_INCREF (Py_None);
1717 py_guestfs_chmod (PyObject *self, PyObject *args)
1726 if (!PyArg_ParseTuple (args, (char *) "Ois:guestfs_chmod",
1727 &py_g, &mode, &path))
1729 g = get_handle (py_g);
1731 r = guestfs_chmod (g, mode, path);
1733 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1737 Py_INCREF (Py_None);
1743 py_guestfs_chown (PyObject *self, PyObject *args)
1753 if (!PyArg_ParseTuple (args, (char *) "Oiis:guestfs_chown",
1754 &py_g, &owner, &group, &path))
1756 g = get_handle (py_g);
1758 r = guestfs_chown (g, owner, group, path);
1760 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1764 Py_INCREF (Py_None);
1770 py_guestfs_exists (PyObject *self, PyObject *args)
1778 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_exists",
1781 g = get_handle (py_g);
1783 r = guestfs_exists (g, path);
1785 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1789 py_r = PyInt_FromLong ((long) r);
1794 py_guestfs_is_file (PyObject *self, PyObject *args)
1802 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_is_file",
1805 g = get_handle (py_g);
1807 r = guestfs_is_file (g, path);
1809 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1813 py_r = PyInt_FromLong ((long) r);
1818 py_guestfs_is_dir (PyObject *self, PyObject *args)
1826 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_is_dir",
1829 g = get_handle (py_g);
1831 r = guestfs_is_dir (g, path);
1833 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1837 py_r = PyInt_FromLong ((long) r);
1842 py_guestfs_pvcreate (PyObject *self, PyObject *args)
1850 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_pvcreate",
1853 g = get_handle (py_g);
1855 r = guestfs_pvcreate (g, device);
1857 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1861 Py_INCREF (Py_None);
1867 py_guestfs_vgcreate (PyObject *self, PyObject *args)
1873 const char *volgroup;
1874 PyObject *py_physvols;
1875 const char **physvols;
1877 if (!PyArg_ParseTuple (args, (char *) "OsO:guestfs_vgcreate",
1878 &py_g, &volgroup, &py_physvols))
1880 g = get_handle (py_g);
1881 physvols = get_string_list (py_physvols);
1882 if (!physvols) return NULL;
1884 r = guestfs_vgcreate (g, volgroup, physvols);
1887 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1891 Py_INCREF (Py_None);
1897 py_guestfs_lvcreate (PyObject *self, PyObject *args)
1904 const char *volgroup;
1907 if (!PyArg_ParseTuple (args, (char *) "Ossi:guestfs_lvcreate",
1908 &py_g, &logvol, &volgroup, &mbytes))
1910 g = get_handle (py_g);
1912 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1914 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1918 Py_INCREF (Py_None);
1924 py_guestfs_mkfs (PyObject *self, PyObject *args)
1933 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mkfs",
1934 &py_g, &fstype, &device))
1936 g = get_handle (py_g);
1938 r = guestfs_mkfs (g, fstype, device);
1940 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1944 Py_INCREF (Py_None);
1950 py_guestfs_sfdisk (PyObject *self, PyObject *args)
1963 if (!PyArg_ParseTuple (args, (char *) "OsiiiO:guestfs_sfdisk",
1964 &py_g, &device, &cyls, &heads, §ors, &py_lines))
1966 g = get_handle (py_g);
1967 lines = get_string_list (py_lines);
1968 if (!lines) return NULL;
1970 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1973 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
1977 Py_INCREF (Py_None);
1983 py_guestfs_write_file (PyObject *self, PyObject *args)
1990 const char *content;
1993 if (!PyArg_ParseTuple (args, (char *) "Ossi:guestfs_write_file",
1994 &py_g, &path, &content, &size))
1996 g = get_handle (py_g);
1998 r = guestfs_write_file (g, path, content, size);
2000 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2004 Py_INCREF (Py_None);
2010 py_guestfs_umount (PyObject *self, PyObject *args)
2016 const char *pathordevice;
2018 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_umount",
2019 &py_g, &pathordevice))
2021 g = get_handle (py_g);
2023 r = guestfs_umount (g, pathordevice);
2025 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2029 Py_INCREF (Py_None);
2035 py_guestfs_mounts (PyObject *self, PyObject *args)
2042 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_mounts",
2045 g = get_handle (py_g);
2047 r = guestfs_mounts (g);
2049 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2053 py_r = put_string_list (r);
2059 py_guestfs_umount_all (PyObject *self, PyObject *args)
2066 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_umount_all",
2069 g = get_handle (py_g);
2071 r = guestfs_umount_all (g);
2073 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2077 Py_INCREF (Py_None);
2083 py_guestfs_lvm_remove_all (PyObject *self, PyObject *args)
2090 if (!PyArg_ParseTuple (args, (char *) "O:guestfs_lvm_remove_all",
2093 g = get_handle (py_g);
2095 r = guestfs_lvm_remove_all (g);
2097 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2101 Py_INCREF (Py_None);
2107 py_guestfs_file (PyObject *self, PyObject *args)
2115 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_file",
2118 g = get_handle (py_g);
2120 r = guestfs_file (g, path);
2122 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2126 py_r = PyString_FromString (r);
2132 py_guestfs_command (PyObject *self, PyObject *args)
2138 PyObject *py_arguments;
2139 const char **arguments;
2141 if (!PyArg_ParseTuple (args, (char *) "OO:guestfs_command",
2142 &py_g, &py_arguments))
2144 g = get_handle (py_g);
2145 arguments = get_string_list (py_arguments);
2146 if (!arguments) return NULL;
2148 r = guestfs_command (g, arguments);
2151 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2155 py_r = PyString_FromString (r);
2161 py_guestfs_command_lines (PyObject *self, PyObject *args)
2167 PyObject *py_arguments;
2168 const char **arguments;
2170 if (!PyArg_ParseTuple (args, (char *) "OO:guestfs_command_lines",
2171 &py_g, &py_arguments))
2173 g = get_handle (py_g);
2174 arguments = get_string_list (py_arguments);
2175 if (!arguments) return NULL;
2177 r = guestfs_command_lines (g, arguments);
2180 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2184 py_r = put_string_list (r);
2190 py_guestfs_stat (PyObject *self, PyObject *args)
2195 struct guestfs_stat *r;
2198 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_stat",
2201 g = get_handle (py_g);
2203 r = guestfs_stat (g, path);
2205 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2209 py_r = put_stat (r);
2215 py_guestfs_lstat (PyObject *self, PyObject *args)
2220 struct guestfs_stat *r;
2223 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_lstat",
2226 g = get_handle (py_g);
2228 r = guestfs_lstat (g, path);
2230 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2234 py_r = put_stat (r);
2240 py_guestfs_statvfs (PyObject *self, PyObject *args)
2245 struct guestfs_statvfs *r;
2248 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_statvfs",
2251 g = get_handle (py_g);
2253 r = guestfs_statvfs (g, path);
2255 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2259 py_r = put_statvfs (r);
2265 py_guestfs_tune2fs_l (PyObject *self, PyObject *args)
2273 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_tune2fs_l",
2276 g = get_handle (py_g);
2278 r = guestfs_tune2fs_l (g, device);
2280 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2284 py_r = put_table (r);
2290 py_guestfs_blockdev_setro (PyObject *self, PyObject *args)
2298 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_setro",
2301 g = get_handle (py_g);
2303 r = guestfs_blockdev_setro (g, device);
2305 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2309 Py_INCREF (Py_None);
2315 py_guestfs_blockdev_setrw (PyObject *self, PyObject *args)
2323 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_setrw",
2326 g = get_handle (py_g);
2328 r = guestfs_blockdev_setrw (g, device);
2330 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2334 Py_INCREF (Py_None);
2340 py_guestfs_blockdev_getro (PyObject *self, PyObject *args)
2348 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_getro",
2351 g = get_handle (py_g);
2353 r = guestfs_blockdev_getro (g, device);
2355 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2359 py_r = PyInt_FromLong ((long) r);
2364 py_guestfs_blockdev_getss (PyObject *self, PyObject *args)
2372 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_getss",
2375 g = get_handle (py_g);
2377 r = guestfs_blockdev_getss (g, device);
2379 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2383 py_r = PyInt_FromLong ((long) r);
2388 py_guestfs_blockdev_getbsz (PyObject *self, PyObject *args)
2396 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_getbsz",
2399 g = get_handle (py_g);
2401 r = guestfs_blockdev_getbsz (g, device);
2403 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2407 py_r = PyInt_FromLong ((long) r);
2412 py_guestfs_blockdev_setbsz (PyObject *self, PyObject *args)
2421 if (!PyArg_ParseTuple (args, (char *) "Osi:guestfs_blockdev_setbsz",
2422 &py_g, &device, &blocksize))
2424 g = get_handle (py_g);
2426 r = guestfs_blockdev_setbsz (g, device, blocksize);
2428 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2432 Py_INCREF (Py_None);
2438 py_guestfs_blockdev_getsz (PyObject *self, PyObject *args)
2446 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_getsz",
2449 g = get_handle (py_g);
2451 r = guestfs_blockdev_getsz (g, device);
2453 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2457 py_r = PyLong_FromLongLong (r);
2462 py_guestfs_blockdev_getsize64 (PyObject *self, PyObject *args)
2470 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_getsize64",
2473 g = get_handle (py_g);
2475 r = guestfs_blockdev_getsize64 (g, device);
2477 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2481 py_r = PyLong_FromLongLong (r);
2486 py_guestfs_blockdev_flushbufs (PyObject *self, PyObject *args)
2494 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_flushbufs",
2497 g = get_handle (py_g);
2499 r = guestfs_blockdev_flushbufs (g, device);
2501 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2505 Py_INCREF (Py_None);
2511 py_guestfs_blockdev_rereadpt (PyObject *self, PyObject *args)
2519 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_blockdev_rereadpt",
2522 g = get_handle (py_g);
2524 r = guestfs_blockdev_rereadpt (g, device);
2526 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2530 Py_INCREF (Py_None);
2536 py_guestfs_upload (PyObject *self, PyObject *args)
2542 const char *filename;
2543 const char *remotefilename;
2545 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_upload",
2546 &py_g, &filename, &remotefilename))
2548 g = get_handle (py_g);
2550 r = guestfs_upload (g, filename, remotefilename);
2552 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2556 Py_INCREF (Py_None);
2562 py_guestfs_download (PyObject *self, PyObject *args)
2568 const char *remotefilename;
2569 const char *filename;
2571 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_download",
2572 &py_g, &remotefilename, &filename))
2574 g = get_handle (py_g);
2576 r = guestfs_download (g, remotefilename, filename);
2578 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2582 Py_INCREF (Py_None);
2588 py_guestfs_checksum (PyObject *self, PyObject *args)
2594 const char *csumtype;
2597 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_checksum",
2598 &py_g, &csumtype, &path))
2600 g = get_handle (py_g);
2602 r = guestfs_checksum (g, csumtype, path);
2604 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2608 py_r = PyString_FromString (r);
2614 py_guestfs_tar_in (PyObject *self, PyObject *args)
2620 const char *tarfile;
2621 const char *directory;
2623 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_tar_in",
2624 &py_g, &tarfile, &directory))
2626 g = get_handle (py_g);
2628 r = guestfs_tar_in (g, tarfile, directory);
2630 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2634 Py_INCREF (Py_None);
2640 py_guestfs_tar_out (PyObject *self, PyObject *args)
2646 const char *directory;
2647 const char *tarfile;
2649 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_tar_out",
2650 &py_g, &directory, &tarfile))
2652 g = get_handle (py_g);
2654 r = guestfs_tar_out (g, directory, tarfile);
2656 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2660 Py_INCREF (Py_None);
2666 py_guestfs_tgz_in (PyObject *self, PyObject *args)
2672 const char *tarball;
2673 const char *directory;
2675 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_tgz_in",
2676 &py_g, &tarball, &directory))
2678 g = get_handle (py_g);
2680 r = guestfs_tgz_in (g, tarball, directory);
2682 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2686 Py_INCREF (Py_None);
2692 py_guestfs_tgz_out (PyObject *self, PyObject *args)
2698 const char *directory;
2699 const char *tarball;
2701 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_tgz_out",
2702 &py_g, &directory, &tarball))
2704 g = get_handle (py_g);
2706 r = guestfs_tgz_out (g, directory, tarball);
2708 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2712 Py_INCREF (Py_None);
2718 py_guestfs_mount_ro (PyObject *self, PyObject *args)
2725 const char *mountpoint;
2727 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mount_ro",
2728 &py_g, &device, &mountpoint))
2730 g = get_handle (py_g);
2732 r = guestfs_mount_ro (g, device, mountpoint);
2734 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2738 Py_INCREF (Py_None);
2744 py_guestfs_mount_options (PyObject *self, PyObject *args)
2750 const char *options;
2752 const char *mountpoint;
2754 if (!PyArg_ParseTuple (args, (char *) "Osss:guestfs_mount_options",
2755 &py_g, &options, &device, &mountpoint))
2757 g = get_handle (py_g);
2759 r = guestfs_mount_options (g, options, device, mountpoint);
2761 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2765 Py_INCREF (Py_None);
2771 py_guestfs_mount_vfs (PyObject *self, PyObject *args)
2777 const char *options;
2778 const char *vfstype;
2780 const char *mountpoint;
2782 if (!PyArg_ParseTuple (args, (char *) "Ossss:guestfs_mount_vfs",
2783 &py_g, &options, &vfstype, &device, &mountpoint))
2785 g = get_handle (py_g);
2787 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2789 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2793 Py_INCREF (Py_None);
2799 py_guestfs_debug (PyObject *self, PyObject *args)
2806 PyObject *py_extraargs;
2807 const char **extraargs;
2809 if (!PyArg_ParseTuple (args, (char *) "OsO:guestfs_debug",
2810 &py_g, &subcmd, &py_extraargs))
2812 g = get_handle (py_g);
2813 extraargs = get_string_list (py_extraargs);
2814 if (!extraargs) return NULL;
2816 r = guestfs_debug (g, subcmd, extraargs);
2819 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2823 py_r = PyString_FromString (r);
2829 py_guestfs_lvremove (PyObject *self, PyObject *args)
2837 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_lvremove",
2840 g = get_handle (py_g);
2842 r = guestfs_lvremove (g, device);
2844 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2848 Py_INCREF (Py_None);
2854 py_guestfs_vgremove (PyObject *self, PyObject *args)
2862 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_vgremove",
2865 g = get_handle (py_g);
2867 r = guestfs_vgremove (g, vgname);
2869 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2873 Py_INCREF (Py_None);
2879 py_guestfs_pvremove (PyObject *self, PyObject *args)
2887 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_pvremove",
2890 g = get_handle (py_g);
2892 r = guestfs_pvremove (g, device);
2894 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2898 Py_INCREF (Py_None);
2904 py_guestfs_set_e2label (PyObject *self, PyObject *args)
2913 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_set_e2label",
2914 &py_g, &device, &label))
2916 g = get_handle (py_g);
2918 r = guestfs_set_e2label (g, device, label);
2920 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2924 Py_INCREF (Py_None);
2930 py_guestfs_get_e2label (PyObject *self, PyObject *args)
2938 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_get_e2label",
2941 g = get_handle (py_g);
2943 r = guestfs_get_e2label (g, device);
2945 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2949 py_r = PyString_FromString (r);
2955 py_guestfs_set_e2uuid (PyObject *self, PyObject *args)
2964 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_set_e2uuid",
2965 &py_g, &device, &uuid))
2967 g = get_handle (py_g);
2969 r = guestfs_set_e2uuid (g, device, uuid);
2971 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
2975 Py_INCREF (Py_None);
2981 py_guestfs_get_e2uuid (PyObject *self, PyObject *args)
2989 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_get_e2uuid",
2992 g = get_handle (py_g);
2994 r = guestfs_get_e2uuid (g, device);
2996 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3000 py_r = PyString_FromString (r);
3006 py_guestfs_fsck (PyObject *self, PyObject *args)
3015 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_fsck",
3016 &py_g, &fstype, &device))
3018 g = get_handle (py_g);
3020 r = guestfs_fsck (g, fstype, device);
3022 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3026 py_r = PyInt_FromLong ((long) r);
3031 py_guestfs_zero (PyObject *self, PyObject *args)
3039 if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_zero",
3042 g = get_handle (py_g);
3044 r = guestfs_zero (g, device);
3046 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3050 Py_INCREF (Py_None);
3056 py_guestfs_grub_install (PyObject *self, PyObject *args)
3065 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_grub_install",
3066 &py_g, &root, &device))
3068 g = get_handle (py_g);
3070 r = guestfs_grub_install (g, root, device);
3072 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3076 Py_INCREF (Py_None);
3082 py_guestfs_cp (PyObject *self, PyObject *args)
3091 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_cp",
3092 &py_g, &src, &dest))
3094 g = get_handle (py_g);
3096 r = guestfs_cp (g, src, dest);
3098 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3102 Py_INCREF (Py_None);
3108 py_guestfs_cp_a (PyObject *self, PyObject *args)
3117 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_cp_a",
3118 &py_g, &src, &dest))
3120 g = get_handle (py_g);
3122 r = guestfs_cp_a (g, src, dest);
3124 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3128 Py_INCREF (Py_None);
3134 py_guestfs_mv (PyObject *self, PyObject *args)
3143 if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mv",
3144 &py_g, &src, &dest))
3146 g = get_handle (py_g);
3148 r = guestfs_mv (g, src, dest);
3150 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3154 Py_INCREF (Py_None);
3160 py_guestfs_drop_caches (PyObject *self, PyObject *args)
3168 if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_drop_caches",
3169 &py_g, &whattodrop))
3171 g = get_handle (py_g);
3173 r = guestfs_drop_caches (g, whattodrop);
3175 PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
3179 Py_INCREF (Py_None);
3184 static PyMethodDef methods[] = {
3185 { (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
3186 { (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
3187 { (char *) "launch", py_guestfs_launch, METH_VARARGS, NULL },
3188 { (char *) "wait_ready", py_guestfs_wait_ready, METH_VARARGS, NULL },
3189 { (char *) "kill_subprocess", py_guestfs_kill_subprocess, METH_VARARGS, NULL },
3190 { (char *) "add_drive", py_guestfs_add_drive, METH_VARARGS, NULL },
3191 { (char *) "add_cdrom", py_guestfs_add_cdrom, METH_VARARGS, NULL },
3192 { (char *) "config", py_guestfs_config, METH_VARARGS, NULL },
3193 { (char *) "set_qemu", py_guestfs_set_qemu, METH_VARARGS, NULL },
3194 { (char *) "get_qemu", py_guestfs_get_qemu, METH_VARARGS, NULL },
3195 { (char *) "set_path", py_guestfs_set_path, METH_VARARGS, NULL },
3196 { (char *) "get_path", py_guestfs_get_path, METH_VARARGS, NULL },
3197 { (char *) "set_autosync", py_guestfs_set_autosync, METH_VARARGS, NULL },
3198 { (char *) "get_autosync", py_guestfs_get_autosync, METH_VARARGS, NULL },
3199 { (char *) "set_verbose", py_guestfs_set_verbose, METH_VARARGS, NULL },
3200 { (char *) "get_verbose", py_guestfs_get_verbose, METH_VARARGS, NULL },
3201 { (char *) "is_ready", py_guestfs_is_ready, METH_VARARGS, NULL },
3202 { (char *) "is_config", py_guestfs_is_config, METH_VARARGS, NULL },
3203 { (char *) "is_launching", py_guestfs_is_launching, METH_VARARGS, NULL },
3204 { (char *) "is_busy", py_guestfs_is_busy, METH_VARARGS, NULL },
3205 { (char *) "get_state", py_guestfs_get_state, METH_VARARGS, NULL },
3206 { (char *) "set_busy", py_guestfs_set_busy, METH_VARARGS, NULL },
3207 { (char *) "set_ready", py_guestfs_set_ready, METH_VARARGS, NULL },
3208 { (char *) "mount", py_guestfs_mount, METH_VARARGS, NULL },
3209 { (char *) "sync", py_guestfs_sync, METH_VARARGS, NULL },
3210 { (char *) "touch", py_guestfs_touch, METH_VARARGS, NULL },
3211 { (char *) "cat", py_guestfs_cat, METH_VARARGS, NULL },
3212 { (char *) "ll", py_guestfs_ll, METH_VARARGS, NULL },
3213 { (char *) "ls", py_guestfs_ls, METH_VARARGS, NULL },
3214 { (char *) "list_devices", py_guestfs_list_devices, METH_VARARGS, NULL },
3215 { (char *) "list_partitions", py_guestfs_list_partitions, METH_VARARGS, NULL },
3216 { (char *) "pvs", py_guestfs_pvs, METH_VARARGS, NULL },
3217 { (char *) "vgs", py_guestfs_vgs, METH_VARARGS, NULL },
3218 { (char *) "lvs", py_guestfs_lvs, METH_VARARGS, NULL },
3219 { (char *) "pvs_full", py_guestfs_pvs_full, METH_VARARGS, NULL },
3220 { (char *) "vgs_full", py_guestfs_vgs_full, METH_VARARGS, NULL },
3221 { (char *) "lvs_full", py_guestfs_lvs_full, METH_VARARGS, NULL },
3222 { (char *) "read_lines", py_guestfs_read_lines, METH_VARARGS, NULL },
3223 { (char *) "aug_init", py_guestfs_aug_init, METH_VARARGS, NULL },
3224 { (char *) "aug_close", py_guestfs_aug_close, METH_VARARGS, NULL },
3225 { (char *) "aug_defvar", py_guestfs_aug_defvar, METH_VARARGS, NULL },
3226 { (char *) "aug_defnode", py_guestfs_aug_defnode, METH_VARARGS, NULL },
3227 { (char *) "aug_get", py_guestfs_aug_get, METH_VARARGS, NULL },
3228 { (char *) "aug_set", py_guestfs_aug_set, METH_VARARGS, NULL },
3229 { (char *) "aug_insert", py_guestfs_aug_insert, METH_VARARGS, NULL },
3230 { (char *) "aug_rm", py_guestfs_aug_rm, METH_VARARGS, NULL },
3231 { (char *) "aug_mv", py_guestfs_aug_mv, METH_VARARGS, NULL },
3232 { (char *) "aug_match", py_guestfs_aug_match, METH_VARARGS, NULL },
3233 { (char *) "aug_save", py_guestfs_aug_save, METH_VARARGS, NULL },
3234 { (char *) "aug_load", py_guestfs_aug_load, METH_VARARGS, NULL },
3235 { (char *) "aug_ls", py_guestfs_aug_ls, METH_VARARGS, NULL },
3236 { (char *) "rm", py_guestfs_rm, METH_VARARGS, NULL },
3237 { (char *) "rmdir", py_guestfs_rmdir, METH_VARARGS, NULL },
3238 { (char *) "rm_rf", py_guestfs_rm_rf, METH_VARARGS, NULL },
3239 { (char *) "mkdir", py_guestfs_mkdir, METH_VARARGS, NULL },
3240 { (char *) "mkdir_p", py_guestfs_mkdir_p, METH_VARARGS, NULL },
3241 { (char *) "chmod", py_guestfs_chmod, METH_VARARGS, NULL },
3242 { (char *) "chown", py_guestfs_chown, METH_VARARGS, NULL },
3243 { (char *) "exists", py_guestfs_exists, METH_VARARGS, NULL },
3244 { (char *) "is_file", py_guestfs_is_file, METH_VARARGS, NULL },
3245 { (char *) "is_dir", py_guestfs_is_dir, METH_VARARGS, NULL },
3246 { (char *) "pvcreate", py_guestfs_pvcreate, METH_VARARGS, NULL },
3247 { (char *) "vgcreate", py_guestfs_vgcreate, METH_VARARGS, NULL },
3248 { (char *) "lvcreate", py_guestfs_lvcreate, METH_VARARGS, NULL },
3249 { (char *) "mkfs", py_guestfs_mkfs, METH_VARARGS, NULL },
3250 { (char *) "sfdisk", py_guestfs_sfdisk, METH_VARARGS, NULL },
3251 { (char *) "write_file", py_guestfs_write_file, METH_VARARGS, NULL },
3252 { (char *) "umount", py_guestfs_umount, METH_VARARGS, NULL },
3253 { (char *) "mounts", py_guestfs_mounts, METH_VARARGS, NULL },
3254 { (char *) "umount_all", py_guestfs_umount_all, METH_VARARGS, NULL },
3255 { (char *) "lvm_remove_all", py_guestfs_lvm_remove_all, METH_VARARGS, NULL },
3256 { (char *) "file", py_guestfs_file, METH_VARARGS, NULL },
3257 { (char *) "command", py_guestfs_command, METH_VARARGS, NULL },
3258 { (char *) "command_lines", py_guestfs_command_lines, METH_VARARGS, NULL },
3259 { (char *) "stat", py_guestfs_stat, METH_VARARGS, NULL },
3260 { (char *) "lstat", py_guestfs_lstat, METH_VARARGS, NULL },
3261 { (char *) "statvfs", py_guestfs_statvfs, METH_VARARGS, NULL },
3262 { (char *) "tune2fs_l", py_guestfs_tune2fs_l, METH_VARARGS, NULL },
3263 { (char *) "blockdev_setro", py_guestfs_blockdev_setro, METH_VARARGS, NULL },
3264 { (char *) "blockdev_setrw", py_guestfs_blockdev_setrw, METH_VARARGS, NULL },
3265 { (char *) "blockdev_getro", py_guestfs_blockdev_getro, METH_VARARGS, NULL },
3266 { (char *) "blockdev_getss", py_guestfs_blockdev_getss, METH_VARARGS, NULL },
3267 { (char *) "blockdev_getbsz", py_guestfs_blockdev_getbsz, METH_VARARGS, NULL },
3268 { (char *) "blockdev_setbsz", py_guestfs_blockdev_setbsz, METH_VARARGS, NULL },
3269 { (char *) "blockdev_getsz", py_guestfs_blockdev_getsz, METH_VARARGS, NULL },
3270 { (char *) "blockdev_getsize64", py_guestfs_blockdev_getsize64, METH_VARARGS, NULL },
3271 { (char *) "blockdev_flushbufs", py_guestfs_blockdev_flushbufs, METH_VARARGS, NULL },
3272 { (char *) "blockdev_rereadpt", py_guestfs_blockdev_rereadpt, METH_VARARGS, NULL },
3273 { (char *) "upload", py_guestfs_upload, METH_VARARGS, NULL },
3274 { (char *) "download", py_guestfs_download, METH_VARARGS, NULL },
3275 { (char *) "checksum", py_guestfs_checksum, METH_VARARGS, NULL },
3276 { (char *) "tar_in", py_guestfs_tar_in, METH_VARARGS, NULL },
3277 { (char *) "tar_out", py_guestfs_tar_out, METH_VARARGS, NULL },
3278 { (char *) "tgz_in", py_guestfs_tgz_in, METH_VARARGS, NULL },
3279 { (char *) "tgz_out", py_guestfs_tgz_out, METH_VARARGS, NULL },
3280 { (char *) "mount_ro", py_guestfs_mount_ro, METH_VARARGS, NULL },
3281 { (char *) "mount_options", py_guestfs_mount_options, METH_VARARGS, NULL },
3282 { (char *) "mount_vfs", py_guestfs_mount_vfs, METH_VARARGS, NULL },
3283 { (char *) "debug", py_guestfs_debug, METH_VARARGS, NULL },
3284 { (char *) "lvremove", py_guestfs_lvremove, METH_VARARGS, NULL },
3285 { (char *) "vgremove", py_guestfs_vgremove, METH_VARARGS, NULL },
3286 { (char *) "pvremove", py_guestfs_pvremove, METH_VARARGS, NULL },
3287 { (char *) "set_e2label", py_guestfs_set_e2label, METH_VARARGS, NULL },
3288 { (char *) "get_e2label", py_guestfs_get_e2label, METH_VARARGS, NULL },
3289 { (char *) "set_e2uuid", py_guestfs_set_e2uuid, METH_VARARGS, NULL },
3290 { (char *) "get_e2uuid", py_guestfs_get_e2uuid, METH_VARARGS, NULL },
3291 { (char *) "fsck", py_guestfs_fsck, METH_VARARGS, NULL },
3292 { (char *) "zero", py_guestfs_zero, METH_VARARGS, NULL },
3293 { (char *) "grub_install", py_guestfs_grub_install, METH_VARARGS, NULL },
3294 { (char *) "cp", py_guestfs_cp, METH_VARARGS, NULL },
3295 { (char *) "cp_a", py_guestfs_cp_a, METH_VARARGS, NULL },
3296 { (char *) "mv", py_guestfs_mv, METH_VARARGS, NULL },
3297 { (char *) "drop_caches", py_guestfs_drop_caches, METH_VARARGS, NULL },
3298 { NULL, NULL, 0, NULL }
3302 initlibguestfsmod (void)
3304 static int initialized = 0;
3306 if (initialized) return;
3307 Py_InitModule ((char *) "libguestfsmod", methods);