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