Generated code for debug command.
[libguestfs.git] / python / guestfs.py
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.
4 #
5 # Copyright (C) 2009 Red Hat Inc.
6 #
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.
11 #
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.
16 #
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
20
21 u"""Python bindings for libguestfs
22
23 import guestfs
24 g = guestfs.GuestFS ()
25 g.add_drive ("guest.img")
26 g.launch ()
27 g.wait_ready ()
28 parts = g.list_partitions ()
29
30 The guestfs module provides a Python binding to the libguestfs API
31 for examining and modifying virtual machine disk images.
32
33 Amongst the things this is good for: making batch configuration
34 changes to guests, getting disk used/free statistics (see also:
35 virt-df), migrating between virtualization systems (see also:
36 virt-p2v), performing partial backups, performing partial guest
37 clones, cloning guests and changing registry/UUID/hostname info, and
38 much else besides.
39
40 Libguestfs uses Linux kernel and qemu code, and can access any type of
41 guest filesystem that Linux and qemu can, including but not limited
42 to: ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
43 schemes, qcow, qcow2, vmdk.
44
45 Libguestfs provides ways to enumerate guest storage (eg. partitions,
46 LVs, what filesystem is in each LV, etc.).  It can also run commands
47 in the context of the guest.  Also you can access filesystems over FTP.
48
49 Errors which happen while using the API are turned into Python
50 RuntimeError exceptions.
51
52 To create a guestfs handle you usually have to perform the following
53 sequence of calls:
54
55 # Create the handle, call add_drive at least once, and possibly
56 # several times if the guest has multiple block devices:
57 g = guestfs.GuestFS ()
58 g.add_drive ("guest.img")
59
60 # Launch the qemu subprocess and wait for it to become ready:
61 g.launch ()
62 g.wait_ready ()
63
64 # Now you can issue commands, for example:
65 logvols = g.lvs ()
66
67 """
68
69 import libguestfsmod
70
71 class GuestFS:
72     """Instances of this class are libguestfs API handles."""
73
74     def __init__ (self):
75         """Create a new libguestfs handle."""
76         self._o = libguestfsmod.create ()
77
78     def __del__ (self):
79         libguestfsmod.close (self._o)
80
81     def launch (self):
82         u"""Internally libguestfs is implemented by running a
83         virtual machine using qemu(1).
84         
85         You should call this after configuring the handle (eg.
86         adding drives) but before performing any actions.
87         """
88         return libguestfsmod.launch (self._o)
89
90     def wait_ready (self):
91         u"""Internally libguestfs is implemented by running a
92         virtual machine using qemu(1).
93         
94         You should call this after "g.launch" to wait for the
95         launch to complete.
96         """
97         return libguestfsmod.wait_ready (self._o)
98
99     def kill_subprocess (self):
100         u"""This kills the qemu subprocess. You should never need to
101         call this.
102         """
103         return libguestfsmod.kill_subprocess (self._o)
104
105     def add_drive (self, filename):
106         u"""This function adds a virtual machine disk image
107         "filename" to the guest. The first time you call this
108         function, the disk appears as IDE disk 0 ("/dev/sda") in
109         the guest, the second time as "/dev/sdb", and so on.
110         
111         You don't necessarily need to be root when using
112         libguestfs. However you obviously do need sufficient
113         permissions to access the filename for whatever
114         operations you want to perform (ie. read access if you
115         just want to read the image or write access if you want
116         to modify the image).
117         
118         This is equivalent to the qemu parameter "-drive
119         file=filename".
120         """
121         return libguestfsmod.add_drive (self._o, filename)
122
123     def add_cdrom (self, filename):
124         u"""This function adds a virtual CD-ROM disk image to the
125         guest.
126         
127         This is equivalent to the qemu parameter "-cdrom
128         filename".
129         """
130         return libguestfsmod.add_cdrom (self._o, filename)
131
132     def config (self, qemuparam, qemuvalue):
133         u"""This can be used to add arbitrary qemu command line
134         parameters of the form "-param value". Actually it's not
135         quite arbitrary - we prevent you from setting some
136         parameters which would interfere with parameters that we
137         use.
138         
139         The first character of "param" string must be a "-"
140         (dash).
141         
142         "value" can be NULL.
143         """
144         return libguestfsmod.config (self._o, qemuparam, qemuvalue)
145
146     def set_qemu (self, qemu):
147         u"""Set the qemu binary that we will use.
148         
149         The default is chosen when the library was compiled by
150         the configure script.
151         
152         You can also override this by setting the
153         "LIBGUESTFS_QEMU" environment variable.
154         
155         The string "qemu" is stashed in the libguestfs handle,
156         so the caller must make sure it remains valid for the
157         lifetime of the handle.
158         
159         Setting "qemu" to "NULL" restores the default qemu
160         binary.
161         """
162         return libguestfsmod.set_qemu (self._o, qemu)
163
164     def get_qemu (self):
165         u"""Return the current qemu binary.
166         
167         This is always non-NULL. If it wasn't set already, then
168         this will return the default qemu binary name.
169         """
170         return libguestfsmod.get_qemu (self._o)
171
172     def set_path (self, path):
173         u"""Set the path that libguestfs searches for kernel and
174         initrd.img.
175         
176         The default is "$libdir/guestfs" unless overridden by
177         setting "LIBGUESTFS_PATH" environment variable.
178         
179         The string "path" is stashed in the libguestfs handle,
180         so the caller must make sure it remains valid for the
181         lifetime of the handle.
182         
183         Setting "path" to "NULL" restores the default path.
184         """
185         return libguestfsmod.set_path (self._o, path)
186
187     def get_path (self):
188         u"""Return the current search path.
189         
190         This is always non-NULL. If it wasn't set already, then
191         this will return the default path.
192         """
193         return libguestfsmod.get_path (self._o)
194
195     def set_autosync (self, autosync):
196         u"""If "autosync" is true, this enables autosync. Libguestfs
197         will make a best effort attempt to run "g.sync" when the
198         handle is closed (also if the program exits without
199         closing handles).
200         """
201         return libguestfsmod.set_autosync (self._o, autosync)
202
203     def get_autosync (self):
204         u"""Get the autosync flag.
205         """
206         return libguestfsmod.get_autosync (self._o)
207
208     def set_verbose (self, verbose):
209         u"""If "verbose" is true, this turns on verbose messages (to
210         "stderr").
211         
212         Verbose messages are disabled unless the environment
213         variable "LIBGUESTFS_DEBUG" is defined and set to 1.
214         """
215         return libguestfsmod.set_verbose (self._o, verbose)
216
217     def get_verbose (self):
218         u"""This returns the verbose messages flag.
219         """
220         return libguestfsmod.get_verbose (self._o)
221
222     def is_ready (self):
223         u"""This returns true iff this handle is ready to accept
224         commands (in the "READY" state).
225         
226         For more information on states, see guestfs(3).
227         """
228         return libguestfsmod.is_ready (self._o)
229
230     def is_config (self):
231         u"""This returns true iff this handle is being configured
232         (in the "CONFIG" state).
233         
234         For more information on states, see guestfs(3).
235         """
236         return libguestfsmod.is_config (self._o)
237
238     def is_launching (self):
239         u"""This returns true iff this handle is launching the
240         subprocess (in the "LAUNCHING" state).
241         
242         For more information on states, see guestfs(3).
243         """
244         return libguestfsmod.is_launching (self._o)
245
246     def is_busy (self):
247         u"""This returns true iff this handle is busy processing a
248         command (in the "BUSY" state).
249         
250         For more information on states, see guestfs(3).
251         """
252         return libguestfsmod.is_busy (self._o)
253
254     def get_state (self):
255         u"""This returns the current state as an opaque integer.
256         This is only useful for printing debug and internal
257         error messages.
258         
259         For more information on states, see guestfs(3).
260         """
261         return libguestfsmod.get_state (self._o)
262
263     def set_busy (self):
264         u"""This sets the state to "BUSY". This is only used when
265         implementing actions using the low-level API.
266         
267         For more information on states, see guestfs(3).
268         """
269         return libguestfsmod.set_busy (self._o)
270
271     def set_ready (self):
272         u"""This sets the state to "READY". This is only used when
273         implementing actions using the low-level API.
274         
275         For more information on states, see guestfs(3).
276         """
277         return libguestfsmod.set_ready (self._o)
278
279     def mount (self, device, mountpoint):
280         u"""Mount a guest disk at a position in the filesystem.
281         Block devices are named "/dev/sda", "/dev/sdb" and so
282         on, as they were added to the guest. If those block
283         devices contain partitions, they will have the usual
284         names (eg. "/dev/sda1"). Also LVM "/dev/VG/LV"-style
285         names can be used.
286         
287         The rules are the same as for mount(2): A filesystem
288         must first be mounted on "/" before others can be
289         mounted. Other filesystems can only be mounted on
290         directories which already exist.
291         
292         The mounted filesystem is writable, if we have
293         sufficient permissions on the underlying device.
294         
295         The filesystem options "sync" and "noatime" are set with
296         this call, in order to improve reliability.
297         """
298         return libguestfsmod.mount (self._o, device, mountpoint)
299
300     def sync (self):
301         u"""This syncs the disk, so that any writes are flushed
302         through to the underlying disk image.
303         
304         You should always call this if you have modified a disk
305         image, before closing the handle.
306         """
307         return libguestfsmod.sync (self._o)
308
309     def touch (self, path):
310         u"""Touch acts like the touch(1) command. It can be used to
311         update the timestamps on a file, or, if the file does
312         not exist, to create a new zero-length file.
313         """
314         return libguestfsmod.touch (self._o, path)
315
316     def cat (self, path):
317         u"""Return the contents of the file named "path".
318         
319         Note that this function cannot correctly handle binary
320         files (specifically, files containing "\\0" character
321         which is treated as end of string). For those you need
322         to use the "g.download" function which has a more
323         complex interface.
324         
325         Because of the message protocol, there is a transfer
326         limit of somewhere between 2MB and 4MB. To transfer
327         large files you should use FTP.
328         """
329         return libguestfsmod.cat (self._o, path)
330
331     def ll (self, directory):
332         u"""List the files in "directory" (relative to the root
333         directory, there is no cwd) in the format of 'ls -la'.
334         
335         This command is mostly useful for interactive sessions.
336         It is *not* intended that you try to parse the output
337         string.
338         """
339         return libguestfsmod.ll (self._o, directory)
340
341     def ls (self, directory):
342         u"""List the files in "directory" (relative to the root
343         directory, there is no cwd). The '.' and '..' entries
344         are not returned, but hidden files are shown.
345         
346         This command is mostly useful for interactive sessions.
347         Programs should probably use "g.readdir" instead.
348         
349         This function returns a list of strings.
350         """
351         return libguestfsmod.ls (self._o, directory)
352
353     def list_devices (self):
354         u"""List all the block devices.
355         
356         The full block device names are returned, eg. "/dev/sda"
357         
358         This function returns a list of strings.
359         """
360         return libguestfsmod.list_devices (self._o)
361
362     def list_partitions (self):
363         u"""List all the partitions detected on all block devices.
364         
365         The full partition device names are returned, eg.
366         "/dev/sda1"
367         
368         This does not return logical volumes. For that you will
369         need to call "g.lvs".
370         
371         This function returns a list of strings.
372         """
373         return libguestfsmod.list_partitions (self._o)
374
375     def pvs (self):
376         u"""List all the physical volumes detected. This is the
377         equivalent of the pvs(8) command.
378         
379         This returns a list of just the device names that
380         contain PVs (eg. "/dev/sda2").
381         
382         See also "g.pvs_full".
383         
384         This function returns a list of strings.
385         """
386         return libguestfsmod.pvs (self._o)
387
388     def vgs (self):
389         u"""List all the volumes groups detected. This is the
390         equivalent of the vgs(8) command.
391         
392         This returns a list of just the volume group names that
393         were detected (eg. "VolGroup00").
394         
395         See also "g.vgs_full".
396         
397         This function returns a list of strings.
398         """
399         return libguestfsmod.vgs (self._o)
400
401     def lvs (self):
402         u"""List all the logical volumes detected. This is the
403         equivalent of the lvs(8) command.
404         
405         This returns a list of the logical volume device names
406         (eg. "/dev/VolGroup00/LogVol00").
407         
408         See also "g.lvs_full".
409         
410         This function returns a list of strings.
411         """
412         return libguestfsmod.lvs (self._o)
413
414     def pvs_full (self):
415         u"""List all the physical volumes detected. This is the
416         equivalent of the pvs(8) command. The "full" version
417         includes all fields.
418         
419         This function returns a list of PVs. Each PV is
420         represented as a dictionary.
421         """
422         return libguestfsmod.pvs_full (self._o)
423
424     def vgs_full (self):
425         u"""List all the volumes groups detected. This is the
426         equivalent of the vgs(8) command. The "full" version
427         includes all fields.
428         
429         This function returns a list of VGs. Each VG is
430         represented as a dictionary.
431         """
432         return libguestfsmod.vgs_full (self._o)
433
434     def lvs_full (self):
435         u"""List all the logical volumes detected. This is the
436         equivalent of the lvs(8) command. The "full" version
437         includes all fields.
438         
439         This function returns a list of LVs. Each LV is
440         represented as a dictionary.
441         """
442         return libguestfsmod.lvs_full (self._o)
443
444     def read_lines (self, path):
445         u"""Return the contents of the file named "path".
446         
447         The file contents are returned as a list of lines.
448         Trailing "LF" and "CRLF" character sequences are *not*
449         returned.
450         
451         Note that this function cannot correctly handle binary
452         files (specifically, files containing "\\0" character
453         which is treated as end of line). For those you need to
454         use the "g.read_file" function which has a more complex
455         interface.
456         
457         This function returns a list of strings.
458         """
459         return libguestfsmod.read_lines (self._o, path)
460
461     def aug_init (self, root, flags):
462         u"""Create a new Augeas handle for editing configuration
463         files. If there was any previous Augeas handle
464         associated with this guestfs session, then it is closed.
465         
466         You must call this before using any other "g.aug_*"
467         commands.
468         
469         "root" is the filesystem root. "root" must not be NULL,
470         use "/" instead.
471         
472         The flags are the same as the flags defined in
473         <augeas.h>, the logical *or* of the following integers:
474         
475         "AUG_SAVE_BACKUP" = 1
476         Keep the original file with a ".augsave" extension.
477         
478         "AUG_SAVE_NEWFILE" = 2
479         Save changes into a file with extension ".augnew",
480         and do not overwrite original. Overrides
481         "AUG_SAVE_BACKUP".
482         
483         "AUG_TYPE_CHECK" = 4
484         Typecheck lenses (can be expensive).
485         
486         "AUG_NO_STDINC" = 8
487         Do not use standard load path for modules.
488         
489         "AUG_SAVE_NOOP" = 16
490         Make save a no-op, just record what would have been
491         changed.
492         
493         "AUG_NO_LOAD" = 32
494         Do not load the tree in "g.aug_init".
495         
496         To close the handle, you can call "g.aug_close".
497         
498         To find out more about Augeas, see <http://augeas.net/>.
499         """
500         return libguestfsmod.aug_init (self._o, root, flags)
501
502     def aug_close (self):
503         u"""Close the current Augeas handle and free up any
504         resources used by it. After calling this, you have to
505         call "g.aug_init" again before you can use any other
506         Augeas functions.
507         """
508         return libguestfsmod.aug_close (self._o)
509
510     def aug_defvar (self, name, expr):
511         u"""Defines an Augeas variable "name" whose value is the
512         result of evaluating "expr". If "expr" is NULL, then
513         "name" is undefined.
514         
515         On success this returns the number of nodes in "expr",
516         or 0 if "expr" evaluates to something which is not a
517         nodeset.
518         """
519         return libguestfsmod.aug_defvar (self._o, name, expr)
520
521     def aug_defnode (self, name, expr, val):
522         u"""Defines a variable "name" whose value is the result of
523         evaluating "expr".
524         
525         If "expr" evaluates to an empty nodeset, a node is
526         created, equivalent to calling "g.aug_set" "expr",
527         "value". "name" will be the nodeset containing that
528         single node.
529         
530         On success this returns a pair containing the number of
531         nodes in the nodeset, and a boolean flag if a node was
532         created.
533         
534         This function returns a tuple (int, bool).
535         """
536         return libguestfsmod.aug_defnode (self._o, name, expr, val)
537
538     def aug_get (self, path):
539         u"""Look up the value associated with "path". If "path"
540         matches exactly one node, the "value" is returned.
541         """
542         return libguestfsmod.aug_get (self._o, path)
543
544     def aug_set (self, path, val):
545         u"""Set the value associated with "path" to "value".
546         """
547         return libguestfsmod.aug_set (self._o, path, val)
548
549     def aug_insert (self, path, label, before):
550         u"""Create a new sibling "label" for "path", inserting it
551         into the tree before or after "path" (depending on the
552         boolean flag "before").
553         
554         "path" must match exactly one existing node in the tree,
555         and "label" must be a label, ie. not contain "/", "*" or
556         end with a bracketed index "[N]".
557         """
558         return libguestfsmod.aug_insert (self._o, path, label, before)
559
560     def aug_rm (self, path):
561         u"""Remove "path" and all of its children.
562         
563         On success this returns the number of entries which were
564         removed.
565         """
566         return libguestfsmod.aug_rm (self._o, path)
567
568     def aug_mv (self, src, dest):
569         u"""Move the node "src" to "dest". "src" must match exactly
570         one node. "dest" is overwritten if it exists.
571         """
572         return libguestfsmod.aug_mv (self._o, src, dest)
573
574     def aug_match (self, path):
575         u"""Returns a list of paths which match the path expression
576         "path". The returned paths are sufficiently qualified so
577         that they match exactly one node in the current tree.
578         
579         This function returns a list of strings.
580         """
581         return libguestfsmod.aug_match (self._o, path)
582
583     def aug_save (self):
584         u"""This writes all pending changes to disk.
585         
586         The flags which were passed to "g.aug_init" affect
587         exactly how files are saved.
588         """
589         return libguestfsmod.aug_save (self._o)
590
591     def aug_load (self):
592         u"""Load files into the tree.
593         
594         See "aug_load" in the Augeas documentation for the full
595         gory details.
596         """
597         return libguestfsmod.aug_load (self._o)
598
599     def aug_ls (self, path):
600         u"""This is just a shortcut for listing "g.aug_match"
601         "path/*" and sorting the resulting nodes into
602         alphabetical order.
603         
604         This function returns a list of strings.
605         """
606         return libguestfsmod.aug_ls (self._o, path)
607
608     def rm (self, path):
609         u"""Remove the single file "path".
610         """
611         return libguestfsmod.rm (self._o, path)
612
613     def rmdir (self, path):
614         u"""Remove the single directory "path".
615         """
616         return libguestfsmod.rmdir (self._o, path)
617
618     def rm_rf (self, path):
619         u"""Remove the file or directory "path", recursively
620         removing the contents if its a directory. This is like
621         the "rm -rf" shell command.
622         """
623         return libguestfsmod.rm_rf (self._o, path)
624
625     def mkdir (self, path):
626         u"""Create a directory named "path".
627         """
628         return libguestfsmod.mkdir (self._o, path)
629
630     def mkdir_p (self, path):
631         u"""Create a directory named "path", creating any parent
632         directories as necessary. This is like the "mkdir -p"
633         shell command.
634         """
635         return libguestfsmod.mkdir_p (self._o, path)
636
637     def chmod (self, mode, path):
638         u"""Change the mode (permissions) of "path" to "mode". Only
639         numeric modes are supported.
640         """
641         return libguestfsmod.chmod (self._o, mode, path)
642
643     def chown (self, owner, group, path):
644         u"""Change the file owner to "owner" and group to "group".
645         
646         Only numeric uid and gid are supported. If you want to
647         use names, you will need to locate and parse the
648         password file yourself (Augeas support makes this
649         relatively easy).
650         """
651         return libguestfsmod.chown (self._o, owner, group, path)
652
653     def exists (self, path):
654         u"""This returns "true" if and only if there is a file,
655         directory (or anything) with the given "path" name.
656         
657         See also "g.is_file", "g.is_dir", "g.stat".
658         """
659         return libguestfsmod.exists (self._o, path)
660
661     def is_file (self, path):
662         u"""This returns "true" if and only if there is a file with
663         the given "path" name. Note that it returns false for
664         other objects like directories.
665         
666         See also "g.stat".
667         """
668         return libguestfsmod.is_file (self._o, path)
669
670     def is_dir (self, path):
671         u"""This returns "true" if and only if there is a directory
672         with the given "path" name. Note that it returns false
673         for other objects like files.
674         
675         See also "g.stat".
676         """
677         return libguestfsmod.is_dir (self._o, path)
678
679     def pvcreate (self, device):
680         u"""This creates an LVM physical volume on the named
681         "device", where "device" should usually be a partition
682         name such as "/dev/sda1".
683         """
684         return libguestfsmod.pvcreate (self._o, device)
685
686     def vgcreate (self, volgroup, physvols):
687         u"""This creates an LVM volume group called "volgroup" from
688         the non-empty list of physical volumes "physvols".
689         """
690         return libguestfsmod.vgcreate (self._o, volgroup, physvols)
691
692     def lvcreate (self, logvol, volgroup, mbytes):
693         u"""This creates an LVM volume group called "logvol" on the
694         volume group "volgroup", with "size" megabytes.
695         """
696         return libguestfsmod.lvcreate (self._o, logvol, volgroup, mbytes)
697
698     def mkfs (self, fstype, device):
699         u"""This creates a filesystem on "device" (usually a
700         partition of LVM logical volume). The filesystem type is
701         "fstype", for example "ext3".
702         """
703         return libguestfsmod.mkfs (self._o, fstype, device)
704
705     def sfdisk (self, device, cyls, heads, sectors, lines):
706         u"""This is a direct interface to the sfdisk(8) program for
707         creating partitions on block devices.
708         
709         "device" should be a block device, for example
710         "/dev/sda".
711         
712         "cyls", "heads" and "sectors" are the number of
713         cylinders, heads and sectors on the device, which are
714         passed directly to sfdisk as the *-C*, *-H* and *-S*
715         parameters. If you pass 0 for any of these, then the
716         corresponding parameter is omitted. Usually for 'large'
717         disks, you can just pass 0 for these, but for small
718         (floppy-sized) disks, sfdisk (or rather, the kernel)
719         cannot work out the right geometry and you will need to
720         tell it.
721         
722         "lines" is a list of lines that we feed to "sfdisk". For
723         more information refer to the sfdisk(8) manpage.
724         
725         To create a single partition occupying the whole disk,
726         you would pass "lines" as a single element list, when
727         the single element being the string "," (comma).
728         
729         This command is dangerous. Without careful use you can
730         easily destroy all your data.
731         """
732         return libguestfsmod.sfdisk (self._o, device, cyls, heads, sectors, lines)
733
734     def write_file (self, path, content, size):
735         u"""This call creates a file called "path". The contents of
736         the file is the string "content" (which can contain any
737         8 bit data), with length "size".
738         
739         As a special case, if "size" is 0 then the length is
740         calculated using "strlen" (so in this case the content
741         cannot contain embedded ASCII NULs).
742         
743         Because of the message protocol, there is a transfer
744         limit of somewhere between 2MB and 4MB. To transfer
745         large files you should use FTP.
746         """
747         return libguestfsmod.write_file (self._o, path, content, size)
748
749     def umount (self, pathordevice):
750         u"""This unmounts the given filesystem. The filesystem may
751         be specified either by its mountpoint (path) or the
752         device which contains the filesystem.
753         """
754         return libguestfsmod.umount (self._o, pathordevice)
755
756     def mounts (self):
757         u"""This returns the list of currently mounted filesystems.
758         It returns the list of devices (eg. "/dev/sda1",
759         "/dev/VG/LV").
760         
761         Some internal mounts are not shown.
762         
763         This function returns a list of strings.
764         """
765         return libguestfsmod.mounts (self._o)
766
767     def umount_all (self):
768         u"""This unmounts all mounted filesystems.
769         
770         Some internal mounts are not unmounted by this call.
771         """
772         return libguestfsmod.umount_all (self._o)
773
774     def lvm_remove_all (self):
775         u"""This command removes all LVM logical volumes, volume
776         groups and physical volumes.
777         
778         This command is dangerous. Without careful use you can
779         easily destroy all your data.
780         """
781         return libguestfsmod.lvm_remove_all (self._o)
782
783     def file (self, path):
784         u"""This call uses the standard file(1) command to determine
785         the type or contents of the file. This also works on
786         devices, for example to find out whether a partition
787         contains a filesystem.
788         
789         The exact command which runs is "file -bsL path". Note
790         in particular that the filename is not prepended to the
791         output (the "-b" option).
792         """
793         return libguestfsmod.file (self._o, path)
794
795     def command (self, arguments):
796         u"""This call runs a command from the guest filesystem. The
797         filesystem must be mounted, and must contain a
798         compatible operating system (ie. something Linux, with
799         the same or compatible processor architecture).
800         
801         The single parameter is an argv-style list of arguments.
802         The first element is the name of the program to run.
803         Subsequent elements are parameters. The list must be
804         non-empty (ie. must contain a program name).
805         
806         The $PATH environment variable will contain at least
807         "/usr/bin" and "/bin". If you require a program from
808         another location, you should provide the full path in
809         the first parameter.
810         
811         Shared libraries and data files required by the program
812         must be available on filesystems which are mounted in
813         the correct places. It is the caller's responsibility to
814         ensure all filesystems that are needed are mounted at
815         the right locations.
816         """
817         return libguestfsmod.command (self._o, arguments)
818
819     def command_lines (self, arguments):
820         u"""This is the same as "g.command", but splits the result
821         into a list of lines.
822         
823         This function returns a list of strings.
824         """
825         return libguestfsmod.command_lines (self._o, arguments)
826
827     def stat (self, path):
828         u"""Returns file information for the given "path".
829         
830         This is the same as the stat(2) system call.
831         
832         This function returns a dictionary, with keys matching
833         the various fields in the stat structure.
834         """
835         return libguestfsmod.stat (self._o, path)
836
837     def lstat (self, path):
838         u"""Returns file information for the given "path".
839         
840         This is the same as "g.stat" except that if "path" is a
841         symbolic link, then the link is stat-ed, not the file it
842         refers to.
843         
844         This is the same as the lstat(2) system call.
845         
846         This function returns a dictionary, with keys matching
847         the various fields in the stat structure.
848         """
849         return libguestfsmod.lstat (self._o, path)
850
851     def statvfs (self, path):
852         u"""Returns file system statistics for any mounted file
853         system. "path" should be a file or directory in the
854         mounted file system (typically it is the mount point
855         itself, but it doesn't need to be).
856         
857         This is the same as the statvfs(2) system call.
858         
859         This function returns a dictionary, with keys matching
860         the various fields in the statvfs structure.
861         """
862         return libguestfsmod.statvfs (self._o, path)
863
864     def tune2fs_l (self, device):
865         u"""This returns the contents of the ext2 or ext3 filesystem
866         superblock on "device".
867         
868         It is the same as running "tune2fs -l device". See
869         tune2fs(8) manpage for more details. The list of fields
870         returned isn't clearly defined, and depends on both the
871         version of "tune2fs" that libguestfs was built against,
872         and the filesystem itself.
873         
874         This function returns a dictionary.
875         """
876         return libguestfsmod.tune2fs_l (self._o, device)
877
878     def blockdev_setro (self, device):
879         u"""Sets the block device named "device" to read-only.
880         
881         This uses the blockdev(8) command.
882         """
883         return libguestfsmod.blockdev_setro (self._o, device)
884
885     def blockdev_setrw (self, device):
886         u"""Sets the block device named "device" to read-write.
887         
888         This uses the blockdev(8) command.
889         """
890         return libguestfsmod.blockdev_setrw (self._o, device)
891
892     def blockdev_getro (self, device):
893         u"""Returns a boolean indicating if the block device is
894         read-only (true if read-only, false if not).
895         
896         This uses the blockdev(8) command.
897         """
898         return libguestfsmod.blockdev_getro (self._o, device)
899
900     def blockdev_getss (self, device):
901         u"""This returns the size of sectors on a block device.
902         Usually 512, but can be larger for modern devices.
903         
904         (Note, this is not the size in sectors, use
905         "g.blockdev_getsz" for that).
906         
907         This uses the blockdev(8) command.
908         """
909         return libguestfsmod.blockdev_getss (self._o, device)
910
911     def blockdev_getbsz (self, device):
912         u"""This returns the block size of a device.
913         
914         (Note this is different from both *size in blocks* and
915         *filesystem block size*).
916         
917         This uses the blockdev(8) command.
918         """
919         return libguestfsmod.blockdev_getbsz (self._o, device)
920
921     def blockdev_setbsz (self, device, blocksize):
922         u"""This sets the block size of a device.
923         
924         (Note this is different from both *size in blocks* and
925         *filesystem block size*).
926         
927         This uses the blockdev(8) command.
928         """
929         return libguestfsmod.blockdev_setbsz (self._o, device, blocksize)
930
931     def blockdev_getsz (self, device):
932         u"""This returns the size of the device in units of 512-byte
933         sectors (even if the sectorsize isn't 512 bytes ...
934         weird).
935         
936         See also "g.blockdev_getss" for the real sector size of
937         the device, and "g.blockdev_getsize64" for the more
938         useful *size in bytes*.
939         
940         This uses the blockdev(8) command.
941         """
942         return libguestfsmod.blockdev_getsz (self._o, device)
943
944     def blockdev_getsize64 (self, device):
945         u"""This returns the size of the device in bytes.
946         
947         See also "g.blockdev_getsz".
948         
949         This uses the blockdev(8) command.
950         """
951         return libguestfsmod.blockdev_getsize64 (self._o, device)
952
953     def blockdev_flushbufs (self, device):
954         u"""This tells the kernel to flush internal buffers
955         associated with "device".
956         
957         This uses the blockdev(8) command.
958         """
959         return libguestfsmod.blockdev_flushbufs (self._o, device)
960
961     def blockdev_rereadpt (self, device):
962         u"""Reread the partition table on "device".
963         
964         This uses the blockdev(8) command.
965         """
966         return libguestfsmod.blockdev_rereadpt (self._o, device)
967
968     def upload (self, filename, remotefilename):
969         u"""Upload local file "filename" to "remotefilename" on the
970         filesystem.
971         
972         "filename" can also be a named pipe.
973         
974         See also "g.download".
975         """
976         return libguestfsmod.upload (self._o, filename, remotefilename)
977
978     def download (self, remotefilename, filename):
979         u"""Download file "remotefilename" and save it as "filename"
980         on the local machine.
981         
982         "filename" can also be a named pipe.
983         
984         See also "g.upload", "g.cat".
985         """
986         return libguestfsmod.download (self._o, remotefilename, filename)
987
988     def checksum (self, csumtype, path):
989         u"""This call computes the MD5, SHAx or CRC checksum of the
990         file named "path".
991         
992         The type of checksum to compute is given by the
993         "csumtype" parameter which must have one of the
994         following values:
995         
996         "crc"
997         Compute the cyclic redundancy check (CRC) specified
998         by POSIX for the "cksum" command.
999         
1000         "md5"
1001         Compute the MD5 hash (using the "md5sum" program).
1002         
1003         "sha1"
1004         Compute the SHA1 hash (using the "sha1sum" program).
1005         
1006         "sha224"
1007         Compute the SHA224 hash (using the "sha224sum"
1008         program).
1009         
1010         "sha256"
1011         Compute the SHA256 hash (using the "sha256sum"
1012         program).
1013         
1014         "sha384"
1015         Compute the SHA384 hash (using the "sha384sum"
1016         program).
1017         
1018         "sha512"
1019         Compute the SHA512 hash (using the "sha512sum"
1020         program).
1021         
1022         The checksum is returned as a printable string.
1023         """
1024         return libguestfsmod.checksum (self._o, csumtype, path)
1025
1026     def tar_in (self, tarfile, directory):
1027         u"""This command uploads and unpacks local file "tarfile"
1028         (an *uncompressed* tar file) into "directory".
1029         
1030         To upload a compressed tarball, use "g.tgz_in".
1031         """
1032         return libguestfsmod.tar_in (self._o, tarfile, directory)
1033
1034     def tar_out (self, directory, tarfile):
1035         u"""This command packs the contents of "directory" and
1036         downloads it to local file "tarfile".
1037         
1038         To download a compressed tarball, use "g.tgz_out".
1039         """
1040         return libguestfsmod.tar_out (self._o, directory, tarfile)
1041
1042     def tgz_in (self, tarball, directory):
1043         u"""This command uploads and unpacks local file "tarball" (a
1044         *gzip compressed* tar file) into "directory".
1045         
1046         To upload an uncompressed tarball, use "g.tar_in".
1047         """
1048         return libguestfsmod.tgz_in (self._o, tarball, directory)
1049
1050     def tgz_out (self, directory, tarball):
1051         u"""This command packs the contents of "directory" and
1052         downloads it to local file "tarball".
1053         
1054         To download an uncompressed tarball, use "g.tar_out".
1055         """
1056         return libguestfsmod.tgz_out (self._o, directory, tarball)
1057
1058     def mount_ro (self, device, mountpoint):
1059         u"""This is the same as the "g.mount" command, but it mounts
1060         the filesystem with the read-only (*-o ro*) flag.
1061         """
1062         return libguestfsmod.mount_ro (self._o, device, mountpoint)
1063
1064     def mount_options (self, options, device, mountpoint):
1065         u"""This is the same as the "g.mount" command, but it allows
1066         you to set the mount options as for the mount(8) *-o*
1067         flag.
1068         """
1069         return libguestfsmod.mount_options (self._o, options, device, mountpoint)
1070
1071     def mount_vfs (self, options, vfstype, device, mountpoint):
1072         u"""This is the same as the "g.mount" command, but it allows
1073         you to set both the mount options and the vfstype as for
1074         the mount(8) *-o* and *-t* flags.
1075         """
1076         return libguestfsmod.mount_vfs (self._o, options, vfstype, device, mountpoint)
1077
1078     def debug (self, subcmd, extraargs):
1079         u"""The "g.debug" command exposes some internals of
1080         "guestfsd" (the guestfs daemon) that runs inside the
1081         qemu subprocess.
1082         
1083         There is no comprehensive help for this command. You
1084         have to look at the file "daemon/debug.c" in the
1085         libguestfs source to find out what you can do.
1086         """
1087         return libguestfsmod.debug (self._o, subcmd, extraargs)
1088