1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Red Hat Inc.
3 # This file is distributed under the same license as the libguestfs package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: libguestfs 1.5.7\n"
10 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
11 "POT-Creation-Date: 2010-09-02 20:33+0200\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=utf-8\n"
17 "Content-Transfer-Encoding: ENCODING"
20 #: ../src/guestfs.pod:1 ../fish/guestfish.pod:1 ../test-tool/libguestfs-test-tool.pod:1 ../fuse/guestmount.pod:1 ../inspector/virt-inspector.pl:36 ../tools/virt-cat.pl:30 ../tools/virt-df.pl:32 ../tools/virt-edit.pl:31 ../tools/virt-list-filesystems.pl:28 ../tools/virt-list-partitions.pl:28 ../tools/virt-ls.pl:31 ../tools/virt-make-fs.pl:33 ../tools/virt-rescue.pl:29 ../tools/virt-resize.pl:38 ../tools/virt-tar.pl:30 ../tools/virt-win-reg.pl:34
25 #: ../src/guestfs.pod:3 ../fish/guestfish.pod:3 ../test-tool/libguestfs-test-tool.pod:3 ../fuse/guestmount.pod:3 ../inspector/virt-inspector.pl:38 ../tools/virt-cat.pl:32 ../tools/virt-df.pl:34 ../tools/virt-edit.pl:33 ../tools/virt-list-filesystems.pl:30 ../tools/virt-list-partitions.pl:30 ../tools/virt-ls.pl:33 ../tools/virt-make-fs.pl:35 ../tools/virt-rescue.pl:31 ../tools/virt-resize.pl:40 ../tools/virt-tar.pl:32 ../tools/virt-win-reg.pl:36
30 #: ../src/guestfs.pod:5
31 msgid "guestfs - Library for accessing and modifying virtual machine images"
35 #: ../src/guestfs.pod:7 ../fish/guestfish.pod:7 ../test-tool/libguestfs-test-tool.pod:7 ../fuse/guestmount.pod:7 ../inspector/virt-inspector.pl:42 ../tools/virt-cat.pl:36 ../tools/virt-df.pl:38 ../tools/virt-edit.pl:37 ../tools/virt-list-filesystems.pl:34 ../tools/virt-list-partitions.pl:34 ../tools/virt-ls.pl:37 ../tools/virt-make-fs.pl:39 ../tools/virt-rescue.pl:35 ../tools/virt-resize.pl:44 ../tools/virt-tar.pl:36 ../tools/virt-win-reg.pl:40
40 #: ../src/guestfs.pod:9
43 " #include <guestfs.h>\n"
48 #: ../src/guestfs.pod:11
51 " guestfs_h *g = guestfs_create ();\n"
52 " guestfs_add_drive (g, \"guest.img\");\n"
53 " guestfs_launch (g);\n"
54 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
55 " guestfs_touch (g, \"/hello\");\n"
56 " guestfs_umount (g, \"/\");\n"
57 " guestfs_sync (g);\n"
58 " guestfs_close (g);\n"
63 #: ../src/guestfs.pod:20
66 " cc prog.c -o prog -lguestfs\n"
68 " cc prog.c -o prog `pkg-config libguestfs --cflags --libs`\n"
73 #: ../src/guestfs.pod:24 ../fish/guestfish.pod:115 ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:16 ../inspector/virt-inspector.pl:48 ../tools/virt-cat.pl:42 ../tools/virt-df.pl:46 ../tools/virt-edit.pl:51 ../tools/virt-list-filesystems.pl:40 ../tools/virt-list-partitions.pl:40 ../tools/virt-ls.pl:43 ../tools/virt-make-fs.pl:47 ../tools/virt-rescue.pl:51 ../tools/virt-resize.pl:50 ../tools/virt-tar.pl:73 ../tools/virt-win-reg.pl:64
78 #: ../src/guestfs.pod:26
80 "Libguestfs is a library for accessing and modifying guest disk images. "
81 "Amongst the things this is good for: making batch configuration changes to "
82 "guests, getting disk used/free statistics (see also: virt-df), migrating "
83 "between virtualization systems (see also: virt-p2v), performing partial "
84 "backups, performing partial guest clones, cloning guests and changing "
85 "registry/UUID/hostname info, and much else besides."
89 #: ../src/guestfs.pod:34
91 "Libguestfs uses Linux kernel and qemu code, and can access any type of guest "
92 "filesystem that Linux and qemu can, including but not limited to: ext2/3/4, "
93 "btrfs, FAT and NTFS, LVM, many different disk partition schemes, qcow, "
98 #: ../src/guestfs.pod:39
100 "Libguestfs provides ways to enumerate guest storage (eg. partitions, LVs, "
101 "what filesystem is in each LV, etc.). It can also run commands in the "
102 "context of the guest. Also you can access filesystems over FUSE."
106 #: ../src/guestfs.pod:44
108 "Libguestfs is a library that can be linked with C and C++ management "
109 "programs (or management programs written in OCaml, Perl, Python, Ruby, Java, "
110 "Haskell or C#). You can also use it from shell scripts or the command line."
114 #: ../src/guestfs.pod:49
116 "You don't need to be root to use libguestfs, although obviously you do need "
117 "enough permissions to access the disk images."
121 #: ../src/guestfs.pod:52
123 "Libguestfs is a large API because it can do many things. For a gentle "
124 "introduction, please read the L</API OVERVIEW> section next."
128 #: ../src/guestfs.pod:55
133 #: ../src/guestfs.pod:57
135 "This section provides a gentler overview of the libguestfs API. We also try "
136 "to group API calls together, where that may not be obvious from reading "
137 "about the individual calls in the main section of this manual."
141 #: ../src/guestfs.pod:62
146 #: ../src/guestfs.pod:64
148 "Before you can use libguestfs calls, you have to create a handle. Then you "
149 "must add at least one disk image to the handle, followed by launching the "
150 "handle, then performing whatever operations you want, and finally closing "
151 "the handle. By convention we use the single letter C<g> for the name of the "
152 "handle variable, although of course you can use any name you want."
156 #: ../src/guestfs.pod:71
157 msgid "The general structure of all libguestfs-using programs looks like this:"
161 #: ../src/guestfs.pod:74
164 " guestfs_h *g = guestfs_create ();\n"
169 #: ../src/guestfs.pod:76
172 " /* Call guestfs_add_drive additional times if there are\n"
173 " * multiple disk images.\n"
175 " guestfs_add_drive (g, \"guest.img\");\n"
180 #: ../src/guestfs.pod:81
183 " /* Most manipulation calls won't work until you've launched\n"
184 " * the handle 'g'. You have to do this _after_ adding drives\n"
185 " * and _before_ other commands.\n"
187 " guestfs_launch (g);\n"
192 #: ../src/guestfs.pod:87
195 " /* Now you can examine what partitions, LVs etc are available.\n"
197 " char **partitions = guestfs_list_partitions (g);\n"
198 " char **logvols = guestfs_lvs (g);\n"
203 #: ../src/guestfs.pod:92
206 " /* To access a filesystem in the image, you must mount it.\n"
208 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
213 #: ../src/guestfs.pod:96
216 " /* Now you can perform filesystem actions on the guest\n"
219 " guestfs_touch (g, \"/hello\");\n"
224 #: ../src/guestfs.pod:101
227 " /* You only need to call guestfs_sync if you have made\n"
228 " * changes to the guest image. (But if you've made changes\n"
229 " * then you *must* sync). See also: guestfs_umount and\n"
230 " * guestfs_umount_all calls.\n"
232 " guestfs_sync (g);\n"
237 #: ../src/guestfs.pod:108
240 " /* Close the handle 'g'. */\n"
241 " guestfs_close (g);\n"
246 #: ../src/guestfs.pod:111
248 "The code above doesn't include any error checking. In real code you should "
249 "check return values carefully for errors. In general all functions that "
250 "return integers return C<-1> on error, and all functions that return "
251 "pointers return C<NULL> on error. See section L</ERROR HANDLING> below for "
252 "how to handle errors, and consult the documentation for each function call "
253 "below to see precisely how they return error indications."
257 #: ../src/guestfs.pod:119
262 #: ../src/guestfs.pod:121
264 "The image filename (C<\"guest.img\"> in the example above) could be a disk "
265 "image from a virtual machine, a L<dd(1)> copy of a physical hard disk, an "
266 "actual block device, or simply an empty file of zeroes that you have created "
267 "through L<posix_fallocate(3)>. Libguestfs lets you do useful things to all "
272 #: ../src/guestfs.pod:127
274 "You can add a disk read-only using L</guestfs_add_drive_ro>, in which case "
275 "libguestfs won't modify the file."
279 #: ../src/guestfs.pod:130
281 "Be extremely cautious if the disk image is in use, eg. if it is being used "
282 "by a virtual machine. Adding it read-write will almost certainly cause disk "
283 "corruption, but adding it read-only is safe."
287 #: ../src/guestfs.pod:134
289 "You must add at least one disk image, and you may add multiple disk images. "
290 "In the API, the disk images are usually referred to as C</dev/sda> (for the "
291 "first one you added), C</dev/sdb> (for the second one you added), etc."
295 #: ../src/guestfs.pod:139
297 "Once L</guestfs_launch> has been called you cannot add any more images. You "
298 "can call L</guestfs_list_devices> to get a list of the device names, in the "
299 "order that you added them. See also L</BLOCK DEVICE NAMING> below."
303 #: ../src/guestfs.pod:144
308 #: ../src/guestfs.pod:146
310 "Before you can read or write files, create directories and so on in a disk "
311 "image that contains filesystems, you have to mount those filesystems using "
312 "L</guestfs_mount>. If you already know that a disk image contains (for "
313 "example) one partition with a filesystem on that partition, then you can "
318 #: ../src/guestfs.pod:152
321 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
326 #: ../src/guestfs.pod:154
328 "where C</dev/sda1> means literally the first partition (C<1>) of the first "
329 "disk image that we added (C</dev/sda>). If the disk contains Linux LVM2 "
330 "logical volumes you could refer to those instead (eg. C</dev/VG/LV>)."
334 #: ../src/guestfs.pod:158
336 "If you are given a disk image and you don't know what it contains then you "
337 "have to find out. Libguestfs can do that too: use "
338 "L</guestfs_list_partitions> and L</guestfs_lvs> to list possible partitions "
339 "and LVs, and either try mounting each to see what is mountable, or else "
340 "examine them with L</guestfs_vfs_type> or L</guestfs_file>. Libguestfs also "
341 "has a set of APIs for inspection of disk images (see L</INSPECTION> below). "
342 "But you might find it easier to look at higher level programs built on top "
343 "of libguestfs, in particular L<virt-inspector(1)>."
347 #: ../src/guestfs.pod:168
349 "To mount a disk image read-only, use L</guestfs_mount_ro>. There are "
350 "several other variations of the C<guestfs_mount_*> call."
354 #: ../src/guestfs.pod:171
355 msgid "FILESYSTEM ACCESS AND MODIFICATION"
359 #: ../src/guestfs.pod:173
361 "The majority of the libguestfs API consists of fairly low-level calls for "
362 "accessing and modifying the files, directories, symlinks etc on mounted "
363 "filesystems. There are over a hundred such calls which you can find listed "
364 "in detail below in this man page, and we don't even pretend to cover them "
365 "all in this overview."
369 #: ../src/guestfs.pod:179
371 "Specify filenames as full paths, starting with C<\"/\"> and including the "
376 #: ../src/guestfs.pod:182
378 "For example, if you mounted a filesystem at C<\"/\"> and you want to read "
379 "the file called C<\"etc/passwd\"> then you could do:"
383 #: ../src/guestfs.pod:185
386 " char *data = guestfs_cat (g, \"/etc/passwd\");\n"
391 #: ../src/guestfs.pod:187
393 "This would return C<data> as a newly allocated buffer containing the full "
394 "content of that file (with some conditions: see also L</DOWNLOADING> below), "
395 "or C<NULL> if there was an error."
399 #: ../src/guestfs.pod:191
401 "As another example, to create a top-level directory on that filesystem "
402 "called C<\"var\"> you would do:"
406 #: ../src/guestfs.pod:194
409 " guestfs_mkdir (g, \"/var\");\n"
414 #: ../src/guestfs.pod:196
415 msgid "To create a symlink you could do:"
419 #: ../src/guestfs.pod:198
422 " guestfs_ln_s (g, \"/etc/init.d/portmap\",\n"
423 " \"/etc/rc3.d/S30portmap\");\n"
428 #: ../src/guestfs.pod:201
430 "Libguestfs will reject attempts to use relative paths and there is no "
431 "concept of a current working directory."
435 #: ../src/guestfs.pod:204
437 "Libguestfs can return errors in many situations: for example if the "
438 "filesystem isn't writable, or if a file or directory that you requested "
439 "doesn't exist. If you are using the C API (documented here) you have to "
440 "check for those error conditions after each call. (Other language bindings "
441 "turn these errors into exceptions)."
445 #: ../src/guestfs.pod:210
447 "File writes are affected by the per-handle umask, set by calling "
448 "L</guestfs_umask> and defaulting to 022. See L</UMASK>."
452 #: ../src/guestfs.pod:213
457 #: ../src/guestfs.pod:215
459 "Libguestfs contains API calls to read, create and modify partition tables on "
464 #: ../src/guestfs.pod:218
466 "In the common case where you want to create a single partition covering the "
467 "whole disk, you should use the L</guestfs_part_disk> call:"
471 #: ../src/guestfs.pod:222
474 " const char *parttype = \"mbr\";\n"
475 " if (disk_is_larger_than_2TB)\n"
476 " parttype = \"gpt\";\n"
477 " guestfs_part_disk (g, \"/dev/sda\", parttype);\n"
482 #: ../src/guestfs.pod:227
484 "Obviously this effectively wipes anything that was on that disk image "
489 #: ../src/guestfs.pod:230
494 #: ../src/guestfs.pod:232
496 "Libguestfs provides access to a large part of the LVM2 API, such as "
497 "L</guestfs_lvcreate> and L</guestfs_vgremove>. It won't make much sense "
498 "unless you familiarize yourself with the concepts of physical volumes, "
499 "volume groups and logical volumes."
503 #: ../src/guestfs.pod:237
505 "This author strongly recommends reading the LVM HOWTO, online at "
506 "L<http://tldp.org/HOWTO/LVM-HOWTO/>."
510 #: ../src/guestfs.pod:240
515 #: ../src/guestfs.pod:242
517 "Use L</guestfs_cat> to download small, text only files. This call is "
518 "limited to files which are less than 2 MB and which cannot contain any ASCII "
519 "NUL (C<\\0>) characters. However it has a very simple to use API."
523 #: ../src/guestfs.pod:247
525 "L</guestfs_read_file> can be used to read files which contain arbitrary 8 "
526 "bit data, since it returns a (pointer, size) pair. However it is still "
527 "limited to \"small\" files, less than 2 MB."
531 #: ../src/guestfs.pod:251
533 "L</guestfs_download> can be used to download any file, with no limits on "
534 "content or size (even files larger than 4 GB)."
538 #: ../src/guestfs.pod:254
539 msgid "To download multiple files, see L</guestfs_tar_out> and L</guestfs_tgz_out>."
543 #: ../src/guestfs.pod:257
548 #: ../src/guestfs.pod:259
550 "It's often the case that you want to write a file or files to the disk "
555 #: ../src/guestfs.pod:262
557 "To write a small file with fixed content, use L</guestfs_write>. To create "
558 "a file of all zeroes, use L</guestfs_truncate_size> (sparse) or "
559 "L</guestfs_fallocate64> (with all disk blocks allocated). There are a "
560 "variety of other functions for creating test files, for example "
561 "L</guestfs_fill> and L</guestfs_fill_pattern>."
565 #: ../src/guestfs.pod:268
567 "To upload a single file, use L</guestfs_upload>. This call has no limits on "
568 "file content or size (even files larger than 4 GB)."
572 #: ../src/guestfs.pod:271
573 msgid "To upload multiple files, see L</guestfs_tar_in> and L</guestfs_tgz_in>."
577 #: ../src/guestfs.pod:273
579 "However the fastest way to upload I<large numbers of arbitrary files> is to "
580 "turn them into a squashfs or CD ISO (see L<mksquashfs(8)> and "
581 "L<mkisofs(8)>), then attach this using L</guestfs_add_drive_ro>. If you add "
582 "the drive in a predictable way (eg. adding it last after all other drives) "
583 "then you can get the device name from L</guestfs_list_devices> and mount it "
584 "directly using L</guestfs_mount_ro>. Note that squashfs images are "
585 "sometimes non-portable between kernel versions, and they don't support "
586 "labels or UUIDs. If you want to pre-build an image or you need to mount it "
587 "using a label or UUID, use an ISO image instead."
591 #: ../src/guestfs.pod:284
596 #: ../src/guestfs.pod:286
598 "There are various different commands for copying between files and devices "
599 "and in and out of the guest filesystem. These are summarised in the table "
604 #: ../src/guestfs.pod:292
605 msgid "B<file> to B<file>"
609 #: ../src/guestfs.pod:294
611 "Use L</guestfs_cp> to copy a single file, or L</guestfs_cp_a> to copy "
612 "directories recursively."
616 #: ../src/guestfs.pod:297
617 msgid "B<file or device> to B<file or device>"
621 #: ../src/guestfs.pod:299
623 "Use L</guestfs_dd> which efficiently uses L<dd(1)> to copy between files and "
624 "devices in the guest."
628 #: ../src/guestfs.pod:302
629 msgid "Example: duplicate the contents of an LV:"
633 #: ../src/guestfs.pod:304
636 " guestfs_dd (g, \"/dev/VG/Original\", \"/dev/VG/Copy\");\n"
641 #: ../src/guestfs.pod:306
643 "The destination (C</dev/VG/Copy>) must be at least as large as the source "
644 "(C</dev/VG/Original>). To copy less than the whole source device, use "
645 "L</guestfs_copy_size>."
649 #: ../src/guestfs.pod:310
650 msgid "B<file on the host> to B<file or device>"
654 #: ../src/guestfs.pod:312
655 msgid "Use L</guestfs_upload>. See L</UPLOADING> above."
659 #: ../src/guestfs.pod:314
660 msgid "B<file or device> to B<file on the host>"
664 #: ../src/guestfs.pod:316
665 msgid "Use L</guestfs_download>. See L</DOWNLOADING> above."
669 #: ../src/guestfs.pod:320
670 msgid "LISTING FILES"
674 #: ../src/guestfs.pod:322
676 "L</guestfs_ll> is just designed for humans to read (mainly when using the "
677 "L<guestfish(1)>-equivalent command C<ll>)."
681 #: ../src/guestfs.pod:325
683 "L</guestfs_ls> is a quick way to get a list of files in a directory from "
684 "programs, as a flat list of strings."
688 #: ../src/guestfs.pod:328
690 "L</guestfs_readdir> is a programmatic way to get a list of files in a "
691 "directory, plus additional information about each one. It is more "
692 "equivalent to using the L<readdir(3)> call on a local filesystem."
696 #: ../src/guestfs.pod:332
698 "L</guestfs_find> and L</guestfs_find0> can be used to recursively list "
703 #: ../src/guestfs.pod:335
704 msgid "RUNNING COMMANDS"
708 #: ../src/guestfs.pod:337
710 "Although libguestfs is a primarily an API for manipulating files inside "
711 "guest images, we also provide some limited facilities for running commands "
716 #: ../src/guestfs.pod:341
717 msgid "There are many limitations to this:"
721 #: ../src/guestfs.pod:345 ../src/guestfs.pod:350 ../src/guestfs.pod:355 ../src/guestfs.pod:359 ../src/guestfs.pod:364 ../src/guestfs.pod:368 ../src/guestfs.pod:373 ../src/guestfs.pod:1214 ../src/guestfs.pod:1219 ../src/guestfs.pod:1223 ../src/guestfs.pod:1325 ../src/guestfs.pod:1329 ../src/guestfs.pod:1333 ../src/guestfs.pod:1338 ../src/guestfs.pod:1346 ../src/guestfs.pod:1365 ../src/guestfs.pod:1373 ../src/guestfs.pod:1587 ../src/guestfs.pod:1593 ../src/guestfs.pod:1598 ../src/guestfs.pod:1604 ../src/guestfs.pod:1711 ../src/guestfs.pod:1715 ../src/guestfs.pod:1719 ../src/guestfs.pod:1723 ../src/guestfs-actions.pod:14 ../src/guestfs-actions.pod:21 ../src/guestfs-actions.pod:372 ../src/guestfs-actions.pod:380 ../src/guestfs-actions.pod:387 ../src/guestfs-actions.pod:394 ../src/guestfs-actions.pod:1257 ../src/guestfs-actions.pod:1261 ../src/guestfs-actions.pod:1265 ../src/guestfs-actions.pod:1269 ../src/guestfs-actions.pod:1277 ../src/guestfs-actions.pod:1281 ../src/guestfs-actions.pod:1285 ../src/guestfs-actions.pod:1295 ../src/guestfs-actions.pod:1299 ../src/guestfs-actions.pod:1303 ../src/guestfs-actions.pod:1426 ../src/guestfs-actions.pod:1430 ../src/guestfs-actions.pod:1435 ../src/guestfs-actions.pod:1440 ../src/guestfs-actions.pod:1492 ../src/guestfs-actions.pod:1496 ../src/guestfs-actions.pod:1501 ../fish/guestfish.pod:309 ../fish/guestfish.pod:313 ../fish/guestfish.pod:317 ../fish/guestfish.pod:321 ../fish/guestfish-actions.pod:13 ../fish/guestfish-actions.pod:20 ../fish/guestfish-actions.pod:300 ../fish/guestfish-actions.pod:308 ../fish/guestfish-actions.pod:315 ../fish/guestfish-actions.pod:322 ../fish/guestfish-actions.pod:998 ../fish/guestfish-actions.pod:1002 ../fish/guestfish-actions.pod:1006 ../fish/guestfish-actions.pod:1010 ../fish/guestfish-actions.pod:1018 ../fish/guestfish-actions.pod:1022 ../fish/guestfish-actions.pod:1026 ../fish/guestfish-actions.pod:1036 ../fish/guestfish-actions.pod:1040 ../fish/guestfish-actions.pod:1044 ../fish/guestfish-actions.pod:1134 ../fish/guestfish-actions.pod:1138 ../fish/guestfish-actions.pod:1143 ../fish/guestfish-actions.pod:1148 ../fish/guestfish-actions.pod:1190 ../fish/guestfish-actions.pod:1194 ../fish/guestfish-actions.pod:1199 ../tools/virt-resize.pl:324 ../tools/virt-resize.pl:329 ../tools/virt-resize.pl:339
726 #: ../src/guestfs.pod:347
728 "The kernel version that the command runs under will be different from what "
733 #: ../src/guestfs.pod:352
735 "If the command needs to communicate with daemons, then most likely they "
740 #: ../src/guestfs.pod:357
741 msgid "The command will be running in limited memory."
745 #: ../src/guestfs.pod:361
747 "The network may not be available unless you enable it (see "
748 "L</guestfs_set_network>)."
752 #: ../src/guestfs.pod:366
753 msgid "Only supports Linux guests (not Windows, BSD, etc)."
757 #: ../src/guestfs.pod:370
758 msgid "Architecture limitations (eg. won't work for a PPC guest on an X86 host)."
762 #: ../src/guestfs.pod:375
764 "For SELinux guests, you may need to enable SELinux and load policy first. "
765 "See L</SELINUX> in this manpage."
769 #: ../src/guestfs.pod:380
771 "The two main API calls to run commands are L</guestfs_command> and "
772 "L</guestfs_sh> (there are also variations)."
776 #: ../src/guestfs.pod:383
778 "The difference is that L</guestfs_sh> runs commands using the shell, so any "
779 "shell globs, redirections, etc will work."
783 #: ../src/guestfs.pod:386
784 msgid "CONFIGURATION FILES"
788 #: ../src/guestfs.pod:388
790 "To read and write configuration files in Linux guest filesystems, we "
791 "strongly recommend using Augeas. For example, Augeas understands how to "
792 "read and write, say, a Linux shadow password file or X.org configuration "
793 "file, and so avoids you having to write that code."
797 #: ../src/guestfs.pod:393
799 "The main Augeas calls are bound through the C<guestfs_aug_*> APIs. We don't "
800 "document Augeas itself here because there is excellent documentation on the "
801 "L<http://augeas.net/> website."
805 #: ../src/guestfs.pod:397
807 "If you don't want to use Augeas (you fool!) then try calling "
808 "L</guestfs_read_lines> to get the file as a list of lines which you can "
813 #: ../src/guestfs.pod:401
818 #: ../src/guestfs.pod:403
820 "We support SELinux guests. To ensure that labeling happens correctly in "
821 "SELinux guests, you need to enable SELinux and load the guest's policy:"
825 #: ../src/guestfs.pod:409
830 #: ../src/guestfs.pod:411
831 msgid "Before launching, do:"
835 #: ../src/guestfs.pod:413
838 " guestfs_set_selinux (g, 1);\n"
843 #: ../src/guestfs.pod:415
848 #: ../src/guestfs.pod:417
850 "After mounting the guest's filesystem(s), load the policy. This is best "
851 "done by running the L<load_policy(8)> command in the guest itself:"
855 #: ../src/guestfs.pod:421
858 " guestfs_sh (g, \"/usr/sbin/load_policy\");\n"
863 #: ../src/guestfs.pod:423
865 "(Older versions of C<load_policy> require you to specify the name of the "
870 #: ../src/guestfs.pod:426
875 #: ../src/guestfs.pod:428
877 "Optionally, set the security context for the API. The correct security "
878 "context to use can only be known by inspecting the guest. As an example:"
882 #: ../src/guestfs.pod:432
885 " guestfs_setcon (g, \"unconfined_u:unconfined_r:unconfined_t:s0\");\n"
890 #: ../src/guestfs.pod:436
891 msgid "This will work for running commands and editing existing files."
895 #: ../src/guestfs.pod:438
897 "When new files are created, you may need to label them explicitly, for "
898 "example by running the external command C<restorecon pathname>."
902 #: ../src/guestfs.pod:442
907 #: ../src/guestfs.pod:444
909 "Certain calls are affected by the current file mode creation mask (the "
910 "\"umask\"). In particular ones which create files or directories, such as "
911 "L</guestfs_touch>, L</guestfs_mknod> or L</guestfs_mkdir>. This affects "
912 "either the default mode that the file is created with or modifies the mode "
917 #: ../src/guestfs.pod:450
919 "The default umask is C<022>, so files are created with modes such as C<0644> "
920 "and directories with C<0755>."
924 #: ../src/guestfs.pod:453
926 "There are two ways to avoid being affected by umask. Either set umask to 0 "
927 "(call C<guestfs_umask (g, 0)> early after launching). Or call "
928 "L</guestfs_chmod> after creating each file or directory."
932 #: ../src/guestfs.pod:457
933 msgid "For more information about umask, see L<umask(2)>."
937 #: ../src/guestfs.pod:459 ../fish/guestfish.pod:559
938 msgid "ENCRYPTED DISKS"
942 #: ../src/guestfs.pod:461
944 "Libguestfs allows you to access Linux guests which have been encrypted using "
945 "whole disk encryption that conforms to the Linux Unified Key Setup (LUKS) "
946 "standard. This includes nearly all whole disk encryption systems used by "
947 "modern Linux guests."
951 #: ../src/guestfs.pod:467
953 "Use L</guestfs_vfs_type> to identify LUKS-encrypted block devices (it "
954 "returns the string C<crypto_LUKS>)."
958 #: ../src/guestfs.pod:470
960 "Then open these devices by calling L</guestfs_luks_open>. Obviously you "
961 "will require the passphrase!"
965 #: ../src/guestfs.pod:473
967 "Opening a LUKS device creates a new device mapper device called "
968 "C</dev/mapper/mapname> (where C<mapname> is the string you supply to "
969 "L</guestfs_luks_open>). Reads and writes to this mapper device are "
970 "decrypted from and encrypted to the underlying block device respectively."
974 #: ../src/guestfs.pod:479
976 "LVM volume groups on the device can be made visible by calling "
977 "L</guestfs_vgscan> followed by L</guestfs_vg_activate_all>. The logical "
978 "volume(s) can now be mounted in the usual way."
982 #: ../src/guestfs.pod:483
984 "Use the reverse process to close a LUKS device. Unmount any logical volumes "
985 "on it, deactivate the volume groups by caling C<guestfs_vg_activate (g, 0, "
986 "[\"/dev/VG\"])>. Then close the mapper device by calling "
987 "L</guestfs_luks_close> on the C</dev/mapper/mapname> device (I<not> the "
988 "underlying encrypted block device)."
992 #: ../src/guestfs.pod:490
997 #: ../src/guestfs.pod:492
999 "Libguestfs has APIs for inspecting an unknown disk image to find out if it "
1000 "contains operating systems. (These APIs used to be in a separate Perl-only "
1001 "library called L<Sys::Guestfs::Lib(3)> but since version 1.5.3 the most "
1002 "frequently used part of this library has been rewritten in C and moved into "
1007 #: ../src/guestfs.pod:498
1009 "Add all disks belonging to the unknown virtual machine and call "
1010 "L</guestfs_launch> in the usual way."
1014 #: ../src/guestfs.pod:501
1016 "Then call L</guestfs_inspect_os>. This function uses other libguestfs calls "
1017 "and certain heuristics, and returns a list of operating systems that were "
1018 "found. An empty list means none were found. A single element is the root "
1019 "filesystem of the operating system. For dual- or multi-boot guests, "
1020 "multiple roots can be returned, each one corresponding to a separate "
1021 "operating system. (Multi-boot virtual machines are extremely rare in the "
1022 "world of virtualization, but since this scenario can happen, we have built "
1023 "libguestfs to deal with it.)"
1027 #: ../src/guestfs.pod:510
1029 "For each root, you can then call various C<guestfs_inspect_get_*> functions "
1030 "to get additional details about that operating system. For example, call "
1031 "L</guestfs_inspect_get_type> to return the string C<windows> or C<linux> for "
1032 "Windows and Linux-based operating systems respectively."
1036 #: ../src/guestfs.pod:516
1038 "Un*x-like and Linux-based operating systems usually consist of several "
1039 "filesystems which are mounted at boot time (for example, a separate boot "
1040 "partition mounted on C</boot>). The inspection rules are able to detect how "
1041 "filesystems correspond to mount points. Call "
1042 "C<guestfs_inspect_get_mountpoints> to get this mapping. It might return a "
1043 "hash table like this example:"
1047 #: ../src/guestfs.pod:523
1050 " /boot => /dev/sda1\n"
1051 " / => /dev/vg_guest/lv_root\n"
1052 " /usr => /dev/vg_guest/lv_usr\n"
1057 #: ../src/guestfs.pod:527
1059 "The caller can then make calls to L</guestfs_mount_options> to mount the "
1060 "filesystems as suggested."
1064 #: ../src/guestfs.pod:530
1066 "Be careful to mount filesystems in the right order (eg. C</> before "
1067 "C</usr>). Sorting the keys of the hash by length, shortest first, should "
1072 #: ../src/guestfs.pod:534
1074 "Inspection currently only works for some common operating systems. "
1075 "Contributors are welcome to send patches for other operating systems that we "
1076 "currently cannot detect."
1080 #: ../src/guestfs.pod:538
1082 "Encrypted disks must be opened before inspection. See L</ENCRYPTED DISKS> "
1083 "for more details. The L</guestfs_inspect_os> function just ignores any "
1084 "encrypted devices."
1088 #: ../src/guestfs.pod:542
1090 "A note on the implementation: The call L</guestfs_inspect_os> performs "
1091 "inspection and caches the results in the guest handle. Subsequent calls to "
1092 "C<guestfs_inspect_get_*> return this cached information, but I<do not> "
1093 "re-read the disks. If you change the content of the guest disks, you can "
1094 "redo inspection by calling L</guestfs_inspect_os> again."
1098 #: ../src/guestfs.pod:549
1099 msgid "SPECIAL CONSIDERATIONS FOR WINDOWS GUESTS"
1103 #: ../src/guestfs.pod:551
1105 "Libguestfs can mount NTFS partitions. It does this using the "
1106 "L<http://www.ntfs-3g.org/> driver."
1110 #: ../src/guestfs.pod:554
1112 "DOS and Windows still use drive letters, and the filesystems are always "
1113 "treated as case insensitive by Windows itself, and therefore you might find "
1114 "a Windows configuration file referring to a path like "
1115 "C<c:\\windows\\system32>. When the filesystem is mounted in libguestfs, "
1116 "that directory might be referred to as C</WINDOWS/System32>."
1120 #: ../src/guestfs.pod:560
1122 "Drive letter mappings are outside the scope of libguestfs. You have to use "
1123 "libguestfs to read the appropriate Windows Registry and configuration files, "
1124 "to determine yourself how drives are mapped (see also L<hivex(3)> and "
1125 "L<virt-inspector(1)>)."
1129 #: ../src/guestfs.pod:565
1131 "Replacing backslash characters with forward slash characters is also outside "
1132 "the scope of libguestfs, but something that you can easily do."
1136 #: ../src/guestfs.pod:568
1138 "Where we can help is in resolving the case insensitivity of paths. For "
1139 "this, call L</guestfs_case_sensitive_path>."
1143 #: ../src/guestfs.pod:571
1145 "Libguestfs also provides some help for decoding Windows Registry \"hive\" "
1146 "files, through the library C<hivex> which is part of the libguestfs project "
1147 "although ships as a separate tarball. You have to locate and download the "
1148 "hive file(s) yourself, and then pass them to C<hivex> functions. See also "
1149 "the programs L<hivexml(1)>, L<hivexsh(1)>, L<hivexregedit(1)> and "
1150 "L<virt-win-reg(1)> for more help on this issue."
1154 #: ../src/guestfs.pod:579
1155 msgid "USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES"
1159 #: ../src/guestfs.pod:581
1161 "Although we don't want to discourage you from using the C API, we will "
1162 "mention here that the same API is also available in other languages."
1166 #: ../src/guestfs.pod:584
1168 "The API is broadly identical in all supported languages. This means that "
1169 "the C call C<guestfs_mount(g,path)> is C<$g-E<gt>mount($path)> in Perl, "
1170 "C<g.mount(path)> in Python, and C<Guestfs.mount g path> in OCaml. In other "
1171 "words, a straightforward, predictable isomorphism between each language."
1175 #: ../src/guestfs.pod:590
1177 "Error messages are automatically transformed into exceptions if the language "
1182 #: ../src/guestfs.pod:593
1184 "We don't try to \"object orientify\" parts of the API in OO languages, "
1185 "although contributors are welcome to write higher level APIs above what we "
1186 "provide in their favourite languages if they wish."
1190 #: ../src/guestfs.pod:599
1195 #: ../src/guestfs.pod:601
1197 "You can use the I<guestfs.h> header file from C++ programs. The C++ API is "
1198 "identical to the C API. C++ classes and exceptions are not used."
1202 #: ../src/guestfs.pod:605
1207 #: ../src/guestfs.pod:607
1209 "The C# bindings are highly experimental. Please read the warnings at the "
1210 "top of C<csharp/Libguestfs.cs>."
1214 #: ../src/guestfs.pod:610
1219 #: ../src/guestfs.pod:612
1221 "This is the only language binding that is working but incomplete. Only "
1222 "calls which return simple integers have been bound in Haskell, and we are "
1223 "looking for help to complete this binding."
1227 #: ../src/guestfs.pod:616
1232 #: ../src/guestfs.pod:618
1234 "Full documentation is contained in the Javadoc which is distributed with "
1239 #: ../src/guestfs.pod:621
1244 #: ../src/guestfs.pod:623
1245 msgid "For documentation see the file C<guestfs.mli>."
1249 #: ../src/guestfs.pod:625
1254 #: ../src/guestfs.pod:627
1255 msgid "For documentation see L<Sys::Guestfs(3)>."
1259 #: ../src/guestfs.pod:629
1264 #: ../src/guestfs.pod:631
1265 msgid "For documentation do:"
1269 #: ../src/guestfs.pod:633
1273 " >>> import guestfs\n"
1274 " >>> help (guestfs)\n"
1279 #: ../src/guestfs.pod:637
1284 #: ../src/guestfs.pod:639
1286 "Use the Guestfs module. There is no Ruby-specific documentation, but you "
1287 "can find examples written in Ruby in the libguestfs source."
1291 #: ../src/guestfs.pod:642
1292 msgid "B<shell scripts>"
1296 #: ../src/guestfs.pod:644
1297 msgid "For documentation see L<guestfish(1)>."
1301 #: ../src/guestfs.pod:648
1302 msgid "LIBGUESTFS GOTCHAS"
1306 #: ../src/guestfs.pod:650
1308 "L<http://en.wikipedia.org/wiki/Gotcha_(programming)>: \"A feature of a "
1309 "system [...] that works in the way it is documented but is counterintuitive "
1310 "and almost invites mistakes.\""
1314 #: ../src/guestfs.pod:654
1316 "Since we developed libguestfs and the associated tools, there are several "
1317 "things we would have designed differently, but are now stuck with for "
1318 "backwards compatibility or other reasons. If there is ever a libguestfs 2.0 "
1319 "release, you can expect these to change. Beware of them."
1323 #: ../src/guestfs.pod:662
1324 msgid "Autosync / forgetting to sync."
1328 #: ../src/guestfs.pod:664
1330 "When modifying a filesystem from C or another language, you B<must> unmount "
1331 "all filesystems and call L</guestfs_sync> explicitly before you close the "
1332 "libguestfs handle. You can also call:"
1336 #: ../src/guestfs.pod:668
1339 " guestfs_set_autosync (g, 1);\n"
1344 #: ../src/guestfs.pod:670
1346 "to have the unmount/sync done automatically for you when the handle 'g' is "
1347 "closed. (This feature is called \"autosync\", L</guestfs_set_autosync> "
1352 #: ../src/guestfs.pod:674
1354 "If you forget to do this, then it is entirely possible that your changes "
1355 "won't be written out, or will be partially written, or (very rarely) that "
1356 "you'll get disk corruption."
1360 #: ../src/guestfs.pod:678
1362 "Note that in L<guestfish(3)> autosync is the default. So quick and dirty "
1363 "guestfish scripts that forget to sync will work just fine, which can make "
1364 "this very puzzling if you are trying to debug a problem."
1368 #: ../src/guestfs.pod:682
1369 msgid "Mount option C<-o sync> should not be the default."
1373 #: ../src/guestfs.pod:684
1375 "If you use L</guestfs_mount>, then C<-o sync,noatime> are added implicitly. "
1376 "However C<-o sync> does not add any reliability benefit, but does have a "
1377 "very large performance impact."
1381 #: ../src/guestfs.pod:688
1383 "The work around is to use L</guestfs_mount_options> and set the mount "
1384 "options that you actually want to use."
1388 #: ../src/guestfs.pod:691
1389 msgid "Read-only should be the default."
1393 #: ../src/guestfs.pod:693
1395 "In L<guestfish(3)>, I<--ro> should be the default, and you should have to "
1396 "specify I<--rw> if you want to make changes to the image."
1400 #: ../src/guestfs.pod:696
1401 msgid "This would reduce the potential to corrupt live VM images."
1405 #: ../src/guestfs.pod:698
1407 "Note that many filesystems change the disk when you just mount and unmount, "
1408 "even if you didn't perform any writes. You need to use "
1409 "L</guestfs_add_drive_ro> to guarantee that the disk is not changed."
1413 #: ../src/guestfs.pod:702
1414 msgid "guestfish command line is hard to use."
1418 #: ../src/guestfs.pod:704
1420 "C<guestfish disk.img> doesn't do what people expect (open C<disk.img> for "
1421 "examination). It tries to run a guestfish command C<disk.img> which doesn't "
1422 "exist, so it fails. In earlier versions of guestfish the error message was "
1423 "also unintuitive, but we have corrected this since. Like the Bourne shell, "
1424 "we should have used C<guestfish -c command> to run commands."
1428 #: ../src/guestfs.pod:711
1429 msgid "guestfish megabyte modifiers don't work right on all commands"
1433 #: ../src/guestfs.pod:713
1435 "In recent guestfish you can use C<1M> to mean 1 megabyte (and similarly for "
1436 "other modifiers). What guestfish actually does is to multiply the number "
1437 "part by the modifier part and pass the result to the C API. However this "
1438 "doesn't work for a few APIs which aren't expecting bytes, but are already "
1439 "expecting some other unit (eg. megabytes)."
1443 #: ../src/guestfs.pod:720
1444 msgid "The most common is L</guestfs_lvcreate>. The guestfish command:"
1448 #: ../src/guestfs.pod:722
1451 " lvcreate LV VG 100M\n"
1456 #: ../src/guestfs.pod:724
1458 "does not do what you might expect. Instead because L</guestfs_lvcreate> is "
1459 "already expecting megabytes, this tries to create a 100 I<terabyte> (100 "
1460 "megabytes * megabytes) logical volume. The error message you get from this "
1461 "is also a little obscure."
1465 #: ../src/guestfs.pod:729
1467 "This could be fixed in the generator by specially marking parameters and "
1468 "return values which take bytes or other units."
1472 #: ../src/guestfs.pod:732
1473 msgid "Library should return errno with error messages."
1477 #: ../src/guestfs.pod:734
1479 "It would be a nice-to-have to be able to get the original value of 'errno' "
1480 "from inside the appliance along error paths (where set). Currently "
1481 "L<guestmount(1)> goes through hoops to try to reverse the error message "
1482 "string into an errno, see the function error() in fuse/guestmount.c."
1486 #: ../src/guestfs.pod:740
1488 "In libguestfs 1.5.4, the protocol was changed so that the Linux errno is "
1489 "sent back from the daemon."
1493 #: ../src/guestfs.pod:745
1494 msgid "PROTOCOL LIMITS"
1498 #: ../src/guestfs.pod:747
1500 "Internally libguestfs uses a message-based protocol to pass API calls and "
1501 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1502 "plenty more detail about this). The maximum message size used by the "
1503 "protocol is slightly less than 4 MB. For some API calls you may need to be "
1504 "aware of this limit. The API calls which may be affected are individually "
1505 "documented, with a link back to this section of the documentation."
1509 #: ../src/guestfs.pod:755
1511 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1512 "a simple string. Because this string is at some point internally encoded as "
1513 "a message, the maximum size that it can return is slightly under 4 MB. If "
1514 "the requested file is larger than this then you will get an error."
1518 #: ../src/guestfs.pod:761
1520 "In order to transfer large files into and out of the guest filesystem, you "
1521 "need to use particular calls that support this. The sections L</UPLOADING> "
1522 "and L</DOWNLOADING> document how to do this."
1526 #: ../src/guestfs.pod:765
1528 "You might also consider mounting the disk image using our FUSE filesystem "
1529 "support (L<guestmount(1)>)."
1533 #: ../src/guestfs.pod:768
1534 msgid "KEYS AND PASSPHRASES"
1538 #: ../src/guestfs.pod:770
1540 "Certain libguestfs calls take a parameter that contains sensitive key "
1541 "material, passed in as a C string."
1545 #: ../src/guestfs.pod:773
1547 "In the future we would hope to change the libguestfs implementation so that "
1548 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1549 "swap. However this is I<not> done at the moment, because of the complexity "
1550 "of such an implementation."
1554 #: ../src/guestfs.pod:778
1556 "Therefore you should be aware that any key parameter you pass to libguestfs "
1557 "might end up being written out to the swap partition. If this is a concern, "
1558 "scrub the swap partition or don't use libguestfs on encrypted devices."
1562 #: ../src/guestfs.pod:783
1563 msgid "CONNECTION MANAGEMENT"
1567 #: ../src/guestfs.pod:785
1572 #: ../src/guestfs.pod:787
1574 "C<guestfs_h> is the opaque type representing a connection handle. Create a "
1575 "handle by calling L</guestfs_create>. Call L</guestfs_close> to free the "
1576 "handle and release all resources used."
1580 #: ../src/guestfs.pod:791
1582 "For information on using multiple handles and threads, see the section "
1583 "L</MULTIPLE HANDLES AND MULTIPLE THREADS> below."
1587 #: ../src/guestfs.pod:794
1588 msgid "guestfs_create"
1592 #: ../src/guestfs.pod:796
1595 " guestfs_h *guestfs_create (void);\n"
1600 #: ../src/guestfs.pod:798
1601 msgid "Create a connection handle."
1605 #: ../src/guestfs.pod:800
1606 msgid "You have to call L</guestfs_add_drive> on the handle at least once."
1610 #: ../src/guestfs.pod:802
1612 "This function returns a non-NULL pointer to a handle on success or NULL on "
1617 #: ../src/guestfs.pod:805
1618 msgid "After configuring the handle, you have to call L</guestfs_launch>."
1622 #: ../src/guestfs.pod:807
1624 "You may also want to configure error handling for the handle. See L</ERROR "
1625 "HANDLING> section below."
1629 #: ../src/guestfs.pod:810
1630 msgid "guestfs_close"
1634 #: ../src/guestfs.pod:812
1637 " void guestfs_close (guestfs_h *g);\n"
1642 #: ../src/guestfs.pod:814
1643 msgid "This closes the connection handle and frees up all resources used."
1647 #: ../src/guestfs.pod:816
1648 msgid "ERROR HANDLING"
1652 #: ../src/guestfs.pod:818
1654 "The convention in all functions that return C<int> is that they return C<-1> "
1655 "to indicate an error. You can get additional information on errors by "
1656 "calling L</guestfs_last_error> and/or by setting up an error handler with "
1657 "L</guestfs_set_error_handler>."
1661 #: ../src/guestfs.pod:823
1662 msgid "The default error handler prints the information string to C<stderr>."
1666 #: ../src/guestfs.pod:825
1668 "Out of memory errors are handled differently. The default action is to call "
1669 "L<abort(3)>. If this is undesirable, then you can set a handler using "
1670 "L</guestfs_set_out_of_memory_handler>."
1674 #: ../src/guestfs.pod:829
1675 msgid "guestfs_last_error"
1679 #: ../src/guestfs.pod:831
1682 " const char *guestfs_last_error (guestfs_h *g);\n"
1687 #: ../src/guestfs.pod:833
1689 "This returns the last error message that happened on C<g>. If there has not "
1690 "been an error since the handle was created, then this returns C<NULL>."
1694 #: ../src/guestfs.pod:837
1696 "The lifetime of the returned string is until the next error occurs, or "
1697 "L</guestfs_close> is called."
1701 #: ../src/guestfs.pod:840
1703 "The error string is not localized (ie. is always in English), because this "
1704 "makes searching for error messages in search engines give the largest number "
1709 #: ../src/guestfs.pod:844
1710 msgid "guestfs_set_error_handler"
1714 #: ../src/guestfs.pod:846
1717 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
1719 " const char *msg);\n"
1720 " void guestfs_set_error_handler (guestfs_h *g,\n"
1721 " guestfs_error_handler_cb cb,\n"
1727 #: ../src/guestfs.pod:853
1729 "The callback C<cb> will be called if there is an error. The parameters "
1730 "passed to the callback are an opaque data pointer and the error message "
1735 #: ../src/guestfs.pod:857
1737 "Note that the message string C<msg> is freed as soon as the callback "
1738 "function returns, so if you want to stash it somewhere you must make your "
1743 #: ../src/guestfs.pod:861
1744 msgid "The default handler prints messages on C<stderr>."
1748 #: ../src/guestfs.pod:863
1749 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
1753 #: ../src/guestfs.pod:865
1754 msgid "guestfs_get_error_handler"
1758 #: ../src/guestfs.pod:867
1761 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
1762 " void **opaque_rtn);\n"
1767 #: ../src/guestfs.pod:870
1768 msgid "Returns the current error handler callback."
1772 #: ../src/guestfs.pod:872
1773 msgid "guestfs_set_out_of_memory_handler"
1777 #: ../src/guestfs.pod:874
1780 " typedef void (*guestfs_abort_cb) (void);\n"
1781 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
1782 " guestfs_abort_cb);\n"
1787 #: ../src/guestfs.pod:878
1789 "The callback C<cb> will be called if there is an out of memory situation. "
1790 "I<Note this callback must not return>."
1794 #: ../src/guestfs.pod:881
1795 msgid "The default is to call L<abort(3)>."
1799 #: ../src/guestfs.pod:883
1800 msgid "You cannot set C<cb> to C<NULL>. You can't ignore out of memory situations."
1804 #: ../src/guestfs.pod:886
1805 msgid "guestfs_get_out_of_memory_handler"
1809 #: ../src/guestfs.pod:888
1812 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
1817 #: ../src/guestfs.pod:890
1818 msgid "This returns the current out of memory handler."
1822 #: ../src/guestfs.pod:892
1827 #: ../src/guestfs.pod:894
1829 "Libguestfs needs a kernel and initrd.img, which it finds by looking along an "
1834 #: ../src/guestfs.pod:897
1836 "By default it looks for these in the directory C<$libdir/guestfs> "
1837 "(eg. C</usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
1841 #: ../src/guestfs.pod:900
1843 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
1844 "to change the directories that libguestfs will search in. The value is a "
1845 "colon-separated list of paths. The current directory is I<not> searched "
1846 "unless the path contains an empty element or C<.>. For example "
1847 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
1848 "then C</usr/lib/guestfs>."
1852 #: ../src/guestfs.pod:907
1853 msgid "HIGH-LEVEL API ACTIONS"
1857 #: ../src/guestfs.pod:909
1858 msgid "ABI GUARANTEE"
1862 #: ../src/guestfs.pod:911
1864 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
1865 "actions as outlined in this section. Although we will deprecate some "
1866 "actions, for example if they get replaced by newer calls, we will keep the "
1867 "old actions forever. This allows you the developer to program in confidence "
1868 "against the libguestfs API."
1872 #: ../src/guestfs.pod:917 ../fish/guestfish.pod:898
1877 #: ../src/guestfs.pod:919
1882 #: ../src/guestfs.pod:921
1887 #: ../src/guestfs.pod:923
1888 msgid "AVAILABILITY"
1892 #: ../src/guestfs.pod:925
1893 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
1897 #: ../src/guestfs.pod:927
1899 "Using L</guestfs_available> you can test availability of the following "
1900 "groups of functions. This test queries the appliance to see if the "
1901 "appliance you are currently using supports the functionality."
1905 #: ../src/guestfs.pod:932
1906 msgid "@AVAILABILITY@"
1910 #: ../src/guestfs.pod:934
1911 msgid "GUESTFISH supported COMMAND"
1915 #: ../src/guestfs.pod:936
1917 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
1918 "prints out the available groups and whether they are supported by this build "
1919 "of libguestfs. Note however that you have to do C<run> first."
1923 #: ../src/guestfs.pod:941
1924 msgid "SINGLE CALLS AT COMPILE TIME"
1928 #: ../src/guestfs.pod:943
1930 "If you need to test whether a single libguestfs function is available at "
1931 "compile time, we recommend using build tools such as autoconf or cmake. For "
1932 "example in autotools you could use:"
1936 #: ../src/guestfs.pod:948
1939 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
1940 " AC_CHECK_FUNCS([guestfs_dd])\n"
1945 #: ../src/guestfs.pod:951
1947 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
1952 #: ../src/guestfs.pod:954
1953 msgid "SINGLE CALLS AT RUN TIME"
1957 #: ../src/guestfs.pod:956
1959 "Testing at compile time doesn't guarantee that a function really exists in "
1960 "the library. The reason is that you might be dynamically linked against a "
1961 "previous I<libguestfs.so> (dynamic library) which doesn't have the call. "
1962 "This situation unfortunately results in a segmentation fault, which is a "
1963 "shortcoming of the C dynamic linking system itself."
1967 #: ../src/guestfs.pod:963
1969 "You can use L<dlopen(3)> to test if a function is available at run time, as "
1970 "in this example program (note that you still need the compile time check as "
1975 #: ../src/guestfs.pod:967
1978 " #include <config.h>\n"
1983 #: ../src/guestfs.pod:969
1986 " #include <stdio.h>\n"
1987 " #include <stdlib.h>\n"
1988 " #include <unistd.h>\n"
1989 " #include <dlfcn.h>\n"
1990 " #include <guestfs.h>\n"
1995 #: ../src/guestfs.pod:975
2000 " #ifdef HAVE_GUESTFS_DD\n"
2002 " int has_function;\n"
2007 #: ../src/guestfs.pod:981
2010 " /* Test if the function guestfs_dd is really available. */\n"
2011 " dl = dlopen (NULL, RTLD_LAZY);\n"
2013 " fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
2014 " exit (EXIT_FAILURE);\n"
2016 " has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
2022 #: ../src/guestfs.pod:990
2025 " if (!has_function)\n"
2026 " printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
2028 " printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
2029 " /* Now it's safe to call\n"
2030 " guestfs_dd (g, \"foo\", \"bar\");\n"
2034 " printf (\"guestfs_dd function was not found at compile time\\n\");\n"
2041 #: ../src/guestfs.pod:1003
2043 "You may think the above is an awful lot of hassle, and it is. There are "
2044 "other ways outside of the C linking system to ensure that this kind of "
2045 "incompatibility never arises, such as using package versioning:"
2049 #: ../src/guestfs.pod:1008
2052 " Requires: libguestfs >= 1.0.80\n"
2057 #: ../src/guestfs.pod:1010 ../src/guestfs.pod:1015
2062 #: ../src/guestfs.pod:1012
2064 "<!-- old anchor for the next section --> <a "
2065 "name=\"state_machine_and_low_level_event_api\"/>"
2069 #: ../src/guestfs.pod:1017
2070 msgid "ARCHITECTURE"
2074 #: ../src/guestfs.pod:1019
2076 "Internally, libguestfs is implemented by running an appliance (a special "
2077 "type of small virtual machine) using L<qemu(1)>. Qemu runs as a child "
2078 "process of the main program."
2082 #: ../src/guestfs.pod:1023
2085 " ___________________\n"
2087 " | main program |\n"
2089 " | | child process / appliance\n"
2090 " | | __________________________\n"
2092 " +-------------------+ RPC | +-----------------+ |\n"
2093 " | libguestfs <--------------------> guestfsd | |\n"
2094 " | | | +-----------------+ |\n"
2095 " \\___________________/ | | Linux kernel | |\n"
2096 " | +--^--------------+ |\n"
2097 " \\_________|________________/\n"
2103 " \\______________/\n"
2108 #: ../src/guestfs.pod:1043
2110 "The library, linked to the main program, creates the child process and hence "
2111 "the appliance in the L</guestfs_launch> function."
2115 #: ../src/guestfs.pod:1046
2117 "Inside the appliance is a Linux kernel and a complete stack of userspace "
2118 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
2119 "L</guestfsd>. The library talks to L</guestfsd> using remote procedure "
2120 "calls (RPC). There is a mostly one-to-one correspondence between libguestfs "
2121 "API calls and RPC calls to the daemon. Lastly the disk image(s) are "
2122 "attached to the qemu process which translates device access by the "
2123 "appliance's Linux kernel into accesses to the image."
2127 #: ../src/guestfs.pod:1055
2129 "A common misunderstanding is that the appliance \"is\" the virtual machine. "
2130 "Although the disk image you are attached to might also be used by some "
2131 "virtual machine, libguestfs doesn't know or care about this. (But you will "
2132 "care if both libguestfs's qemu process and your virtual machine are trying "
2133 "to update the disk image at the same time, since these usually results in "
2134 "massive disk corruption)."
2138 #: ../src/guestfs.pod:1062
2139 msgid "STATE MACHINE"
2143 #: ../src/guestfs.pod:1064
2144 msgid "libguestfs uses a state machine to model the child process:"
2148 #: ../src/guestfs.pod:1066
2160 " / | \\ \\ guestfs_launch\n"
2161 " / | _\\__V______\n"
2163 " / | | LAUNCHING |\n"
2164 " / | \\___________/\n"
2166 " / | guestfs_launch\n"
2168 " ______ / __|____V\n"
2169 " / \\ ------> / \\\n"
2170 " | BUSY | | READY |\n"
2171 " \\______/ <------ \\________/\n"
2176 #: ../src/guestfs.pod:1088
2178 "The normal transitions are (1) CONFIG (when the handle is created, but there "
2179 "is no child process), (2) LAUNCHING (when the child process is booting up), "
2180 "(3) alternating between READY and BUSY as commands are issued to, and "
2181 "carried out by, the child process."
2185 #: ../src/guestfs.pod:1093
2187 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
2188 "asynchronously at any time (eg. due to some internal error), and that causes "
2189 "the state to transition back to CONFIG."
2193 #: ../src/guestfs.pod:1097
2195 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
2196 "issued when in the CONFIG state."
2200 #: ../src/guestfs.pod:1100
2202 "The high-level API offers two calls that go from CONFIG through LAUNCHING to "
2203 "READY. L</guestfs_launch> blocks until the child process is READY to accept "
2204 "commands (or until some failure or timeout). L</guestfs_launch> internally "
2205 "moves the state from CONFIG to LAUNCHING while it is running."
2209 #: ../src/guestfs.pod:1106
2211 "High-level API actions such as L</guestfs_mount> can only be issued when in "
2212 "the READY state. These high-level API calls block waiting for the command "
2213 "to be carried out (ie. the state to transition to BUSY and then back to "
2214 "READY). But using the low-level event API, you get non-blocking versions. "
2215 "(But you can still only carry out one operation per handle at a time - that "
2216 "is a limitation of the communications protocol we use)."
2220 #: ../src/guestfs.pod:1114
2222 "Finally, the child process sends asynchronous messages back to the main "
2223 "program, such as kernel log messages. Mostly these are ignored by the "
2224 "high-level API, but using the low-level event API you can register to "
2225 "receive these messages."
2229 #: ../src/guestfs.pod:1119
2230 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
2234 #: ../src/guestfs.pod:1121
2236 "The child process generates events in some situations. Current events "
2237 "include: receiving a log message, the child process exits."
2241 #: ../src/guestfs.pod:1124
2243 "Use the C<guestfs_set_*_callback> functions to set a callback for different "
2248 #: ../src/guestfs.pod:1127
2250 "Only I<one callback of each type> can be registered for each handle. "
2251 "Calling C<guestfs_set_*_callback> again overwrites the previous callback of "
2252 "that type. Cancel all callbacks of this type by calling this function with "
2253 "C<cb> set to C<NULL>."
2257 #: ../src/guestfs.pod:1132
2258 msgid "guestfs_set_log_message_callback"
2262 #: ../src/guestfs.pod:1134
2265 " typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,\n"
2266 " char *buf, int len);\n"
2267 " void guestfs_set_log_message_callback (guestfs_h *g,\n"
2268 " guestfs_log_message_cb cb,\n"
2274 #: ../src/guestfs.pod:1140
2276 "The callback function C<cb> will be called whenever qemu or the guest writes "
2277 "anything to the console."
2281 #: ../src/guestfs.pod:1143
2282 msgid "Use this function to capture kernel messages and similar."
2286 #: ../src/guestfs.pod:1145
2288 "Normally there is no log message handler, and log messages are just "
2293 #: ../src/guestfs.pod:1148
2294 msgid "guestfs_set_subprocess_quit_callback"
2298 #: ../src/guestfs.pod:1150
2301 " typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);\n"
2302 " void guestfs_set_subprocess_quit_callback (guestfs_h *g,\n"
2303 " guestfs_subprocess_quit_cb cb,\n"
2309 #: ../src/guestfs.pod:1155
2311 "The callback function C<cb> will be called when the child process quits, "
2312 "either asynchronously or if killed by L</guestfs_kill_subprocess>. (This "
2313 "corresponds to a transition from any state to the CONFIG state)."
2317 #: ../src/guestfs.pod:1160
2318 msgid "guestfs_set_launch_done_callback"
2322 #: ../src/guestfs.pod:1162
2325 " typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);\n"
2326 " void guestfs_set_launch_done_callback (guestfs_h *g,\n"
2327 " guestfs_launch_done_cb cb,\n"
2333 #: ../src/guestfs.pod:1167
2335 "The callback function C<cb> will be called when the child process becomes "
2336 "ready first time after it has been launched. (This corresponds to a "
2337 "transition from LAUNCHING to the READY state)."
2341 #: ../src/guestfs.pod:1171
2342 msgid "guestfs_set_close_callback"
2346 #: ../src/guestfs.pod:1173
2349 " typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);\n"
2350 " void guestfs_set_close_callback (guestfs_h *g,\n"
2351 " guestfs_close_cb cb,\n"
2357 #: ../src/guestfs.pod:1178
2359 "The callback function C<cb> will be called while the handle is being closed "
2360 "(synchronously from L</guestfs_close>)."
2364 #: ../src/guestfs.pod:1181
2366 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
2367 "handles that are open when the program exits. This means that this callback "
2368 "might be called indirectly from L<exit(3)>, which can cause unexpected "
2369 "problems in higher-level languages (eg. if your HLL interpreter has already "
2370 "been cleaned up by the time this is called, and if your callback then jumps "
2371 "into some HLL function)."
2375 #: ../src/guestfs.pod:1189
2376 msgid "guestfs_set_progress_callback"
2380 #: ../src/guestfs.pod:1191
2383 " typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque,\n"
2384 " int proc_nr, int serial,\n"
2385 " uint64_t position, uint64_t total);\n"
2386 " void guestfs_set_progress_callback (guestfs_h *g,\n"
2387 " guestfs_progress_cb cb,\n"
2393 #: ../src/guestfs.pod:1198
2395 "Some long-running operations can generate progress messages. If this "
2396 "callback is registered, then it will be called each time a progress message "
2397 "is generated (usually two seconds after the operation started, and three "
2398 "times per second thereafter until it completes, although the frequency may "
2399 "change in future versions)."
2403 #: ../src/guestfs.pod:1204
2405 "The callback receives two numbers: C<position> and C<total>. The units of "
2406 "C<total> are not defined, although for some operations C<total> may relate "
2407 "in some way to the amount of data to be transferred (eg. in bytes or "
2408 "megabytes), and C<position> may be the portion which has been transferred."
2412 #: ../src/guestfs.pod:1210
2413 msgid "The only defined and stable parts of the API are:"
2417 #: ../src/guestfs.pod:1216
2419 "The callback can display to the user some type of progress bar or indicator "
2420 "which shows the ratio of C<position>:C<total>."
2424 #: ../src/guestfs.pod:1221
2425 msgid "0 E<lt>= C<position> E<lt>= C<total>"
2429 #: ../src/guestfs.pod:1225
2431 "If any progress notification is sent during a call, then a final progress "
2432 "notification is always sent when C<position> = C<total>."
2436 #: ../src/guestfs.pod:1228
2438 "This is to simplify caller code, so callers can easily set the progress "
2439 "indicator to \"100%\" at the end of the operation, without requiring special "
2440 "code to detect this case."
2444 #: ../src/guestfs.pod:1234
2446 "The callback also receives the procedure number and serial number of the "
2447 "call. These are only useful for debugging protocol issues, and the callback "
2448 "can normally ignore them. The callback may want to print these numbers in "
2449 "error messages or debugging messages."
2453 #: ../src/guestfs.pod:1239
2454 msgid "PRIVATE DATA AREA"
2458 #: ../src/guestfs.pod:1241
2460 "You can attach named pieces of private data to the libguestfs handle, and "
2461 "fetch them by name for the lifetime of the handle. This is called the "
2462 "private data area and is only available from the C API."
2466 #: ../src/guestfs.pod:1245
2467 msgid "To attach a named piece of data, use the following call:"
2471 #: ../src/guestfs.pod:1247
2474 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
2479 #: ../src/guestfs.pod:1249
2481 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
2482 "pointer (which can be C<NULL>). Any previous item with the same name is "
2487 #: ../src/guestfs.pod:1253
2489 "You can use any C<key> you want, but names beginning with an underscore "
2490 "character are reserved for internal libguestfs purposes (for implementing "
2491 "language bindings). It is recommended to prefix the name with some unique "
2492 "string to avoid collisions with other users."
2496 #: ../src/guestfs.pod:1258
2497 msgid "To retrieve the pointer, use:"
2501 #: ../src/guestfs.pod:1260
2504 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
2509 #: ../src/guestfs.pod:1262
2511 "This function returns C<NULL> if either no data is found associated with "
2512 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
2517 #: ../src/guestfs.pod:1266
2519 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
2520 "way. As far as libguestfs is concerned, it need not be a valid pointer at "
2521 "all. In particular, libguestfs does I<not> try to free the data when the "
2522 "handle is closed. If the data must be freed, then the caller must either "
2523 "free it before calling L</guestfs_close> or must set up a close callback to "
2524 "do it (see L</guestfs_set_close_callback>, and note that only one callback "
2525 "can be registered for a handle)."
2529 #: ../src/guestfs.pod:1274
2531 "The private data area is implemented using a hash table, and should be "
2532 "reasonably efficient for moderate numbers of keys."
2536 #: ../src/guestfs.pod:1277
2537 msgid "BLOCK DEVICE NAMING"
2541 #: ../src/guestfs.pod:1279
2543 "In the kernel there is now quite a profusion of schemata for naming block "
2544 "devices (in this context, by I<block device> I mean a physical or virtual "
2545 "hard drive). The original Linux IDE driver used names starting with "
2546 "C</dev/hd*>. SCSI devices have historically used a different naming scheme, "
2547 "C</dev/sd*>. When the Linux kernel I<libata> driver became a popular "
2548 "replacement for the old IDE driver (particularly for SATA devices) those "
2549 "devices also used the C</dev/sd*> scheme. Additionally we now have virtual "
2550 "machines with paravirtualized drivers. This has created several different "
2551 "naming systems, such as C</dev/vd*> for virtio disks and C</dev/xvd*> for "
2556 #: ../src/guestfs.pod:1291
2558 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2559 "Linux kernel to access block devices. We can run a variety of appliances "
2560 "based on a variety of Linux kernels."
2564 #: ../src/guestfs.pod:1295
2566 "This causes a problem for libguestfs because many API calls use device or "
2567 "partition names. Working scripts and the recipe (example) scripts that we "
2568 "make available over the internet could fail if the naming scheme changes."
2572 #: ../src/guestfs.pod:1300
2574 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>. "
2575 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2576 "required. For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2577 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2581 #: ../src/guestfs.pod:1306
2583 "Note that this I<only> applies to parameters. The L</guestfs_list_devices>, "
2584 "L</guestfs_list_partitions> and similar calls return the true names of the "
2585 "devices and partitions as known to the appliance."
2589 #: ../src/guestfs.pod:1311
2590 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
2594 #: ../src/guestfs.pod:1313
2596 "Usually this translation is transparent. However in some (very rare) cases "
2597 "you may need to know the exact algorithm. Such cases include where you use "
2598 "L</guestfs_config> to add a mixture of virtio and IDE devices to the "
2599 "qemu-based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> "
2604 #: ../src/guestfs.pod:1319
2606 "The algorithm is applied only to I<parameters> which are known to be either "
2607 "device or partition names. Return values from functions such as "
2608 "L</guestfs_list_devices> are never changed."
2612 #: ../src/guestfs.pod:1327
2613 msgid "Is the string a parameter which is a device or partition name?"
2617 #: ../src/guestfs.pod:1331
2618 msgid "Does the string begin with C</dev/sd>?"
2622 #: ../src/guestfs.pod:1335
2624 "Does the named device exist? If so, we use that device. However if I<not> "
2625 "then we continue with this algorithm."
2629 #: ../src/guestfs.pod:1340
2630 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
2634 #: ../src/guestfs.pod:1342
2635 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
2639 #: ../src/guestfs.pod:1344
2640 msgid "If that named device exists, use it. If not, continue."
2644 #: ../src/guestfs.pod:1348
2645 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
2649 #: ../src/guestfs.pod:1350
2650 msgid "If that named device exists, use it. If not, return an error."
2654 #: ../src/guestfs.pod:1354
2655 msgid "PORTABILITY CONCERNS"
2659 #: ../src/guestfs.pod:1356
2661 "Although the standard naming scheme and automatic translation is useful for "
2662 "simple programs and guestfish scripts, for larger programs it is best not to "
2663 "rely on this mechanism."
2667 #: ../src/guestfs.pod:1360
2669 "Where possible for maximum future portability programs using libguestfs "
2670 "should use these future-proof techniques:"
2674 #: ../src/guestfs.pod:1367
2676 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
2677 "device names, and then use those names directly."
2681 #: ../src/guestfs.pod:1370
2682 msgid "Since those device names exist by definition, they will never be translated."
2686 #: ../src/guestfs.pod:1375
2688 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
2689 "filesystem labels."
2693 #: ../src/guestfs.pod:1380
2698 #: ../src/guestfs.pod:1382
2699 msgid "COMMUNICATION PROTOCOL"
2703 #: ../src/guestfs.pod:1384
2705 "Don't rely on using this protocol directly. This section documents how it "
2706 "currently works, but it may change at any time."
2710 #: ../src/guestfs.pod:1387
2712 "The protocol used to talk between the library and the daemon running inside "
2713 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
2714 "1014, RFC 1832, RFC 4506)."
2718 #: ../src/guestfs.pod:1391
2720 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
2721 "this file is automatically generated)."
2725 #: ../src/guestfs.pod:1394
2727 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
2728 "and C<FileOut> parameters, which are handled with very simple request/reply "
2729 "messages. Then there are functions that have any C<FileIn> or C<FileOut> "
2730 "parameters, which use the same request and reply messages, but they may also "
2731 "be followed by files sent using a chunked encoding."
2735 #: ../src/guestfs.pod:1401
2736 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
2740 #: ../src/guestfs.pod:1403
2741 msgid "For ordinary functions, the request message is:"
2745 #: ../src/guestfs.pod:1405
2748 " total length (header + arguments,\n"
2749 " but not including the length word itself)\n"
2750 " struct guestfs_message_header (encoded as XDR)\n"
2751 " struct guestfs_<foo>_args (encoded as XDR)\n"
2756 #: ../src/guestfs.pod:1410
2758 "The total length field allows the daemon to allocate a fixed size buffer "
2759 "into which it slurps the rest of the message. As a result, the total length "
2760 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
2761 "effective size of any request is limited to somewhere under this size."
2765 #: ../src/guestfs.pod:1416
2767 "Note also that many functions don't take any arguments, in which case the "
2768 "C<guestfs_I<foo>_args> is completely omitted."
2772 #: ../src/guestfs.pod:1419
2774 "The header contains the procedure number (C<guestfs_proc>) which is how the "
2775 "receiver knows what type of args structure to expect, or none at all."
2779 #: ../src/guestfs.pod:1423
2780 msgid "The reply message for ordinary functions is:"
2784 #: ../src/guestfs.pod:1425
2787 " total length (header + ret,\n"
2788 " but not including the length word itself)\n"
2789 " struct guestfs_message_header (encoded as XDR)\n"
2790 " struct guestfs_<foo>_ret (encoded as XDR)\n"
2795 #: ../src/guestfs.pod:1430
2797 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
2798 "functions that return no formal return values."
2802 #: ../src/guestfs.pod:1433
2803 msgid "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
2807 #: ../src/guestfs.pod:1436
2809 "In the case of an error, a flag is set in the header, and the reply message "
2810 "is slightly changed:"
2814 #: ../src/guestfs.pod:1439
2817 " total length (header + error,\n"
2818 " but not including the length word itself)\n"
2819 " struct guestfs_message_header (encoded as XDR)\n"
2820 " struct guestfs_message_error (encoded as XDR)\n"
2825 #: ../src/guestfs.pod:1444
2827 "The C<guestfs_message_error> structure contains the error message as a "
2832 #: ../src/guestfs.pod:1447
2833 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
2837 #: ../src/guestfs.pod:1449
2839 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest. "
2840 "The normal request message is sent (see above). However this is followed by "
2841 "a sequence of file chunks."
2845 #: ../src/guestfs.pod:1453
2848 " total length (header + arguments,\n"
2849 " but not including the length word itself,\n"
2850 " and not including the chunks)\n"
2851 " struct guestfs_message_header (encoded as XDR)\n"
2852 " struct guestfs_<foo>_args (encoded as XDR)\n"
2853 " sequence of chunks for FileIn param #0\n"
2854 " sequence of chunks for FileIn param #1 etc.\n"
2859 #: ../src/guestfs.pod:1461
2860 msgid "The \"sequence of chunks\" is:"
2864 #: ../src/guestfs.pod:1463
2867 " length of chunk (not including length word itself)\n"
2868 " struct guestfs_chunk (encoded as XDR)\n"
2869 " length of chunk\n"
2870 " struct guestfs_chunk (encoded as XDR)\n"
2872 " length of chunk\n"
2873 " struct guestfs_chunk (with data.data_len == 0)\n"
2878 #: ../src/guestfs.pod:1471
2880 "The final chunk has the C<data_len> field set to zero. Additionally a flag "
2881 "is set in the final chunk to indicate either successful completion or early "
2886 #: ../src/guestfs.pod:1475
2888 "At time of writing there are no functions that have more than one FileIn "
2889 "parameter. However this is (theoretically) supported, by sending the "
2890 "sequence of chunks for each FileIn parameter one after another (from left to "
2895 #: ../src/guestfs.pod:1480
2897 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
2898 "transfer. The library does this by sending a chunk with a special flag set "
2899 "to indicate cancellation. When the daemon sees this, it cancels the whole "
2900 "RPC, does I<not> send any reply, and goes back to reading the next request."
2904 #: ../src/guestfs.pod:1486
2906 "The daemon may also cancel. It does this by writing a special word "
2907 "C<GUESTFS_CANCEL_FLAG> to the socket. The library listens for this during "
2908 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
2909 "cancel chunk). The special word is chosen so that even if cancellation "
2910 "happens right at the end of the transfer (after the library has finished "
2911 "writing and has started listening for the reply), the \"spurious\" cancel "
2912 "flag will not be confused with the reply message."
2916 #: ../src/guestfs.pod:1495
2918 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
2919 "limit), and also files where the size is not known in advance (eg. from "
2920 "pipes or sockets). However the chunks are rather small "
2921 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
2922 "to keep much in memory."
2926 #: ../src/guestfs.pod:1501
2927 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
2931 #: ../src/guestfs.pod:1503
2933 "The protocol for FileOut parameters is exactly the same as for FileIn "
2934 "parameters, but with the roles of daemon and library reversed."
2938 #: ../src/guestfs.pod:1506
2941 " total length (header + ret,\n"
2942 " but not including the length word itself,\n"
2943 " and not including the chunks)\n"
2944 " struct guestfs_message_header (encoded as XDR)\n"
2945 " struct guestfs_<foo>_ret (encoded as XDR)\n"
2946 " sequence of chunks for FileOut param #0\n"
2947 " sequence of chunks for FileOut param #1 etc.\n"
2952 #: ../src/guestfs.pod:1514
2953 msgid "INITIAL MESSAGE"
2957 #: ../src/guestfs.pod:1516
2959 "Because the underlying channel (QEmu -net channel) doesn't have any sort of "
2960 "connection control, when the daemon launches it sends an initial word "
2961 "(C<GUESTFS_LAUNCH_FLAG>) which indicates that the guest and daemon is "
2962 "alive. This is what L</guestfs_launch> waits for."
2966 #: ../src/guestfs.pod:1521
2967 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
2971 #: ../src/guestfs.pod:1523
2973 "All high-level libguestfs actions are synchronous. If you want to use "
2974 "libguestfs asynchronously then you must create a thread."
2978 #: ../src/guestfs.pod:1526
2980 "Only use the handle from a single thread. Either use the handle exclusively "
2981 "from one thread, or provide your own mutex so that two threads cannot issue "
2982 "calls on the same handle at the same time."
2986 #: ../src/guestfs.pod:1530
2987 msgid "QEMU WRAPPERS"
2991 #: ../src/guestfs.pod:1532
2993 "If you want to compile your own qemu, run qemu from a non-standard location, "
2994 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
2999 #: ../src/guestfs.pod:1536
3001 "There is one important rule to remember: you I<must C<exec qemu>> as the "
3002 "last command in the shell script (so that qemu replaces the shell and "
3003 "becomes the direct child of the libguestfs-using program). If you don't do "
3004 "this, then the qemu process won't be cleaned up correctly."
3008 #: ../src/guestfs.pod:1541
3010 "Here is an example of a wrapper, where I have built my own copy of qemu from "
3015 #: ../src/guestfs.pod:1544
3019 " qemudir=/home/rjones/d/qemu\n"
3020 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "
3026 #: ../src/guestfs.pod:1548
3028 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
3029 "then use it by setting the LIBGUESTFS_QEMU environment variable. For "
3034 #: ../src/guestfs.pod:1552
3037 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
3042 #: ../src/guestfs.pod:1554
3044 "Note that libguestfs also calls qemu with the -help and -version options in "
3045 "order to determine features."
3049 #: ../src/guestfs.pod:1557
3050 msgid "LIBGUESTFS VERSION NUMBERS"
3054 #: ../src/guestfs.pod:1559
3056 "Since April 2010, libguestfs has started to make separate development and "
3057 "stable releases, along with corresponding branches in our git repository. "
3058 "These separate releases can be identified by version number:"
3062 #: ../src/guestfs.pod:1564
3065 " even numbers for stable: 1.2.x, 1.4.x, ...\n"
3066 " .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
3072 " | `-------- sub-version\n"
3074 " `------ always '1' because we don't change the ABI\n"
3079 #: ../src/guestfs.pod:1575
3080 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
3084 #: ../src/guestfs.pod:1577
3086 "As time passes we cherry pick fixes from the development branch and backport "
3087 "those into the stable branch, the effect being that the stable branch should "
3088 "get more stable and less buggy over time. So the stable releases are ideal "
3089 "for people who don't need new features but would just like the software to "
3094 #: ../src/guestfs.pod:1583
3095 msgid "Our criteria for backporting changes are:"
3099 #: ../src/guestfs.pod:1589
3101 "Documentation changes which don't affect any code are backported unless the "
3102 "documentation refers to a future feature which is not in stable."
3106 #: ../src/guestfs.pod:1595
3108 "Bug fixes which are not controversial, fix obvious problems, and have been "
3109 "well tested are backported."
3113 #: ../src/guestfs.pod:1600
3115 "Simple rearrangements of code which shouldn't affect how it works get "
3116 "backported. This is so that the code in the two branches doesn't get too "
3117 "far out of step, allowing us to backport future fixes more easily."
3121 #: ../src/guestfs.pod:1606
3123 "We I<don't> backport new features, new APIs, new tools etc, except in one "
3124 "exceptional case: the new feature is required in order to implement an "
3125 "important bug fix."
3129 #: ../src/guestfs.pod:1612
3131 "A new stable branch starts when we think the new features in development are "
3132 "substantial and compelling enough over the current stable branch to warrant "
3133 "it. When that happens we create new stable and development versions 1.N.0 "
3134 "and 1.(N+1).0 [N is even]. The new dot-oh release won't necessarily be so "
3135 "stable at this point, but by backporting fixes from development, that branch "
3136 "will stabilize over time."
3140 #: ../src/guestfs.pod:1620 ../fish/guestfish.pod:905 ../test-tool/libguestfs-test-tool.pod:104 ../tools/virt-edit.pl:312 ../tools/virt-rescue.pl:226
3141 msgid "ENVIRONMENT VARIABLES"
3145 #: ../src/guestfs.pod:1624 ../fish/guestfish.pod:925
3146 msgid "LIBGUESTFS_APPEND"
3150 #: ../src/guestfs.pod:1626 ../fish/guestfish.pod:927
3151 msgid "Pass additional options to the guest kernel."
3155 #: ../src/guestfs.pod:1628 ../fish/guestfish.pod:929
3156 msgid "LIBGUESTFS_DEBUG"
3160 #: ../src/guestfs.pod:1630
3162 "Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the same "
3163 "effect as calling C<guestfs_set_verbose (g, 1)>."
3167 #: ../src/guestfs.pod:1633 ../fish/guestfish.pod:934
3168 msgid "LIBGUESTFS_MEMSIZE"
3172 #: ../src/guestfs.pod:1635 ../fish/guestfish.pod:936
3173 msgid "Set the memory allocated to the qemu process, in megabytes. For example:"
3177 #: ../src/guestfs.pod:1638 ../fish/guestfish.pod:939
3180 " LIBGUESTFS_MEMSIZE=700\n"
3185 #: ../src/guestfs.pod:1640 ../fish/guestfish.pod:941
3186 msgid "LIBGUESTFS_PATH"
3190 #: ../src/guestfs.pod:1642
3192 "Set the path that libguestfs uses to search for kernel and initrd.img. See "
3193 "the discussion of paths in section PATH above."
3197 #: ../src/guestfs.pod:1645 ../fish/guestfish.pod:946
3198 msgid "LIBGUESTFS_QEMU"
3202 #: ../src/guestfs.pod:1647 ../fish/guestfish.pod:948
3204 "Set the default qemu binary that libguestfs uses. If not set, then the qemu "
3205 "which was found at compile time by the configure script is used."
3209 #: ../src/guestfs.pod:1651
3210 msgid "See also L</QEMU WRAPPERS> above."
3214 #: ../src/guestfs.pod:1653 ../fish/guestfish.pod:952
3215 msgid "LIBGUESTFS_TRACE"
3219 #: ../src/guestfs.pod:1655
3221 "Set C<LIBGUESTFS_TRACE=1> to enable command traces. This has the same "
3222 "effect as calling C<guestfs_set_trace (g, 1)>."
3226 #: ../src/guestfs.pod:1658 ../fish/guestfish.pod:961
3231 #: ../src/guestfs.pod:1660 ../fish/guestfish.pod:963
3232 msgid "Location of temporary directory, defaults to C</tmp>."
3236 #: ../src/guestfs.pod:1662 ../fish/guestfish.pod:965
3238 "If libguestfs was compiled to use the supermin appliance then each handle "
3239 "will require rather a large amount of space in this directory for short "
3240 "periods of time (~ 80 MB). You can use C<$TMPDIR> to configure another "
3241 "directory to use in case C</tmp> is not large enough."
3245 #: ../src/guestfs.pod:1670 ../fish/guestfish.pod:1023 ../test-tool/libguestfs-test-tool.pod:109 ../fuse/guestmount.pod:178 ../inspector/virt-inspector.pl:846 ../tools/virt-cat.pl:163 ../tools/virt-df.pl:482 ../tools/virt-edit.pl:325 ../tools/virt-list-filesystems.pl:191 ../tools/virt-list-partitions.pl:229 ../tools/virt-ls.pl:210 ../tools/virt-make-fs.pl:527 ../tools/virt-rescue.pl:231 ../tools/virt-resize.pl:1390 ../tools/virt-tar.pl:257 ../tools/virt-win-reg.pl:461
3250 #: ../src/guestfs.pod:1672
3252 "L<guestfish(1)>, L<guestmount(1)>, L<virt-cat(1)>, L<virt-df(1)>, "
3253 "L<virt-edit(1)>, L<virt-inspector(1)>, L<virt-list-filesystems(1)>, "
3254 "L<virt-list-partitions(1)>, L<virt-ls(1)>, L<virt-make-fs(1)>, "
3255 "L<virt-rescue(1)>, L<virt-tar(1)>, L<virt-win-reg(1)>, L<qemu(1)>, "
3256 "L<febootstrap(1)>, L<hivex(3)>, L<http://libguestfs.org/>."
3260 #: ../src/guestfs.pod:1690
3262 "Tools with a similar purpose: L<fdisk(8)>, L<parted(8)>, L<kpartx(8)>, "
3263 "L<lvm(8)>, L<disktype(1)>."
3267 #: ../src/guestfs.pod:1697 ../tools/virt-make-fs.pl:541 ../tools/virt-win-reg.pl:476
3272 #: ../src/guestfs.pod:1699
3273 msgid "To get a list of bugs against libguestfs use this link:"
3277 #: ../src/guestfs.pod:1701
3278 msgid "L<https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools>"
3282 #: ../src/guestfs.pod:1703
3283 msgid "To report a new bug against libguestfs use this link:"
3287 #: ../src/guestfs.pod:1705
3288 msgid "L<https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools>"
3292 #: ../src/guestfs.pod:1707
3293 msgid "When reporting a bug, please check:"
3297 #: ../src/guestfs.pod:1713
3298 msgid "That the bug hasn't been reported already."
3302 #: ../src/guestfs.pod:1717
3303 msgid "That you are testing a recent version."
3307 #: ../src/guestfs.pod:1721
3308 msgid "Describe the bug accurately, and give a way to reproduce it."
3312 #: ../src/guestfs.pod:1725
3314 "Run libguestfs-test-tool and paste the B<complete, unedited> output into the "
3319 #: ../src/guestfs.pod:1730 ../fish/guestfish.pod:1039 ../test-tool/libguestfs-test-tool.pod:115 ../fuse/guestmount.pod:189 ../inspector/virt-inspector.pl:855
3324 #: ../src/guestfs.pod:1732 ../fish/guestfish.pod:1041 ../test-tool/libguestfs-test-tool.pod:117 ../fuse/guestmount.pod:191
3325 msgid "Richard W.M. Jones (C<rjones at redhat dot com>)"
3329 #: ../src/guestfs.pod:1734 ../fish/guestfish.pod:1043 ../test-tool/libguestfs-test-tool.pod:119 ../fuse/guestmount.pod:193 ../inspector/virt-inspector.pl:861 ../tools/virt-cat.pl:177 ../tools/virt-df.pl:495 ../tools/virt-edit.pl:341 ../tools/virt-list-filesystems.pl:207 ../tools/virt-list-partitions.pl:244 ../tools/virt-ls.pl:225 ../tools/virt-make-fs.pl:556 ../tools/virt-rescue.pl:245 ../tools/virt-resize.pl:1411 ../tools/virt-tar.pl:272 ../tools/virt-win-reg.pl:491
3334 #: ../src/guestfs.pod:1736 ../fish/guestfish.pod:1045
3335 msgid "Copyright (C) 2009-2010 Red Hat Inc. L<http://libguestfs.org/>"
3339 #: ../src/guestfs.pod:1739
3341 "This library is free software; you can redistribute it and/or modify it "
3342 "under the terms of the GNU Lesser General Public License as published by the "
3343 "Free Software Foundation; either version 2 of the License, or (at your "
3344 "option) any later version."
3348 #: ../src/guestfs.pod:1744
3350 "This library is distributed in the hope that it will be useful, but WITHOUT "
3351 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
3352 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
3357 #: ../src/guestfs.pod:1749
3359 "You should have received a copy of the GNU Lesser General Public License "
3360 "along with this library; if not, write to the Free Software Foundation, "
3361 "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
3365 #: ../src/guestfs-actions.pod:1
3366 msgid "guestfs_add_cdrom"
3370 #: ../src/guestfs-actions.pod:3
3373 " int guestfs_add_cdrom (guestfs_h *g,\n"
3374 "\t\tconst char *filename);\n"
3379 #: ../src/guestfs-actions.pod:6 ../fish/guestfish-actions.pod:5
3380 msgid "This function adds a virtual CD-ROM disk image to the guest."
3384 #: ../src/guestfs-actions.pod:8 ../fish/guestfish-actions.pod:7
3385 msgid "This is equivalent to the qemu parameter C<-cdrom filename>."
3389 #: ../src/guestfs-actions.pod:10 ../src/guestfs-actions.pod:1488 ../fish/guestfish-actions.pod:9 ../fish/guestfish-actions.pod:1186
3394 #: ../src/guestfs-actions.pod:16
3396 "This call checks for the existence of C<filename>. This stops you from "
3397 "specifying other types of drive which are supported by qemu such as C<nbd:> "
3398 "and C<http:> URLs. To specify those, use the general C<guestfs_config> call "
3403 #: ../src/guestfs-actions.pod:23
3405 "If you just want to add an ISO file (often you use this as an efficient way "
3406 "to transfer large files into the guest), then you should probably use "
3407 "C<guestfs_add_drive_ro> instead."
3411 #: ../src/guestfs-actions.pod:29 ../src/guestfs-actions.pod:63 ../src/guestfs-actions.pod:92 ../src/guestfs-actions.pod:103 ../src/guestfs-actions.pod:114 ../src/guestfs-actions.pod:124 ../src/guestfs-actions.pod:135 ../src/guestfs-actions.pod:238 ../src/guestfs-actions.pod:255 ../src/guestfs-actions.pod:266 ../src/guestfs-actions.pod:302 ../src/guestfs-actions.pod:324 ../src/guestfs-actions.pod:339 ../src/guestfs-actions.pod:403 ../src/guestfs-actions.pod:430 ../src/guestfs-actions.pod:441 ../src/guestfs-actions.pod:453 ../src/guestfs-actions.pod:534 ../src/guestfs-actions.pod:549 ../src/guestfs-actions.pod:560 ../src/guestfs-actions.pod:571 ../src/guestfs-actions.pod:717 ../src/guestfs-actions.pod:734 ../src/guestfs-actions.pod:749 ../src/guestfs-actions.pod:824 ../src/guestfs-actions.pod:839 ../src/guestfs-actions.pod:855 ../src/guestfs-actions.pod:866 ../src/guestfs-actions.pod:883 ../src/guestfs-actions.pod:916 ../src/guestfs-actions.pod:974 ../src/guestfs-actions.pod:996 ../src/guestfs-actions.pod:1027 ../src/guestfs-actions.pod:1115 ../src/guestfs-actions.pod:1146 ../src/guestfs-actions.pod:1346 ../src/guestfs-actions.pod:1365 ../src/guestfs-actions.pod:1446 ../src/guestfs-actions.pod:1794 ../src/guestfs-actions.pod:1917 ../src/guestfs-actions.pod:1972 ../src/guestfs-actions.pod:2002 ../src/guestfs-actions.pod:2349 ../src/guestfs-actions.pod:2361 ../src/guestfs-actions.pod:2378 ../src/guestfs-actions.pod:2443 ../src/guestfs-actions.pod:2454 ../src/guestfs-actions.pod:2464 ../src/guestfs-actions.pod:2475 ../src/guestfs-actions.pod:2487 ../src/guestfs-actions.pod:2517 ../src/guestfs-actions.pod:2581 ../src/guestfs-actions.pod:2598 ../src/guestfs-actions.pod:2612 ../src/guestfs-actions.pod:2632 ../src/guestfs-actions.pod:2652 ../src/guestfs-actions.pod:2681 ../src/guestfs-actions.pod:2697 ../src/guestfs-actions.pod:2713 ../src/guestfs-actions.pod:2725 ../src/guestfs-actions.pod:2734 ../src/guestfs-actions.pod:2767 ../src/guestfs-actions.pod:2780 ../src/guestfs-actions.pod:2790 ../src/guestfs-actions.pod:2802 ../src/guestfs-actions.pod:2816 ../src/guestfs-actions.pod:2896 ../src/guestfs-actions.pod:2913 ../src/guestfs-actions.pod:2923 ../src/guestfs-actions.pod:2968 ../src/guestfs-actions.pod:2983 ../src/guestfs-actions.pod:2998 ../src/guestfs-actions.pod:3011 ../src/guestfs-actions.pod:3022 ../src/guestfs-actions.pod:3033 ../src/guestfs-actions.pod:3047 ../src/guestfs-actions.pod:3059 ../src/guestfs-actions.pod:3076 ../src/guestfs-actions.pod:3107 ../src/guestfs-actions.pod:3135 ../src/guestfs-actions.pod:3151 ../src/guestfs-actions.pod:3167 ../src/guestfs-actions.pod:3176 ../src/guestfs-actions.pod:3190 ../src/guestfs-actions.pod:3200 ../src/guestfs-actions.pod:3212 ../src/guestfs-actions.pod:3224 ../src/guestfs-actions.pod:3256 ../src/guestfs-actions.pod:3268 ../src/guestfs-actions.pod:3285 ../src/guestfs-actions.pod:3296 ../src/guestfs-actions.pod:3310 ../src/guestfs-actions.pod:3350 ../src/guestfs-actions.pod:3381 ../src/guestfs-actions.pod:3392 ../src/guestfs-actions.pod:3417 ../src/guestfs-actions.pod:3431 ../src/guestfs-actions.pod:3446 ../src/guestfs-actions.pod:3568 ../src/guestfs-actions.pod:3620 ../src/guestfs-actions.pod:3639 ../src/guestfs-actions.pod:3654 ../src/guestfs-actions.pod:3665 ../src/guestfs-actions.pod:3699 ../src/guestfs-actions.pod:3713 ../src/guestfs-actions.pod:3723 ../src/guestfs-actions.pod:3734 ../src/guestfs-actions.pod:3966 ../src/guestfs-actions.pod:3982 ../src/guestfs-actions.pod:3993 ../src/guestfs-actions.pod:4002 ../src/guestfs-actions.pod:4013 ../src/guestfs-actions.pod:4022 ../src/guestfs-actions.pod:4033 ../src/guestfs-actions.pod:4046 ../src/guestfs-actions.pod:4064 ../src/guestfs-actions.pod:4080 ../src/guestfs-actions.pod:4096 ../src/guestfs-actions.pod:4111 ../src/guestfs-actions.pod:4131 ../src/guestfs-actions.pod:4146 ../src/guestfs-actions.pod:4162 ../src/guestfs-actions.pod:4180 ../src/guestfs-actions.pod:4196 ../src/guestfs-actions.pod:4210 ../src/guestfs-actions.pod:4235 ../src/guestfs-actions.pod:4256 ../src/guestfs-actions.pod:4272 ../src/guestfs-actions.pod:4293 ../src/guestfs-actions.pod:4305 ../src/guestfs-actions.pod:4317 ../src/guestfs-actions.pod:4333 ../src/guestfs-actions.pod:4367 ../src/guestfs-actions.pod:4387 ../src/guestfs-actions.pod:4410 ../src/guestfs-actions.pod:4500 ../src/guestfs-actions.pod:4606 ../src/guestfs-actions.pod:4615 ../src/guestfs-actions.pod:4625 ../src/guestfs-actions.pod:4635 ../src/guestfs-actions.pod:4654 ../src/guestfs-actions.pod:4664 ../src/guestfs-actions.pod:4674 ../src/guestfs-actions.pod:4684 ../src/guestfs-actions.pod:4696 ../src/guestfs-actions.pod:4746 ../src/guestfs-actions.pod:4760 ../src/guestfs-actions.pod:4773 ../src/guestfs-actions.pod:4786 ../src/guestfs-actions.pod:4800 ../src/guestfs-actions.pod:4810 ../src/guestfs-actions.pod:4827 ../src/guestfs-actions.pod:4857 ../src/guestfs-actions.pod:4868 ../src/guestfs-actions.pod:4903 ../src/guestfs-actions.pod:4913 ../src/guestfs-actions.pod:4928 ../src/guestfs-actions.pod:4956 ../src/guestfs-actions.pod:5060 ../src/guestfs-actions.pod:5075 ../src/guestfs-actions.pod:5086 ../src/guestfs-actions.pod:5132 ../src/guestfs-actions.pod:5142 ../src/guestfs-actions.pod:5179 ../src/guestfs-actions.pod:5206 ../src/guestfs-actions.pod:5248 ../src/guestfs-actions.pod:5271 ../src/guestfs-actions.pod:5328 ../src/guestfs-actions.pod:5344 ../src/guestfs-actions.pod:5370
3412 msgid "This function returns 0 on success or -1 on error."
3416 #: ../src/guestfs-actions.pod:31
3417 msgid "guestfs_add_drive"
3421 #: ../src/guestfs-actions.pod:33
3424 " int guestfs_add_drive (guestfs_h *g,\n"
3425 "\t\tconst char *filename);\n"
3430 #: ../src/guestfs-actions.pod:36 ../fish/guestfish-actions.pod:32
3432 "This function adds a virtual machine disk image C<filename> to the guest. "
3433 "The first time you call this function, the disk appears as IDE disk 0 "
3434 "(C</dev/sda>) in the guest, the second time as C</dev/sdb>, and so on."
3438 #: ../src/guestfs-actions.pod:41 ../fish/guestfish-actions.pod:37
3440 "You don't necessarily need to be root when using libguestfs. However you "
3441 "obviously do need sufficient permissions to access the filename for whatever "
3442 "operations you want to perform (ie. read access if you just want to read the "
3443 "image or write access if you want to modify the image)."
3447 #: ../src/guestfs-actions.pod:47 ../fish/guestfish-actions.pod:43
3449 "This is equivalent to the qemu parameter C<-drive "
3450 "file=filename,cache=off,if=...>."
3454 #: ../src/guestfs-actions.pod:50 ../fish/guestfish-actions.pod:46
3456 "C<cache=off> is omitted in cases where it is not supported by the underlying "
3461 #: ../src/guestfs-actions.pod:53 ../src/guestfs-actions.pod:82
3463 "C<if=...> is set at compile time by the configuration option C<./configure "
3464 "--with-drive-if=...>. In the rare case where you might need to change this "
3465 "at run time, use C<guestfs_add_drive_with_if> or "
3466 "C<guestfs_add_drive_ro_with_if>."
3470 #: ../src/guestfs-actions.pod:58 ../src/guestfs-actions.pod:87
3472 "Note that this call checks for the existence of C<filename>. This stops you "
3473 "from specifying other types of drive which are supported by qemu such as "
3474 "C<nbd:> and C<http:> URLs. To specify those, use the general "
3475 "C<guestfs_config> call instead."
3479 #: ../src/guestfs-actions.pod:65
3480 msgid "guestfs_add_drive_ro"
3484 #: ../src/guestfs-actions.pod:67
3487 " int guestfs_add_drive_ro (guestfs_h *g,\n"
3488 "\t\tconst char *filename);\n"
3493 #: ../src/guestfs-actions.pod:70 ../fish/guestfish-actions.pod:63
3494 msgid "This adds a drive in snapshot mode, making it effectively read-only."
3498 #: ../src/guestfs-actions.pod:73 ../fish/guestfish-actions.pod:66
3500 "Note that writes to the device are allowed, and will be seen for the "
3501 "duration of the guestfs handle, but they are written to a temporary file "
3502 "which is discarded as soon as the guestfs handle is closed. We don't "
3503 "currently have any method to enable changes to be committed, although qemu "
3508 #: ../src/guestfs-actions.pod:79 ../fish/guestfish-actions.pod:72
3510 "This is equivalent to the qemu parameter C<-drive "
3511 "file=filename,snapshot=on,if=...>."
3515 #: ../src/guestfs-actions.pod:94
3516 msgid "guestfs_add_drive_ro_with_if"
3520 #: ../src/guestfs-actions.pod:96
3523 " int guestfs_add_drive_ro_with_if (guestfs_h *g,\n"
3524 "\t\tconst char *filename,\n"
3525 "\t\tconst char *iface);\n"
3530 #: ../src/guestfs-actions.pod:100
3532 "This is the same as C<guestfs_add_drive_ro> but it allows you to specify the "
3533 "QEMU interface emulation to use at run time."
3537 #: ../src/guestfs-actions.pod:105
3538 msgid "guestfs_add_drive_with_if"
3542 #: ../src/guestfs-actions.pod:107
3545 " int guestfs_add_drive_with_if (guestfs_h *g,\n"
3546 "\t\tconst char *filename,\n"
3547 "\t\tconst char *iface);\n"
3552 #: ../src/guestfs-actions.pod:111
3554 "This is the same as C<guestfs_add_drive> but it allows you to specify the "
3555 "QEMU interface emulation to use at run time."
3559 #: ../src/guestfs-actions.pod:116
3560 msgid "guestfs_aug_clear"
3564 #: ../src/guestfs-actions.pod:118
3567 " int guestfs_aug_clear (guestfs_h *g,\n"
3568 "\t\tconst char *augpath);\n"
3573 #: ../src/guestfs-actions.pod:121 ../fish/guestfish-actions.pod:103
3575 "Set the value associated with C<path> to C<NULL>. This is the same as the "
3576 "L<augtool(1)> C<clear> command."
3580 #: ../src/guestfs-actions.pod:126
3581 msgid "guestfs_aug_close"
3585 #: ../src/guestfs-actions.pod:128
3588 " int guestfs_aug_close (guestfs_h *g);\n"
3593 #: ../src/guestfs-actions.pod:130
3595 "Close the current Augeas handle and free up any resources used by it. After "
3596 "calling this, you have to call C<guestfs_aug_init> again before you can use "
3597 "any other Augeas functions."
3601 #: ../src/guestfs-actions.pod:137
3602 msgid "guestfs_aug_defnode"
3606 #: ../src/guestfs-actions.pod:139
3609 " struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,\n"
3610 "\t\tconst char *name,\n"
3611 "\t\tconst char *expr,\n"
3612 "\t\tconst char *val);\n"
3617 #: ../src/guestfs-actions.pod:144 ../fish/guestfish-actions.pod:119
3618 msgid "Defines a variable C<name> whose value is the result of evaluating C<expr>."
3622 #: ../src/guestfs-actions.pod:147
3624 "If C<expr> evaluates to an empty nodeset, a node is created, equivalent to "
3625 "calling C<guestfs_aug_set> C<expr>, C<value>. C<name> will be the nodeset "
3626 "containing that single node."
3630 #: ../src/guestfs-actions.pod:151 ../fish/guestfish-actions.pod:126
3632 "On success this returns a pair containing the number of nodes in the "
3633 "nodeset, and a boolean flag if a node was created."
3637 #: ../src/guestfs-actions.pod:155
3639 "This function returns a C<struct guestfs_int_bool *>, or NULL if there was "
3640 "an error. I<The caller must call C<guestfs_free_int_bool> after use>."
3644 #: ../src/guestfs-actions.pod:159
3645 msgid "guestfs_aug_defvar"
3649 #: ../src/guestfs-actions.pod:161
3652 " int guestfs_aug_defvar (guestfs_h *g,\n"
3653 "\t\tconst char *name,\n"
3654 "\t\tconst char *expr);\n"
3659 #: ../src/guestfs-actions.pod:165 ../fish/guestfish-actions.pod:134
3661 "Defines an Augeas variable C<name> whose value is the result of evaluating "
3662 "C<expr>. If C<expr> is NULL, then C<name> is undefined."
3666 #: ../src/guestfs-actions.pod:169 ../fish/guestfish-actions.pod:138
3668 "On success this returns the number of nodes in C<expr>, or C<0> if C<expr> "
3669 "evaluates to something which is not a nodeset."
3673 #: ../src/guestfs-actions.pod:172 ../src/guestfs-actions.pod:313 ../src/guestfs-actions.pod:467 ../src/guestfs-actions.pod:492 ../src/guestfs-actions.pod:507 ../src/guestfs-actions.pod:523 ../src/guestfs-actions.pod:1013 ../src/guestfs-actions.pod:1328 ../src/guestfs-actions.pod:1510 ../src/guestfs-actions.pod:1591 ../src/guestfs-actions.pod:1622 ../src/guestfs-actions.pod:1665 ../src/guestfs-actions.pod:1682 ../src/guestfs-actions.pod:1907 ../src/guestfs-actions.pod:2119 ../src/guestfs-actions.pod:2137 ../src/guestfs-actions.pod:3370 ../src/guestfs-actions.pod:3477 ../src/guestfs-actions.pod:3793 ../src/guestfs-actions.pod:4892 ../src/guestfs-actions.pod:5216 ../src/guestfs-actions.pod:5226 ../src/guestfs-actions.pod:5236
3674 msgid "On error this function returns -1."
3678 #: ../src/guestfs-actions.pod:174
3679 msgid "guestfs_aug_get"
3683 #: ../src/guestfs-actions.pod:176
3686 " char *guestfs_aug_get (guestfs_h *g,\n"
3687 "\t\tconst char *augpath);\n"
3692 #: ../src/guestfs-actions.pod:179 ../fish/guestfish-actions.pod:145
3694 "Look up the value associated with C<path>. If C<path> matches exactly one "
3695 "node, the C<value> is returned."
3699 #: ../src/guestfs-actions.pod:182 ../src/guestfs-actions.pod:610 ../src/guestfs-actions.pod:625 ../src/guestfs-actions.pod:682 ../src/guestfs-actions.pod:695 ../src/guestfs-actions.pod:786 ../src/guestfs-actions.pod:899 ../src/guestfs-actions.pod:928 ../src/guestfs-actions.pod:942 ../src/guestfs-actions.pod:958 ../src/guestfs-actions.pod:1041 ../src/guestfs-actions.pod:1205 ../src/guestfs-actions.pod:1314 ../src/guestfs-actions.pod:1459 ../src/guestfs-actions.pod:1473 ../src/guestfs-actions.pod:1549 ../src/guestfs-actions.pod:1567 ../src/guestfs-actions.pod:1701 ../src/guestfs-actions.pod:1840 ../src/guestfs-actions.pod:2021 ../src/guestfs-actions.pod:2071 ../src/guestfs-actions.pod:2187 ../src/guestfs-actions.pod:2222 ../src/guestfs-actions.pod:2432 ../src/guestfs-actions.pod:2853 ../src/guestfs-actions.pod:2949 ../src/guestfs-actions.pod:3492 ../src/guestfs-actions.pod:3771 ../src/guestfs-actions.pod:3909 ../src/guestfs-actions.pod:3952 ../src/guestfs-actions.pod:4428 ../src/guestfs-actions.pod:4441 ../src/guestfs-actions.pod:4455 ../src/guestfs-actions.pod:4476 ../src/guestfs-actions.pod:5009 ../src/guestfs-actions.pod:5025 ../src/guestfs-actions.pod:5040 ../src/guestfs-actions.pod:5188 ../src/guestfs-actions.pod:5418
3701 "This function returns a string, or NULL on error. I<The caller must free "
3702 "the returned string after use>."
3706 #: ../src/guestfs-actions.pod:185
3707 msgid "guestfs_aug_init"
3711 #: ../src/guestfs-actions.pod:187
3714 " int guestfs_aug_init (guestfs_h *g,\n"
3715 "\t\tconst char *root,\n"
3721 #: ../src/guestfs-actions.pod:191 ../fish/guestfish-actions.pod:152
3723 "Create a new Augeas handle for editing configuration files. If there was "
3724 "any previous Augeas handle associated with this guestfs session, then it is "
3729 #: ../src/guestfs-actions.pod:195
3730 msgid "You must call this before using any other C<guestfs_aug_*> commands."
3734 #: ../src/guestfs-actions.pod:198 ../fish/guestfish-actions.pod:159
3735 msgid "C<root> is the filesystem root. C<root> must not be NULL, use C</> instead."
3739 #: ../src/guestfs-actions.pod:201 ../fish/guestfish-actions.pod:162
3741 "The flags are the same as the flags defined in E<lt>augeas.hE<gt>, the "
3742 "logical I<or> of the following integers:"
3746 #: ../src/guestfs-actions.pod:207 ../fish/guestfish-actions.pod:168
3747 msgid "C<AUG_SAVE_BACKUP> = 1"
3751 #: ../src/guestfs-actions.pod:209 ../fish/guestfish-actions.pod:170
3752 msgid "Keep the original file with a C<.augsave> extension."
3756 #: ../src/guestfs-actions.pod:211 ../fish/guestfish-actions.pod:172
3757 msgid "C<AUG_SAVE_NEWFILE> = 2"
3761 #: ../src/guestfs-actions.pod:213 ../fish/guestfish-actions.pod:174
3763 "Save changes into a file with extension C<.augnew>, and do not overwrite "
3764 "original. Overrides C<AUG_SAVE_BACKUP>."
3768 #: ../src/guestfs-actions.pod:216 ../fish/guestfish-actions.pod:177
3769 msgid "C<AUG_TYPE_CHECK> = 4"
3773 #: ../src/guestfs-actions.pod:218 ../fish/guestfish-actions.pod:179
3774 msgid "Typecheck lenses (can be expensive)."
3778 #: ../src/guestfs-actions.pod:220 ../fish/guestfish-actions.pod:181
3779 msgid "C<AUG_NO_STDINC> = 8"
3783 #: ../src/guestfs-actions.pod:222 ../fish/guestfish-actions.pod:183
3784 msgid "Do not use standard load path for modules."
3788 #: ../src/guestfs-actions.pod:224 ../fish/guestfish-actions.pod:185
3789 msgid "C<AUG_SAVE_NOOP> = 16"
3793 #: ../src/guestfs-actions.pod:226 ../fish/guestfish-actions.pod:187
3794 msgid "Make save a no-op, just record what would have been changed."
3798 #: ../src/guestfs-actions.pod:228 ../fish/guestfish-actions.pod:189
3799 msgid "C<AUG_NO_LOAD> = 32"
3803 #: ../src/guestfs-actions.pod:230
3804 msgid "Do not load the tree in C<guestfs_aug_init>."
3808 #: ../src/guestfs-actions.pod:234
3809 msgid "To close the handle, you can call C<guestfs_aug_close>."
3813 #: ../src/guestfs-actions.pod:236 ../fish/guestfish-actions.pod:197
3814 msgid "To find out more about Augeas, see L<http://augeas.net/>."
3818 #: ../src/guestfs-actions.pod:240
3819 msgid "guestfs_aug_insert"
3823 #: ../src/guestfs-actions.pod:242
3826 " int guestfs_aug_insert (guestfs_h *g,\n"