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