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.7.0\n"
10 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
11 "POT-Creation-Date: 2010-11-02 16:23+0000\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:31 ../tools/virt-edit.pl:30 ../tools/virt-win-reg.pl:33 ../tools/virt-df.pl:32 ../tools/virt-ls.pl:30 ../tools/virt-resize.pl:38 ../tools/virt-list-filesystems.pl:28 ../tools/virt-cat.pl:29 ../tools/virt-tar.pl:29 ../tools/virt-rescue.pl:29 ../tools/virt-make-fs.pl:33 ../tools/virt-list-partitions.pl:28
25 #: ../src/guestfs.pod:3 ../fish/guestfish.pod:3 ../test-tool/libguestfs-test-tool.pod:3 ../fuse/guestmount.pod:3 ../inspector/virt-inspector.pl:33 ../tools/virt-edit.pl:32 ../tools/virt-win-reg.pl:35 ../tools/virt-df.pl:34 ../tools/virt-ls.pl:32 ../tools/virt-resize.pl:40 ../tools/virt-list-filesystems.pl:30 ../tools/virt-cat.pl:31 ../tools/virt-tar.pl:31 ../tools/virt-rescue.pl:31 ../tools/virt-make-fs.pl:35 ../tools/virt-list-partitions.pl:30
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:37 ../tools/virt-edit.pl:36 ../tools/virt-win-reg.pl:39 ../tools/virt-df.pl:38 ../tools/virt-ls.pl:36 ../tools/virt-resize.pl:44 ../tools/virt-list-filesystems.pl:34 ../tools/virt-cat.pl:35 ../tools/virt-tar.pl:35 ../tools/virt-rescue.pl:35 ../tools/virt-make-fs.pl:39 ../tools/virt-list-partitions.pl:34
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:30 ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:20 ../inspector/virt-inspector.pl:43 ../tools/virt-edit.pl:50 ../tools/virt-win-reg.pl:63 ../tools/virt-df.pl:46 ../tools/virt-ls.pl:42 ../tools/virt-resize.pl:50 ../tools/virt-list-filesystems.pl:40 ../tools/virt-cat.pl:41 ../tools/virt-tar.pl:72 ../tools/virt-rescue.pl:51 ../tools/virt-make-fs.pl:47 ../tools/virt-list-partitions.pl:40
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 "PHP, Haskell or C#). You can also use it from shell scripts or the command "
115 #: ../src/guestfs.pod:49
117 "You don't need to be root to use libguestfs, although obviously you do need "
118 "enough permissions to access the disk images."
122 #: ../src/guestfs.pod:52
124 "Libguestfs is a large API because it can do many things. For a gentle "
125 "introduction, please read the L</API OVERVIEW> section next."
129 #: ../src/guestfs.pod:55
134 #: ../src/guestfs.pod:57
136 "This section provides a gentler overview of the libguestfs API. We also try "
137 "to group API calls together, where that may not be obvious from reading "
138 "about the individual calls in the main section of this manual."
142 #: ../src/guestfs.pod:62
147 #: ../src/guestfs.pod:64
149 "Before you can use libguestfs calls, you have to create a handle. Then you "
150 "must add at least one disk image to the handle, followed by launching the "
151 "handle, then performing whatever operations you want, and finally closing "
152 "the handle. By convention we use the single letter C<g> for the name of the "
153 "handle variable, although of course you can use any name you want."
157 #: ../src/guestfs.pod:71
158 msgid "The general structure of all libguestfs-using programs looks like this:"
162 #: ../src/guestfs.pod:74
165 " guestfs_h *g = guestfs_create ();\n"
170 #: ../src/guestfs.pod:76
173 " /* Call guestfs_add_drive additional times if there are\n"
174 " * multiple disk images.\n"
176 " guestfs_add_drive (g, \"guest.img\");\n"
181 #: ../src/guestfs.pod:81
184 " /* Most manipulation calls won't work until you've launched\n"
185 " * the handle 'g'. You have to do this _after_ adding drives\n"
186 " * and _before_ other commands.\n"
188 " guestfs_launch (g);\n"
193 #: ../src/guestfs.pod:87
196 " /* Now you can examine what partitions, LVs etc are available.\n"
198 " char **partitions = guestfs_list_partitions (g);\n"
199 " char **logvols = guestfs_lvs (g);\n"
204 #: ../src/guestfs.pod:92
207 " /* To access a filesystem in the image, you must mount it.\n"
209 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
214 #: ../src/guestfs.pod:96
217 " /* Now you can perform filesystem actions on the guest\n"
220 " guestfs_touch (g, \"/hello\");\n"
225 #: ../src/guestfs.pod:101
228 " /* You only need to call guestfs_sync if you have made\n"
229 " * changes to the guest image. (But if you've made changes\n"
230 " * then you *must* sync). See also: guestfs_umount and\n"
231 " * guestfs_umount_all calls.\n"
233 " guestfs_sync (g);\n"
238 #: ../src/guestfs.pod:108
241 " /* Close the handle 'g'. */\n"
242 " guestfs_close (g);\n"
247 #: ../src/guestfs.pod:111
249 "The code above doesn't include any error checking. In real code you should "
250 "check return values carefully for errors. In general all functions that "
251 "return integers return C<-1> on error, and all functions that return "
252 "pointers return C<NULL> on error. See section L</ERROR HANDLING> below for "
253 "how to handle errors, and consult the documentation for each function call "
254 "below to see precisely how they return error indications."
258 #: ../src/guestfs.pod:119
263 #: ../src/guestfs.pod:121
265 "The image filename (C<\"guest.img\"> in the example above) could be a disk "
266 "image from a virtual machine, a L<dd(1)> copy of a physical hard disk, an "
267 "actual block device, or simply an empty file of zeroes that you have created "
268 "through L<posix_fallocate(3)>. Libguestfs lets you do useful things to all "
273 #: ../src/guestfs.pod:127
275 "The call you should use in modern code for adding drives is "
276 "L</guestfs_add_drive_opts>. To add a disk image, allowing writes, and "
277 "specifying that the format is raw, do:"
281 #: ../src/guestfs.pod:131
284 " guestfs_add_drive_opts (g, filename,\n"
285 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
291 #: ../src/guestfs.pod:135
292 msgid "You can add a disk read-only using:"
296 #: ../src/guestfs.pod:137
299 " guestfs_add_drive_opts (g, filename,\n"
300 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
301 " GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
307 #: ../src/guestfs.pod:142
309 "or by calling the older function L</guestfs_add_drive_ro>. In either case "
310 "libguestfs won't modify the file."
314 #: ../src/guestfs.pod:145
316 "Be extremely cautious if the disk image is in use, eg. if it is being used "
317 "by a virtual machine. Adding it read-write will almost certainly cause disk "
318 "corruption, but adding it read-only is safe."
322 #: ../src/guestfs.pod:149
324 "You must add at least one disk image, and you may add multiple disk images. "
325 "In the API, the disk images are usually referred to as C</dev/sda> (for the "
326 "first one you added), C</dev/sdb> (for the second one you added), etc."
330 #: ../src/guestfs.pod:154
332 "Once L</guestfs_launch> has been called you cannot add any more images. You "
333 "can call L</guestfs_list_devices> to get a list of the device names, in the "
334 "order that you added them. See also L</BLOCK DEVICE NAMING> below."
338 #: ../src/guestfs.pod:159
343 #: ../src/guestfs.pod:161
345 "Before you can read or write files, create directories and so on in a disk "
346 "image that contains filesystems, you have to mount those filesystems using "
347 "L</guestfs_mount>. If you already know that a disk image contains (for "
348 "example) one partition with a filesystem on that partition, then you can "
353 #: ../src/guestfs.pod:167
356 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
361 #: ../src/guestfs.pod:169
363 "where C</dev/sda1> means literally the first partition (C<1>) of the first "
364 "disk image that we added (C</dev/sda>). If the disk contains Linux LVM2 "
365 "logical volumes you could refer to those instead (eg. C</dev/VG/LV>)."
369 #: ../src/guestfs.pod:173
371 "If you are given a disk image and you don't know what it contains then you "
372 "have to find out. Libguestfs can do that too: use "
373 "L</guestfs_list_partitions> and L</guestfs_lvs> to list possible partitions "
374 "and LVs, and either try mounting each to see what is mountable, or else "
375 "examine them with L</guestfs_vfs_type> or L</guestfs_file>. Libguestfs also "
376 "has a set of APIs for inspection of disk images (see L</INSPECTION> below). "
377 "But you might find it easier to look at higher level programs built on top "
378 "of libguestfs, in particular L<virt-inspector(1)>."
382 #: ../src/guestfs.pod:183
384 "To mount a disk image read-only, use L</guestfs_mount_ro>. There are "
385 "several other variations of the C<guestfs_mount_*> call."
389 #: ../src/guestfs.pod:186
390 msgid "FILESYSTEM ACCESS AND MODIFICATION"
394 #: ../src/guestfs.pod:188
396 "The majority of the libguestfs API consists of fairly low-level calls for "
397 "accessing and modifying the files, directories, symlinks etc on mounted "
398 "filesystems. There are over a hundred such calls which you can find listed "
399 "in detail below in this man page, and we don't even pretend to cover them "
400 "all in this overview."
404 #: ../src/guestfs.pod:194
406 "Specify filenames as full paths, starting with C<\"/\"> and including the "
411 #: ../src/guestfs.pod:197
413 "For example, if you mounted a filesystem at C<\"/\"> and you want to read "
414 "the file called C<\"etc/passwd\"> then you could do:"
418 #: ../src/guestfs.pod:200
421 " char *data = guestfs_cat (g, \"/etc/passwd\");\n"
426 #: ../src/guestfs.pod:202
428 "This would return C<data> as a newly allocated buffer containing the full "
429 "content of that file (with some conditions: see also L</DOWNLOADING> below), "
430 "or C<NULL> if there was an error."
434 #: ../src/guestfs.pod:206
436 "As another example, to create a top-level directory on that filesystem "
437 "called C<\"var\"> you would do:"
441 #: ../src/guestfs.pod:209
444 " guestfs_mkdir (g, \"/var\");\n"
449 #: ../src/guestfs.pod:211
450 msgid "To create a symlink you could do:"
454 #: ../src/guestfs.pod:213
457 " guestfs_ln_s (g, \"/etc/init.d/portmap\",\n"
458 " \"/etc/rc3.d/S30portmap\");\n"
463 #: ../src/guestfs.pod:216
465 "Libguestfs will reject attempts to use relative paths and there is no "
466 "concept of a current working directory."
470 #: ../src/guestfs.pod:219
472 "Libguestfs can return errors in many situations: for example if the "
473 "filesystem isn't writable, or if a file or directory that you requested "
474 "doesn't exist. If you are using the C API (documented here) you have to "
475 "check for those error conditions after each call. (Other language bindings "
476 "turn these errors into exceptions)."
480 #: ../src/guestfs.pod:225
482 "File writes are affected by the per-handle umask, set by calling "
483 "L</guestfs_umask> and defaulting to 022. See L</UMASK>."
487 #: ../src/guestfs.pod:228
492 #: ../src/guestfs.pod:230
494 "Libguestfs contains API calls to read, create and modify partition tables on "
499 #: ../src/guestfs.pod:233
501 "In the common case where you want to create a single partition covering the "
502 "whole disk, you should use the L</guestfs_part_disk> call:"
506 #: ../src/guestfs.pod:237
509 " const char *parttype = \"mbr\";\n"
510 " if (disk_is_larger_than_2TB)\n"
511 " parttype = \"gpt\";\n"
512 " guestfs_part_disk (g, \"/dev/sda\", parttype);\n"
517 #: ../src/guestfs.pod:242
519 "Obviously this effectively wipes anything that was on that disk image "
524 #: ../src/guestfs.pod:245
529 #: ../src/guestfs.pod:247
531 "Libguestfs provides access to a large part of the LVM2 API, such as "
532 "L</guestfs_lvcreate> and L</guestfs_vgremove>. It won't make much sense "
533 "unless you familiarize yourself with the concepts of physical volumes, "
534 "volume groups and logical volumes."
538 #: ../src/guestfs.pod:252
540 "This author strongly recommends reading the LVM HOWTO, online at "
541 "L<http://tldp.org/HOWTO/LVM-HOWTO/>."
545 #: ../src/guestfs.pod:255
550 #: ../src/guestfs.pod:257
552 "Use L</guestfs_cat> to download small, text only files. This call is "
553 "limited to files which are less than 2 MB and which cannot contain any ASCII "
554 "NUL (C<\\0>) characters. However it has a very simple to use API."
558 #: ../src/guestfs.pod:262
560 "L</guestfs_read_file> can be used to read files which contain arbitrary 8 "
561 "bit data, since it returns a (pointer, size) pair. However it is still "
562 "limited to \"small\" files, less than 2 MB."
566 #: ../src/guestfs.pod:266
568 "L</guestfs_download> can be used to download any file, with no limits on "
569 "content or size (even files larger than 4 GB)."
573 #: ../src/guestfs.pod:269
574 msgid "To download multiple files, see L</guestfs_tar_out> and L</guestfs_tgz_out>."
578 #: ../src/guestfs.pod:272
583 #: ../src/guestfs.pod:274
585 "It's often the case that you want to write a file or files to the disk "
590 #: ../src/guestfs.pod:277
592 "To write a small file with fixed content, use L</guestfs_write>. To create "
593 "a file of all zeroes, use L</guestfs_truncate_size> (sparse) or "
594 "L</guestfs_fallocate64> (with all disk blocks allocated). There are a "
595 "variety of other functions for creating test files, for example "
596 "L</guestfs_fill> and L</guestfs_fill_pattern>."
600 #: ../src/guestfs.pod:283
602 "To upload a single file, use L</guestfs_upload>. This call has no limits on "
603 "file content or size (even files larger than 4 GB)."
607 #: ../src/guestfs.pod:286
608 msgid "To upload multiple files, see L</guestfs_tar_in> and L</guestfs_tgz_in>."
612 #: ../src/guestfs.pod:288
614 "However the fastest way to upload I<large numbers of arbitrary files> is to "
615 "turn them into a squashfs or CD ISO (see L<mksquashfs(8)> and "
616 "L<mkisofs(8)>), then attach this using L</guestfs_add_drive_ro>. If you add "
617 "the drive in a predictable way (eg. adding it last after all other drives) "
618 "then you can get the device name from L</guestfs_list_devices> and mount it "
619 "directly using L</guestfs_mount_ro>. Note that squashfs images are "
620 "sometimes non-portable between kernel versions, and they don't support "
621 "labels or UUIDs. If you want to pre-build an image or you need to mount it "
622 "using a label or UUID, use an ISO image instead."
626 #: ../src/guestfs.pod:299
631 #: ../src/guestfs.pod:301
633 "There are various different commands for copying between files and devices "
634 "and in and out of the guest filesystem. These are summarised in the table "
639 #: ../src/guestfs.pod:307
640 msgid "B<file> to B<file>"
644 #: ../src/guestfs.pod:309
646 "Use L</guestfs_cp> to copy a single file, or L</guestfs_cp_a> to copy "
647 "directories recursively."
651 #: ../src/guestfs.pod:312
652 msgid "B<file or device> to B<file or device>"
656 #: ../src/guestfs.pod:314
658 "Use L</guestfs_dd> which efficiently uses L<dd(1)> to copy between files and "
659 "devices in the guest."
663 #: ../src/guestfs.pod:317
664 msgid "Example: duplicate the contents of an LV:"
668 #: ../src/guestfs.pod:319
671 " guestfs_dd (g, \"/dev/VG/Original\", \"/dev/VG/Copy\");\n"
676 #: ../src/guestfs.pod:321
678 "The destination (C</dev/VG/Copy>) must be at least as large as the source "
679 "(C</dev/VG/Original>). To copy less than the whole source device, use "
680 "L</guestfs_copy_size>."
684 #: ../src/guestfs.pod:325
685 msgid "B<file on the host> to B<file or device>"
689 #: ../src/guestfs.pod:327
690 msgid "Use L</guestfs_upload>. See L</UPLOADING> above."
694 #: ../src/guestfs.pod:329
695 msgid "B<file or device> to B<file on the host>"
699 #: ../src/guestfs.pod:331
700 msgid "Use L</guestfs_download>. See L</DOWNLOADING> above."
704 #: ../src/guestfs.pod:335
705 msgid "LISTING FILES"
709 #: ../src/guestfs.pod:337
711 "L</guestfs_ll> is just designed for humans to read (mainly when using the "
712 "L<guestfish(1)>-equivalent command C<ll>)."
716 #: ../src/guestfs.pod:340
718 "L</guestfs_ls> is a quick way to get a list of files in a directory from "
719 "programs, as a flat list of strings."
723 #: ../src/guestfs.pod:343
725 "L</guestfs_readdir> is a programmatic way to get a list of files in a "
726 "directory, plus additional information about each one. It is more "
727 "equivalent to using the L<readdir(3)> call on a local filesystem."
731 #: ../src/guestfs.pod:347
733 "L</guestfs_find> and L</guestfs_find0> can be used to recursively list "
738 #: ../src/guestfs.pod:350
739 msgid "RUNNING COMMANDS"
743 #: ../src/guestfs.pod:352
745 "Although libguestfs is primarily an API for manipulating files inside guest "
746 "images, we also provide some limited facilities for running commands inside "
751 #: ../src/guestfs.pod:356
752 msgid "There are many limitations to this:"
756 #: ../src/guestfs.pod:360 ../src/guestfs.pod:365 ../src/guestfs.pod:370 ../src/guestfs.pod:374 ../src/guestfs.pod:379 ../src/guestfs.pod:383 ../src/guestfs.pod:388 ../src/guestfs.pod:393 ../src/guestfs.pod:1159 ../src/guestfs.pod:1164 ../src/guestfs.pod:1168 ../src/guestfs.pod:1384 ../src/guestfs.pod:1389 ../src/guestfs.pod:1393 ../src/guestfs.pod:1495 ../src/guestfs.pod:1499 ../src/guestfs.pod:1503 ../src/guestfs.pod:1508 ../src/guestfs.pod:1516 ../src/guestfs.pod:1535 ../src/guestfs.pod:1543 ../src/guestfs.pod:1773 ../src/guestfs.pod:1779 ../src/guestfs.pod:1784 ../src/guestfs.pod:1790 ../src/guestfs.pod:1897 ../src/guestfs.pod:1901 ../src/guestfs.pod:1905 ../src/guestfs.pod:1909 ../src/guestfs-actions.pod:14 ../src/guestfs-actions.pod:21 ../src/guestfs-actions.pod:438 ../src/guestfs-actions.pod:446 ../src/guestfs-actions.pod:453 ../src/guestfs-actions.pod:460 ../src/guestfs-actions.pod:1351 ../src/guestfs-actions.pod:1355 ../src/guestfs-actions.pod:1359 ../src/guestfs-actions.pod:1363 ../src/guestfs-actions.pod:1371 ../src/guestfs-actions.pod:1375 ../src/guestfs-actions.pod:1379 ../src/guestfs-actions.pod:1389 ../src/guestfs-actions.pod:1393 ../src/guestfs-actions.pod:1397 ../src/guestfs-actions.pod:1520 ../src/guestfs-actions.pod:1524 ../src/guestfs-actions.pod:1529 ../src/guestfs-actions.pod:1534 ../src/guestfs-actions.pod:1586 ../src/guestfs-actions.pod:1590 ../src/guestfs-actions.pod:1595 ../fish/guestfish.pod:364 ../fish/guestfish.pod:368 ../fish/guestfish.pod:372 ../fish/guestfish.pod:376 ../fish/guestfish-actions.pod:13 ../fish/guestfish-actions.pod:20 ../fish/guestfish-actions.pod:339 ../fish/guestfish-actions.pod:347 ../fish/guestfish-actions.pod:354 ../fish/guestfish-actions.pod:361 ../fish/guestfish-actions.pod:1056 ../fish/guestfish-actions.pod:1060 ../fish/guestfish-actions.pod:1064 ../fish/guestfish-actions.pod:1068 ../fish/guestfish-actions.pod:1076 ../fish/guestfish-actions.pod:1080 ../fish/guestfish-actions.pod:1084 ../fish/guestfish-actions.pod:1094 ../fish/guestfish-actions.pod:1098 ../fish/guestfish-actions.pod:1102 ../fish/guestfish-actions.pod:1192 ../fish/guestfish-actions.pod:1196 ../fish/guestfish-actions.pod:1201 ../fish/guestfish-actions.pod:1206 ../fish/guestfish-actions.pod:1248 ../fish/guestfish-actions.pod:1252 ../fish/guestfish-actions.pod:1257 ../inspector/virt-inspector.pl:584 ../inspector/virt-inspector.pl:588 ../tools/virt-df.pl:161 ../tools/virt-df.pl:167 ../tools/virt-resize.pl:348 ../tools/virt-resize.pl:353 ../tools/virt-resize.pl:363
761 #: ../src/guestfs.pod:362
763 "The kernel version that the command runs under will be different from what "
768 #: ../src/guestfs.pod:367
770 "If the command needs to communicate with daemons, then most likely they "
775 #: ../src/guestfs.pod:372
776 msgid "The command will be running in limited memory."
780 #: ../src/guestfs.pod:376
782 "The network may not be available unless you enable it (see "
783 "L</guestfs_set_network>)."
787 #: ../src/guestfs.pod:381
788 msgid "Only supports Linux guests (not Windows, BSD, etc)."
792 #: ../src/guestfs.pod:385
793 msgid "Architecture limitations (eg. won't work for a PPC guest on an X86 host)."
797 #: ../src/guestfs.pod:390
799 "For SELinux guests, you may need to enable SELinux and load policy first. "
800 "See L</SELINUX> in this manpage."
804 #: ../src/guestfs.pod:395
806 "I<Security:> It is not safe to run commands from untrusted, possibly "
807 "malicious guests. These commands may attempt to exploit your program by "
808 "sending unexpected output. They could also try to exploit the Linux kernel "
809 "or qemu provided by the libguestfs appliance. They could use the network "
810 "provided by the libguestfs appliance to bypass ordinary network partitions "
811 "and firewalls. They could use the elevated privileges or different SELinux "
812 "context of your program to their advantage."
816 #: ../src/guestfs.pod:404
818 "A secure alternative is to use libguestfs to install a \"firstboot\" script "
819 "(a script which runs when the guest next boots normally), and to have this "
820 "script run the commands you want in the normal context of the running guest, "
821 "network security and so on."
825 #: ../src/guestfs.pod:411
827 "The two main API calls to run commands are L</guestfs_command> and "
828 "L</guestfs_sh> (there are also variations)."
832 #: ../src/guestfs.pod:414
834 "The difference is that L</guestfs_sh> runs commands using the shell, so any "
835 "shell globs, redirections, etc will work."
839 #: ../src/guestfs.pod:417
840 msgid "CONFIGURATION FILES"
844 #: ../src/guestfs.pod:419
846 "To read and write configuration files in Linux guest filesystems, we "
847 "strongly recommend using Augeas. For example, Augeas understands how to "
848 "read and write, say, a Linux shadow password file or X.org configuration "
849 "file, and so avoids you having to write that code."
853 #: ../src/guestfs.pod:424
855 "The main Augeas calls are bound through the C<guestfs_aug_*> APIs. We don't "
856 "document Augeas itself here because there is excellent documentation on the "
857 "L<http://augeas.net/> website."
861 #: ../src/guestfs.pod:428
863 "If you don't want to use Augeas (you fool!) then try calling "
864 "L</guestfs_read_lines> to get the file as a list of lines which you can "
869 #: ../src/guestfs.pod:432
874 #: ../src/guestfs.pod:434
876 "We support SELinux guests. To ensure that labeling happens correctly in "
877 "SELinux guests, you need to enable SELinux and load the guest's policy:"
881 #: ../src/guestfs.pod:440
886 #: ../src/guestfs.pod:442
887 msgid "Before launching, do:"
891 #: ../src/guestfs.pod:444
894 " guestfs_set_selinux (g, 1);\n"
899 #: ../src/guestfs.pod:446
904 #: ../src/guestfs.pod:448
906 "After mounting the guest's filesystem(s), load the policy. This is best "
907 "done by running the L<load_policy(8)> command in the guest itself:"
911 #: ../src/guestfs.pod:452
914 " guestfs_sh (g, \"/usr/sbin/load_policy\");\n"
919 #: ../src/guestfs.pod:454
921 "(Older versions of C<load_policy> require you to specify the name of the "
926 #: ../src/guestfs.pod:457
931 #: ../src/guestfs.pod:459
933 "Optionally, set the security context for the API. The correct security "
934 "context to use can only be known by inspecting the guest. As an example:"
938 #: ../src/guestfs.pod:463
941 " guestfs_setcon (g, \"unconfined_u:unconfined_r:unconfined_t:s0\");\n"
946 #: ../src/guestfs.pod:467
947 msgid "This will work for running commands and editing existing files."
951 #: ../src/guestfs.pod:469
953 "When new files are created, you may need to label them explicitly, for "
954 "example by running the external command C<restorecon pathname>."
958 #: ../src/guestfs.pod:473
963 #: ../src/guestfs.pod:475
965 "Certain calls are affected by the current file mode creation mask (the "
966 "\"umask\"). In particular ones which create files or directories, such as "
967 "L</guestfs_touch>, L</guestfs_mknod> or L</guestfs_mkdir>. This affects "
968 "either the default mode that the file is created with or modifies the mode "
973 #: ../src/guestfs.pod:481
975 "The default umask is C<022>, so files are created with modes such as C<0644> "
976 "and directories with C<0755>."
980 #: ../src/guestfs.pod:484
982 "There are two ways to avoid being affected by umask. Either set umask to 0 "
983 "(call C<guestfs_umask (g, 0)> early after launching). Or call "
984 "L</guestfs_chmod> after creating each file or directory."
988 #: ../src/guestfs.pod:488
989 msgid "For more information about umask, see L<umask(2)>."
993 #: ../src/guestfs.pod:490 ../fish/guestfish.pod:630
994 msgid "ENCRYPTED DISKS"
998 #: ../src/guestfs.pod:492
1000 "Libguestfs allows you to access Linux guests which have been encrypted using "
1001 "whole disk encryption that conforms to the Linux Unified Key Setup (LUKS) "
1002 "standard. This includes nearly all whole disk encryption systems used by "
1003 "modern Linux guests."
1007 #: ../src/guestfs.pod:498
1009 "Use L</guestfs_vfs_type> to identify LUKS-encrypted block devices (it "
1010 "returns the string C<crypto_LUKS>)."
1014 #: ../src/guestfs.pod:501
1016 "Then open these devices by calling L</guestfs_luks_open>. Obviously you "
1017 "will require the passphrase!"
1021 #: ../src/guestfs.pod:504
1023 "Opening a LUKS device creates a new device mapper device called "
1024 "C</dev/mapper/mapname> (where C<mapname> is the string you supply to "
1025 "L</guestfs_luks_open>). Reads and writes to this mapper device are "
1026 "decrypted from and encrypted to the underlying block device respectively."
1030 #: ../src/guestfs.pod:510
1032 "LVM volume groups on the device can be made visible by calling "
1033 "L</guestfs_vgscan> followed by L</guestfs_vg_activate_all>. The logical "
1034 "volume(s) can now be mounted in the usual way."
1038 #: ../src/guestfs.pod:514
1040 "Use the reverse process to close a LUKS device. Unmount any logical volumes "
1041 "on it, deactivate the volume groups by caling C<guestfs_vg_activate (g, 0, "
1042 "[\"/dev/VG\"])>. Then close the mapper device by calling "
1043 "L</guestfs_luks_close> on the C</dev/mapper/mapname> device (I<not> the "
1044 "underlying encrypted block device)."
1048 #: ../src/guestfs.pod:521
1053 #: ../src/guestfs.pod:523
1055 "Libguestfs has APIs for inspecting an unknown disk image to find out if it "
1056 "contains operating systems. (These APIs used to be in a separate Perl-only "
1057 "library called L<Sys::Guestfs::Lib(3)> but since version 1.5.3 the most "
1058 "frequently used part of this library has been rewritten in C and moved into "
1063 #: ../src/guestfs.pod:529
1065 "Add all disks belonging to the unknown virtual machine and call "
1066 "L</guestfs_launch> in the usual way."
1070 #: ../src/guestfs.pod:532
1072 "Then call L</guestfs_inspect_os>. This function uses other libguestfs calls "
1073 "and certain heuristics, and returns a list of operating systems that were "
1074 "found. An empty list means none were found. A single element is the root "
1075 "filesystem of the operating system. For dual- or multi-boot guests, "
1076 "multiple roots can be returned, each one corresponding to a separate "
1077 "operating system. (Multi-boot virtual machines are extremely rare in the "
1078 "world of virtualization, but since this scenario can happen, we have built "
1079 "libguestfs to deal with it.)"
1083 #: ../src/guestfs.pod:541
1085 "For each root, you can then call various C<guestfs_inspect_get_*> functions "
1086 "to get additional details about that operating system. For example, call "
1087 "L</guestfs_inspect_get_type> to return the string C<windows> or C<linux> for "
1088 "Windows and Linux-based operating systems respectively."
1092 #: ../src/guestfs.pod:547
1094 "Un*x-like and Linux-based operating systems usually consist of several "
1095 "filesystems which are mounted at boot time (for example, a separate boot "
1096 "partition mounted on C</boot>). The inspection rules are able to detect how "
1097 "filesystems correspond to mount points. Call "
1098 "C<guestfs_inspect_get_mountpoints> to get this mapping. It might return a "
1099 "hash table like this example:"
1103 #: ../src/guestfs.pod:554
1106 " /boot => /dev/sda1\n"
1107 " / => /dev/vg_guest/lv_root\n"
1108 " /usr => /dev/vg_guest/lv_usr\n"
1113 #: ../src/guestfs.pod:558
1115 "The caller can then make calls to L</guestfs_mount_options> to mount the "
1116 "filesystems as suggested."
1120 #: ../src/guestfs.pod:561
1122 "Be careful to mount filesystems in the right order (eg. C</> before "
1123 "C</usr>). Sorting the keys of the hash by length, shortest first, should "
1128 #: ../src/guestfs.pod:565
1130 "Inspection currently only works for some common operating systems. "
1131 "Contributors are welcome to send patches for other operating systems that we "
1132 "currently cannot detect."
1136 #: ../src/guestfs.pod:569
1138 "Encrypted disks must be opened before inspection. See L</ENCRYPTED DISKS> "
1139 "for more details. The L</guestfs_inspect_os> function just ignores any "
1140 "encrypted devices."
1144 #: ../src/guestfs.pod:573
1146 "A note on the implementation: The call L</guestfs_inspect_os> performs "
1147 "inspection and caches the results in the guest handle. Subsequent calls to "
1148 "C<guestfs_inspect_get_*> return this cached information, but I<do not> "
1149 "re-read the disks. If you change the content of the guest disks, you can "
1150 "redo inspection by calling L</guestfs_inspect_os> again."
1154 #: ../src/guestfs.pod:580
1155 msgid "SPECIAL CONSIDERATIONS FOR WINDOWS GUESTS"
1159 #: ../src/guestfs.pod:582
1161 "Libguestfs can mount NTFS partitions. It does this using the "
1162 "L<http://www.ntfs-3g.org/> driver."
1166 #: ../src/guestfs.pod:585
1168 "DOS and Windows still use drive letters, and the filesystems are always "
1169 "treated as case insensitive by Windows itself, and therefore you might find "
1170 "a Windows configuration file referring to a path like "
1171 "C<c:\\windows\\system32>. When the filesystem is mounted in libguestfs, "
1172 "that directory might be referred to as C</WINDOWS/System32>."
1176 #: ../src/guestfs.pod:591
1178 "Drive letter mappings are outside the scope of libguestfs. You have to use "
1179 "libguestfs to read the appropriate Windows Registry and configuration files, "
1180 "to determine yourself how drives are mapped (see also L<hivex(3)> and "
1181 "L<virt-inspector(1)>)."
1185 #: ../src/guestfs.pod:596
1187 "Replacing backslash characters with forward slash characters is also outside "
1188 "the scope of libguestfs, but something that you can easily do."
1192 #: ../src/guestfs.pod:599
1194 "Where we can help is in resolving the case insensitivity of paths. For "
1195 "this, call L</guestfs_case_sensitive_path>."
1199 #: ../src/guestfs.pod:602
1201 "Libguestfs also provides some help for decoding Windows Registry \"hive\" "
1202 "files, through the library C<hivex> which is part of the libguestfs project "
1203 "although ships as a separate tarball. You have to locate and download the "
1204 "hive file(s) yourself, and then pass them to C<hivex> functions. See also "
1205 "the programs L<hivexml(1)>, L<hivexsh(1)>, L<hivexregedit(1)> and "
1206 "L<virt-win-reg(1)> for more help on this issue."
1210 #: ../src/guestfs.pod:610
1211 msgid "USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES"
1215 #: ../src/guestfs.pod:612
1217 "Although we don't want to discourage you from using the C API, we will "
1218 "mention here that the same API is also available in other languages."
1222 #: ../src/guestfs.pod:615
1224 "The API is broadly identical in all supported languages. This means that "
1225 "the C call C<guestfs_mount(g,path)> is C<$g-E<gt>mount($path)> in Perl, "
1226 "C<g.mount(path)> in Python, and C<Guestfs.mount g path> in OCaml. In other "
1227 "words, a straightforward, predictable isomorphism between each language."
1231 #: ../src/guestfs.pod:621
1233 "Error messages are automatically transformed into exceptions if the language "
1238 #: ../src/guestfs.pod:624
1240 "We don't try to \"object orientify\" parts of the API in OO languages, "
1241 "although contributors are welcome to write higher level APIs above what we "
1242 "provide in their favourite languages if they wish."
1246 #: ../src/guestfs.pod:630
1251 #: ../src/guestfs.pod:632
1253 "You can use the I<guestfs.h> header file from C++ programs. The C++ API is "
1254 "identical to the C API. C++ classes and exceptions are not used."
1258 #: ../src/guestfs.pod:636
1263 #: ../src/guestfs.pod:638
1265 "The C# bindings are highly experimental. Please read the warnings at the "
1266 "top of C<csharp/Libguestfs.cs>."
1270 #: ../src/guestfs.pod:641
1275 #: ../src/guestfs.pod:643
1277 "This is the only language binding that is working but incomplete. Only "
1278 "calls which return simple integers have been bound in Haskell, and we are "
1279 "looking for help to complete this binding."
1283 #: ../src/guestfs.pod:647
1288 #: ../src/guestfs.pod:649
1290 "Full documentation is contained in the Javadoc which is distributed with "
1295 #: ../src/guestfs.pod:652
1300 #: ../src/guestfs.pod:654
1301 msgid "For documentation see the file C<guestfs.mli>."
1305 #: ../src/guestfs.pod:656
1310 #: ../src/guestfs.pod:658
1311 msgid "For documentation see L<Sys::Guestfs(3)>."
1315 #: ../src/guestfs.pod:660
1320 #: ../src/guestfs.pod:662
1322 "For documentation see C<README-PHP> supplied with libguestfs sources or in "
1323 "the php-libguestfs package for your distribution."
1327 #: ../src/guestfs.pod:665
1328 msgid "The PHP binding only works correctly on 64 bit machines."
1332 #: ../src/guestfs.pod:667
1337 #: ../src/guestfs.pod:669
1338 msgid "For documentation do:"
1342 #: ../src/guestfs.pod:671
1346 " >>> import guestfs\n"
1347 " >>> help (guestfs)\n"
1352 #: ../src/guestfs.pod:675
1357 #: ../src/guestfs.pod:677
1359 "Use the Guestfs module. There is no Ruby-specific documentation, but you "
1360 "can find examples written in Ruby in the libguestfs source."
1364 #: ../src/guestfs.pod:680
1365 msgid "B<shell scripts>"
1369 #: ../src/guestfs.pod:682
1370 msgid "For documentation see L<guestfish(1)>."
1374 #: ../src/guestfs.pod:686
1375 msgid "LIBGUESTFS GOTCHAS"
1379 #: ../src/guestfs.pod:688
1381 "L<http://en.wikipedia.org/wiki/Gotcha_(programming)>: \"A feature of a "
1382 "system [...] that works in the way it is documented but is counterintuitive "
1383 "and almost invites mistakes.\""
1387 #: ../src/guestfs.pod:692
1389 "Since we developed libguestfs and the associated tools, there are several "
1390 "things we would have designed differently, but are now stuck with for "
1391 "backwards compatibility or other reasons. If there is ever a libguestfs 2.0 "
1392 "release, you can expect these to change. Beware of them."
1396 #: ../src/guestfs.pod:700
1397 msgid "Autosync / forgetting to sync."
1401 #: ../src/guestfs.pod:702
1403 "When modifying a filesystem from C or another language, you B<must> unmount "
1404 "all filesystems and call L</guestfs_sync> explicitly before you close the "
1405 "libguestfs handle. You can also call:"
1409 #: ../src/guestfs.pod:706
1412 " guestfs_set_autosync (g, 1);\n"
1417 #: ../src/guestfs.pod:708
1419 "to have the unmount/sync done automatically for you when the handle 'g' is "
1420 "closed. (This feature is called \"autosync\", L</guestfs_set_autosync> "
1425 #: ../src/guestfs.pod:712
1427 "If you forget to do this, then it is entirely possible that your changes "
1428 "won't be written out, or will be partially written, or (very rarely) that "
1429 "you'll get disk corruption."
1433 #: ../src/guestfs.pod:716
1435 "Note that in L<guestfish(3)> autosync is the default. So quick and dirty "
1436 "guestfish scripts that forget to sync will work just fine, which can make "
1437 "this very puzzling if you are trying to debug a problem."
1441 #: ../src/guestfs.pod:720
1443 "Update: Autosync is enabled by default for all API users starting from "
1444 "libguestfs 1.5.24."
1448 #: ../src/guestfs.pod:723
1449 msgid "Mount option C<-o sync> should not be the default."
1453 #: ../src/guestfs.pod:725
1455 "If you use L</guestfs_mount>, then C<-o sync,noatime> are added implicitly. "
1456 "However C<-o sync> does not add any reliability benefit, but does have a "
1457 "very large performance impact."
1461 #: ../src/guestfs.pod:729
1463 "The work around is to use L</guestfs_mount_options> and set the mount "
1464 "options that you actually want to use."
1468 #: ../src/guestfs.pod:732
1469 msgid "Read-only should be the default."
1473 #: ../src/guestfs.pod:734
1475 "In L<guestfish(3)>, I<--ro> should be the default, and you should have to "
1476 "specify I<--rw> if you want to make changes to the image."
1480 #: ../src/guestfs.pod:737
1481 msgid "This would reduce the potential to corrupt live VM images."
1485 #: ../src/guestfs.pod:739
1487 "Note that many filesystems change the disk when you just mount and unmount, "
1488 "even if you didn't perform any writes. You need to use "
1489 "L</guestfs_add_drive_ro> to guarantee that the disk is not changed."
1493 #: ../src/guestfs.pod:743
1494 msgid "guestfish command line is hard to use."
1498 #: ../src/guestfs.pod:745
1500 "C<guestfish disk.img> doesn't do what people expect (open C<disk.img> for "
1501 "examination). It tries to run a guestfish command C<disk.img> which doesn't "
1502 "exist, so it fails. In earlier versions of guestfish the error message was "
1503 "also unintuitive, but we have corrected this since. Like the Bourne shell, "
1504 "we should have used C<guestfish -c command> to run commands."
1508 #: ../src/guestfs.pod:752
1509 msgid "guestfish megabyte modifiers don't work right on all commands"
1513 #: ../src/guestfs.pod:754
1515 "In recent guestfish you can use C<1M> to mean 1 megabyte (and similarly for "
1516 "other modifiers). What guestfish actually does is to multiply the number "
1517 "part by the modifier part and pass the result to the C API. However this "
1518 "doesn't work for a few APIs which aren't expecting bytes, but are already "
1519 "expecting some other unit (eg. megabytes)."
1523 #: ../src/guestfs.pod:761
1524 msgid "The most common is L</guestfs_lvcreate>. The guestfish command:"
1528 #: ../src/guestfs.pod:763
1531 " lvcreate LV VG 100M\n"
1536 #: ../src/guestfs.pod:765
1538 "does not do what you might expect. Instead because L</guestfs_lvcreate> is "
1539 "already expecting megabytes, this tries to create a 100 I<terabyte> (100 "
1540 "megabytes * megabytes) logical volume. The error message you get from this "
1541 "is also a little obscure."
1545 #: ../src/guestfs.pod:770
1547 "This could be fixed in the generator by specially marking parameters and "
1548 "return values which take bytes or other units."
1552 #: ../src/guestfs.pod:773
1553 msgid "Library should return errno with error messages."
1557 #: ../src/guestfs.pod:775
1559 "It would be a nice-to-have to be able to get the original value of 'errno' "
1560 "from inside the appliance along error paths (where set). Currently "
1561 "L<guestmount(1)> goes through hoops to try to reverse the error message "
1562 "string into an errno, see the function error() in fuse/guestmount.c."
1566 #: ../src/guestfs.pod:781
1568 "In libguestfs 1.5.4, the protocol was changed so that the Linux errno is "
1569 "sent back from the daemon."
1573 #: ../src/guestfs.pod:784
1574 msgid "Ambiguity between devices and paths"
1578 #: ../src/guestfs.pod:786
1580 "There is a subtle ambiguity in the API between a device name "
1581 "(eg. C</dev/sdb2>) and a similar pathname. A file might just happen to be "
1582 "called C<sdb2> in the directory C</dev> (consider some non-Unix VM image)."
1586 #: ../src/guestfs.pod:791
1588 "In the current API we usually resolve this ambiguity by having two separate "
1589 "calls, for example L</guestfs_checksum> and L</guestfs_checksum_device>. "
1590 "Some API calls are ambiguous and (incorrectly) resolve the problem by "
1591 "detecting if the path supplied begins with C</dev/>."
1595 #: ../src/guestfs.pod:797
1597 "To avoid both the ambiguity and the need to duplicate some calls, we could "
1598 "make paths/devices into structured names. One way to do this would be to "
1599 "use a notation like grub (C<hd(0,0)>), although nobody really likes this "
1600 "aspect of grub. Another way would be to use a structured type, equivalent "
1601 "to this OCaml type:"
1605 #: ../src/guestfs.pod:803
1608 " type path = Path of string | Device of int | Partition of int * int\n"
1613 #: ../src/guestfs.pod:805
1614 msgid "which would allow you to pass arguments like:"
1618 #: ../src/guestfs.pod:807
1621 " Path \"/foo/bar\"\n"
1622 " Device 1 (* /dev/sdb, or perhaps /dev/sda *)\n"
1623 " Partition (1, 2) (* /dev/sdb2 (or is it /dev/sda2 or /dev/sdb3?) *)\n"
1624 " Path \"/dev/sdb2\" (* not a device *)\n"
1629 #: ../src/guestfs.pod:812
1631 "As you can see there are still problems to resolve even with this "
1632 "representation. Also consider how it might work in guestfish."
1636 #: ../src/guestfs.pod:817
1637 msgid "PROTOCOL LIMITS"
1641 #: ../src/guestfs.pod:819
1643 "Internally libguestfs uses a message-based protocol to pass API calls and "
1644 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1645 "plenty more detail about this). The maximum message size used by the "
1646 "protocol is slightly less than 4 MB. For some API calls you may need to be "
1647 "aware of this limit. The API calls which may be affected are individually "
1648 "documented, with a link back to this section of the documentation."
1652 #: ../src/guestfs.pod:827
1654 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1655 "a simple string. Because this string is at some point internally encoded as "
1656 "a message, the maximum size that it can return is slightly under 4 MB. If "
1657 "the requested file is larger than this then you will get an error."
1661 #: ../src/guestfs.pod:833
1663 "In order to transfer large files into and out of the guest filesystem, you "
1664 "need to use particular calls that support this. The sections L</UPLOADING> "
1665 "and L</DOWNLOADING> document how to do this."
1669 #: ../src/guestfs.pod:837
1671 "You might also consider mounting the disk image using our FUSE filesystem "
1672 "support (L<guestmount(1)>)."
1676 #: ../src/guestfs.pod:840
1677 msgid "KEYS AND PASSPHRASES"
1681 #: ../src/guestfs.pod:842
1683 "Certain libguestfs calls take a parameter that contains sensitive key "
1684 "material, passed in as a C string."
1688 #: ../src/guestfs.pod:845
1690 "In the future we would hope to change the libguestfs implementation so that "
1691 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1692 "swap. However this is I<not> done at the moment, because of the complexity "
1693 "of such an implementation."
1697 #: ../src/guestfs.pod:850
1699 "Therefore you should be aware that any key parameter you pass to libguestfs "
1700 "might end up being written out to the swap partition. If this is a concern, "
1701 "scrub the swap partition or don't use libguestfs on encrypted devices."
1705 #: ../src/guestfs.pod:855
1706 msgid "CONNECTION MANAGEMENT"
1710 #: ../src/guestfs.pod:857
1715 #: ../src/guestfs.pod:859
1717 "C<guestfs_h> is the opaque type representing a connection handle. Create a "
1718 "handle by calling L</guestfs_create>. Call L</guestfs_close> to free the "
1719 "handle and release all resources used."
1723 #: ../src/guestfs.pod:863
1725 "For information on using multiple handles and threads, see the section "
1726 "L</MULTIPLE HANDLES AND MULTIPLE THREADS> below."
1730 #: ../src/guestfs.pod:866
1731 msgid "guestfs_create"
1735 #: ../src/guestfs.pod:868
1738 " guestfs_h *guestfs_create (void);\n"
1743 #: ../src/guestfs.pod:870
1744 msgid "Create a connection handle."
1748 #: ../src/guestfs.pod:872
1750 "You have to call L</guestfs_add_drive_opts> (or one of the equivalent calls) "
1751 "on the handle at least once."
1755 #: ../src/guestfs.pod:875
1757 "This function returns a non-NULL pointer to a handle on success or NULL on "
1762 #: ../src/guestfs.pod:878
1763 msgid "After configuring the handle, you have to call L</guestfs_launch>."
1767 #: ../src/guestfs.pod:880
1769 "You may also want to configure error handling for the handle. See L</ERROR "
1770 "HANDLING> section below."
1774 #: ../src/guestfs.pod:883
1775 msgid "guestfs_close"
1779 #: ../src/guestfs.pod:885
1782 " void guestfs_close (guestfs_h *g);\n"
1787 #: ../src/guestfs.pod:887
1788 msgid "This closes the connection handle and frees up all resources used."
1792 #: ../src/guestfs.pod:889
1793 msgid "ERROR HANDLING"
1797 #: ../src/guestfs.pod:891
1799 "The convention in all functions that return C<int> is that they return C<-1> "
1800 "to indicate an error. You can get additional information on errors by "
1801 "calling L</guestfs_last_error> and/or by setting up an error handler with "
1802 "L</guestfs_set_error_handler>."
1806 #: ../src/guestfs.pod:896
1807 msgid "The default error handler prints the information string to C<stderr>."
1811 #: ../src/guestfs.pod:898
1813 "Out of memory errors are handled differently. The default action is to call "
1814 "L<abort(3)>. If this is undesirable, then you can set a handler using "
1815 "L</guestfs_set_out_of_memory_handler>."
1819 #: ../src/guestfs.pod:902
1820 msgid "guestfs_last_error"
1824 #: ../src/guestfs.pod:904
1827 " const char *guestfs_last_error (guestfs_h *g);\n"
1832 #: ../src/guestfs.pod:906
1834 "This returns the last error message that happened on C<g>. If there has not "
1835 "been an error since the handle was created, then this returns C<NULL>."
1839 #: ../src/guestfs.pod:910
1841 "The lifetime of the returned string is until the next error occurs, or "
1842 "L</guestfs_close> is called."
1846 #: ../src/guestfs.pod:913
1848 "The error string is not localized (ie. is always in English), because this "
1849 "makes searching for error messages in search engines give the largest number "
1854 #: ../src/guestfs.pod:917
1855 msgid "guestfs_set_error_handler"
1859 #: ../src/guestfs.pod:919
1862 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
1864 " const char *msg);\n"
1865 " void guestfs_set_error_handler (guestfs_h *g,\n"
1866 " guestfs_error_handler_cb cb,\n"
1872 #: ../src/guestfs.pod:926
1874 "The callback C<cb> will be called if there is an error. The parameters "
1875 "passed to the callback are an opaque data pointer and the error message "
1880 #: ../src/guestfs.pod:930
1882 "Note that the message string C<msg> is freed as soon as the callback "
1883 "function returns, so if you want to stash it somewhere you must make your "
1888 #: ../src/guestfs.pod:934
1889 msgid "The default handler prints messages on C<stderr>."
1893 #: ../src/guestfs.pod:936
1894 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
1898 #: ../src/guestfs.pod:938
1899 msgid "guestfs_get_error_handler"
1903 #: ../src/guestfs.pod:940
1906 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
1907 " void **opaque_rtn);\n"
1912 #: ../src/guestfs.pod:943
1913 msgid "Returns the current error handler callback."
1917 #: ../src/guestfs.pod:945
1918 msgid "guestfs_set_out_of_memory_handler"
1922 #: ../src/guestfs.pod:947
1925 " typedef void (*guestfs_abort_cb) (void);\n"
1926 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
1927 " guestfs_abort_cb);\n"
1932 #: ../src/guestfs.pod:951
1934 "The callback C<cb> will be called if there is an out of memory situation. "
1935 "I<Note this callback must not return>."
1939 #: ../src/guestfs.pod:954
1940 msgid "The default is to call L<abort(3)>."
1944 #: ../src/guestfs.pod:956
1945 msgid "You cannot set C<cb> to C<NULL>. You can't ignore out of memory situations."
1949 #: ../src/guestfs.pod:959
1950 msgid "guestfs_get_out_of_memory_handler"
1954 #: ../src/guestfs.pod:961
1957 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
1962 #: ../src/guestfs.pod:963
1963 msgid "This returns the current out of memory handler."
1967 #: ../src/guestfs.pod:965
1972 #: ../src/guestfs.pod:967
1974 "Libguestfs needs a kernel and initrd.img, which it finds by looking along an "
1979 #: ../src/guestfs.pod:970
1981 "By default it looks for these in the directory C<$libdir/guestfs> "
1982 "(eg. C</usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
1986 #: ../src/guestfs.pod:973
1988 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
1989 "to change the directories that libguestfs will search in. The value is a "
1990 "colon-separated list of paths. The current directory is I<not> searched "
1991 "unless the path contains an empty element or C<.>. For example "
1992 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
1993 "then C</usr/lib/guestfs>."
1997 #: ../src/guestfs.pod:980
1998 msgid "HIGH-LEVEL API ACTIONS"
2002 #: ../src/guestfs.pod:982
2003 msgid "ABI GUARANTEE"
2007 #: ../src/guestfs.pod:984
2009 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
2010 "actions as outlined in this section. Although we will deprecate some "
2011 "actions, for example if they get replaced by newer calls, we will keep the "
2012 "old actions forever. This allows you the developer to program in confidence "
2013 "against the libguestfs API."
2017 #: ../src/guestfs.pod:990 ../fish/guestfish.pod:860
2022 #: ../src/guestfs.pod:992
2027 #: ../src/guestfs.pod:994
2032 #: ../src/guestfs.pod:996
2033 msgid "AVAILABILITY"
2037 #: ../src/guestfs.pod:998
2038 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
2042 #: ../src/guestfs.pod:1000
2044 "Using L</guestfs_available> you can test availability of the following "
2045 "groups of functions. This test queries the appliance to see if the "
2046 "appliance you are currently using supports the functionality."
2050 #: ../src/guestfs.pod:1005
2051 msgid "@AVAILABILITY@"
2055 #: ../src/guestfs.pod:1007
2056 msgid "GUESTFISH supported COMMAND"
2060 #: ../src/guestfs.pod:1009
2062 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
2063 "prints out the available groups and whether they are supported by this build "
2064 "of libguestfs. Note however that you have to do C<run> first."
2068 #: ../src/guestfs.pod:1014
2069 msgid "SINGLE CALLS AT COMPILE TIME"
2073 #: ../src/guestfs.pod:1016
2075 "Since version 1.5.8, C<E<lt>guestfs.hE<gt>> defines symbols for each C API "
2076 "function, such as:"
2080 #: ../src/guestfs.pod:1019
2083 " #define LIBGUESTFS_HAVE_DD 1\n"
2088 #: ../src/guestfs.pod:1021
2089 msgid "if L</guestfs_dd> is available."
2093 #: ../src/guestfs.pod:1023
2095 "Before version 1.5.8, if you needed to test whether a single libguestfs "
2096 "function is available at compile time, we recommended using build tools such "
2097 "as autoconf or cmake. For example in autotools you could use:"
2101 #: ../src/guestfs.pod:1028
2104 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
2105 " AC_CHECK_FUNCS([guestfs_dd])\n"
2110 #: ../src/guestfs.pod:1031
2112 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
2117 #: ../src/guestfs.pod:1034
2118 msgid "SINGLE CALLS AT RUN TIME"
2122 #: ../src/guestfs.pod:1036
2124 "Testing at compile time doesn't guarantee that a function really exists in "
2125 "the library. The reason is that you might be dynamically linked against a "
2126 "previous I<libguestfs.so> (dynamic library) which doesn't have the call. "
2127 "This situation unfortunately results in a segmentation fault, which is a "
2128 "shortcoming of the C dynamic linking system itself."
2132 #: ../src/guestfs.pod:1043
2134 "You can use L<dlopen(3)> to test if a function is available at run time, as "
2135 "in this example program (note that you still need the compile time check as "
2140 #: ../src/guestfs.pod:1047
2143 " #include <stdio.h>\n"
2144 " #include <stdlib.h>\n"
2145 " #include <unistd.h>\n"
2146 " #include <dlfcn.h>\n"
2147 " #include <guestfs.h>\n"
2152 #: ../src/guestfs.pod:1053
2157 " #ifdef LIBGUESTFS_HAVE_DD\n"
2159 " int has_function;\n"
2164 #: ../src/guestfs.pod:1059
2167 " /* Test if the function guestfs_dd is really available. */\n"
2168 " dl = dlopen (NULL, RTLD_LAZY);\n"
2170 " fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
2171 " exit (EXIT_FAILURE);\n"
2173 " has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
2179 #: ../src/guestfs.pod:1068
2182 " if (!has_function)\n"
2183 " printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
2185 " printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
2186 " /* Now it's safe to call\n"
2187 " guestfs_dd (g, \"foo\", \"bar\");\n"
2191 " printf (\"guestfs_dd function was not found at compile time\\n\");\n"
2198 #: ../src/guestfs.pod:1081
2200 "You may think the above is an awful lot of hassle, and it is. There are "
2201 "other ways outside of the C linking system to ensure that this kind of "
2202 "incompatibility never arises, such as using package versioning:"
2206 #: ../src/guestfs.pod:1086
2209 " Requires: libguestfs >= 1.0.80\n"
2214 #: ../src/guestfs.pod:1088
2215 msgid "CALLS WITH OPTIONAL ARGUMENTS"
2219 #: ../src/guestfs.pod:1090
2221 "A recent feature of the API is the introduction of calls which take optional "
2222 "arguments. In C these are declared 3 ways. The main way is as a call which "
2223 "takes variable arguments (ie. C<...>), as in this example:"
2227 #: ../src/guestfs.pod:1095
2230 " int guestfs_add_drive_opts (guestfs_h *g, const char *filename, ...);\n"
2235 #: ../src/guestfs.pod:1097
2237 "Call this with a list of optional arguments, terminated by C<-1>. So to "
2238 "call with no optional arguments specified:"
2242 #: ../src/guestfs.pod:1100
2245 " guestfs_add_drive_opts (g, filename, -1);\n"
2250 #: ../src/guestfs.pod:1102
2251 msgid "With a single optional argument:"
2255 #: ../src/guestfs.pod:1104
2258 " guestfs_add_drive_opts (g, filename,\n"
2259 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
2265 #: ../src/guestfs.pod:1108
2270 #: ../src/guestfs.pod:1110
2273 " guestfs_add_drive_opts (g, filename,\n"
2274 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
2275 " GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
2281 #: ../src/guestfs.pod:1115
2283 "and so forth. Don't forget the terminating C<-1> otherwise Bad Things will "
2288 #: ../src/guestfs.pod:1118
2289 msgid "USING va_list FOR OPTIONAL ARGUMENTS"
2293 #: ../src/guestfs.pod:1120
2295 "The second variant has the same name with the suffix C<_va>, which works the "
2296 "same way but takes a C<va_list>. See the C manual for details. For the "
2297 "example function, this is declared:"
2301 #: ../src/guestfs.pod:1124
2304 " int guestfs_add_drive_opts_va (guestfs_h *g, const char *filename,\n"
2310 #: ../src/guestfs.pod:1127
2311 msgid "CONSTRUCTING OPTIONAL ARGUMENTS"
2315 #: ../src/guestfs.pod:1129
2317 "The third variant is useful where you need to construct these calls. You "
2318 "pass in a structure where you fill in the optional fields. The structure "
2319 "has a bitmask as the first element which you must set to indicate which "
2320 "fields you have filled in. For our example function the structure and call "
2325 #: ../src/guestfs.pod:1135
2328 " struct guestfs_add_drive_opts_argv {\n"
2329 " uint64_t bitmask;\n"
2331 " const char *format;\n"
2334 " int guestfs_add_drive_opts_argv (guestfs_h *g, const char *filename,\n"
2335 " const struct guestfs_add_drive_opts_argv *optargs);\n"
2340 #: ../src/guestfs.pod:1144
2341 msgid "You could call it like this:"
2345 #: ../src/guestfs.pod:1146
2348 " struct guestfs_add_drive_opts_argv optargs = {\n"
2349 " .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK |\n"
2350 " GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK,\n"
2352 " .format = \"qcow2\"\n"
2358 #: ../src/guestfs.pod:1153
2361 " guestfs_add_drive_opts_argv (g, filename, &optargs);\n"
2366 #: ../src/guestfs.pod:1155 ../src/guestfs-actions.pod:10 ../src/guestfs-actions.pod:1582 ../fish/guestfish-actions.pod:9 ../fish/guestfish-actions.pod:1244
2371 #: ../src/guestfs.pod:1161
2372 msgid "The C<_BITMASK> suffix on each option name when specifying the bitmask."
2376 #: ../src/guestfs.pod:1166
2377 msgid "You do not need to fill in all fields of the structure."
2381 #: ../src/guestfs.pod:1170
2383 "There must be a one-to-one correspondence between fields of the structure "
2384 "that are filled in, and bits set in the bitmask."
2388 #: ../src/guestfs.pod:1175
2389 msgid "OPTIONAL ARGUMENTS IN OTHER LANGUAGES"
2393 #: ../src/guestfs.pod:1177
2395 "In other languages, optional arguments are expressed in the way that is "
2396 "natural for that language. We refer you to the language-specific "
2397 "documentation for more details on that."
2401 #: ../src/guestfs.pod:1181
2402 msgid "For guestfish, see L<guestfish(1)/OPTIONAL ARGUMENTS>."
2406 #: ../src/guestfs.pod:1183 ../src/guestfs.pod:1188
2411 #: ../src/guestfs.pod:1185
2413 "<!-- old anchor for the next section --> <a "
2414 "name=\"state_machine_and_low_level_event_api\"/>"
2418 #: ../src/guestfs.pod:1190
2419 msgid "ARCHITECTURE"
2423 #: ../src/guestfs.pod:1192
2425 "Internally, libguestfs is implemented by running an appliance (a special "
2426 "type of small virtual machine) using L<qemu(1)>. Qemu runs as a child "
2427 "process of the main program."
2431 #: ../src/guestfs.pod:1196
2434 " ___________________\n"
2436 " | main program |\n"
2438 " | | child process / appliance\n"
2439 " | | __________________________\n"
2441 " +-------------------+ RPC | +-----------------+ |\n"
2442 " | libguestfs <--------------------> guestfsd | |\n"
2443 " | | | +-----------------+ |\n"
2444 " \\___________________/ | | Linux kernel | |\n"
2445 " | +--^--------------+ |\n"
2446 " \\_________|________________/\n"
2452 " \\______________/\n"
2457 #: ../src/guestfs.pod:1216
2459 "The library, linked to the main program, creates the child process and hence "
2460 "the appliance in the L</guestfs_launch> function."
2464 #: ../src/guestfs.pod:1219
2466 "Inside the appliance is a Linux kernel and a complete stack of userspace "
2467 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
2468 "L</guestfsd>. The library talks to L</guestfsd> using remote procedure "
2469 "calls (RPC). There is a mostly one-to-one correspondence between libguestfs "
2470 "API calls and RPC calls to the daemon. Lastly the disk image(s) are "
2471 "attached to the qemu process which translates device access by the "
2472 "appliance's Linux kernel into accesses to the image."
2476 #: ../src/guestfs.pod:1228
2478 "A common misunderstanding is that the appliance \"is\" the virtual machine. "
2479 "Although the disk image you are attached to might also be used by some "
2480 "virtual machine, libguestfs doesn't know or care about this. (But you will "
2481 "care if both libguestfs's qemu process and your virtual machine are trying "
2482 "to update the disk image at the same time, since these usually results in "
2483 "massive disk corruption)."
2487 #: ../src/guestfs.pod:1235
2488 msgid "STATE MACHINE"
2492 #: ../src/guestfs.pod:1237
2493 msgid "libguestfs uses a state machine to model the child process:"
2497 #: ../src/guestfs.pod:1239
2509 " / | \\ \\ guestfs_launch\n"
2510 " / | _\\__V______\n"
2512 " / | | LAUNCHING |\n"
2513 " / | \\___________/\n"
2515 " / | guestfs_launch\n"
2517 " ______ / __|____V\n"
2518 " / \\ ------> / \\\n"
2519 " | BUSY | | READY |\n"
2520 " \\______/ <------ \\________/\n"
2525 #: ../src/guestfs.pod:1261
2527 "The normal transitions are (1) CONFIG (when the handle is created, but there "
2528 "is no child process), (2) LAUNCHING (when the child process is booting up), "
2529 "(3) alternating between READY and BUSY as commands are issued to, and "
2530 "carried out by, the child process."
2534 #: ../src/guestfs.pod:1266
2536 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
2537 "asynchronously at any time (eg. due to some internal error), and that causes "
2538 "the state to transition back to CONFIG."
2542 #: ../src/guestfs.pod:1270
2544 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
2545 "issued when in the CONFIG state."
2549 #: ../src/guestfs.pod:1273
2551 "The API offers one call that goes from CONFIG through LAUNCHING to READY. "
2552 "L</guestfs_launch> blocks until the child process is READY to accept "
2553 "commands (or until some failure or timeout). L</guestfs_launch> internally "
2554 "moves the state from CONFIG to LAUNCHING while it is running."
2558 #: ../src/guestfs.pod:1279
2560 "API actions such as L</guestfs_mount> can only be issued when in the READY "
2561 "state. These API calls block waiting for the command to be carried out "
2562 "(ie. the state to transition to BUSY and then back to READY). There are no "
2563 "non-blocking versions, and no way to issue more than one command per handle "
2568 #: ../src/guestfs.pod:1285
2570 "Finally, the child process sends asynchronous messages back to the main "
2571 "program, such as kernel log messages. You can register a callback to "
2572 "receive these messages."
2576 #: ../src/guestfs.pod:1289
2577 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
2581 #: ../src/guestfs.pod:1291
2583 "The child process generates events in some situations. Current events "
2584 "include: receiving a log message, the child process exits."
2588 #: ../src/guestfs.pod:1294
2590 "Use the C<guestfs_set_*_callback> functions to set a callback for different "
2595 #: ../src/guestfs.pod:1297
2597 "Only I<one callback of each type> can be registered for each handle. "
2598 "Calling C<guestfs_set_*_callback> again overwrites the previous callback of "
2599 "that type. Cancel all callbacks of this type by calling this function with "
2600 "C<cb> set to C<NULL>."
2604 #: ../src/guestfs.pod:1302
2605 msgid "guestfs_set_log_message_callback"
2609 #: ../src/guestfs.pod:1304
2612 " typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,\n"
2613 " char *buf, int len);\n"
2614 " void guestfs_set_log_message_callback (guestfs_h *g,\n"
2615 " guestfs_log_message_cb cb,\n"
2621 #: ../src/guestfs.pod:1310
2623 "The callback function C<cb> will be called whenever qemu or the guest writes "
2624 "anything to the console."
2628 #: ../src/guestfs.pod:1313
2629 msgid "Use this function to capture kernel messages and similar."
2633 #: ../src/guestfs.pod:1315
2635 "Normally there is no log message handler, and log messages are just "
2640 #: ../src/guestfs.pod:1318
2641 msgid "guestfs_set_subprocess_quit_callback"
2645 #: ../src/guestfs.pod:1320
2648 " typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);\n"
2649 " void guestfs_set_subprocess_quit_callback (guestfs_h *g,\n"
2650 " guestfs_subprocess_quit_cb cb,\n"
2656 #: ../src/guestfs.pod:1325
2658 "The callback function C<cb> will be called when the child process quits, "
2659 "either asynchronously or if killed by L</guestfs_kill_subprocess>. (This "
2660 "corresponds to a transition from any state to the CONFIG state)."
2664 #: ../src/guestfs.pod:1330
2665 msgid "guestfs_set_launch_done_callback"
2669 #: ../src/guestfs.pod:1332
2672 " typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);\n"
2673 " void guestfs_set_launch_done_callback (guestfs_h *g,\n"
2674 " guestfs_launch_done_cb cb,\n"
2680 #: ../src/guestfs.pod:1337
2682 "The callback function C<cb> will be called when the child process becomes "
2683 "ready first time after it has been launched. (This corresponds to a "
2684 "transition from LAUNCHING to the READY state)."
2688 #: ../src/guestfs.pod:1341
2689 msgid "guestfs_set_close_callback"
2693 #: ../src/guestfs.pod:1343
2696 " typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);\n"
2697 " void guestfs_set_close_callback (guestfs_h *g,\n"
2698 " guestfs_close_cb cb,\n"
2704 #: ../src/guestfs.pod:1348
2706 "The callback function C<cb> will be called while the handle is being closed "
2707 "(synchronously from L</guestfs_close>)."
2711 #: ../src/guestfs.pod:1351
2713 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
2714 "handles that are open when the program exits. This means that this callback "
2715 "might be called indirectly from L<exit(3)>, which can cause unexpected "
2716 "problems in higher-level languages (eg. if your HLL interpreter has already "
2717 "been cleaned up by the time this is called, and if your callback then jumps "
2718 "into some HLL function)."
2722 #: ../src/guestfs.pod:1359
2723 msgid "guestfs_set_progress_callback"
2727 #: ../src/guestfs.pod:1361
2730 " typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque,\n"
2731 " int proc_nr, int serial,\n"
2732 " uint64_t position, uint64_t total);\n"
2733 " void guestfs_set_progress_callback (guestfs_h *g,\n"
2734 " guestfs_progress_cb cb,\n"
2740 #: ../src/guestfs.pod:1368
2742 "Some long-running operations can generate progress messages. If this "
2743 "callback is registered, then it will be called each time a progress message "
2744 "is generated (usually two seconds after the operation started, and three "
2745 "times per second thereafter until it completes, although the frequency may "
2746 "change in future versions)."
2750 #: ../src/guestfs.pod:1374
2752 "The callback receives two numbers: C<position> and C<total>. The units of "
2753 "C<total> are not defined, although for some operations C<total> may relate "
2754 "in some way to the amount of data to be transferred (eg. in bytes or "
2755 "megabytes), and C<position> may be the portion which has been transferred."
2759 #: ../src/guestfs.pod:1380
2760 msgid "The only defined and stable parts of the API are:"
2764 #: ../src/guestfs.pod:1386
2766 "The callback can display to the user some type of progress bar or indicator "
2767 "which shows the ratio of C<position>:C<total>."
2771 #: ../src/guestfs.pod:1391
2772 msgid "0 E<lt>= C<position> E<lt>= C<total>"
2776 #: ../src/guestfs.pod:1395
2778 "If any progress notification is sent during a call, then a final progress "
2779 "notification is always sent when C<position> = C<total>."
2783 #: ../src/guestfs.pod:1398
2785 "This is to simplify caller code, so callers can easily set the progress "
2786 "indicator to \"100%\" at the end of the operation, without requiring special "
2787 "code to detect this case."
2791 #: ../src/guestfs.pod:1404
2793 "The callback also receives the procedure number and serial number of the "
2794 "call. These are only useful for debugging protocol issues, and the callback "
2795 "can normally ignore them. The callback may want to print these numbers in "
2796 "error messages or debugging messages."
2800 #: ../src/guestfs.pod:1409
2801 msgid "PRIVATE DATA AREA"
2805 #: ../src/guestfs.pod:1411
2807 "You can attach named pieces of private data to the libguestfs handle, and "
2808 "fetch them by name for the lifetime of the handle. This is called the "
2809 "private data area and is only available from the C API."
2813 #: ../src/guestfs.pod:1415
2814 msgid "To attach a named piece of data, use the following call:"
2818 #: ../src/guestfs.pod:1417
2821 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
2826 #: ../src/guestfs.pod:1419
2828 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
2829 "pointer (which can be C<NULL>). Any previous item with the same name is "
2834 #: ../src/guestfs.pod:1423
2836 "You can use any C<key> you want, but names beginning with an underscore "
2837 "character are reserved for internal libguestfs purposes (for implementing "
2838 "language bindings). It is recommended to prefix the name with some unique "
2839 "string to avoid collisions with other users."
2843 #: ../src/guestfs.pod:1428
2844 msgid "To retrieve the pointer, use:"
2848 #: ../src/guestfs.pod:1430
2851 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
2856 #: ../src/guestfs.pod:1432
2858 "This function returns C<NULL> if either no data is found associated with "
2859 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
2864 #: ../src/guestfs.pod:1436
2866 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
2867 "way. As far as libguestfs is concerned, it need not be a valid pointer at "
2868 "all. In particular, libguestfs does I<not> try to free the data when the "
2869 "handle is closed. If the data must be freed, then the caller must either "
2870 "free it before calling L</guestfs_close> or must set up a close callback to "
2871 "do it (see L</guestfs_set_close_callback>, and note that only one callback "
2872 "can be registered for a handle)."
2876 #: ../src/guestfs.pod:1444
2878 "The private data area is implemented using a hash table, and should be "
2879 "reasonably efficient for moderate numbers of keys."
2883 #: ../src/guestfs.pod:1447
2884 msgid "BLOCK DEVICE NAMING"
2888 #: ../src/guestfs.pod:1449
2890 "In the kernel there is now quite a profusion of schemata for naming block "
2891 "devices (in this context, by I<block device> I mean a physical or virtual "
2892 "hard drive). The original Linux IDE driver used names starting with "
2893 "C</dev/hd*>. SCSI devices have historically used a different naming scheme, "
2894 "C</dev/sd*>. When the Linux kernel I<libata> driver became a popular "
2895 "replacement for the old IDE driver (particularly for SATA devices) those "
2896 "devices also used the C</dev/sd*> scheme. Additionally we now have virtual "
2897 "machines with paravirtualized drivers. This has created several different "
2898 "naming systems, such as C</dev/vd*> for virtio disks and C</dev/xvd*> for "
2903 #: ../src/guestfs.pod:1461
2905 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2906 "Linux kernel to access block devices. We can run a variety of appliances "
2907 "based on a variety of Linux kernels."
2911 #: ../src/guestfs.pod:1465
2913 "This causes a problem for libguestfs because many API calls use device or "
2914 "partition names. Working scripts and the recipe (example) scripts that we "
2915 "make available over the internet could fail if the naming scheme changes."
2919 #: ../src/guestfs.pod:1470
2921 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>. "
2922 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2923 "required. For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2924 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2928 #: ../src/guestfs.pod:1476
2930 "Note that this I<only> applies to parameters. The L</guestfs_list_devices>, "
2931 "L</guestfs_list_partitions> and similar calls return the true names of the "
2932 "devices and partitions as known to the appliance."
2936 #: ../src/guestfs.pod:1481
2937 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
2941 #: ../src/guestfs.pod:1483
2943 "Usually this translation is transparent. However in some (very rare) cases "
2944 "you may need to know the exact algorithm. Such cases include where you use "
2945 "L</guestfs_config> to add a mixture of virtio and IDE devices to the "
2946 "qemu-based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> "
2951 #: ../src/guestfs.pod:1489
2953 "The algorithm is applied only to I<parameters> which are known to be either "
2954 "device or partition names. Return values from functions such as "
2955 "L</guestfs_list_devices> are never changed."
2959 #: ../src/guestfs.pod:1497
2960 msgid "Is the string a parameter which is a device or partition name?"
2964 #: ../src/guestfs.pod:1501
2965 msgid "Does the string begin with C</dev/sd>?"
2969 #: ../src/guestfs.pod:1505
2971 "Does the named device exist? If so, we use that device. However if I<not> "
2972 "then we continue with this algorithm."
2976 #: ../src/guestfs.pod:1510
2977 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
2981 #: ../src/guestfs.pod:1512
2982 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
2986 #: ../src/guestfs.pod:1514
2987 msgid "If that named device exists, use it. If not, continue."
2991 #: ../src/guestfs.pod:1518
2992 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
2996 #: ../src/guestfs.pod:1520
2997 msgid "If that named device exists, use it. If not, return an error."
3001 #: ../src/guestfs.pod:1524
3002 msgid "PORTABILITY CONCERNS"
3006 #: ../src/guestfs.pod:1526
3008 "Although the standard naming scheme and automatic translation is useful for "
3009 "simple programs and guestfish scripts, for larger programs it is best not to "
3010 "rely on this mechanism."
3014 #: ../src/guestfs.pod:1530
3016 "Where possible for maximum future portability programs using libguestfs "
3017 "should use these future-proof techniques:"
3021 #: ../src/guestfs.pod:1537
3023 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
3024 "device names, and then use those names directly."
3028 #: ../src/guestfs.pod:1540
3029 msgid "Since those device names exist by definition, they will never be translated."
3033 #: ../src/guestfs.pod:1545
3035 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
3036 "filesystem labels."
3040 #: ../src/guestfs.pod:1550
3045 #: ../src/guestfs.pod:1552
3046 msgid "COMMUNICATION PROTOCOL"
3050 #: ../src/guestfs.pod:1554
3052 "Don't rely on using this protocol directly. This section documents how it "
3053 "currently works, but it may change at any time."
3057 #: ../src/guestfs.pod:1557
3059 "The protocol used to talk between the library and the daemon running inside "
3060 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
3061 "1014, RFC 1832, RFC 4506)."
3065 #: ../src/guestfs.pod:1561
3067 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
3068 "this file is automatically generated)."
3072 #: ../src/guestfs.pod:1564
3074 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
3075 "and C<FileOut> parameters, which are handled with very simple request/reply "
3076 "messages. Then there are functions that have any C<FileIn> or C<FileOut> "
3077 "parameters, which use the same request and reply messages, but they may also "
3078 "be followed by files sent using a chunked encoding."
3082 #: ../src/guestfs.pod:1571
3083 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
3087 #: ../src/guestfs.pod:1573
3088 msgid "For ordinary functions, the request message is:"
3092 #: ../src/guestfs.pod:1575
3095 " total length (header + arguments,\n"
3096 " but not including the length word itself)\n"
3097 " struct guestfs_message_header (encoded as XDR)\n"
3098 " struct guestfs_<foo>_args (encoded as XDR)\n"
3103 #: ../src/guestfs.pod:1580
3105 "The total length field allows the daemon to allocate a fixed size buffer "
3106 "into which it slurps the rest of the message. As a result, the total length "
3107 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
3108 "effective size of any request is limited to somewhere under this size."
3112 #: ../src/guestfs.pod:1586
3114 "Note also that many functions don't take any arguments, in which case the "
3115 "C<guestfs_I<foo>_args> is completely omitted."
3119 #: ../src/guestfs.pod:1589
3121 "The header contains the procedure number (C<guestfs_proc>) which is how the "
3122 "receiver knows what type of args structure to expect, or none at all."
3126 #: ../src/guestfs.pod:1593
3127 msgid "The reply message for ordinary functions is:"
3131 #: ../src/guestfs.pod:1595
3134 " total length (header + ret,\n"
3135 " but not including the length word itself)\n"
3136 " struct guestfs_message_header (encoded as XDR)\n"
3137 " struct guestfs_<foo>_ret (encoded as XDR)\n"
3142 #: ../src/guestfs.pod:1600
3144 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
3145 "functions that return no formal return values."
3149 #: ../src/guestfs.pod:1603
3150 msgid "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
3154 #: ../src/guestfs.pod:1606
3156 "In the case of an error, a flag is set in the header, and the reply message "
3157 "is slightly changed:"
3161 #: ../src/guestfs.pod:1609
3164 " total length (header + error,\n"
3165 " but not including the length word itself)\n"
3166 " struct guestfs_message_header (encoded as XDR)\n"
3167 " struct guestfs_message_error (encoded as XDR)\n"
3172 #: ../src/guestfs.pod:1614
3174 "The C<guestfs_message_error> structure contains the error message as a "
3179 #: ../src/guestfs.pod:1617
3180 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
3184 #: ../src/guestfs.pod:1619
3186 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest. "
3187 "The normal request message is sent (see above). However this is followed by "
3188 "a sequence of file chunks."
3192 #: ../src/guestfs.pod:1623
3195 " total length (header + arguments,\n"
3196 " but not including the length word itself,\n"
3197 " and not including the chunks)\n"
3198 " struct guestfs_message_header (encoded as XDR)\n"
3199 " struct guestfs_<foo>_args (encoded as XDR)\n"
3200 " sequence of chunks for FileIn param #0\n"
3201 " sequence of chunks for FileIn param #1 etc.\n"
3206 #: ../src/guestfs.pod:1631
3207 msgid "The \"sequence of chunks\" is:"
3211 #: ../src/guestfs.pod:1633
3214 " length of chunk (not including length word itself)\n"
3215 " struct guestfs_chunk (encoded as XDR)\n"
3216 " length of chunk\n"
3217 " struct guestfs_chunk (encoded as XDR)\n"
3219 " length of chunk\n"
3220 " struct guestfs_chunk (with data.data_len == 0)\n"
3225 #: ../src/guestfs.pod:1641
3227 "The final chunk has the C<data_len> field set to zero. Additionally a flag "
3228 "is set in the final chunk to indicate either successful completion or early "
3233 #: ../src/guestfs.pod:1645
3235 "At time of writing there are no functions that have more than one FileIn "
3236 "parameter. However this is (theoretically) supported, by sending the "
3237 "sequence of chunks for each FileIn parameter one after another (from left to "
3242 #: ../src/guestfs.pod:1650
3244 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
3245 "transfer. The library does this by sending a chunk with a special flag set "
3246 "to indicate cancellation. When the daemon sees this, it cancels the whole "
3247 "RPC, does I<not> send any reply, and goes back to reading the next request."
3251 #: ../src/guestfs.pod:1656
3253 "The daemon may also cancel. It does this by writing a special word "
3254 "C<GUESTFS_CANCEL_FLAG> to the socket. The library listens for this during "
3255 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
3256 "cancel chunk). The special word is chosen so that even if cancellation "
3257 "happens right at the end of the transfer (after the library has finished "
3258 "writing and has started listening for the reply), the \"spurious\" cancel "
3259 "flag will not be confused with the reply message."
3263 #: ../src/guestfs.pod:1665
3265 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
3266 "limit), and also files where the size is not known in advance (eg. from "
3267 "pipes or sockets). However the chunks are rather small "
3268 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
3269 "to keep much in memory."
3273 #: ../src/guestfs.pod:1671
3274 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
3278 #: ../src/guestfs.pod:1673
3280 "The protocol for FileOut parameters is exactly the same as for FileIn "
3281 "parameters, but with the roles of daemon and library reversed."
3285 #: ../src/guestfs.pod:1676
3288 " total length (header + ret,\n"
3289 " but not including the length word itself,\n"
3290 " and not including the chunks)\n"
3291 " struct guestfs_message_header (encoded as XDR)\n"
3292 " struct guestfs_<foo>_ret (encoded as XDR)\n"
3293 " sequence of chunks for FileOut param #0\n"
3294 " sequence of chunks for FileOut param #1 etc.\n"
3299 #: ../src/guestfs.pod:1684
3300 msgid "INITIAL MESSAGE"
3304 #: ../src/guestfs.pod:1686
3306 "When the daemon launches it sends an initial word (C<GUESTFS_LAUNCH_FLAG>) "
3307 "which indicates that the guest and daemon is alive. This is what "
3308 "L</guestfs_launch> waits for."
3312 #: ../src/guestfs.pod:1690
3313 msgid "PROGRESS NOTIFICATION MESSAGES"
3317 #: ../src/guestfs.pod:1692
3319 "The daemon may send progress notification messages at any time. These are "
3320 "distinguished by the normal length word being replaced by "
3321 "C<GUESTFS_PROGRESS_FLAG>, followed by a fixed size progress message."
3325 #: ../src/guestfs.pod:1696
3327 "The library turns them into progress callbacks (see "
3328 "C<guestfs_set_progress_callback>) if there is a callback registered, or "
3329 "discards them if not."
3333 #: ../src/guestfs.pod:1700
3335 "The daemon self-limits the frequency of progress messages it sends (see "
3336 "C<daemon/proto.c:notify_progress>). Not all calls generate progress "
3341 #: ../src/guestfs.pod:1704
3342 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
3346 #: ../src/guestfs.pod:1706
3348 "All high-level libguestfs actions are synchronous. If you want to use "
3349 "libguestfs asynchronously then you must create a thread."
3353 #: ../src/guestfs.pod:1709
3355 "Only use the handle from a single thread. Either use the handle exclusively "
3356 "from one thread, or provide your own mutex so that two threads cannot issue "
3357 "calls on the same handle at the same time."
3361 #: ../src/guestfs.pod:1713
3363 "See the graphical program guestfs-browser for one possible architecture for "
3364 "multithreaded programs using libvirt and libguestfs."
3368 #: ../src/guestfs.pod:1716
3369 msgid "QEMU WRAPPERS"
3373 #: ../src/guestfs.pod:1718
3375 "If you want to compile your own qemu, run qemu from a non-standard location, "
3376 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
3381 #: ../src/guestfs.pod:1722
3383 "There is one important rule to remember: you I<must C<exec qemu>> as the "
3384 "last command in the shell script (so that qemu replaces the shell and "
3385 "becomes the direct child of the libguestfs-using program). If you don't do "
3386 "this, then the qemu process won't be cleaned up correctly."
3390 #: ../src/guestfs.pod:1727
3392 "Here is an example of a wrapper, where I have built my own copy of qemu from "
3397 #: ../src/guestfs.pod:1730
3401 " qemudir=/home/rjones/d/qemu\n"
3402 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "
3408 #: ../src/guestfs.pod:1734
3410 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
3411 "then use it by setting the LIBGUESTFS_QEMU environment variable. For "
3416 #: ../src/guestfs.pod:1738
3419 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
3424 #: ../src/guestfs.pod:1740
3426 "Note that libguestfs also calls qemu with the -help and -version options in "
3427 "order to determine features."
3431 #: ../src/guestfs.pod:1743
3432 msgid "LIBGUESTFS VERSION NUMBERS"
3436 #: ../src/guestfs.pod:1745
3438 "Since April 2010, libguestfs has started to make separate development and "
3439 "stable releases, along with corresponding branches in our git repository. "
3440 "These separate releases can be identified by version number:"
3444 #: ../src/guestfs.pod:1750
3447 " even numbers for stable: 1.2.x, 1.4.x, ...\n"
3448 " .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
3454 " | `-------- sub-version\n"
3456 " `------ always '1' because we don't change the ABI\n"
3461 #: ../src/guestfs.pod:1761
3462 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
3466 #: ../src/guestfs.pod:1763
3468 "As time passes we cherry pick fixes from the development branch and backport "
3469 "those into the stable branch, the effect being that the stable branch should "
3470 "get more stable and less buggy over time. So the stable releases are ideal "
3471 "for people who don't need new features but would just like the software to "
3476 #: ../src/guestfs.pod:1769
3477 msgid "Our criteria for backporting changes are:"
3481 #: ../src/guestfs.pod:1775
3483 "Documentation changes which don't affect any code are backported unless the "
3484 "documentation refers to a future feature which is not in stable."
3488 #: ../src/guestfs.pod:1781
3490 "Bug fixes which are not controversial, fix obvious problems, and have been "
3491 "well tested are backported."
3495 #: ../src/guestfs.pod:1786
3497 "Simple rearrangements of code which shouldn't affect how it works get "
3498 "backported. This is so that the code in the two branches doesn't get too "
3499 "far out of step, allowing us to backport future fixes more easily."
3503 #: ../src/guestfs.pod:1792
3505 "We I<don't> backport new features, new APIs, new tools etc, except in one "
3506 "exceptional case: the new feature is required in order to implement an "
3507 "important bug fix."
3511 #: ../src/guestfs.pod:1798
3513 "A new stable branch starts when we think the new features in development are "
3514 "substantial and compelling enough over the current stable branch to warrant "
3515 "it. When that happens we create new stable and development versions 1.N.0 "
3516 "and 1.(N+1).0 [N is even]. The new dot-oh release won't necessarily be so "
3517 "stable at this point, but by backporting fixes from development, that branch "
3518 "will stabilize over time."
3522 #: ../src/guestfs.pod:1806 ../fish/guestfish.pod:867 ../test-tool/libguestfs-test-tool.pod:104 ../tools/virt-edit.pl:330 ../tools/virt-rescue.pl:255
3523 msgid "ENVIRONMENT VARIABLES"
3527 #: ../src/guestfs.pod:1810 ../fish/guestfish.pod:893
3528 msgid "LIBGUESTFS_APPEND"
3532 #: ../src/guestfs.pod:1812 ../fish/guestfish.pod:895
3533 msgid "Pass additional options to the guest kernel."
3537 #: ../src/guestfs.pod:1814 ../fish/guestfish.pod:897
3538 msgid "LIBGUESTFS_DEBUG"
3542 #: ../src/guestfs.pod:1816
3544 "Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the same "
3545 "effect as calling C<guestfs_set_verbose (g, 1)>."
3549 #: ../src/guestfs.pod:1819 ../fish/guestfish.pod:902
3550 msgid "LIBGUESTFS_MEMSIZE"
3554 #: ../src/guestfs.pod:1821 ../fish/guestfish.pod:904
3555 msgid "Set the memory allocated to the qemu process, in megabytes. For example:"
3559 #: ../src/guestfs.pod:1824 ../fish/guestfish.pod:907
3562 " LIBGUESTFS_MEMSIZE=700\n"
3567 #: ../src/guestfs.pod:1826 ../fish/guestfish.pod:909
3568 msgid "LIBGUESTFS_PATH"
3572 #: ../src/guestfs.pod:1828
3574 "Set the path that libguestfs uses to search for kernel and initrd.img. See "
3575 "the discussion of paths in section PATH above."
3579 #: ../src/guestfs.pod:1831 ../fish/guestfish.pod:914
3580 msgid "LIBGUESTFS_QEMU"
3584 #: ../src/guestfs.pod:1833 ../fish/guestfish.pod:916
3586 "Set the default qemu binary that libguestfs uses. If not set, then the qemu "
3587 "which was found at compile time by the configure script is used."
3591 #: ../src/guestfs.pod:1837
3592 msgid "See also L</QEMU WRAPPERS> above."
3596 #: ../src/guestfs.pod:1839 ../fish/guestfish.pod:920
3597 msgid "LIBGUESTFS_TRACE"
3601 #: ../src/guestfs.pod:1841
3603 "Set C<LIBGUESTFS_TRACE=1> to enable command traces. This has the same "
3604 "effect as calling C<guestfs_set_trace (g, 1)>."
3608 #: ../src/guestfs.pod:1844 ../fish/guestfish.pod:929
3613 #: ../src/guestfs.pod:1846 ../fish/guestfish.pod:931
3614 msgid "Location of temporary directory, defaults to C</tmp>."
3618 #: ../src/guestfs.pod:1848 ../fish/guestfish.pod:933
3620 "If libguestfs was compiled to use the supermin appliance then the real "
3621 "appliance is cached in this directory, shared between all handles belonging "
3622 "to the same EUID. You can use C<$TMPDIR> to configure another directory to "
3623 "use in case C</tmp> is not large enough."
3627 #: ../src/guestfs.pod:1856 ../fish/guestfish.pod:991 ../test-tool/libguestfs-test-tool.pod:109 ../fuse/guestmount.pod:214 ../inspector/virt-inspector.pl:570 ../tools/virt-edit.pl:350 ../tools/virt-win-reg.pl:484 ../tools/virt-df.pl:640 ../tools/virt-ls.pl:232 ../tools/virt-resize.pl:1486 ../tools/virt-list-filesystems.pl:186 ../tools/virt-cat.pl:185 ../tools/virt-tar.pl:281 ../tools/virt-rescue.pl:267 ../tools/virt-make-fs.pl:534 ../tools/virt-list-partitions.pl:254
3632 #: ../src/guestfs.pod:1858
3634 "L<guestfish(1)>, L<guestmount(1)>, L<virt-cat(1)>, L<virt-df(1)>, "
3635 "L<virt-edit(1)>, L<virt-inspector(1)>, L<virt-list-filesystems(1)>, "
3636 "L<virt-list-partitions(1)>, L<virt-ls(1)>, L<virt-make-fs(1)>, "
3637 "L<virt-rescue(1)>, L<virt-tar(1)>, L<virt-win-reg(1)>, L<qemu(1)>, "
3638 "L<febootstrap(1)>, L<hivex(3)>, L<http://libguestfs.org/>."
3642 #: ../src/guestfs.pod:1876
3644 "Tools with a similar purpose: L<fdisk(8)>, L<parted(8)>, L<kpartx(8)>, "
3645 "L<lvm(8)>, L<disktype(1)>."
3649 #: ../src/guestfs.pod:1883 ../tools/virt-win-reg.pl:499 ../tools/virt-make-fs.pl:548
3654 #: ../src/guestfs.pod:1885
3655 msgid "To get a list of bugs against libguestfs use this link:"
3659 #: ../src/guestfs.pod:1887
3660 msgid "L<https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools>"
3664 #: ../src/guestfs.pod:1889
3665 msgid "To report a new bug against libguestfs use this link:"
3669 #: ../src/guestfs.pod:1891
3670 msgid "L<https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools>"
3674 #: ../src/guestfs.pod:1893
3675 msgid "When reporting a bug, please check:"
3679 #: ../src/guestfs.pod:1899
3680 msgid "That the bug hasn't been reported already."
3684 #: ../src/guestfs.pod:1903
3685 msgid "That you are testing a recent version."
3689 #: ../src/guestfs.pod:1907
3690 msgid "Describe the bug accurately, and give a way to reproduce it."
3694 #: ../src/guestfs.pod:1911
3696 "Run libguestfs-test-tool and paste the B<complete, unedited> output into the "
3701 #: ../src/guestfs.pod:1916 ../fish/guestfish.pod:1008 ../test-tool/libguestfs-test-tool.pod:115 ../fuse/guestmount.pod:225 ../inspector/virt-inspector.pl:580
3706 #: ../src/guestfs.pod:1918 ../fish/guestfish.pod:1010 ../test-tool/libguestfs-test-tool.pod:117 ../fuse/guestmount.pod:227
3707 msgid "Richard W.M. Jones (C<rjones at redhat dot com>)"
3711 #: ../src/guestfs.pod:1920 ../fish/guestfish.pod:1012 ../test-tool/libguestfs-test-tool.pod:119 ../fuse/guestmount.pod:229 ../inspector/virt-inspector.pl:594 ../tools/virt-edit.pl:366 ../tools/virt-win-reg.pl:514 ../tools/virt-df.pl:653 ../tools/virt-ls.pl:247 ../tools/virt-resize.pl:1512 ../tools/virt-list-filesystems.pl:202 ../tools/virt-cat.pl:199 ../tools/virt-tar.pl:296 ../tools/virt-rescue.pl:281 ../tools/virt-make-fs.pl:563 ../tools/virt-list-partitions.pl:269
3716 #: ../src/guestfs.pod:1922 ../fish/guestfish.pod:1014 ../fuse/guestmount.pod:231
3717 msgid "Copyright (C) 2009-2010 Red Hat Inc. L<http://libguestfs.org/>"
3721 #: ../src/guestfs.pod:1925
3723 "This library is free software; you can redistribute it and/or modify it "
3724 "under the terms of the GNU Lesser General Public License as published by the "
3725 "Free Software Foundation; either version 2 of the License, or (at your "
3726 "option) any later version."
3730 #: ../src/guestfs.pod:1930
3732 "This library is distributed in the hope that it will be useful, but WITHOUT "
3733 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
3734 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
3739 #: ../src/guestfs.pod:1935
3741 "You should have received a copy of the GNU Lesser General Public License "
3742 "along with this library; if not, write to the Free Software Foundation, "
3743 "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
3747 #: ../src/guestfs-actions.pod:1
3748 msgid "guestfs_add_cdrom"
3752 #: ../src/guestfs-actions.pod:3
3755 " int guestfs_add_cdrom (guestfs_h *g,\n"
3756 "\t\tconst char *filename);\n"
3761 #: ../src/guestfs-actions.pod:6 ../fish/guestfish-actions.pod:5
3762 msgid "This function adds a virtual CD-ROM disk image to the guest."
3766 #: ../src/guestfs-actions.pod:8 ../fish/guestfish-actions.pod:7
3767 msgid "This is equivalent to the qemu parameter C<-cdrom filename>."
3771 #: ../src/guestfs-actions.pod:16
3773 "This call checks for the existence of C<filename>. This stops you from "
3774 "specifying other types of drive which are supported by qemu such as C<nbd:> "
3775 "and C<http:> URLs. To specify those, use the general C<guestfs_config> call "
3780 #: ../src/guestfs-actions.pod:23
3782 "If you just want to add an ISO file (often you use this as an efficient way "
3783 "to transfer large files into the guest), then you should probably use "
3784 "C<guestfs_add_drive_ro> instead."
3788 #: ../src/guestfs-actions.pod:29 ../src/guestfs-actions.pod:54 ../src/guestfs-actions.pod:112 ../src/guestfs-actions.pod:144 ../src/guestfs-actions.pod:155 ../src/guestfs-actions.pod:173 ../src/guestfs-actions.pod:190 ../src/guestfs-actions.pod:201 ../src/guestfs-actions.pod:304 ../src/guestfs-actions.pod:321 ../src/guestfs-actions.pod:332 ../src/guestfs-actions.pod:368 ../src/guestfs-actions.pod:390 ../src/guestfs-actions.pod:405 ../src/guestfs-actions.pod:469 ../src/guestfs-actions.pod:496 ../src/guestfs-actions.pod:507 ../src/guestfs-actions.pod:519 ../src/guestfs-actions.pod:600 ../src/guestfs-actions.pod:615 ../src/guestfs-actions.pod:626 ../src/guestfs-actions.pod:637 ../src/guestfs-actions.pod:783 ../src/guestfs-actions.pod:800 ../src/guestfs-actions.pod:815 ../src/guestfs-actions.pod:890 ../src/guestfs-actions.pod:905 ../src/guestfs-actions.pod:921 ../src/guestfs-actions.pod:932 ../src/guestfs-actions.pod:949 ../src/guestfs-actions.pod:982 ../src/guestfs-actions.pod:1040 ../src/guestfs-actions.pod:1068 ../src/guestfs-actions.pod:1090 ../src/guestfs-actions.pod:1121 ../src/guestfs-actions.pod:1209 ../src/guestfs-actions.pod:1240 ../src/guestfs-actions.pod:1440 ../src/guestfs-actions.pod:1459 ../src/guestfs-actions.pod:1540 ../src/guestfs-actions.pod:1888 ../src/guestfs-actions.pod:2011 ../src/guestfs-actions.pod:2066 ../src/guestfs-actions.pod:2096 ../src/guestfs-actions.pod:2545 ../src/guestfs-actions.pod:2557 ../src/guestfs-actions.pod:2574 ../src/guestfs-actions.pod:2682 ../src/guestfs-actions.pod:2693 ../src/guestfs-actions.pod:2703 ../src/guestfs-actions.pod:2714 ../src/guestfs-actions.pod:2726 ../src/guestfs-actions.pod:2756 ../src/guestfs-actions.pod:2820 ../src/guestfs-actions.pod:2837 ../src/guestfs-actions.pod:2851 ../src/guestfs-actions.pod:2871 ../src/guestfs-actions.pod:2891 ../src/guestfs-actions.pod:2920 ../src/guestfs-actions.pod:2936 ../src/guestfs-actions.pod:2952 ../src/guestfs-actions.pod:2981 ../src/guestfs-actions.pod:2990 ../src/guestfs-actions.pod:3023 ../src/guestfs-actions.pod:3036 ../src/guestfs-actions.pod:3046 ../src/guestfs-actions.pod:3058 ../src/guestfs-actions.pod:3072 ../src/guestfs-actions.pod:3152 ../src/guestfs-actions.pod:3169 ../src/guestfs-actions.pod:3179 ../src/guestfs-actions.pod:3224 ../src/guestfs-actions.pod:3239 ../src/guestfs-actions.pod:3254 ../src/guestfs-actions.pod:3267 ../src/guestfs-actions.pod:3278 ../src/guestfs-actions.pod:3289 ../src/guestfs-actions.pod:3303 ../src/guestfs-actions.pod:3315 ../src/guestfs-actions.pod:3332 ../src/guestfs-actions.pod:3378 ../src/guestfs-actions.pod:3406 ../src/guestfs-actions.pod:3422 ../src/guestfs-actions.pod:3438 ../src/guestfs-actions.pod:3447 ../src/guestfs-actions.pod:3461 ../src/guestfs-actions.pod:3471 ../src/guestfs-actions.pod:3483 ../src/guestfs-actions.pod:3495 ../src/guestfs-actions.pod:3527 ../src/guestfs-actions.pod:3539 ../src/guestfs-actions.pod:3556 ../src/guestfs-actions.pod:3567 ../src/guestfs-actions.pod:3581 ../src/guestfs-actions.pod:3621 ../src/guestfs-actions.pod:3652 ../src/guestfs-actions.pod:3663 ../src/guestfs-actions.pod:3688 ../src/guestfs-actions.pod:3702 ../src/guestfs-actions.pod:3717 ../src/guestfs-actions.pod:3839 ../src/guestfs-actions.pod:3891 ../src/guestfs-actions.pod:3910 ../src/guestfs-actions.pod:3925 ../src/guestfs-actions.pod:3951 ../src/guestfs-actions.pod:4008 ../src/guestfs-actions.pod:4022 ../src/guestfs-actions.pod:4032 ../src/guestfs-actions.pod:4043 ../src/guestfs-actions.pod:4298 ../src/guestfs-actions.pod:4314 ../src/guestfs-actions.pod:4325 ../src/guestfs-actions.pod:4334 ../src/guestfs-actions.pod:4345 ../src/guestfs-actions.pod:4354 ../src/guestfs-actions.pod:4365 ../src/guestfs-actions.pod:4378 ../src/guestfs-actions.pod:4396 ../src/guestfs-actions.pod:4412 ../src/guestfs-actions.pod:4428 ../src/guestfs-actions.pod:4443 ../src/guestfs-actions.pod:4463 ../src/guestfs-actions.pod:4478 ../src/guestfs-actions.pod:4494 ../src/guestfs-actions.pod:4512 ../src/guestfs-actions.pod:4528 ../src/guestfs-actions.pod:4542 ../src/guestfs-actions.pod:4567 ../src/guestfs-actions.pod:4588 ../src/guestfs-actions.pod:4604 ../src/guestfs-actions.pod:4625 ../src/guestfs-actions.pod:4637 ../src/guestfs-actions.pod:4649 ../src/guestfs-actions.pod:4665 ../src/guestfs-actions.pod:4699 ../src/guestfs-actions.pod:4719 ../src/guestfs-actions.pod:4742 ../src/guestfs-actions.pod:4832 ../src/guestfs-actions.pod:4938 ../src/guestfs-actions.pod:4947 ../src/guestfs-actions.pod:4957 ../src/guestfs-actions.pod:4967 ../src/guestfs-actions.pod:4986 ../src/guestfs-actions.pod:4996 ../src/guestfs-actions.pod:5006 ../src/guestfs-actions.pod:5016 ../src/guestfs-actions.pod:5028 ../src/guestfs-actions.pod:5078 ../src/guestfs-actions.pod:5092 ../src/guestfs-actions.pod:5105 ../src/guestfs-actions.pod:5118 ../src/guestfs-actions.pod:5132 ../src/guestfs-actions.pod:5142 ../src/guestfs-actions.pod:5159 ../src/guestfs-actions.pod:5189 ../src/guestfs-actions.pod:5200 ../src/guestfs-actions.pod:5235 ../src/guestfs-actions.pod:5245 ../src/guestfs-actions.pod:5260 ../src/guestfs-actions.pod:5286 ../src/guestfs-actions.pod:5314 ../src/guestfs-actions.pod:5418 ../src/guestfs-actions.pod:5433 ../src/guestfs-actions.pod:5444 ../src/guestfs-actions.pod:5490 ../src/guestfs-actions.pod:5500 ../src/guestfs-actions.pod:5537 ../src/guestfs-actions.pod:5564 ../src/guestfs-actions.pod:5606 ../src/guestfs-actions.pod:5629 ../src/guestfs-actions.pod:5686 ../src/guestfs-actions.pod:5702 ../src/guestfs-actions.pod:5728
3789 msgid "This function returns 0 on success or -1 on error."
3793 #: ../src/guestfs-actions.pod:31 ../src/guestfs-actions.pod:157 ../src/guestfs-actions.pod:175 ../fish/guestfish-actions.pod:28 ../fish/guestfish-actions.pod:117 ../fish/guestfish-actions.pod:131
3795 "This function is deprecated. In new code, use the C<add_drive_opts> call "
3800 #: ../src/guestfs-actions.pod:34 ../src/guestfs-actions.pod:160 ../src/guestfs-actions.pod:178 ../src/guestfs-actions.pod:1214 ../src/guestfs-actions.pod:1649 ../src/guestfs-actions.pod:1667 ../src/guestfs-actions.pod:5637 ../src/guestfs-actions.pod:5782 ../fish/guestfish-actions.pod:31 ../fish/guestfish-actions.pod:120 ../fish/guestfish-actions.pod:134 ../fish/guestfish-actions.pod:940 ../fish/guestfish-actions.pod:1297 ../fish/guestfish-actions.pod:1311 ../fish/guestfish-actions.pod:4353 ../fish/guestfish-actions.pod:4450
3802 "Deprecated functions will not be removed from the API, but the fact that "
3803 "they are deprecated indicates that there are problems with correct use of "
3808 #: ../src/guestfs-actions.pod:38
3809 msgid "guestfs_add_drive"
3813 #: ../src/guestfs-actions.pod:40
3816 " int guestfs_add_drive (guestfs_h *g,\n"
3817 "\t\tconst char *filename);\n"
3822 #: ../src/guestfs-actions.pod:43
3824 "This function is the equivalent of calling C<guestfs_add_drive_opts> with no "
3825 "optional parameters, so the disk is added writable, with the format being "
3826 "detected automatically."
3830 #: ../src/guestfs-actions.pod:47
3832 "Automatic detection of the format opens you up to a potential security hole "
3833 "when dealing with untrusted raw-format images. See CVE-2010-3851 and "
3834 "RHBZ#642934. Specifying the format closes this security hole. Therefore "
3835 "you should think about replacing calls to this function with calls to "
3836 "C<guestfs_add_drive_opts>, and specifying the format."
3840 #: ../src/guestfs-actions.pod:56
3841 msgid "guestfs_add_drive_opts"
3845 #: ../src/guestfs-actions.pod:58
3848 " int guestfs_add_drive_opts (guestfs_h *g,\n"
3849 "\t\tconst char *filename,\n"
3855 #: ../src/guestfs-actions.pod:62
3857 "You may supply a list of optional arguments to this call. Use zero or more "
3858 "of the following pairs of parameters, and terminate the list with C<-1> on "
3859 "its own. See L</CALLS WITH OPTIONAL ARGUMENTS>."
3863 #: ../src/guestfs-actions.pod:67
3866 " GUESTFS_ADD_DRIVE_OPTS_READONLY, int readonly,\n"
3867 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, const char *format,\n"
3868 " GUESTFS_ADD_DRIVE_OPTS_IFACE, const char *iface,\n"
3873 #: ../src/guestfs-actions.pod:71 ../fish/guestfish-actions.pod:56
3875 "This function adds a virtual machine disk image C<filename> to libguestfs. "
3876 "The first time you call this function, the disk appears as C</dev/sda>, the "
3877 "second time as C</dev/sdb>, and so on."
3881 #: ../src/guestfs-actions.pod:76 ../fish/guestfish-actions.pod:61
3883 "You don't necessarily need to be root when using libguestfs. However you "
3884 "obviously do need sufficient permissions to access the filename for whatever "
3885 "operations you want to perform (ie. read access if you just want to read the "
3886 "image or write access if you want to modify the image)."
3890 #: ../src/guestfs-actions.pod:82 ../fish/guestfish-actions.pod:67
3891 msgid "This call checks that C<filename> exists."
3895 #: ../src/guestfs-actions.pod:84 ../fish/guestfish-actions.pod:69
3896 msgid "The optional arguments are:"
3900 #: ../src/guestfs-actions.pod:88 ../fish/guestfish-actions.pod:73
3905 #: ../src/guestfs-actions.pod:90 ../fish/guestfish-actions.pod:75
3907 "If true then the image is treated as read-only. Writes are still allowed, "
3908 "but they are stored in a temporary snapshot overlay which is discarded at "
3909 "the end. The disk that you add is not modified."
3913 #: ../src/guestfs-actions.pod:94 ../fish/guestfish-actions.pod:79
3918 #: ../src/guestfs-actions.pod:96
3920 "This forces the image format. If you omit this (or use C<guestfs_add_drive> "
3921 "or C<guestfs_add_drive_ro>) then the format is automatically detected. "
3922 "Possible formats include C<raw> and C<qcow2>."
3926 #: ../src/guestfs-actions.pod:100 ../fish/guestfish-actions.pod:85
3928 "Automatic detection of the format opens you up to a potential security hole "
3929 "when dealing with untrusted raw-format images. See CVE-2010-3851 and "
3930 "RHBZ#642934. Specifying the format closes this security hole."
3934 #: ../src/guestfs-actions.pod:105 ../fish/guestfish-actions.pod:90
3939 #: ../src/guestfs-actions.pod:107
3941 "This rarely-used option lets you emulate the behaviour of the deprecated "
3942 "C<guestfs_add_drive_with_if> call (q.v.)"
3946 #: ../src/guestfs-actions.pod:114
3947 msgid "guestfs_add_drive_opts_va"
3951 #: ../src/guestfs-actions.pod:116
3954 " int guestfs_add_drive_opts_va (guestfs_h *g,\n"
3955 "\t\tconst char *filename,\n"
3956 "\t\tva_list args);\n"
3961 #: ../src/guestfs-actions.pod:120
3962 msgid "This is the \"va_list variant\" of L</guestfs_add_drive_opts>."
3966 #: ../src/guestfs-actions.pod:122 ../src/guestfs-actions.pod:132
3967 msgid "See L</CALLS WITH OPTIONAL ARGUMENTS>."
3971 #: ../src/guestfs-actions.pod:124
3972 msgid "guestfs_add_drive_opts_argv"
3976 #: ../src/guestfs-actions.pod:126
3979 " int guestfs_add_drive_opts_argv (guestfs_h *g,\n"
3980 "\t\tconst char *filename,\n"
3981 "\t\tconst struct guestfs_add_drive_opts_argv *optargs);\n"
3986 #: ../src/guestfs-actions.pod:130
3987 msgid "This is the \"argv variant\" of L</guestfs_add_drive_opts>."
3991 #: ../src/guestfs-actions.pod:134
3992 msgid "guestfs_add_drive_ro"
3996 #: ../src/guestfs-actions.pod:136
3999 " int guestfs_add_drive_ro (guestfs_h *g,\n"
4000 "\t\tconst char *filename);\n"
4005 #: ../src/guestfs-actions.pod:139
4007 "This function is the equivalent of calling C<guestfs_add_drive_opts> with "
4008 "the optional parameter C<GUESTFS_ADD_DRIVE_OPTS_READONLY> set to 1, so the "
4009 "disk is added read-only, with the format being detected automatically."
4013 #: ../src/guestfs-actions.pod:146
4014 msgid "guestfs_add_drive_ro_with_if"
4018 #: ../src/guestfs-actions.pod:148
4021 " int guestfs_add_drive_ro_with_if (guestfs_h *g,\n"
4022 "\t\tconst char *filename,\n"
4023 "\t\tconst char *iface);\n"
4028 #: ../src/guestfs-actions.pod:152
4030 "This is the same as C<guestfs_add_drive_ro> but it allows you to specify the "
4031 "QEMU interface emulation to use at run time."
4035 #: ../src/guestfs-actions.pod:164
4036 msgid "guestfs_add_drive_with_if"
4040 #: ../src/guestfs-actions.pod:166
4043 " int guestfs_add_drive_with_if (guestfs_h *g,\n"
4044 "\t\tconst char *filename,\n"
4045 "\t\tconst char *iface);\n"
4050 #: ../src/guestfs-actions.pod:170
4052 "This is the same as C<guestfs_add_drive> but it allows you to specify the "
4053 "QEMU interface emulation to use at run time."
4057 #: ../src/guestfs-actions.pod:182
4058 msgid "guestfs_aug_clear"
4062 #: ../src/guestfs-actions.pod:184
4065 " int guestfs_aug_clear (guestfs_h *g,\n"
4066 "\t\tconst char *augpath);\n"
4071 #: ../src/guestfs-actions.pod:187 ../fish/guestfish-actions.pod:142
4073 "Set the value associated with C<path> to C<NULL>. This is the same as the "
4074 "L<augtool(1)> C<clear> command."
4078 #: ../src/guestfs-actions.pod:192
4079 msgid "guestfs_aug_close"
4083 #: ../src/guestfs-actions.pod:194
4086 " int guestfs_aug_close (guestfs_h *g);\n"
4091 #: ../src/guestfs-actions.pod:196
4093 "Close the current Augeas handle and free up any resources used by it. After "
4094 "calling this, you have to call C<guestfs_aug_init> again before you can use "
4095 "any other Augeas functions."
4099 #: ../src/guestfs-actions.pod:203
4100 msgid "guestfs_aug_defnode"
4104 #: ../src/guestfs-actions.pod:205
4107 " struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,\n"
4108 "\t\tconst char *name,\n"
4109 "\t\tconst char *expr,\n"
4110 "\t\tconst char *val);\n"
4115 #: ../src/guestfs-actions.pod:210 ../fish/guestfish-actions.pod:158
4116 msgid "Defines a variable C<name> whose value is the result of evaluating C<expr>."
4120 #: ../src/guestfs-actions.pod:213
4122 "If C<expr> evaluates to an empty nodeset, a node is created, equivalent to "
4123 "calling C<guestfs_aug_set> C<expr>, C<value>. C<name> will be the nodeset "
4124 "containing that single node."
4128 #: ../src/guestfs-actions.pod:217 ../fish/guestfish-actions.pod:165
4130 "On success this returns a pair containing the number of nodes in the "
4131 "nodeset, and a boolean flag if a node was created."
4135 #: ../src/guestfs-actions.pod:221
4137 "This function returns a C<struct guestfs_int_bool *>, or NULL if there was "
4138 "an error. I<The caller must call C<guestfs_free_int_bool> after use>."
4142 #: ../src/guestfs-actions.pod:225
4143 msgid "guestfs_aug_defvar"
4147 #: ../src/guestfs-actions.pod:227
4150 " int guestfs_aug_defvar (guestfs_h *g,\n"
4151 "\t\tconst char *name,\n"
4152 "\t\tconst char *expr);\n"
4157 #: ../src/guestfs-actions.pod:231 ../fish/guestfish-actions.pod:173
4159 "Defines an Augeas variable C<name> whose value is the result of evaluating "
4160 "C<expr>. If C<expr> is NULL, then C<name> is undefined."
4164 #: ../src/guestfs-actions.pod:235 ../fish/guestfish-actions.pod:177
4166 "On success this returns the number of nodes in C<expr>, or C<0> if C<expr> "
4167 "evaluates to something which is not a nodeset."
4171 #: ../src/guestfs-actions.pod:238 ../src/guestfs-actions.pod:379 ../src/guestfs-actions.pod:533 ../src/guestfs-actions.pod:558 ../src/guestfs-actions.pod:573 ../src/guestfs-actions.pod:589 ../src/guestfs-actions.pod:1107 ../src/guestfs-actions.pod:1422 ../src/guestfs-actions.pod:1604 ../src/guestfs-actions.pod:1685 ../src/guestfs-actions.pod:1716 ../src/guestfs-actions.pod:1759 ../src/guestfs-actions.pod:1776 ../src/guestfs-actions.pod:2001 ../src/guestfs-actions.pod:2233 ../src/guestfs-actions.pod:2251 ../src/guestfs-actions.pod:3641 ../src/guestfs-actions.pod:3748 ../src/guestfs-actions.pod:4102 ../src/guestfs-actions.pod:4125 ../src/guestfs-actions.pod:5224 ../src/guestfs-actions.pod:5574 ../src/guestfs-actions.pod:5584 ../src/guestfs-actions.pod:5594
4172 msgid "On error this function returns -1."
4176 #: ../src/guestfs-actions.pod:240
4177 msgid "guestfs_aug_get"
4181 #: ../src/guestfs-actions.pod:242
4184 " char *guestfs_aug_get (guestfs_h *g,\n"
4185 "\t\tconst char *augpath);\n"
4190 #: ../src/guestfs-actions.pod:245 ../fish/guestfish-actions.pod:184
4192 "Look up the value associated with C<path>. If C<path> matches exactly one "
4193 "node, the C<value> is returned."
4197 #: ../src/guestfs-actions.pod:248 ../src/guestfs-actions.pod:676 ../src/guestfs-actions.pod:691 ../src/guestfs-actions.pod:748 ../src/guestfs-actions.pod:761 ../src/guestfs-actions.pod:852 ../src/guestfs-actions.pod:965 ../src/guestfs-actions.pod:994 ../src/guestfs-actions.pod:1008 ../src/guestfs-actions.pod:1024 ../src/guestfs-actions.pod:1135 ../src/guestfs-actions.pod:1299 ../src/guestfs-actions.pod:1408 ../src/guestfs-actions.pod:1553 ../src/guestfs-actions.pod:1567 ../src/guestfs-actions.pod:1643 ../src/guestfs-actions.pod:1661 ../src/guestfs-actions.pod:1795 ../src/guestfs-actions.pod:1934 ../src/guestfs-actions.pod:2115 ../src/guestfs-actions.pod:2185 ../src/guestfs-actions.pod:2301 ../src/guestfs-actions.pod:2336 ../src/guestfs-actions.pod:2356 ../src/guestfs-actions.pod:2671 ../src/guestfs-actions.pod:2968 ../src/guestfs-actions.pod:3109 ../src/guestfs-actions.pod:3205 ../src/guestfs-actions.pod:3763 ../src/guestfs-actions.pod:3939 ../src/guestfs-actions.pod:4080 ../src/guestfs-actions.pod:4241 ../src/guestfs-actions.pod:4284 ../src/guestfs-actions.pod:4760 ../src/guestfs-actions.pod:4773 ../src/guestfs-actions.pod:4787 ../src/guestfs-actions.pod:4808 ../src/guestfs-actions.pod:5367 ../src/guestfs-actions.pod:5383 ../src/guestfs-actions.pod:5398 ../src/guestfs-actions.pod:5546 ../src/guestfs-actions.pod:5776
4199 "This function returns a string, or NULL on error. I<The caller must free "
4200 "the returned string after use>."
4204 #: ../src/guestfs-actions.pod:251
4205 msgid "guestfs_aug_init"
4209 #: ../src/guestfs-actions.pod:253
4212 " int guestfs_aug_init (guestfs_h *g,\n"
4213 "\t\tconst char *root,\n"
4219 #: ../src/guestfs-actions.pod:257 ../fish/guestfish-actions.pod:191
4221 "Create a new Augeas handle for editing configuration files. If there was "
4222 "any previous Augeas handle associated with this guestfs session, then it is "
4227 #: ../src/guestfs-actions.pod:261
4228 msgid "You must call this before using any other C<guestfs_aug_*> commands."
4232 #: ../src/guestfs-actions.pod:264 ../fish/guestfish-actions.pod:198
4233 msgid "C<root> is the filesystem root. C<root> must not be NULL, use C</> instead."
4237 #: ../src/guestfs-actions.pod:267 ../fish/guestfish-actions.pod:201
4239 "The flags are the same as the flags defined in E<lt>augeas.hE<gt>, the "
4240 "logical I<or> of the following integers:"
4244 #: ../src/guestfs-actions.pod:273 ../fish/guestfish-actions.pod:207
4245 msgid "C<AUG_SAVE_BACKUP> = 1"
4249 #: ../src/guestfs-actions.pod:275 ../fish/guestfish-actions.pod:209
4250 msgid "Keep the original file with a C<.augsave> extension."
4254 #: ../src/guestfs-actions.pod:277 ../fish/guestfish-actions.pod:211
4255 msgid "C<AUG_SAVE_NEWFILE> = 2"
4259 #: ../src/guestfs-actions.pod:279 ../fish/guestfish-actions.pod:213
4261 "Save changes into a file with extension C<.augnew>, and do not overwrite "
4262 "original. Overrides C<AUG_SAVE_BACKUP>."
4266 #: ../src/guestfs-actions.pod:282 ../fish/guestfish-actions.pod:216
4267 msgid "C<AUG_TYPE_CHECK> = 4"
4271 #: ../src/guestfs-actions.pod:284 ../fish/guestfish-actions.pod:218
4272 msgid "Typecheck lenses (can be expensive)."
4276 #: ../src/guestfs-actions.pod:286 ../fish/guestfish-actions.pod:220
4277 msgid "C<AUG_NO_STDINC> = 8"
4281 #: ../src/guestfs-actions.pod:288 ../fish/guestfish-actions.pod:222
4282 msgid "Do not use standard load path for modules."
4286 #: ../src/guestfs-actions.pod:290 ../fish/guestfish-actions.pod:224
4287 msgid "C<AUG_SAVE_NOOP> = 16"
4291 #: ../src/guestfs-actions.pod:292 ../fish/guestfish-actions.pod:226
4292 msgid "Make save a no-op, just record what would have been changed."
4296 #: ../src/guestfs-actions.pod:294 ../fish/guestfish-actions.pod:228
4297 msgid "C<AUG_NO_LOAD> = 32"
4301 #: ../src/guestfs-actions.pod:296
4302 msgid "Do not load the tree in C<guestfs_aug_init>."
4306 #: ../src/guestfs-actions.pod:300
4307 msgid "To close the handle, you can call C<guestfs_aug_close>."
4311 #: ../src/guestfs-actions.pod:302 ../fish/guestfish-actions.pod:236
4312 msgid "To find out more about Augeas, see L<http://augeas.net/>."
4316 #: ../src/guestfs-actions.pod:306
4317 msgid "guestfs_aug_insert"
4321 #: ../src/guestfs-actions.pod:308
4324 " int guestfs_aug_insert (guestfs_h *g,\n"
4325 "\t\tconst char *augpath,\n"
4326 "\t\tconst char *label,\n"
4327 "\t\tint before);\n"
4332 #: ../src/guestfs-actions.pod:313 ../fish/guestfish-actions.pod:242
4334 "Create a new sibling C<label> for C<path>, inserting it into the tree before "
4335 "or after C<path> (depending on the boolean flag C<before>)."
4339 #: ../src/guestfs-actions.pod:317 ../fish/guestfish-actions.pod:246
4341 "C<path> must match exactly one existing node in the tree, and C<label> must "
4342 "be a label, ie. not contain C</>, C<*> or end with a bracketed index C<[N]>."
4346 #: ../src/guestfs-actions.pod:323
4347 msgid "guestfs_aug_load"
4351 #: ../src/guestfs-actions.pod:325
4354 " int guestfs_aug_load (guestfs_h *g);\n"
4359 #: ../src/guestfs-actions.pod:327 ../fish/guestfish-actions.pod:254
4360 msgid "Load files into the tree."
4364 #: ../src/guestfs-actions.pod:329 ../fish/guestfish-actions.pod:256
4365 msgid "See C<aug_load> in the Augeas documentation for the full gory details."
4369 #: ../src/guestfs-actions.pod:334
4370 msgid "guestfs_aug_ls"
4374 #: ../src/guestfs-actions.pod:336
4377 " char **guestfs_aug_ls (guestfs_h *g,\n"
4378 "\t\tconst char *augpath);\n"
4383 #: ../src/guestfs-actions.pod:339
4385 "This is just a shortcut for listing C<guestfs_aug_match> C<path/*> and "
4386 "sorting the resulting nodes into alphabetical order."
4390 #: ../src/guestfs-actions.pod:342 ../src/guestfs-actions.pod:355 ../src/guestfs-actions.pod:483 ../src/guestfs-actions.pod:868 ../src/guestfs-actions.pod:1147 ../src/guestfs-actions.pod:1163 ../src/guestfs-actions.pod:1251 ../src/guestfs-actions.pod:1267 ../src/guestfs-actions.pod:1498 ../src/guestfs-actions.pod:1832 ../src/guestfs-actions.pod:1845 ../src/guestfs-actions.pod:1861 ../src/guestfs-actions.pod:1898 ../src/guestfs-actions.pod:1919 ../src/guestfs-actions.pod:1981 ../src/guestfs-actions.pod:2021 ../src/guestfs-actions.pod:2207 ../src/guestfs-actions.pod:2395 ../src/guestfs-actions.pod:2600 ../src/guestfs-actions.pod:2656 ../src/guestfs-actions.pod:2740 ../src/guestfs-actions.pod:3086 ../src/guestfs-actions.pod:3608 ../src/guestfs-actions.pod:4057 ../src/guestfs-actions.pod:4166 ../src/guestfs-actions.pod:4272 ../src/guestfs-actions.pod:4821 ../src/guestfs-actions.pod:4870 ../src/guestfs-actions.pod:4922 ../src/guestfs-actions.pod:5038 ../src/guestfs-actions.pod:5059 ../src/guestfs-actions.pod:5459 ../src/guestfs-actions.pod:5476 ../src/guestfs-actions.pod:5514 ../src/guestfs-actions.pod:5650 ../src/guestfs-actions.pod:5666 ../src/guestfs-actions.pod:5739 ../src/guestfs-actions.pod:5755 ../src/guestfs-actions.pod:5795 ../src/guestfs-actions.pod:5811
4392 "This function returns a NULL-terminated array of strings (like "
4393 "L<environ(3)>), or NULL if there was an error. I<The caller must free the "
4394 "strings and the array after use>."
4398 #: ../src/guestfs-actions.pod:346
4399 msgid "guestfs_aug_match"
4403 #: ../src/guestfs-actions.pod:348
4406 " char **guestfs_aug_match (guestfs_h *g,\n"
4407 "\t\tconst char *augpath);\n"
4412 #: ../src/guestfs-actions.pod:351 ../fish/guestfish-actions.pod:270
4414 "Returns a list of paths which match the path expression C<path>. The "
4415 "returned paths are sufficiently qualified so that they match exactly one "
4416 "node in the current tree."
4420 #: ../src/guestfs-actions.pod:359
4421 msgid "guestfs_aug_mv"
4425 #: ../src/guestfs-actions.pod:361
4428 " int guestfs_aug_mv (guestfs_h *g,\n"
4429 "\t\tconst char *src,\n"
4430 "\t\tconst char *dest);\n"
4435 #: ../src/guestfs-actions.pod:365 ../fish/guestfish-actions.pod:278
4437 "Move the node C<src> to C<dest>. C<src> must match exactly one node. "
4438 "C<dest> is overwritten if it exists."
4442 #: ../src/guestfs-actions.pod:370
4443 msgid "guestfs_aug_rm"
4447 #: ../src/guestfs-actions.pod:372
4450 " int guestfs_aug_rm (guestfs_h *g,\n"
4451 "\t\tconst char *augpath);\n"
4456 #: ../src/guestfs-actions.pod:375 ../fish/guestfish-actions.pod:285
4457 msgid "Remove C<path> and all of its children."
4461 #: ../src/guestfs-actions.pod:377 ../fish/guestfish-actions.pod:287
4462 msgid "On success this returns the number of entries which were removed."
4466 #: ../src/guestfs-actions.pod:381
4467 msgid "guestfs_aug_save"
4471 #: ../src/guestfs-actions.pod:383
4474 " int guestfs_aug_save (guestfs_h *g);\n"
4479 #: ../src/guestfs-actions.pod:385 ../fish/guestfish-actions.pod:293
4480 msgid "This writes all pending changes to disk."
4484 #: ../src/guestfs-actions.pod:387
4486 "The flags which were passed to C<guestfs_aug_init> affect exactly how files "
4491 #: ../src/guestfs-actions.pod:392
4492 msgid "guestfs_aug_set"
4496 #: ../src/guestfs-actions.pod:394
4499 " int guestfs_aug_set (guestfs_h *g,\n"
4500 "\t\tconst char *augpath,\n"
4501 "\t\tconst char *val);\n"
4506 #: ../src/guestfs-actions.pod:398 ../fish/guestfish-actions.pod:302
4507 msgid "Set the value associated with C<path> to C<val>."
4511 #: ../src/guestfs-actions.pod:400
4513 "In the Augeas API, it is possible to clear a node by setting the value to "
4514 "NULL. Due to an oversight in the libguestfs API you cannot do that with "
4515 "this call. Instead you must use the C<guestfs_aug_clear> call."
4519 #: ../src/guestfs-actions.pod:407
4520 msgid "guestfs_available"
4524 #: ../src/guestfs-actions.pod:409
4527 " int guestfs_available (guestfs_h *g,\n"
4528 "\t\tchar *const *groups);\n"
4533 #: ../src/guestfs-actions.pod:412 ../fish/guestfish-actions.pod:313
4535 "This command is used to check the availability of some groups of "
4536 "functionality in the appliance, which not all builds of the libguestfs "
4537 "appliance will be able to provide."
4541 #: ../src/guestfs-actions.pod:416
4543 "The libguestfs groups, and the functions that those groups correspond to, "
4544 "are listed in L<guestfs(3)/AVAILABILITY>. You can also fetch this list at "
4545 "runtime by calling C<guestfs_available_all_groups>."
4549 #: ../src/guestfs-actions.pod:421 ../fish/guestfish-actions.pod:322
4551 "The argument C<groups> is a list of group names, eg: C<[\"inotify\", "
4552 "\"augeas\"]> would check for the availability of the Linux inotify functions "
4553 "and Augeas (configuration file editing) functions."
4557 #: ../src/guestfs-actions.pod:426 ../fish/guestfish-actions.pod:327
4558 msgid "The command returns no error if I<all> requested groups are available."