1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
10 "POT-Creation-Date: 2010-10-28 18:08+0200\n"
11 "PO-Revision-Date: 2010-09-02 14:46+0100\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: ../src/guestfs.pod:1 ../fish/guestfish.pod:1
21 #: ../test-tool/libguestfs-test-tool.pod:1 ../fuse/guestmount.pod:1
22 #: ../inspector/virt-inspector.pl:31 ../tools/virt-edit.pl:30
23 #: ../tools/virt-win-reg.pl:33 ../tools/virt-df.pl:32 ../tools/virt-ls.pl:30
24 #: ../tools/virt-resize.pl:38 ../tools/virt-list-filesystems.pl:28
25 #: ../tools/virt-cat.pl:29 ../tools/virt-tar.pl:29 ../tools/virt-rescue.pl:29
26 #: ../tools/virt-make-fs.pl:33 ../tools/virt-list-partitions.pl:28
31 #: ../src/guestfs.pod:3 ../fish/guestfish.pod:3
32 #: ../test-tool/libguestfs-test-tool.pod:3 ../fuse/guestmount.pod:3
33 #: ../inspector/virt-inspector.pl:33 ../tools/virt-edit.pl:32
34 #: ../tools/virt-win-reg.pl:35 ../tools/virt-df.pl:34 ../tools/virt-ls.pl:32
35 #: ../tools/virt-resize.pl:40 ../tools/virt-list-filesystems.pl:30
36 #: ../tools/virt-cat.pl:31 ../tools/virt-tar.pl:31 ../tools/virt-rescue.pl:31
37 #: ../tools/virt-make-fs.pl:35 ../tools/virt-list-partitions.pl:30
42 #: ../src/guestfs.pod:5
43 msgid "guestfs - Library for accessing and modifying virtual machine images"
47 #: ../src/guestfs.pod:7 ../fish/guestfish.pod:7
48 #: ../test-tool/libguestfs-test-tool.pod:7 ../fuse/guestmount.pod:7
49 #: ../inspector/virt-inspector.pl:37 ../tools/virt-edit.pl:36
50 #: ../tools/virt-win-reg.pl:39 ../tools/virt-df.pl:38 ../tools/virt-ls.pl:36
51 #: ../tools/virt-resize.pl:44 ../tools/virt-list-filesystems.pl:34
52 #: ../tools/virt-cat.pl:35 ../tools/virt-tar.pl:35 ../tools/virt-rescue.pl:35
53 #: ../tools/virt-make-fs.pl:39 ../tools/virt-list-partitions.pl:34
58 #: ../src/guestfs.pod:9
61 " #include <guestfs.h>\n"
66 #: ../src/guestfs.pod:11
69 " guestfs_h *g = guestfs_create ();\n"
70 " guestfs_add_drive (g, \"guest.img\");\n"
71 " guestfs_launch (g);\n"
72 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
73 " guestfs_touch (g, \"/hello\");\n"
74 " guestfs_umount (g, \"/\");\n"
75 " guestfs_sync (g);\n"
76 " guestfs_close (g);\n"
81 #: ../src/guestfs.pod:20
84 " cc prog.c -o prog -lguestfs\n"
86 " cc prog.c -o prog `pkg-config libguestfs --cflags --libs`\n"
91 #: ../src/guestfs.pod:24 ../fish/guestfish.pod:30
92 #: ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:20
93 #: ../inspector/virt-inspector.pl:43 ../tools/virt-edit.pl:50
94 #: ../tools/virt-win-reg.pl:63 ../tools/virt-df.pl:46 ../tools/virt-ls.pl:42
95 #: ../tools/virt-resize.pl:50 ../tools/virt-list-filesystems.pl:40
96 #: ../tools/virt-cat.pl:41 ../tools/virt-tar.pl:72 ../tools/virt-rescue.pl:51
97 #: ../tools/virt-make-fs.pl:47 ../tools/virt-list-partitions.pl:40
102 #: ../src/guestfs.pod:26
104 "Libguestfs is a library for accessing and modifying guest disk images. "
105 "Amongst the things this is good for: making batch configuration changes to "
106 "guests, getting disk used/free statistics (see also: virt-df), migrating "
107 "between virtualization systems (see also: virt-p2v), performing partial "
108 "backups, performing partial guest clones, cloning guests and changing "
109 "registry/UUID/hostname info, and much else besides."
113 #: ../src/guestfs.pod:34
115 "Libguestfs uses Linux kernel and qemu code, and can access any type of guest "
116 "filesystem that Linux and qemu can, including but not limited to: ext2/3/4, "
117 "btrfs, FAT and NTFS, LVM, many different disk partition schemes, qcow, "
122 #: ../src/guestfs.pod:39
124 "Libguestfs provides ways to enumerate guest storage (eg. partitions, LVs, "
125 "what filesystem is in each LV, etc.). It can also run commands in the "
126 "context of the guest. Also you can access filesystems over FUSE."
130 #: ../src/guestfs.pod:44
132 "Libguestfs is a library that can be linked with C and C++ management "
133 "programs (or management programs written in OCaml, Perl, Python, Ruby, Java, "
134 "PHP, Haskell or C#). You can also use it from shell scripts or the command "
139 #: ../src/guestfs.pod:49
141 "You don't need to be root to use libguestfs, although obviously you do need "
142 "enough permissions to access the disk images."
146 #: ../src/guestfs.pod:52
148 "Libguestfs is a large API because it can do many things. For a gentle "
149 "introduction, please read the L</API OVERVIEW> section next."
153 #: ../src/guestfs.pod:55
158 #: ../src/guestfs.pod:57
160 "This section provides a gentler overview of the libguestfs API. We also try "
161 "to group API calls together, where that may not be obvious from reading "
162 "about the individual calls in the main section of this manual."
166 #: ../src/guestfs.pod:62
171 #: ../src/guestfs.pod:64
173 "Before you can use libguestfs calls, you have to create a handle. Then you "
174 "must add at least one disk image to the handle, followed by launching the "
175 "handle, then performing whatever operations you want, and finally closing "
176 "the handle. By convention we use the single letter C<g> for the name of the "
177 "handle variable, although of course you can use any name you want."
181 #: ../src/guestfs.pod:71
182 msgid "The general structure of all libguestfs-using programs looks like this:"
186 #: ../src/guestfs.pod:74
189 " guestfs_h *g = guestfs_create ();\n"
194 #: ../src/guestfs.pod:76
197 " /* Call guestfs_add_drive additional times if there are\n"
198 " * multiple disk images.\n"
200 " guestfs_add_drive (g, \"guest.img\");\n"
205 #: ../src/guestfs.pod:81
208 " /* Most manipulation calls won't work until you've launched\n"
209 " * the handle 'g'. You have to do this _after_ adding drives\n"
210 " * and _before_ other commands.\n"
212 " guestfs_launch (g);\n"
217 #: ../src/guestfs.pod:87
220 " /* Now you can examine what partitions, LVs etc are available.\n"
222 " char **partitions = guestfs_list_partitions (g);\n"
223 " char **logvols = guestfs_lvs (g);\n"
228 #: ../src/guestfs.pod:92
231 " /* To access a filesystem in the image, you must mount it.\n"
233 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
238 #: ../src/guestfs.pod:96
241 " /* Now you can perform filesystem actions on the guest\n"
244 " guestfs_touch (g, \"/hello\");\n"
249 #: ../src/guestfs.pod:101
252 " /* You only need to call guestfs_sync if you have made\n"
253 " * changes to the guest image. (But if you've made changes\n"
254 " * then you *must* sync). See also: guestfs_umount and\n"
255 " * guestfs_umount_all calls.\n"
257 " guestfs_sync (g);\n"
262 #: ../src/guestfs.pod:108
265 " /* Close the handle 'g'. */\n"
266 " guestfs_close (g);\n"
271 #: ../src/guestfs.pod:111
273 "The code above doesn't include any error checking. In real code you should "
274 "check return values carefully for errors. In general all functions that "
275 "return integers return C<-1> on error, and all functions that return "
276 "pointers return C<NULL> on error. See section L</ERROR HANDLING> below for "
277 "how to handle errors, and consult the documentation for each function call "
278 "below to see precisely how they return error indications."
282 #: ../src/guestfs.pod:119
287 #: ../src/guestfs.pod:121
289 "The image filename (C<\"guest.img\"> in the example above) could be a disk "
290 "image from a virtual machine, a L<dd(1)> copy of a physical hard disk, an "
291 "actual block device, or simply an empty file of zeroes that you have created "
292 "through L<posix_fallocate(3)>. Libguestfs lets you do useful things to all "
297 #: ../src/guestfs.pod:127
299 "The call you should use in modern code for adding drives is L</"
300 "guestfs_add_drive_opts>. To add a disk image, allowing writes, and "
301 "specifying that the format is raw, do:"
305 #: ../src/guestfs.pod:131
308 " guestfs_add_drive_opts (g, filename,\n"
309 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
315 #: ../src/guestfs.pod:135
316 msgid "You can add a disk read-only using:"
320 #: ../src/guestfs.pod:137
323 " guestfs_add_drive_opts (g, filename,\n"
324 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
325 " GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
331 #: ../src/guestfs.pod:142
333 "or by calling the older function L</guestfs_add_drive_ro>. In either case "
334 "libguestfs won't modify the file."
338 #: ../src/guestfs.pod:145
340 "Be extremely cautious if the disk image is in use, eg. if it is being used "
341 "by a virtual machine. Adding it read-write will almost certainly cause disk "
342 "corruption, but adding it read-only is safe."
346 #: ../src/guestfs.pod:149
348 "You must add at least one disk image, and you may add multiple disk images. "
349 "In the API, the disk images are usually referred to as C</dev/sda> (for the "
350 "first one you added), C</dev/sdb> (for the second one you added), etc."
354 #: ../src/guestfs.pod:154
356 "Once L</guestfs_launch> has been called you cannot add any more images. You "
357 "can call L</guestfs_list_devices> to get a list of the device names, in the "
358 "order that you added them. See also L</BLOCK DEVICE NAMING> below."
362 #: ../src/guestfs.pod:159
367 #: ../src/guestfs.pod:161
369 "Before you can read or write files, create directories and so on in a disk "
370 "image that contains filesystems, you have to mount those filesystems using "
371 "L</guestfs_mount>. If you already know that a disk image contains (for "
372 "example) one partition with a filesystem on that partition, then you can "
377 #: ../src/guestfs.pod:167
380 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
385 #: ../src/guestfs.pod:169
387 "where C</dev/sda1> means literally the first partition (C<1>) of the first "
388 "disk image that we added (C</dev/sda>). If the disk contains Linux LVM2 "
389 "logical volumes you could refer to those instead (eg. C</dev/VG/LV>)."
393 #: ../src/guestfs.pod:173
395 "If you are given a disk image and you don't know what it contains then you "
396 "have to find out. Libguestfs can do that too: use L</"
397 "guestfs_list_partitions> and L</guestfs_lvs> to list possible partitions and "
398 "LVs, and either try mounting each to see what is mountable, or else examine "
399 "them with L</guestfs_vfs_type> or L</guestfs_file>. Libguestfs also has a "
400 "set of APIs for inspection of disk images (see L</INSPECTION> below). But "
401 "you might find it easier to look at higher level programs built on top of "
402 "libguestfs, in particular L<virt-inspector(1)>."
406 #: ../src/guestfs.pod:183
408 "To mount a disk image read-only, use L</guestfs_mount_ro>. There are "
409 "several other variations of the C<guestfs_mount_*> call."
413 #: ../src/guestfs.pod:186
414 msgid "FILESYSTEM ACCESS AND MODIFICATION"
418 #: ../src/guestfs.pod:188
420 "The majority of the libguestfs API consists of fairly low-level calls for "
421 "accessing and modifying the files, directories, symlinks etc on mounted "
422 "filesystems. There are over a hundred such calls which you can find listed "
423 "in detail below in this man page, and we don't even pretend to cover them "
424 "all in this overview."
428 #: ../src/guestfs.pod:194
430 "Specify filenames as full paths, starting with C<\"/\"> and including the "
435 #: ../src/guestfs.pod:197
437 "For example, if you mounted a filesystem at C<\"/\"> and you want to read "
438 "the file called C<\"etc/passwd\"> then you could do:"
442 #: ../src/guestfs.pod:200
445 " char *data = guestfs_cat (g, \"/etc/passwd\");\n"
450 #: ../src/guestfs.pod:202
452 "This would return C<data> as a newly allocated buffer containing the full "
453 "content of that file (with some conditions: see also L</DOWNLOADING> below), "
454 "or C<NULL> if there was an error."
458 #: ../src/guestfs.pod:206
460 "As another example, to create a top-level directory on that filesystem "
461 "called C<\"var\"> you would do:"
465 #: ../src/guestfs.pod:209
468 " guestfs_mkdir (g, \"/var\");\n"
473 #: ../src/guestfs.pod:211
474 msgid "To create a symlink you could do:"
478 #: ../src/guestfs.pod:213
481 " guestfs_ln_s (g, \"/etc/init.d/portmap\",\n"
482 " \"/etc/rc3.d/S30portmap\");\n"
487 #: ../src/guestfs.pod:216
489 "Libguestfs will reject attempts to use relative paths and there is no "
490 "concept of a current working directory."
494 #: ../src/guestfs.pod:219
496 "Libguestfs can return errors in many situations: for example if the "
497 "filesystem isn't writable, or if a file or directory that you requested "
498 "doesn't exist. If you are using the C API (documented here) you have to "
499 "check for those error conditions after each call. (Other language bindings "
500 "turn these errors into exceptions)."
504 #: ../src/guestfs.pod:225
506 "File writes are affected by the per-handle umask, set by calling L</"
507 "guestfs_umask> and defaulting to 022. See L</UMASK>."
511 #: ../src/guestfs.pod:228
516 #: ../src/guestfs.pod:230
518 "Libguestfs contains API calls to read, create and modify partition tables on "
523 #: ../src/guestfs.pod:233
525 "In the common case where you want to create a single partition covering the "
526 "whole disk, you should use the L</guestfs_part_disk> call:"
530 #: ../src/guestfs.pod:237
533 " const char *parttype = \"mbr\";\n"
534 " if (disk_is_larger_than_2TB)\n"
535 " parttype = \"gpt\";\n"
536 " guestfs_part_disk (g, \"/dev/sda\", parttype);\n"
541 #: ../src/guestfs.pod:242
543 "Obviously this effectively wipes anything that was on that disk image before."
547 #: ../src/guestfs.pod:245
552 #: ../src/guestfs.pod:247
554 "Libguestfs provides access to a large part of the LVM2 API, such as L</"
555 "guestfs_lvcreate> and L</guestfs_vgremove>. It won't make much sense unless "
556 "you familiarize yourself with the concepts of physical volumes, volume "
557 "groups and logical volumes."
561 #: ../src/guestfs.pod:252
563 "This author strongly recommends reading the LVM HOWTO, online at L<http://"
564 "tldp.org/HOWTO/LVM-HOWTO/>."
568 #: ../src/guestfs.pod:255
573 #: ../src/guestfs.pod:257
575 "Use L</guestfs_cat> to download small, text only files. This call is "
576 "limited to files which are less than 2 MB and which cannot contain any ASCII "
577 "NUL (C<\\0>) characters. However it has a very simple to use API."
581 #: ../src/guestfs.pod:262
583 "L</guestfs_read_file> can be used to read files which contain arbitrary 8 "
584 "bit data, since it returns a (pointer, size) pair. However it is still "
585 "limited to \"small\" files, less than 2 MB."
589 #: ../src/guestfs.pod:266
591 "L</guestfs_download> can be used to download any file, with no limits on "
592 "content or size (even files larger than 4 GB)."
596 #: ../src/guestfs.pod:269
598 "To download multiple files, see L</guestfs_tar_out> and L</guestfs_tgz_out>."
602 #: ../src/guestfs.pod:272
607 #: ../src/guestfs.pod:274
609 "It's often the case that you want to write a file or files to the disk image."
613 #: ../src/guestfs.pod:277
615 "To write a small file with fixed content, use L</guestfs_write>. To create "
616 "a file of all zeroes, use L</guestfs_truncate_size> (sparse) or L</"
617 "guestfs_fallocate64> (with all disk blocks allocated). There are a variety "
618 "of other functions for creating test files, for example L</guestfs_fill> and "
619 "L</guestfs_fill_pattern>."
623 #: ../src/guestfs.pod:283
625 "To upload a single file, use L</guestfs_upload>. This call has no limits on "
626 "file content or size (even files larger than 4 GB)."
630 #: ../src/guestfs.pod:286
632 "To upload multiple files, see L</guestfs_tar_in> and L</guestfs_tgz_in>."
636 #: ../src/guestfs.pod:288
638 "However the fastest way to upload I<large numbers of arbitrary files> is to "
639 "turn them into a squashfs or CD ISO (see L<mksquashfs(8)> and L<mkisofs(8)"
640 ">), then attach this using L</guestfs_add_drive_ro>. If you add the drive "
641 "in a predictable way (eg. adding it last after all other drives) then you "
642 "can get the device name from L</guestfs_list_devices> and mount it directly "
643 "using L</guestfs_mount_ro>. Note that squashfs images are sometimes non-"
644 "portable between kernel versions, and they don't support labels or UUIDs. "
645 "If you want to pre-build an image or you need to mount it using a label or "
646 "UUID, use an ISO image instead."
650 #: ../src/guestfs.pod:299
655 #: ../src/guestfs.pod:301
657 "There are various different commands for copying between files and devices "
658 "and in and out of the guest filesystem. These are summarised in the table "
663 #: ../src/guestfs.pod:307
664 msgid "B<file> to B<file>"
668 #: ../src/guestfs.pod:309
670 "Use L</guestfs_cp> to copy a single file, or L</guestfs_cp_a> to copy "
671 "directories recursively."
675 #: ../src/guestfs.pod:312
676 msgid "B<file or device> to B<file or device>"
680 #: ../src/guestfs.pod:314
682 "Use L</guestfs_dd> which efficiently uses L<dd(1)> to copy between files and "
683 "devices in the guest."
687 #: ../src/guestfs.pod:317
688 msgid "Example: duplicate the contents of an LV:"
692 #: ../src/guestfs.pod:319
695 " guestfs_dd (g, \"/dev/VG/Original\", \"/dev/VG/Copy\");\n"
700 #: ../src/guestfs.pod:321
702 "The destination (C</dev/VG/Copy>) must be at least as large as the source "
703 "(C</dev/VG/Original>). To copy less than the whole source device, use L</"
704 "guestfs_copy_size>."
708 #: ../src/guestfs.pod:325
709 msgid "B<file on the host> to B<file or device>"
713 #: ../src/guestfs.pod:327
714 msgid "Use L</guestfs_upload>. See L</UPLOADING> above."
718 #: ../src/guestfs.pod:329
719 msgid "B<file or device> to B<file on the host>"
723 #: ../src/guestfs.pod:331
724 msgid "Use L</guestfs_download>. See L</DOWNLOADING> above."
728 #: ../src/guestfs.pod:335
729 msgid "LISTING FILES"
733 #: ../src/guestfs.pod:337
735 "L</guestfs_ll> is just designed for humans to read (mainly when using the "
736 "L<guestfish(1)>-equivalent command C<ll>)."
740 #: ../src/guestfs.pod:340
742 "L</guestfs_ls> is a quick way to get a list of files in a directory from "
743 "programs, as a flat list of strings."
747 #: ../src/guestfs.pod:343
749 "L</guestfs_readdir> is a programmatic way to get a list of files in a "
750 "directory, plus additional information about each one. It is more "
751 "equivalent to using the L<readdir(3)> call on a local filesystem."
755 #: ../src/guestfs.pod:347
757 "L</guestfs_find> and L</guestfs_find0> can be used to recursively list files."
761 #: ../src/guestfs.pod:350
762 msgid "RUNNING COMMANDS"
766 #: ../src/guestfs.pod:352
768 "Although libguestfs is primarily an API for manipulating files inside guest "
769 "images, we also provide some limited facilities for running commands inside "
774 #: ../src/guestfs.pod:356
775 msgid "There are many limitations to this:"
779 #: ../src/guestfs.pod:360 ../src/guestfs.pod:365 ../src/guestfs.pod:370
780 #: ../src/guestfs.pod:374 ../src/guestfs.pod:379 ../src/guestfs.pod:383
781 #: ../src/guestfs.pod:388 ../src/guestfs.pod:393 ../src/guestfs.pod:1159
782 #: ../src/guestfs.pod:1164 ../src/guestfs.pod:1168 ../src/guestfs.pod:1384
783 #: ../src/guestfs.pod:1389 ../src/guestfs.pod:1393 ../src/guestfs.pod:1495
784 #: ../src/guestfs.pod:1499 ../src/guestfs.pod:1503 ../src/guestfs.pod:1508
785 #: ../src/guestfs.pod:1516 ../src/guestfs.pod:1535 ../src/guestfs.pod:1543
786 #: ../src/guestfs.pod:1773 ../src/guestfs.pod:1779 ../src/guestfs.pod:1784
787 #: ../src/guestfs.pod:1790 ../src/guestfs.pod:1897 ../src/guestfs.pod:1901
788 #: ../src/guestfs.pod:1905 ../src/guestfs.pod:1909
789 #: ../src/guestfs-actions.pod:14 ../src/guestfs-actions.pod:21
790 #: ../src/guestfs-actions.pod:438 ../src/guestfs-actions.pod:446
791 #: ../src/guestfs-actions.pod:453 ../src/guestfs-actions.pod:460
792 #: ../src/guestfs-actions.pod:1351 ../src/guestfs-actions.pod:1355
793 #: ../src/guestfs-actions.pod:1359 ../src/guestfs-actions.pod:1363
794 #: ../src/guestfs-actions.pod:1371 ../src/guestfs-actions.pod:1375
795 #: ../src/guestfs-actions.pod:1379 ../src/guestfs-actions.pod:1389
796 #: ../src/guestfs-actions.pod:1393 ../src/guestfs-actions.pod:1397
797 #: ../src/guestfs-actions.pod:1520 ../src/guestfs-actions.pod:1524
798 #: ../src/guestfs-actions.pod:1529 ../src/guestfs-actions.pod:1534
799 #: ../src/guestfs-actions.pod:1586 ../src/guestfs-actions.pod:1590
800 #: ../src/guestfs-actions.pod:1595 ../fish/guestfish.pod:364
801 #: ../fish/guestfish.pod:368 ../fish/guestfish.pod:372
802 #: ../fish/guestfish.pod:376 ../fish/guestfish-actions.pod:13
803 #: ../fish/guestfish-actions.pod:20 ../fish/guestfish-actions.pod:339
804 #: ../fish/guestfish-actions.pod:347 ../fish/guestfish-actions.pod:354
805 #: ../fish/guestfish-actions.pod:361 ../fish/guestfish-actions.pod:1056
806 #: ../fish/guestfish-actions.pod:1060 ../fish/guestfish-actions.pod:1064
807 #: ../fish/guestfish-actions.pod:1068 ../fish/guestfish-actions.pod:1076
808 #: ../fish/guestfish-actions.pod:1080 ../fish/guestfish-actions.pod:1084
809 #: ../fish/guestfish-actions.pod:1094 ../fish/guestfish-actions.pod:1098
810 #: ../fish/guestfish-actions.pod:1102 ../fish/guestfish-actions.pod:1192
811 #: ../fish/guestfish-actions.pod:1196 ../fish/guestfish-actions.pod:1201
812 #: ../fish/guestfish-actions.pod:1206 ../fish/guestfish-actions.pod:1248
813 #: ../fish/guestfish-actions.pod:1252 ../fish/guestfish-actions.pod:1257
814 #: ../inspector/virt-inspector.pl:370 ../inspector/virt-inspector.pl:374
815 #: ../tools/virt-df.pl:161 ../tools/virt-df.pl:167 ../tools/virt-resize.pl:348
816 #: ../tools/virt-resize.pl:353 ../tools/virt-resize.pl:363
821 #: ../src/guestfs.pod:362
823 "The kernel version that the command runs under will be different from what "
828 #: ../src/guestfs.pod:367
830 "If the command needs to communicate with daemons, then most likely they "
835 #: ../src/guestfs.pod:372
836 msgid "The command will be running in limited memory."
840 #: ../src/guestfs.pod:376
842 "The network may not be available unless you enable it (see L</"
843 "guestfs_set_network>)."
847 #: ../src/guestfs.pod:381
848 msgid "Only supports Linux guests (not Windows, BSD, etc)."
852 #: ../src/guestfs.pod:385
854 "Architecture limitations (eg. won't work for a PPC guest on an X86 host)."
858 #: ../src/guestfs.pod:390
860 "For SELinux guests, you may need to enable SELinux and load policy first. "
861 "See L</SELINUX> in this manpage."
865 #: ../src/guestfs.pod:395
867 "I<Security:> It is not safe to run commands from untrusted, possibly "
868 "malicious guests. These commands may attempt to exploit your program by "
869 "sending unexpected output. They could also try to exploit the Linux kernel "
870 "or qemu provided by the libguestfs appliance. They could use the network "
871 "provided by the libguestfs appliance to bypass ordinary network partitions "
872 "and firewalls. They could use the elevated privileges or different SELinux "
873 "context of your program to their advantage."
877 #: ../src/guestfs.pod:404
879 "A secure alternative is to use libguestfs to install a \"firstboot\" script "
880 "(a script which runs when the guest next boots normally), and to have this "
881 "script run the commands you want in the normal context of the running guest, "
882 "network security and so on."
886 #: ../src/guestfs.pod:411
888 "The two main API calls to run commands are L</guestfs_command> and L</"
889 "guestfs_sh> (there are also variations)."
893 #: ../src/guestfs.pod:414
895 "The difference is that L</guestfs_sh> runs commands using the shell, so any "
896 "shell globs, redirections, etc will work."
900 #: ../src/guestfs.pod:417
901 msgid "CONFIGURATION FILES"
905 #: ../src/guestfs.pod:419
907 "To read and write configuration files in Linux guest filesystems, we "
908 "strongly recommend using Augeas. For example, Augeas understands how to "
909 "read and write, say, a Linux shadow password file or X.org configuration "
910 "file, and so avoids you having to write that code."
914 #: ../src/guestfs.pod:424
916 "The main Augeas calls are bound through the C<guestfs_aug_*> APIs. We don't "
917 "document Augeas itself here because there is excellent documentation on the "
918 "L<http://augeas.net/> website."
922 #: ../src/guestfs.pod:428
924 "If you don't want to use Augeas (you fool!) then try calling L</"
925 "guestfs_read_lines> to get the file as a list of lines which you can iterate "
930 #: ../src/guestfs.pod:432
935 #: ../src/guestfs.pod:434
937 "We support SELinux guests. To ensure that labeling happens correctly in "
938 "SELinux guests, you need to enable SELinux and load the guest's policy:"
942 #: ../src/guestfs.pod:440
947 #: ../src/guestfs.pod:442
948 msgid "Before launching, do:"
952 #: ../src/guestfs.pod:444
955 " guestfs_set_selinux (g, 1);\n"
960 #: ../src/guestfs.pod:446
965 #: ../src/guestfs.pod:448
967 "After mounting the guest's filesystem(s), load the policy. This is best "
968 "done by running the L<load_policy(8)> command in the guest itself:"
972 #: ../src/guestfs.pod:452
975 " guestfs_sh (g, \"/usr/sbin/load_policy\");\n"
980 #: ../src/guestfs.pod:454
982 "(Older versions of C<load_policy> require you to specify the name of the "
987 #: ../src/guestfs.pod:457
992 #: ../src/guestfs.pod:459
994 "Optionally, set the security context for the API. The correct security "
995 "context to use can only be known by inspecting the guest. As an example:"
999 #: ../src/guestfs.pod:463
1002 " guestfs_setcon (g, \"unconfined_u:unconfined_r:unconfined_t:s0\");\n"
1007 #: ../src/guestfs.pod:467
1008 msgid "This will work for running commands and editing existing files."
1012 #: ../src/guestfs.pod:469
1014 "When new files are created, you may need to label them explicitly, for "
1015 "example by running the external command C<restorecon pathname>."
1019 #: ../src/guestfs.pod:473
1024 #: ../src/guestfs.pod:475
1026 "Certain calls are affected by the current file mode creation mask (the "
1027 "\"umask\"). In particular ones which create files or directories, such as "
1028 "L</guestfs_touch>, L</guestfs_mknod> or L</guestfs_mkdir>. This affects "
1029 "either the default mode that the file is created with or modifies the mode "
1034 #: ../src/guestfs.pod:481
1036 "The default umask is C<022>, so files are created with modes such as C<0644> "
1037 "and directories with C<0755>."
1041 #: ../src/guestfs.pod:484
1043 "There are two ways to avoid being affected by umask. Either set umask to 0 "
1044 "(call C<guestfs_umask (g, 0)> early after launching). Or call L</"
1045 "guestfs_chmod> after creating each file or directory."
1049 #: ../src/guestfs.pod:488
1050 msgid "For more information about umask, see L<umask(2)>."
1054 #: ../src/guestfs.pod:490 ../fish/guestfish.pod:630
1055 msgid "ENCRYPTED DISKS"
1059 #: ../src/guestfs.pod:492
1061 "Libguestfs allows you to access Linux guests which have been encrypted using "
1062 "whole disk encryption that conforms to the Linux Unified Key Setup (LUKS) "
1063 "standard. This includes nearly all whole disk encryption systems used by "
1064 "modern Linux guests."
1068 #: ../src/guestfs.pod:498
1070 "Use L</guestfs_vfs_type> to identify LUKS-encrypted block devices (it "
1071 "returns the string C<crypto_LUKS>)."
1075 #: ../src/guestfs.pod:501
1077 "Then open these devices by calling L</guestfs_luks_open>. Obviously you "
1078 "will require the passphrase!"
1082 #: ../src/guestfs.pod:504
1084 "Opening a LUKS device creates a new device mapper device called C</dev/"
1085 "mapper/mapname> (where C<mapname> is the string you supply to L</"
1086 "guestfs_luks_open>). Reads and writes to this mapper device are decrypted "
1087 "from and encrypted to the underlying block device respectively."
1091 #: ../src/guestfs.pod:510
1093 "LVM volume groups on the device can be made visible by calling L</"
1094 "guestfs_vgscan> followed by L</guestfs_vg_activate_all>. The logical volume"
1095 "(s) can now be mounted in the usual way."
1099 #: ../src/guestfs.pod:514
1101 "Use the reverse process to close a LUKS device. Unmount any logical volumes "
1102 "on it, deactivate the volume groups by caling C<guestfs_vg_activate (g, 0, "
1103 "[\"/dev/VG\"])>. Then close the mapper device by calling L</"
1104 "guestfs_luks_close> on the C</dev/mapper/mapname> device (I<not> the "
1105 "underlying encrypted block device)."
1109 #: ../src/guestfs.pod:521
1114 #: ../src/guestfs.pod:523
1116 "Libguestfs has APIs for inspecting an unknown disk image to find out if it "
1117 "contains operating systems. (These APIs used to be in a separate Perl-only "
1118 "library called L<Sys::Guestfs::Lib(3)> but since version 1.5.3 the most "
1119 "frequently used part of this library has been rewritten in C and moved into "
1124 #: ../src/guestfs.pod:529
1126 "Add all disks belonging to the unknown virtual machine and call L</"
1127 "guestfs_launch> in the usual way."
1131 #: ../src/guestfs.pod:532
1133 "Then call L</guestfs_inspect_os>. This function uses other libguestfs calls "
1134 "and certain heuristics, and returns a list of operating systems that were "
1135 "found. An empty list means none were found. A single element is the root "
1136 "filesystem of the operating system. For dual- or multi-boot guests, "
1137 "multiple roots can be returned, each one corresponding to a separate "
1138 "operating system. (Multi-boot virtual machines are extremely rare in the "
1139 "world of virtualization, but since this scenario can happen, we have built "
1140 "libguestfs to deal with it.)"
1144 #: ../src/guestfs.pod:541
1146 "For each root, you can then call various C<guestfs_inspect_get_*> functions "
1147 "to get additional details about that operating system. For example, call L</"
1148 "guestfs_inspect_get_type> to return the string C<windows> or C<linux> for "
1149 "Windows and Linux-based operating systems respectively."
1153 #: ../src/guestfs.pod:547
1155 "Un*x-like and Linux-based operating systems usually consist of several "
1156 "filesystems which are mounted at boot time (for example, a separate boot "
1157 "partition mounted on C</boot>). The inspection rules are able to detect how "
1158 "filesystems correspond to mount points. Call "
1159 "C<guestfs_inspect_get_mountpoints> to get this mapping. It might return a "
1160 "hash table like this example:"
1164 #: ../src/guestfs.pod:554
1167 " /boot => /dev/sda1\n"
1168 " / => /dev/vg_guest/lv_root\n"
1169 " /usr => /dev/vg_guest/lv_usr\n"
1174 #: ../src/guestfs.pod:558
1176 "The caller can then make calls to L</guestfs_mount_options> to mount the "
1177 "filesystems as suggested."
1181 #: ../src/guestfs.pod:561
1183 "Be careful to mount filesystems in the right order (eg. C</> before C</"
1184 "usr>). Sorting the keys of the hash by length, shortest first, should work."
1188 #: ../src/guestfs.pod:565
1190 "Inspection currently only works for some common operating systems. "
1191 "Contributors are welcome to send patches for other operating systems that we "
1192 "currently cannot detect."
1196 #: ../src/guestfs.pod:569
1198 "Encrypted disks must be opened before inspection. See L</ENCRYPTED DISKS> "
1199 "for more details. The L</guestfs_inspect_os> function just ignores any "
1200 "encrypted devices."
1204 #: ../src/guestfs.pod:573
1206 "A note on the implementation: The call L</guestfs_inspect_os> performs "
1207 "inspection and caches the results in the guest handle. Subsequent calls to "
1208 "C<guestfs_inspect_get_*> return this cached information, but I<do not> re-"
1209 "read the disks. If you change the content of the guest disks, you can redo "
1210 "inspection by calling L</guestfs_inspect_os> again."
1214 #: ../src/guestfs.pod:580
1215 msgid "SPECIAL CONSIDERATIONS FOR WINDOWS GUESTS"
1219 #: ../src/guestfs.pod:582
1221 "Libguestfs can mount NTFS partitions. It does this using the L<http://www."
1222 "ntfs-3g.org/> driver."
1226 #: ../src/guestfs.pod:585
1228 "DOS and Windows still use drive letters, and the filesystems are always "
1229 "treated as case insensitive by Windows itself, and therefore you might find "
1230 "a Windows configuration file referring to a path like C<c:\\windows"
1231 "\\system32>. When the filesystem is mounted in libguestfs, that directory "
1232 "might be referred to as C</WINDOWS/System32>."
1236 #: ../src/guestfs.pod:591
1238 "Drive letter mappings are outside the scope of libguestfs. You have to use "
1239 "libguestfs to read the appropriate Windows Registry and configuration files, "
1240 "to determine yourself how drives are mapped (see also L<hivex(3)> and L<virt-"
1245 #: ../src/guestfs.pod:596
1247 "Replacing backslash characters with forward slash characters is also outside "
1248 "the scope of libguestfs, but something that you can easily do."
1252 #: ../src/guestfs.pod:599
1254 "Where we can help is in resolving the case insensitivity of paths. For "
1255 "this, call L</guestfs_case_sensitive_path>."
1259 #: ../src/guestfs.pod:602
1261 "Libguestfs also provides some help for decoding Windows Registry \"hive\" "
1262 "files, through the library C<hivex> which is part of the libguestfs project "
1263 "although ships as a separate tarball. You have to locate and download the "
1264 "hive file(s) yourself, and then pass them to C<hivex> functions. See also "
1265 "the programs L<hivexml(1)>, L<hivexsh(1)>, L<hivexregedit(1)> and L<virt-win-"
1266 "reg(1)> for more help on this issue."
1270 #: ../src/guestfs.pod:610
1271 msgid "USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES"
1275 #: ../src/guestfs.pod:612
1277 "Although we don't want to discourage you from using the C API, we will "
1278 "mention here that the same API is also available in other languages."
1282 #: ../src/guestfs.pod:615
1284 "The API is broadly identical in all supported languages. This means that "
1285 "the C call C<guestfs_mount(g,path)> is C<$g-E<gt>mount($path)> in Perl, C<g."
1286 "mount(path)> in Python, and C<Guestfs.mount g path> in OCaml. In other "
1287 "words, a straightforward, predictable isomorphism between each language."
1291 #: ../src/guestfs.pod:621
1293 "Error messages are automatically transformed into exceptions if the language "
1298 #: ../src/guestfs.pod:624
1300 "We don't try to \"object orientify\" parts of the API in OO languages, "
1301 "although contributors are welcome to write higher level APIs above what we "
1302 "provide in their favourite languages if they wish."
1306 #: ../src/guestfs.pod:630
1311 #: ../src/guestfs.pod:632
1313 "You can use the I<guestfs.h> header file from C++ programs. The C++ API is "
1314 "identical to the C API. C++ classes and exceptions are not used."
1318 #: ../src/guestfs.pod:636
1323 #: ../src/guestfs.pod:638
1325 "The C# bindings are highly experimental. Please read the warnings at the "
1326 "top of C<csharp/Libguestfs.cs>."
1330 #: ../src/guestfs.pod:641
1335 #: ../src/guestfs.pod:643
1337 "This is the only language binding that is working but incomplete. Only "
1338 "calls which return simple integers have been bound in Haskell, and we are "
1339 "looking for help to complete this binding."
1343 #: ../src/guestfs.pod:647
1348 #: ../src/guestfs.pod:649
1350 "Full documentation is contained in the Javadoc which is distributed with "
1355 #: ../src/guestfs.pod:652
1360 #: ../src/guestfs.pod:654
1361 msgid "For documentation see the file C<guestfs.mli>."
1365 #: ../src/guestfs.pod:656
1370 #: ../src/guestfs.pod:658
1371 msgid "For documentation see L<Sys::Guestfs(3)>."
1375 #: ../src/guestfs.pod:660
1380 #: ../src/guestfs.pod:662
1382 "For documentation see C<README-PHP> supplied with libguestfs sources or in "
1383 "the php-libguestfs package for your distribution."
1387 #: ../src/guestfs.pod:665
1388 msgid "The PHP binding only works correctly on 64 bit machines."
1392 #: ../src/guestfs.pod:667
1397 #: ../src/guestfs.pod:669
1398 msgid "For documentation do:"
1402 #: ../src/guestfs.pod:671
1406 " >>> import guestfs\n"
1407 " >>> help (guestfs)\n"
1412 #: ../src/guestfs.pod:675
1417 #: ../src/guestfs.pod:677
1419 "Use the Guestfs module. There is no Ruby-specific documentation, but you "
1420 "can find examples written in Ruby in the libguestfs source."
1424 #: ../src/guestfs.pod:680
1425 msgid "B<shell scripts>"
1429 #: ../src/guestfs.pod:682
1430 msgid "For documentation see L<guestfish(1)>."
1434 #: ../src/guestfs.pod:686
1435 msgid "LIBGUESTFS GOTCHAS"
1439 #: ../src/guestfs.pod:688
1441 "L<http://en.wikipedia.org/wiki/Gotcha_(programming)>: \"A feature of a "
1442 "system [...] that works in the way it is documented but is counterintuitive "
1443 "and almost invites mistakes.\""
1447 #: ../src/guestfs.pod:692
1449 "Since we developed libguestfs and the associated tools, there are several "
1450 "things we would have designed differently, but are now stuck with for "
1451 "backwards compatibility or other reasons. If there is ever a libguestfs 2.0 "
1452 "release, you can expect these to change. Beware of them."
1456 #: ../src/guestfs.pod:700
1457 msgid "Autosync / forgetting to sync."
1461 #: ../src/guestfs.pod:702
1463 "When modifying a filesystem from C or another language, you B<must> unmount "
1464 "all filesystems and call L</guestfs_sync> explicitly before you close the "
1465 "libguestfs handle. You can also call:"
1469 #: ../src/guestfs.pod:706
1472 " guestfs_set_autosync (g, 1);\n"
1477 #: ../src/guestfs.pod:708
1479 "to have the unmount/sync done automatically for you when the handle 'g' is "
1480 "closed. (This feature is called \"autosync\", L</guestfs_set_autosync> q.v.)"
1484 #: ../src/guestfs.pod:712
1486 "If you forget to do this, then it is entirely possible that your changes "
1487 "won't be written out, or will be partially written, or (very rarely) that "
1488 "you'll get disk corruption."
1492 #: ../src/guestfs.pod:716
1494 "Note that in L<guestfish(3)> autosync is the default. So quick and dirty "
1495 "guestfish scripts that forget to sync will work just fine, which can make "
1496 "this very puzzling if you are trying to debug a problem."
1500 #: ../src/guestfs.pod:720
1502 "Update: Autosync is enabled by default for all API users starting from "
1503 "libguestfs 1.5.24."
1507 #: ../src/guestfs.pod:723
1508 msgid "Mount option C<-o sync> should not be the default."
1512 #: ../src/guestfs.pod:725
1514 "If you use L</guestfs_mount>, then C<-o sync,noatime> are added implicitly. "
1515 "However C<-o sync> does not add any reliability benefit, but does have a "
1516 "very large performance impact."
1520 #: ../src/guestfs.pod:729
1522 "The work around is to use L</guestfs_mount_options> and set the mount "
1523 "options that you actually want to use."
1527 #: ../src/guestfs.pod:732
1528 msgid "Read-only should be the default."
1532 #: ../src/guestfs.pod:734
1534 "In L<guestfish(3)>, I<--ro> should be the default, and you should have to "
1535 "specify I<--rw> if you want to make changes to the image."
1539 #: ../src/guestfs.pod:737
1540 msgid "This would reduce the potential to corrupt live VM images."
1544 #: ../src/guestfs.pod:739
1546 "Note that many filesystems change the disk when you just mount and unmount, "
1547 "even if you didn't perform any writes. You need to use L</"
1548 "guestfs_add_drive_ro> to guarantee that the disk is not changed."
1552 #: ../src/guestfs.pod:743
1553 msgid "guestfish command line is hard to use."
1557 #: ../src/guestfs.pod:745
1559 "C<guestfish disk.img> doesn't do what people expect (open C<disk.img> for "
1560 "examination). It tries to run a guestfish command C<disk.img> which doesn't "
1561 "exist, so it fails. In earlier versions of guestfish the error message was "
1562 "also unintuitive, but we have corrected this since. Like the Bourne shell, "
1563 "we should have used C<guestfish -c command> to run commands."
1567 #: ../src/guestfs.pod:752
1568 msgid "guestfish megabyte modifiers don't work right on all commands"
1572 #: ../src/guestfs.pod:754
1574 "In recent guestfish you can use C<1M> to mean 1 megabyte (and similarly for "
1575 "other modifiers). What guestfish actually does is to multiply the number "
1576 "part by the modifier part and pass the result to the C API. However this "
1577 "doesn't work for a few APIs which aren't expecting bytes, but are already "
1578 "expecting some other unit (eg. megabytes)."
1582 #: ../src/guestfs.pod:761
1583 msgid "The most common is L</guestfs_lvcreate>. The guestfish command:"
1587 #: ../src/guestfs.pod:763
1590 " lvcreate LV VG 100M\n"
1595 #: ../src/guestfs.pod:765
1597 "does not do what you might expect. Instead because L</guestfs_lvcreate> is "
1598 "already expecting megabytes, this tries to create a 100 I<terabyte> (100 "
1599 "megabytes * megabytes) logical volume. The error message you get from this "
1600 "is also a little obscure."
1604 #: ../src/guestfs.pod:770
1606 "This could be fixed in the generator by specially marking parameters and "
1607 "return values which take bytes or other units."
1611 #: ../src/guestfs.pod:773
1612 msgid "Library should return errno with error messages."
1616 #: ../src/guestfs.pod:775
1618 "It would be a nice-to-have to be able to get the original value of 'errno' "
1619 "from inside the appliance along error paths (where set). Currently "
1620 "L<guestmount(1)> goes through hoops to try to reverse the error message "
1621 "string into an errno, see the function error() in fuse/guestmount.c."
1625 #: ../src/guestfs.pod:781
1627 "In libguestfs 1.5.4, the protocol was changed so that the Linux errno is "
1628 "sent back from the daemon."
1632 #: ../src/guestfs.pod:784
1633 msgid "Ambiguity between devices and paths"
1637 #: ../src/guestfs.pod:786
1639 "There is a subtle ambiguity in the API between a device name (eg. C</dev/"
1640 "sdb2>) and a similar pathname. A file might just happen to be called "
1641 "C<sdb2> in the directory C</dev> (consider some non-Unix VM image)."
1645 #: ../src/guestfs.pod:791
1647 "In the current API we usually resolve this ambiguity by having two separate "
1648 "calls, for example L</guestfs_checksum> and L</guestfs_checksum_device>. "
1649 "Some API calls are ambiguous and (incorrectly) resolve the problem by "
1650 "detecting if the path supplied begins with C</dev/>."
1654 #: ../src/guestfs.pod:797
1656 "To avoid both the ambiguity and the need to duplicate some calls, we could "
1657 "make paths/devices into structured names. One way to do this would be to "
1658 "use a notation like grub (C<hd(0,0)>), although nobody really likes this "
1659 "aspect of grub. Another way would be to use a structured type, equivalent "
1660 "to this OCaml type:"
1664 #: ../src/guestfs.pod:803
1667 " type path = Path of string | Device of int | Partition of int * int\n"
1672 #: ../src/guestfs.pod:805
1673 msgid "which would allow you to pass arguments like:"
1677 #: ../src/guestfs.pod:807
1680 " Path \"/foo/bar\"\n"
1681 " Device 1 (* /dev/sdb, or perhaps /dev/sda *)\n"
1682 " Partition (1, 2) (* /dev/sdb2 (or is it /dev/sda2 or /dev/sdb3?) *)\n"
1683 " Path \"/dev/sdb2\" (* not a device *)\n"
1688 #: ../src/guestfs.pod:812
1690 "As you can see there are still problems to resolve even with this "
1691 "representation. Also consider how it might work in guestfish."
1695 #: ../src/guestfs.pod:817
1696 msgid "PROTOCOL LIMITS"
1700 #: ../src/guestfs.pod:819
1702 "Internally libguestfs uses a message-based protocol to pass API calls and "
1703 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1704 "plenty more detail about this). The maximum message size used by the "
1705 "protocol is slightly less than 4 MB. For some API calls you may need to be "
1706 "aware of this limit. The API calls which may be affected are individually "
1707 "documented, with a link back to this section of the documentation."
1711 #: ../src/guestfs.pod:827
1713 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1714 "a simple string. Because this string is at some point internally encoded as "
1715 "a message, the maximum size that it can return is slightly under 4 MB. If "
1716 "the requested file is larger than this then you will get an error."
1720 #: ../src/guestfs.pod:833
1722 "In order to transfer large files into and out of the guest filesystem, you "
1723 "need to use particular calls that support this. The sections L</UPLOADING> "
1724 "and L</DOWNLOADING> document how to do this."
1728 #: ../src/guestfs.pod:837
1730 "You might also consider mounting the disk image using our FUSE filesystem "
1731 "support (L<guestmount(1)>)."
1735 #: ../src/guestfs.pod:840
1736 msgid "KEYS AND PASSPHRASES"
1740 #: ../src/guestfs.pod:842
1742 "Certain libguestfs calls take a parameter that contains sensitive key "
1743 "material, passed in as a C string."
1747 #: ../src/guestfs.pod:845
1749 "In the future we would hope to change the libguestfs implementation so that "
1750 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1751 "swap. However this is I<not> done at the moment, because of the complexity "
1752 "of such an implementation."
1756 #: ../src/guestfs.pod:850
1758 "Therefore you should be aware that any key parameter you pass to libguestfs "
1759 "might end up being written out to the swap partition. If this is a concern, "
1760 "scrub the swap partition or don't use libguestfs on encrypted devices."
1764 #: ../src/guestfs.pod:855
1765 msgid "CONNECTION MANAGEMENT"
1769 #: ../src/guestfs.pod:857
1774 #: ../src/guestfs.pod:859
1776 "C<guestfs_h> is the opaque type representing a connection handle. Create a "
1777 "handle by calling L</guestfs_create>. Call L</guestfs_close> to free the "
1778 "handle and release all resources used."
1782 #: ../src/guestfs.pod:863
1784 "For information on using multiple handles and threads, see the section L</"
1785 "MULTIPLE HANDLES AND MULTIPLE THREADS> below."
1789 #: ../src/guestfs.pod:866
1790 msgid "guestfs_create"
1794 #: ../src/guestfs.pod:868
1797 " guestfs_h *guestfs_create (void);\n"
1802 #: ../src/guestfs.pod:870
1803 msgid "Create a connection handle."
1807 #: ../src/guestfs.pod:872
1809 "You have to call L</guestfs_add_drive_opts> (or one of the equivalent calls) "
1810 "on the handle at least once."
1814 #: ../src/guestfs.pod:875
1816 "This function returns a non-NULL pointer to a handle on success or NULL on "
1821 #: ../src/guestfs.pod:878
1822 msgid "After configuring the handle, you have to call L</guestfs_launch>."
1826 #: ../src/guestfs.pod:880
1828 "You may also want to configure error handling for the handle. See L</ERROR "
1829 "HANDLING> section below."
1833 #: ../src/guestfs.pod:883
1834 msgid "guestfs_close"
1838 #: ../src/guestfs.pod:885
1841 " void guestfs_close (guestfs_h *g);\n"
1846 #: ../src/guestfs.pod:887
1847 msgid "This closes the connection handle and frees up all resources used."
1851 #: ../src/guestfs.pod:889
1852 msgid "ERROR HANDLING"
1856 #: ../src/guestfs.pod:891
1858 "The convention in all functions that return C<int> is that they return C<-1> "
1859 "to indicate an error. You can get additional information on errors by "
1860 "calling L</guestfs_last_error> and/or by setting up an error handler with L</"
1861 "guestfs_set_error_handler>."
1865 #: ../src/guestfs.pod:896
1866 msgid "The default error handler prints the information string to C<stderr>."
1870 #: ../src/guestfs.pod:898
1872 "Out of memory errors are handled differently. The default action is to call "
1873 "L<abort(3)>. If this is undesirable, then you can set a handler using L</"
1874 "guestfs_set_out_of_memory_handler>."
1878 #: ../src/guestfs.pod:902
1879 msgid "guestfs_last_error"
1883 #: ../src/guestfs.pod:904
1886 " const char *guestfs_last_error (guestfs_h *g);\n"
1891 #: ../src/guestfs.pod:906
1893 "This returns the last error message that happened on C<g>. If there has not "
1894 "been an error since the handle was created, then this returns C<NULL>."
1898 #: ../src/guestfs.pod:910
1900 "The lifetime of the returned string is until the next error occurs, or L</"
1901 "guestfs_close> is called."
1905 #: ../src/guestfs.pod:913
1907 "The error string is not localized (ie. is always in English), because this "
1908 "makes searching for error messages in search engines give the largest number "
1913 #: ../src/guestfs.pod:917
1914 msgid "guestfs_set_error_handler"
1918 #: ../src/guestfs.pod:919
1921 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
1923 " const char *msg);\n"
1924 " void guestfs_set_error_handler (guestfs_h *g,\n"
1925 " guestfs_error_handler_cb cb,\n"
1931 #: ../src/guestfs.pod:926
1933 "The callback C<cb> will be called if there is an error. The parameters "
1934 "passed to the callback are an opaque data pointer and the error message "
1939 #: ../src/guestfs.pod:930
1941 "Note that the message string C<msg> is freed as soon as the callback "
1942 "function returns, so if you want to stash it somewhere you must make your "
1947 #: ../src/guestfs.pod:934
1948 msgid "The default handler prints messages on C<stderr>."
1952 #: ../src/guestfs.pod:936
1953 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
1957 #: ../src/guestfs.pod:938
1958 msgid "guestfs_get_error_handler"
1962 #: ../src/guestfs.pod:940
1965 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
1966 " void **opaque_rtn);\n"
1971 #: ../src/guestfs.pod:943
1972 msgid "Returns the current error handler callback."
1976 #: ../src/guestfs.pod:945
1977 msgid "guestfs_set_out_of_memory_handler"
1981 #: ../src/guestfs.pod:947
1984 " typedef void (*guestfs_abort_cb) (void);\n"
1985 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
1986 " guestfs_abort_cb);\n"
1991 #: ../src/guestfs.pod:951
1993 "The callback C<cb> will be called if there is an out of memory situation. "
1994 "I<Note this callback must not return>."
1998 #: ../src/guestfs.pod:954
1999 msgid "The default is to call L<abort(3)>."
2003 #: ../src/guestfs.pod:956
2005 "You cannot set C<cb> to C<NULL>. You can't ignore out of memory situations."
2009 #: ../src/guestfs.pod:959
2010 msgid "guestfs_get_out_of_memory_handler"
2014 #: ../src/guestfs.pod:961
2017 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
2022 #: ../src/guestfs.pod:963
2023 msgid "This returns the current out of memory handler."
2027 #: ../src/guestfs.pod:965
2032 #: ../src/guestfs.pod:967
2034 "Libguestfs needs a kernel and initrd.img, which it finds by looking along an "
2039 #: ../src/guestfs.pod:970
2041 "By default it looks for these in the directory C<$libdir/guestfs> (eg. C</"
2042 "usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
2046 #: ../src/guestfs.pod:973
2048 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
2049 "to change the directories that libguestfs will search in. The value is a "
2050 "colon-separated list of paths. The current directory is I<not> searched "
2051 "unless the path contains an empty element or C<.>. For example "
2052 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
2053 "then C</usr/lib/guestfs>."
2057 #: ../src/guestfs.pod:980
2058 msgid "HIGH-LEVEL API ACTIONS"
2062 #: ../src/guestfs.pod:982
2063 msgid "ABI GUARANTEE"
2067 #: ../src/guestfs.pod:984
2069 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
2070 "actions as outlined in this section. Although we will deprecate some "
2071 "actions, for example if they get replaced by newer calls, we will keep the "
2072 "old actions forever. This allows you the developer to program in confidence "
2073 "against the libguestfs API."
2077 #: ../src/guestfs.pod:990 ../fish/guestfish.pod:860
2082 #: ../src/guestfs.pod:992
2087 #: ../src/guestfs.pod:994
2092 #: ../src/guestfs.pod:996
2093 msgid "AVAILABILITY"
2097 #: ../src/guestfs.pod:998
2098 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
2102 #: ../src/guestfs.pod:1000
2104 "Using L</guestfs_available> you can test availability of the following "
2105 "groups of functions. This test queries the appliance to see if the "
2106 "appliance you are currently using supports the functionality."
2110 #: ../src/guestfs.pod:1005
2111 msgid "@AVAILABILITY@"
2115 #: ../src/guestfs.pod:1007
2116 msgid "GUESTFISH supported COMMAND"
2120 #: ../src/guestfs.pod:1009
2122 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
2123 "prints out the available groups and whether they are supported by this build "
2124 "of libguestfs. Note however that you have to do C<run> first."
2128 #: ../src/guestfs.pod:1014
2129 msgid "SINGLE CALLS AT COMPILE TIME"
2133 #: ../src/guestfs.pod:1016
2135 "Since version 1.5.8, C<E<lt>guestfs.hE<gt>> defines symbols for each C API "
2136 "function, such as:"
2140 #: ../src/guestfs.pod:1019
2143 " #define LIBGUESTFS_HAVE_DD 1\n"
2148 #: ../src/guestfs.pod:1021
2149 msgid "if L</guestfs_dd> is available."
2153 #: ../src/guestfs.pod:1023
2155 "Before version 1.5.8, if you needed to test whether a single libguestfs "
2156 "function is available at compile time, we recommended using build tools such "
2157 "as autoconf or cmake. For example in autotools you could use:"
2161 #: ../src/guestfs.pod:1028
2164 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
2165 " AC_CHECK_FUNCS([guestfs_dd])\n"
2170 #: ../src/guestfs.pod:1031
2172 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
2177 #: ../src/guestfs.pod:1034
2178 msgid "SINGLE CALLS AT RUN TIME"
2182 #: ../src/guestfs.pod:1036
2184 "Testing at compile time doesn't guarantee that a function really exists in "
2185 "the library. The reason is that you might be dynamically linked against a "
2186 "previous I<libguestfs.so> (dynamic library) which doesn't have the call. "
2187 "This situation unfortunately results in a segmentation fault, which is a "
2188 "shortcoming of the C dynamic linking system itself."
2192 #: ../src/guestfs.pod:1043
2194 "You can use L<dlopen(3)> to test if a function is available at run time, as "
2195 "in this example program (note that you still need the compile time check as "
2200 #: ../src/guestfs.pod:1047
2203 " #include <stdio.h>\n"
2204 " #include <stdlib.h>\n"
2205 " #include <unistd.h>\n"
2206 " #include <dlfcn.h>\n"
2207 " #include <guestfs.h>\n"
2212 #: ../src/guestfs.pod:1053
2217 " #ifdef LIBGUESTFS_HAVE_DD\n"
2219 " int has_function;\n"
2224 #: ../src/guestfs.pod:1059
2227 " /* Test if the function guestfs_dd is really available. */\n"
2228 " dl = dlopen (NULL, RTLD_LAZY);\n"
2230 " fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
2231 " exit (EXIT_FAILURE);\n"
2233 " has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
2239 #: ../src/guestfs.pod:1068
2242 " if (!has_function)\n"
2243 " printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
2245 " printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
2246 " /* Now it's safe to call\n"
2247 " guestfs_dd (g, \"foo\", \"bar\");\n"
2251 " printf (\"guestfs_dd function was not found at compile time\\n\");\n"
2258 #: ../src/guestfs.pod:1081
2260 "You may think the above is an awful lot of hassle, and it is. There are "
2261 "other ways outside of the C linking system to ensure that this kind of "
2262 "incompatibility never arises, such as using package versioning:"
2266 #: ../src/guestfs.pod:1086
2269 " Requires: libguestfs >= 1.0.80\n"
2274 #: ../src/guestfs.pod:1088
2275 msgid "CALLS WITH OPTIONAL ARGUMENTS"
2279 #: ../src/guestfs.pod:1090
2281 "A recent feature of the API is the introduction of calls which take optional "
2282 "arguments. In C these are declared 3 ways. The main way is as a call which "
2283 "takes variable arguments (ie. C<...>), as in this example:"
2287 #: ../src/guestfs.pod:1095
2290 " int guestfs_add_drive_opts (guestfs_h *g, const char *filename, ...);\n"
2295 #: ../src/guestfs.pod:1097
2297 "Call this with a list of optional arguments, terminated by C<-1>. So to "
2298 "call with no optional arguments specified:"
2302 #: ../src/guestfs.pod:1100
2305 " guestfs_add_drive_opts (g, filename, -1);\n"
2310 #: ../src/guestfs.pod:1102
2311 msgid "With a single optional argument:"
2315 #: ../src/guestfs.pod:1104
2318 " guestfs_add_drive_opts (g, filename,\n"
2319 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
2325 #: ../src/guestfs.pod:1108
2330 #: ../src/guestfs.pod:1110
2333 " guestfs_add_drive_opts (g, filename,\n"
2334 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
2335 " GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
2341 #: ../src/guestfs.pod:1115
2343 "and so forth. Don't forget the terminating C<-1> otherwise Bad Things will "
2348 #: ../src/guestfs.pod:1118
2349 msgid "USING va_list FOR OPTIONAL ARGUMENTS"
2353 #: ../src/guestfs.pod:1120
2355 "The second variant has the same name with the suffix C<_va>, which works the "
2356 "same way but takes a C<va_list>. See the C manual for details. For the "
2357 "example function, this is declared:"
2361 #: ../src/guestfs.pod:1124
2364 " int guestfs_add_drive_opts_va (guestfs_h *g, const char *filename,\n"
2370 #: ../src/guestfs.pod:1127
2371 msgid "CONSTRUCTING OPTIONAL ARGUMENTS"
2375 #: ../src/guestfs.pod:1129
2377 "The third variant is useful where you need to construct these calls. You "
2378 "pass in a structure where you fill in the optional fields. The structure "
2379 "has a bitmask as the first element which you must set to indicate which "
2380 "fields you have filled in. For our example function the structure and call "
2385 #: ../src/guestfs.pod:1135
2388 " struct guestfs_add_drive_opts_argv {\n"
2389 " uint64_t bitmask;\n"
2391 " const char *format;\n"
2394 " int guestfs_add_drive_opts_argv (guestfs_h *g, const char *filename,\n"
2395 " const struct guestfs_add_drive_opts_argv *optargs);\n"
2400 #: ../src/guestfs.pod:1144
2401 msgid "You could call it like this:"
2405 #: ../src/guestfs.pod:1146
2408 " struct guestfs_add_drive_opts_argv optargs = {\n"
2409 " .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK |\n"
2410 " GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK,\n"
2412 " .format = \"qcow2\"\n"
2418 #: ../src/guestfs.pod:1153
2421 " guestfs_add_drive_opts_argv (g, filename, &optargs);\n"
2426 #: ../src/guestfs.pod:1155 ../src/guestfs-actions.pod:10
2427 #: ../src/guestfs-actions.pod:1582 ../fish/guestfish-actions.pod:9
2428 #: ../fish/guestfish-actions.pod:1244
2433 #: ../src/guestfs.pod:1161
2434 msgid "The C<_BITMASK> suffix on each option name when specifying the bitmask."
2438 #: ../src/guestfs.pod:1166
2439 msgid "You do not need to fill in all fields of the structure."
2443 #: ../src/guestfs.pod:1170
2445 "There must be a one-to-one correspondence between fields of the structure "
2446 "that are filled in, and bits set in the bitmask."
2450 #: ../src/guestfs.pod:1175
2451 msgid "OPTIONAL ARGUMENTS IN OTHER LANGUAGES"
2455 #: ../src/guestfs.pod:1177
2457 "In other languages, optional arguments are expressed in the way that is "
2458 "natural for that language. We refer you to the language-specific "
2459 "documentation for more details on that."
2463 #: ../src/guestfs.pod:1181
2464 msgid "For guestfish, see L<guestfish(1)/OPTIONAL ARGUMENTS>."
2468 #: ../src/guestfs.pod:1183 ../src/guestfs.pod:1188
2473 #: ../src/guestfs.pod:1185
2475 "<!-- old anchor for the next section --> <a name="
2476 "\"state_machine_and_low_level_event_api\"/>"
2480 #: ../src/guestfs.pod:1190
2481 msgid "ARCHITECTURE"
2485 #: ../src/guestfs.pod:1192
2487 "Internally, libguestfs is implemented by running an appliance (a special "
2488 "type of small virtual machine) using L<qemu(1)>. Qemu runs as a child "
2489 "process of the main program."
2493 #: ../src/guestfs.pod:1196
2496 " ___________________\n"
2498 " | main program |\n"
2500 " | | child process / appliance\n"
2501 " | | __________________________\n"
2503 " +-------------------+ RPC | +-----------------+ |\n"
2504 " | libguestfs <--------------------> guestfsd | |\n"
2505 " | | | +-----------------+ |\n"
2506 " \\___________________/ | | Linux kernel | |\n"
2507 " | +--^--------------+ |\n"
2508 " \\_________|________________/\n"
2514 " \\______________/\n"
2519 #: ../src/guestfs.pod:1216
2521 "The library, linked to the main program, creates the child process and hence "
2522 "the appliance in the L</guestfs_launch> function."
2526 #: ../src/guestfs.pod:1219
2528 "Inside the appliance is a Linux kernel and a complete stack of userspace "
2529 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
2530 "L</guestfsd>. The library talks to L</guestfsd> using remote procedure "
2531 "calls (RPC). There is a mostly one-to-one correspondence between libguestfs "
2532 "API calls and RPC calls to the daemon. Lastly the disk image(s) are "
2533 "attached to the qemu process which translates device access by the "
2534 "appliance's Linux kernel into accesses to the image."
2538 #: ../src/guestfs.pod:1228
2540 "A common misunderstanding is that the appliance \"is\" the virtual machine. "
2541 "Although the disk image you are attached to might also be used by some "
2542 "virtual machine, libguestfs doesn't know or care about this. (But you will "
2543 "care if both libguestfs's qemu process and your virtual machine are trying "
2544 "to update the disk image at the same time, since these usually results in "
2545 "massive disk corruption)."
2549 #: ../src/guestfs.pod:1235
2550 msgid "STATE MACHINE"
2554 #: ../src/guestfs.pod:1237
2555 msgid "libguestfs uses a state machine to model the child process:"
2559 #: ../src/guestfs.pod:1239
2571 " / | \\ \\ guestfs_launch\n"
2572 " / | _\\__V______\n"
2574 " / | | LAUNCHING |\n"
2575 " / | \\___________/\n"
2577 " / | guestfs_launch\n"
2579 " ______ / __|____V\n"
2580 " / \\ ------> / \\\n"
2581 " | BUSY | | READY |\n"
2582 " \\______/ <------ \\________/\n"
2587 #: ../src/guestfs.pod:1261
2589 "The normal transitions are (1) CONFIG (when the handle is created, but there "
2590 "is no child process), (2) LAUNCHING (when the child process is booting up), "
2591 "(3) alternating between READY and BUSY as commands are issued to, and "
2592 "carried out by, the child process."
2596 #: ../src/guestfs.pod:1266
2598 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
2599 "asynchronously at any time (eg. due to some internal error), and that causes "
2600 "the state to transition back to CONFIG."
2604 #: ../src/guestfs.pod:1270
2606 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
2607 "issued when in the CONFIG state."
2611 #: ../src/guestfs.pod:1273
2613 "The API offers one call that goes from CONFIG through LAUNCHING to READY. "
2614 "L</guestfs_launch> blocks until the child process is READY to accept "
2615 "commands (or until some failure or timeout). L</guestfs_launch> internally "
2616 "moves the state from CONFIG to LAUNCHING while it is running."
2620 #: ../src/guestfs.pod:1279
2622 "API actions such as L</guestfs_mount> can only be issued when in the READY "
2623 "state. These API calls block waiting for the command to be carried out (ie. "
2624 "the state to transition to BUSY and then back to READY). There are no non-"
2625 "blocking versions, and no way to issue more than one command per handle at "
2630 #: ../src/guestfs.pod:1285
2632 "Finally, the child process sends asynchronous messages back to the main "
2633 "program, such as kernel log messages. You can register a callback to "
2634 "receive these messages."
2638 #: ../src/guestfs.pod:1289
2639 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
2643 #: ../src/guestfs.pod:1291
2645 "The child process generates events in some situations. Current events "
2646 "include: receiving a log message, the child process exits."
2650 #: ../src/guestfs.pod:1294
2652 "Use the C<guestfs_set_*_callback> functions to set a callback for different "
2657 #: ../src/guestfs.pod:1297
2659 "Only I<one callback of each type> can be registered for each handle. "
2660 "Calling C<guestfs_set_*_callback> again overwrites the previous callback of "
2661 "that type. Cancel all callbacks of this type by calling this function with "
2662 "C<cb> set to C<NULL>."
2666 #: ../src/guestfs.pod:1302
2667 msgid "guestfs_set_log_message_callback"
2671 #: ../src/guestfs.pod:1304
2674 " typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,\n"
2675 " char *buf, int len);\n"
2676 " void guestfs_set_log_message_callback (guestfs_h *g,\n"
2677 " guestfs_log_message_cb cb,\n"
2683 #: ../src/guestfs.pod:1310
2685 "The callback function C<cb> will be called whenever qemu or the guest writes "
2686 "anything to the console."
2690 #: ../src/guestfs.pod:1313
2691 msgid "Use this function to capture kernel messages and similar."
2695 #: ../src/guestfs.pod:1315
2697 "Normally there is no log message handler, and log messages are just "
2702 #: ../src/guestfs.pod:1318
2703 msgid "guestfs_set_subprocess_quit_callback"
2707 #: ../src/guestfs.pod:1320
2710 " typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);\n"
2711 " void guestfs_set_subprocess_quit_callback (guestfs_h *g,\n"
2712 " guestfs_subprocess_quit_cb cb,\n"
2718 #: ../src/guestfs.pod:1325
2720 "The callback function C<cb> will be called when the child process quits, "
2721 "either asynchronously or if killed by L</guestfs_kill_subprocess>. (This "
2722 "corresponds to a transition from any state to the CONFIG state)."
2726 #: ../src/guestfs.pod:1330
2727 msgid "guestfs_set_launch_done_callback"
2731 #: ../src/guestfs.pod:1332
2734 " typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);\n"
2735 " void guestfs_set_launch_done_callback (guestfs_h *g,\n"
2736 " guestfs_launch_done_cb cb,\n"
2742 #: ../src/guestfs.pod:1337
2744 "The callback function C<cb> will be called when the child process becomes "
2745 "ready first time after it has been launched. (This corresponds to a "
2746 "transition from LAUNCHING to the READY state)."
2750 #: ../src/guestfs.pod:1341
2751 msgid "guestfs_set_close_callback"
2755 #: ../src/guestfs.pod:1343
2758 " typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);\n"
2759 " void guestfs_set_close_callback (guestfs_h *g,\n"
2760 " guestfs_close_cb cb,\n"
2766 #: ../src/guestfs.pod:1348
2768 "The callback function C<cb> will be called while the handle is being closed "
2769 "(synchronously from L</guestfs_close>)."
2773 #: ../src/guestfs.pod:1351
2775 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
2776 "handles that are open when the program exits. This means that this callback "
2777 "might be called indirectly from L<exit(3)>, which can cause unexpected "
2778 "problems in higher-level languages (eg. if your HLL interpreter has already "
2779 "been cleaned up by the time this is called, and if your callback then jumps "
2780 "into some HLL function)."
2784 #: ../src/guestfs.pod:1359
2785 msgid "guestfs_set_progress_callback"
2789 #: ../src/guestfs.pod:1361
2792 " typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque,\n"
2793 " int proc_nr, int serial,\n"
2794 " uint64_t position, uint64_t total);\n"
2795 " void guestfs_set_progress_callback (guestfs_h *g,\n"
2796 " guestfs_progress_cb cb,\n"
2802 #: ../src/guestfs.pod:1368
2804 "Some long-running operations can generate progress messages. If this "
2805 "callback is registered, then it will be called each time a progress message "
2806 "is generated (usually two seconds after the operation started, and three "
2807 "times per second thereafter until it completes, although the frequency may "
2808 "change in future versions)."
2812 #: ../src/guestfs.pod:1374
2814 "The callback receives two numbers: C<position> and C<total>. The units of "
2815 "C<total> are not defined, although for some operations C<total> may relate "
2816 "in some way to the amount of data to be transferred (eg. in bytes or "
2817 "megabytes), and C<position> may be the portion which has been transferred."
2821 #: ../src/guestfs.pod:1380
2822 msgid "The only defined and stable parts of the API are:"
2826 #: ../src/guestfs.pod:1386
2828 "The callback can display to the user some type of progress bar or indicator "
2829 "which shows the ratio of C<position>:C<total>."
2833 #: ../src/guestfs.pod:1391
2834 msgid "0 E<lt>= C<position> E<lt>= C<total>"
2838 #: ../src/guestfs.pod:1395
2840 "If any progress notification is sent during a call, then a final progress "
2841 "notification is always sent when C<position> = C<total>."
2845 #: ../src/guestfs.pod:1398
2847 "This is to simplify caller code, so callers can easily set the progress "
2848 "indicator to \"100%\" at the end of the operation, without requiring special "
2849 "code to detect this case."
2853 #: ../src/guestfs.pod:1404
2855 "The callback also receives the procedure number and serial number of the "
2856 "call. These are only useful for debugging protocol issues, and the callback "
2857 "can normally ignore them. The callback may want to print these numbers in "
2858 "error messages or debugging messages."
2862 #: ../src/guestfs.pod:1409
2863 msgid "PRIVATE DATA AREA"
2867 #: ../src/guestfs.pod:1411
2869 "You can attach named pieces of private data to the libguestfs handle, and "
2870 "fetch them by name for the lifetime of the handle. This is called the "
2871 "private data area and is only available from the C API."
2875 #: ../src/guestfs.pod:1415
2876 msgid "To attach a named piece of data, use the following call:"
2880 #: ../src/guestfs.pod:1417
2883 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
2888 #: ../src/guestfs.pod:1419
2890 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
2891 "pointer (which can be C<NULL>). Any previous item with the same name is "
2896 #: ../src/guestfs.pod:1423
2898 "You can use any C<key> you want, but names beginning with an underscore "
2899 "character are reserved for internal libguestfs purposes (for implementing "
2900 "language bindings). It is recommended to prefix the name with some unique "
2901 "string to avoid collisions with other users."
2905 #: ../src/guestfs.pod:1428
2906 msgid "To retrieve the pointer, use:"
2910 #: ../src/guestfs.pod:1430
2913 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
2918 #: ../src/guestfs.pod:1432
2920 "This function returns C<NULL> if either no data is found associated with "
2921 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
2926 #: ../src/guestfs.pod:1436
2928 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
2929 "way. As far as libguestfs is concerned, it need not be a valid pointer at "
2930 "all. In particular, libguestfs does I<not> try to free the data when the "
2931 "handle is closed. If the data must be freed, then the caller must either "
2932 "free it before calling L</guestfs_close> or must set up a close callback to "
2933 "do it (see L</guestfs_set_close_callback>, and note that only one callback "
2934 "can be registered for a handle)."
2938 #: ../src/guestfs.pod:1444
2940 "The private data area is implemented using a hash table, and should be "
2941 "reasonably efficient for moderate numbers of keys."
2945 #: ../src/guestfs.pod:1447
2946 msgid "BLOCK DEVICE NAMING"
2950 #: ../src/guestfs.pod:1449
2952 "In the kernel there is now quite a profusion of schemata for naming block "
2953 "devices (in this context, by I<block device> I mean a physical or virtual "
2954 "hard drive). The original Linux IDE driver used names starting with C</dev/"
2955 "hd*>. SCSI devices have historically used a different naming scheme, C</dev/"
2956 "sd*>. When the Linux kernel I<libata> driver became a popular replacement "
2957 "for the old IDE driver (particularly for SATA devices) those devices also "
2958 "used the C</dev/sd*> scheme. Additionally we now have virtual machines with "
2959 "paravirtualized drivers. This has created several different naming systems, "
2960 "such as C</dev/vd*> for virtio disks and C</dev/xvd*> for Xen PV disks."
2964 #: ../src/guestfs.pod:1461
2966 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2967 "Linux kernel to access block devices. We can run a variety of appliances "
2968 "based on a variety of Linux kernels."
2972 #: ../src/guestfs.pod:1465
2974 "This causes a problem for libguestfs because many API calls use device or "
2975 "partition names. Working scripts and the recipe (example) scripts that we "
2976 "make available over the internet could fail if the naming scheme changes."
2980 #: ../src/guestfs.pod:1470
2982 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>. "
2983 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2984 "required. For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2985 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2989 #: ../src/guestfs.pod:1476
2991 "Note that this I<only> applies to parameters. The L</guestfs_list_devices>, "
2992 "L</guestfs_list_partitions> and similar calls return the true names of the "
2993 "devices and partitions as known to the appliance."
2997 #: ../src/guestfs.pod:1481
2998 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
3002 #: ../src/guestfs.pod:1483
3004 "Usually this translation is transparent. However in some (very rare) cases "
3005 "you may need to know the exact algorithm. Such cases include where you use "
3006 "L</guestfs_config> to add a mixture of virtio and IDE devices to the qemu-"
3007 "based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> devices."
3011 #: ../src/guestfs.pod:1489
3013 "The algorithm is applied only to I<parameters> which are known to be either "
3014 "device or partition names. Return values from functions such as L</"
3015 "guestfs_list_devices> are never changed."
3019 #: ../src/guestfs.pod:1497
3020 msgid "Is the string a parameter which is a device or partition name?"
3024 #: ../src/guestfs.pod:1501
3025 msgid "Does the string begin with C</dev/sd>?"
3029 #: ../src/guestfs.pod:1505
3031 "Does the named device exist? If so, we use that device. However if I<not> "
3032 "then we continue with this algorithm."
3036 #: ../src/guestfs.pod:1510
3037 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
3041 #: ../src/guestfs.pod:1512
3042 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
3046 #: ../src/guestfs.pod:1514
3047 msgid "If that named device exists, use it. If not, continue."
3051 #: ../src/guestfs.pod:1518
3052 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
3056 #: ../src/guestfs.pod:1520
3057 msgid "If that named device exists, use it. If not, return an error."
3061 #: ../src/guestfs.pod:1524
3062 msgid "PORTABILITY CONCERNS"
3066 #: ../src/guestfs.pod:1526
3068 "Although the standard naming scheme and automatic translation is useful for "
3069 "simple programs and guestfish scripts, for larger programs it is best not to "
3070 "rely on this mechanism."
3074 #: ../src/guestfs.pod:1530
3076 "Where possible for maximum future portability programs using libguestfs "
3077 "should use these future-proof techniques:"
3081 #: ../src/guestfs.pod:1537
3083 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
3084 "device names, and then use those names directly."
3088 #: ../src/guestfs.pod:1540
3090 "Since those device names exist by definition, they will never be translated."
3094 #: ../src/guestfs.pod:1545
3096 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
3097 "filesystem labels."
3101 #: ../src/guestfs.pod:1550
3106 #: ../src/guestfs.pod:1552
3107 msgid "COMMUNICATION PROTOCOL"
3111 #: ../src/guestfs.pod:1554
3113 "Don't rely on using this protocol directly. This section documents how it "
3114 "currently works, but it may change at any time."
3118 #: ../src/guestfs.pod:1557
3120 "The protocol used to talk between the library and the daemon running inside "
3121 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
3122 "1014, RFC 1832, RFC 4506)."
3126 #: ../src/guestfs.pod:1561
3128 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
3129 "this file is automatically generated)."
3133 #: ../src/guestfs.pod:1564
3135 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
3136 "and C<FileOut> parameters, which are handled with very simple request/reply "
3137 "messages. Then there are functions that have any C<FileIn> or C<FileOut> "
3138 "parameters, which use the same request and reply messages, but they may also "
3139 "be followed by files sent using a chunked encoding."
3143 #: ../src/guestfs.pod:1571
3144 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
3148 #: ../src/guestfs.pod:1573
3149 msgid "For ordinary functions, the request message is:"
3153 #: ../src/guestfs.pod:1575
3156 " total length (header + arguments,\n"
3157 " but not including the length word itself)\n"
3158 " struct guestfs_message_header (encoded as XDR)\n"
3159 " struct guestfs_<foo>_args (encoded as XDR)\n"
3164 #: ../src/guestfs.pod:1580
3166 "The total length field allows the daemon to allocate a fixed size buffer "
3167 "into which it slurps the rest of the message. As a result, the total length "
3168 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
3169 "effective size of any request is limited to somewhere under this size."
3173 #: ../src/guestfs.pod:1586
3175 "Note also that many functions don't take any arguments, in which case the "
3176 "C<guestfs_I<foo>_args> is completely omitted."
3180 #: ../src/guestfs.pod:1589
3182 "The header contains the procedure number (C<guestfs_proc>) which is how the "
3183 "receiver knows what type of args structure to expect, or none at all."
3187 #: ../src/guestfs.pod:1593
3188 msgid "The reply message for ordinary functions is:"
3192 #: ../src/guestfs.pod:1595
3195 " total length (header + ret,\n"
3196 " but not including the length word itself)\n"
3197 " struct guestfs_message_header (encoded as XDR)\n"
3198 " struct guestfs_<foo>_ret (encoded as XDR)\n"
3203 #: ../src/guestfs.pod:1600
3205 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
3206 "functions that return no formal return values."
3210 #: ../src/guestfs.pod:1603
3212 "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
3216 #: ../src/guestfs.pod:1606
3218 "In the case of an error, a flag is set in the header, and the reply message "
3219 "is slightly changed:"
3223 #: ../src/guestfs.pod:1609
3226 " total length (header + error,\n"
3227 " but not including the length word itself)\n"
3228 " struct guestfs_message_header (encoded as XDR)\n"
3229 " struct guestfs_message_error (encoded as XDR)\n"
3234 #: ../src/guestfs.pod:1614
3236 "The C<guestfs_message_error> structure contains the error message as a "
3241 #: ../src/guestfs.pod:1617
3242 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
3246 #: ../src/guestfs.pod:1619
3248 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest. "
3249 "The normal request message is sent (see above). However this is followed by "
3250 "a sequence of file chunks."
3254 #: ../src/guestfs.pod:1623
3257 " total length (header + arguments,\n"
3258 " but not including the length word itself,\n"
3259 " and not including the chunks)\n"
3260 " struct guestfs_message_header (encoded as XDR)\n"
3261 " struct guestfs_<foo>_args (encoded as XDR)\n"
3262 " sequence of chunks for FileIn param #0\n"
3263 " sequence of chunks for FileIn param #1 etc.\n"
3268 #: ../src/guestfs.pod:1631
3269 msgid "The \"sequence of chunks\" is:"
3273 #: ../src/guestfs.pod:1633
3276 " length of chunk (not including length word itself)\n"
3277 " struct guestfs_chunk (encoded as XDR)\n"
3278 " length of chunk\n"
3279 " struct guestfs_chunk (encoded as XDR)\n"
3281 " length of chunk\n"
3282 " struct guestfs_chunk (with data.data_len == 0)\n"
3287 #: ../src/guestfs.pod:1641
3289 "The final chunk has the C<data_len> field set to zero. Additionally a flag "
3290 "is set in the final chunk to indicate either successful completion or early "
3295 #: ../src/guestfs.pod:1645
3297 "At time of writing there are no functions that have more than one FileIn "
3298 "parameter. However this is (theoretically) supported, by sending the "
3299 "sequence of chunks for each FileIn parameter one after another (from left to "
3304 #: ../src/guestfs.pod:1650
3306 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
3307 "transfer. The library does this by sending a chunk with a special flag set "
3308 "to indicate cancellation. When the daemon sees this, it cancels the whole "
3309 "RPC, does I<not> send any reply, and goes back to reading the next request."
3313 #: ../src/guestfs.pod:1656
3315 "The daemon may also cancel. It does this by writing a special word "
3316 "C<GUESTFS_CANCEL_FLAG> to the socket. The library listens for this during "
3317 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
3318 "cancel chunk). The special word is chosen so that even if cancellation "
3319 "happens right at the end of the transfer (after the library has finished "
3320 "writing and has started listening for the reply), the \"spurious\" cancel "
3321 "flag will not be confused with the reply message."
3325 #: ../src/guestfs.pod:1665
3327 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
3328 "limit), and also files where the size is not known in advance (eg. from "
3329 "pipes or sockets). However the chunks are rather small "
3330 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
3331 "to keep much in memory."
3335 #: ../src/guestfs.pod:1671
3336 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
3340 #: ../src/guestfs.pod:1673
3342 "The protocol for FileOut parameters is exactly the same as for FileIn "
3343 "parameters, but with the roles of daemon and library reversed."
3347 #: ../src/guestfs.pod:1676
3350 " total length (header + ret,\n"
3351 " but not including the length word itself,\n"
3352 " and not including the chunks)\n"
3353 " struct guestfs_message_header (encoded as XDR)\n"
3354 " struct guestfs_<foo>_ret (encoded as XDR)\n"
3355 " sequence of chunks for FileOut param #0\n"
3356 " sequence of chunks for FileOut param #1 etc.\n"
3361 #: ../src/guestfs.pod:1684
3362 msgid "INITIAL MESSAGE"
3366 #: ../src/guestfs.pod:1686
3368 "When the daemon launches it sends an initial word (C<GUESTFS_LAUNCH_FLAG>) "
3369 "which indicates that the guest and daemon is alive. This is what L</"
3370 "guestfs_launch> waits for."
3374 #: ../src/guestfs.pod:1690
3375 msgid "PROGRESS NOTIFICATION MESSAGES"
3379 #: ../src/guestfs.pod:1692
3381 "The daemon may send progress notification messages at any time. These are "
3382 "distinguished by the normal length word being replaced by "
3383 "C<GUESTFS_PROGRESS_FLAG>, followed by a fixed size progress message."
3387 #: ../src/guestfs.pod:1696
3389 "The library turns them into progress callbacks (see "
3390 "C<guestfs_set_progress_callback>) if there is a callback registered, or "
3391 "discards them if not."
3395 #: ../src/guestfs.pod:1700
3397 "The daemon self-limits the frequency of progress messages it sends (see "
3398 "C<daemon/proto.c:notify_progress>). Not all calls generate progress "
3403 #: ../src/guestfs.pod:1704
3404 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
3408 #: ../src/guestfs.pod:1706
3410 "All high-level libguestfs actions are synchronous. If you want to use "
3411 "libguestfs asynchronously then you must create a thread."
3415 #: ../src/guestfs.pod:1709
3417 "Only use the handle from a single thread. Either use the handle exclusively "
3418 "from one thread, or provide your own mutex so that two threads cannot issue "
3419 "calls on the same handle at the same time."
3423 #: ../src/guestfs.pod:1713
3425 "See the graphical program guestfs-browser for one possible architecture for "
3426 "multithreaded programs using libvirt and libguestfs."
3430 #: ../src/guestfs.pod:1716
3431 msgid "QEMU WRAPPERS"
3435 #: ../src/guestfs.pod:1718
3437 "If you want to compile your own qemu, run qemu from a non-standard location, "
3438 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
3443 #: ../src/guestfs.pod:1722
3445 "There is one important rule to remember: you I<must C<exec qemu>> as the "
3446 "last command in the shell script (so that qemu replaces the shell and "
3447 "becomes the direct child of the libguestfs-using program). If you don't do "
3448 "this, then the qemu process won't be cleaned up correctly."
3452 #: ../src/guestfs.pod:1727
3454 "Here is an example of a wrapper, where I have built my own copy of qemu from "
3459 #: ../src/guestfs.pod:1730
3463 " qemudir=/home/rjones/d/qemu\n"
3464 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios \"$@\"\n"
3469 #: ../src/guestfs.pod:1734
3471 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
3472 "then use it by setting the LIBGUESTFS_QEMU environment variable. For "
3477 #: ../src/guestfs.pod:1738
3480 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
3485 #: ../src/guestfs.pod:1740
3487 "Note that libguestfs also calls qemu with the -help and -version options in "
3488 "order to determine features."
3492 #: ../src/guestfs.pod:1743
3493 msgid "LIBGUESTFS VERSION NUMBERS"
3497 #: ../src/guestfs.pod:1745
3499 "Since April 2010, libguestfs has started to make separate development and "
3500 "stable releases, along with corresponding branches in our git repository. "
3501 "These separate releases can be identified by version number:"
3505 #: ../src/guestfs.pod:1750
3508 " even numbers for stable: 1.2.x, 1.4.x, ...\n"
3509 " .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
3515 " | `-------- sub-version\n"
3517 " `------ always '1' because we don't change the ABI\n"
3522 #: ../src/guestfs.pod:1761
3523 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
3527 #: ../src/guestfs.pod:1763
3529 "As time passes we cherry pick fixes from the development branch and backport "
3530 "those into the stable branch, the effect being that the stable branch should "
3531 "get more stable and less buggy over time. So the stable releases are ideal "
3532 "for people who don't need new features but would just like the software to "
3537 #: ../src/guestfs.pod:1769
3538 msgid "Our criteria for backporting changes are:"
3542 #: ../src/guestfs.pod:1775
3544 "Documentation changes which don't affect any code are backported unless the "
3545 "documentation refers to a future feature which is not in stable."
3549 #: ../src/guestfs.pod:1781
3551 "Bug fixes which are not controversial, fix obvious problems, and have been "
3552 "well tested are backported."
3556 #: ../src/guestfs.pod:1786
3558 "Simple rearrangements of code which shouldn't affect how it works get "
3559 "backported. This is so that the code in the two branches doesn't get too "
3560 "far out of step, allowing us to backport future fixes more easily."
3564 #: ../src/guestfs.pod:1792
3566 "We I<don't> backport new features, new APIs, new tools etc, except in one "
3567 "exceptional case: the new feature is required in order to implement an "
3568 "important bug fix."
3572 #: ../src/guestfs.pod:1798
3574 "A new stable branch starts when we think the new features in development are "
3575 "substantial and compelling enough over the current stable branch to warrant "
3576 "it. When that happens we create new stable and development versions 1.N.0 "
3577 "and 1.(N+1).0 [N is even]. The new dot-oh release won't necessarily be so "
3578 "stable at this point, but by backporting fixes from development, that branch "
3579 "will stabilize over time."
3583 #: ../src/guestfs.pod:1806 ../fish/guestfish.pod:867
3584 #: ../test-tool/libguestfs-test-tool.pod:104 ../tools/virt-edit.pl:330
3585 #: ../tools/virt-rescue.pl:255
3586 msgid "ENVIRONMENT VARIABLES"
3590 #: ../src/guestfs.pod:1810 ../fish/guestfish.pod:893
3591 msgid "LIBGUESTFS_APPEND"
3595 #: ../src/guestfs.pod:1812 ../fish/guestfish.pod:895
3596 msgid "Pass additional options to the guest kernel."
3600 #: ../src/guestfs.pod:1814 ../fish/guestfish.pod:897
3601 msgid "LIBGUESTFS_DEBUG"
3605 #: ../src/guestfs.pod:1816
3607 "Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the same "
3608 "effect as calling C<guestfs_set_verbose (g, 1)>."
3612 #: ../src/guestfs.pod:1819 ../fish/guestfish.pod:902
3613 msgid "LIBGUESTFS_MEMSIZE"
3617 #: ../src/guestfs.pod:1821 ../fish/guestfish.pod:904
3619 "Set the memory allocated to the qemu process, in megabytes. For example:"
3623 #: ../src/guestfs.pod:1824 ../fish/guestfish.pod:907
3626 " LIBGUESTFS_MEMSIZE=700\n"
3631 #: ../src/guestfs.pod:1826 ../fish/guestfish.pod:909
3632 msgid "LIBGUESTFS_PATH"
3636 #: ../src/guestfs.pod:1828
3638 "Set the path that libguestfs uses to search for kernel and initrd.img. See "
3639 "the discussion of paths in section PATH above."
3643 #: ../src/guestfs.pod:1831 ../fish/guestfish.pod:914
3644 msgid "LIBGUESTFS_QEMU"
3648 #: ../src/guestfs.pod:1833 ../fish/guestfish.pod:916
3650 "Set the default qemu binary that libguestfs uses. If not set, then the qemu "
3651 "which was found at compile time by the configure script is used."
3655 #: ../src/guestfs.pod:1837
3656 msgid "See also L</QEMU WRAPPERS> above."
3660 #: ../src/guestfs.pod:1839 ../fish/guestfish.pod:920
3661 msgid "LIBGUESTFS_TRACE"
3665 #: ../src/guestfs.pod:1841
3667 "Set C<LIBGUESTFS_TRACE=1> to enable command traces. This has the same "
3668 "effect as calling C<guestfs_set_trace (g, 1)>."
3672 #: ../src/guestfs.pod:1844 ../fish/guestfish.pod:929
3677 #: ../src/guestfs.pod:1846 ../fish/guestfish.pod:931
3678 msgid "Location of temporary directory, defaults to C</tmp>."
3682 #: ../src/guestfs.pod:1848 ../fish/guestfish.pod:933
3684 "If libguestfs was compiled to use the supermin appliance then the real "
3685 "appliance is cached in this directory, shared between all handles belonging "
3686 "to the same EUID. You can use C<$TMPDIR> to configure another directory to "
3687 "use in case C</tmp> is not large enough."
3691 #: ../src/guestfs.pod:1856 ../fish/guestfish.pod:991
3692 #: ../test-tool/libguestfs-test-tool.pod:109 ../fuse/guestmount.pod:214
3693 #: ../inspector/virt-inspector.pl:357 ../tools/virt-edit.pl:350
3694 #: ../tools/virt-win-reg.pl:484 ../tools/virt-df.pl:640
3695 #: ../tools/virt-ls.pl:232 ../tools/virt-resize.pl:1486
3696 #: ../tools/virt-list-filesystems.pl:186 ../tools/virt-cat.pl:185
3697 #: ../tools/virt-tar.pl:281 ../tools/virt-rescue.pl:267
3698 #: ../tools/virt-make-fs.pl:534 ../tools/virt-list-partitions.pl:254
3703 #: ../src/guestfs.pod:1858
3705 "L<guestfish(1)>, L<guestmount(1)>, L<virt-cat(1)>, L<virt-df(1)>, L<virt-edit"
3706 "(1)>, L<virt-inspector(1)>, L<virt-list-filesystems(1)>, L<virt-list-"
3707 "partitions(1)>, L<virt-ls(1)>, L<virt-make-fs(1)>, L<virt-rescue(1)>, L<virt-"
3708 "tar(1)>, L<virt-win-reg(1)>, L<qemu(1)>, L<febootstrap(1)>, L<hivex(3)>, "
3709 "L<http://libguestfs.org/>."
3713 #: ../src/guestfs.pod:1876
3715 "Tools with a similar purpose: L<fdisk(8)>, L<parted(8)>, L<kpartx(8)>, L<lvm"
3716 "(8)>, L<disktype(1)>."
3720 #: ../src/guestfs.pod:1883 ../tools/virt-win-reg.pl:499
3721 #: ../tools/virt-make-fs.pl:548
3726 #: ../src/guestfs.pod:1885
3727 msgid "To get a list of bugs against libguestfs use this link:"
3731 #: ../src/guestfs.pod:1887
3733 "L<https://bugzilla.redhat.com/buglist.cgi?"
3734 "component=libguestfs&product=Virtualization+Tools>"
3738 #: ../src/guestfs.pod:1889
3739 msgid "To report a new bug against libguestfs use this link:"
3743 #: ../src/guestfs.pod:1891
3745 "L<https://bugzilla.redhat.com/enter_bug.cgi?"
3746 "component=libguestfs&product=Virtualization+Tools>"
3750 #: ../src/guestfs.pod:1893
3751 msgid "When reporting a bug, please check:"
3755 #: ../src/guestfs.pod:1899
3756 msgid "That the bug hasn't been reported already."
3760 #: ../src/guestfs.pod:1903
3761 msgid "That you are testing a recent version."
3765 #: ../src/guestfs.pod:1907
3766 msgid "Describe the bug accurately, and give a way to reproduce it."
3770 #: ../src/guestfs.pod:1911
3772 "Run libguestfs-test-tool and paste the B<complete, unedited> output into the "
3777 #: ../src/guestfs.pod:1916 ../fish/guestfish.pod:1008
3778 #: ../test-tool/libguestfs-test-tool.pod:115 ../fuse/guestmount.pod:225
3779 #: ../inspector/virt-inspector.pl:366
3784 #: ../src/guestfs.pod:1918 ../fish/guestfish.pod:1010
3785 #: ../test-tool/libguestfs-test-tool.pod:117 ../fuse/guestmount.pod:227
3786 msgid "Richard W.M. Jones (C<rjones at redhat dot com>)"
3790 #: ../src/guestfs.pod:1920 ../fish/guestfish.pod:1012
3791 #: ../test-tool/libguestfs-test-tool.pod:119 ../fuse/guestmount.pod:229
3792 #: ../inspector/virt-inspector.pl:380 ../tools/virt-edit.pl:366
3793 #: ../tools/virt-win-reg.pl:514 ../tools/virt-df.pl:653
3794 #: ../tools/virt-ls.pl:247 ../tools/virt-resize.pl:1512
3795 #: ../tools/virt-list-filesystems.pl:202 ../tools/virt-cat.pl:199
3796 #: ../tools/virt-tar.pl:296 ../tools/virt-rescue.pl:281
3797 #: ../tools/virt-make-fs.pl:563 ../tools/virt-list-partitions.pl:269
3802 #: ../src/guestfs.pod:1922 ../fish/guestfish.pod:1014
3803 #: ../fuse/guestmount.pod:231
3804 msgid "Copyright (C) 2009-2010 Red Hat Inc. L<http://libguestfs.org/>"
3808 #: ../src/guestfs.pod:1925
3810 "This library is free software; you can redistribute it and/or modify it "
3811 "under the terms of the GNU Lesser General Public License as published by the "
3812 "Free Software Foundation; either version 2 of the License, or (at your "
3813 "option) any later version."
3817 #: ../src/guestfs.pod:1930
3819 "This library is distributed in the hope that it will be useful, but WITHOUT "
3820 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
3821 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
3826 #: ../src/guestfs.pod:1935
3828 "You should have received a copy of the GNU Lesser General Public License "
3829 "along with this library; if not, write to the Free Software Foundation, "
3830 "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
3834 #: ../src/guestfs-actions.pod:1
3835 msgid "guestfs_add_cdrom"
3839 #: ../src/guestfs-actions.pod:3
3842 " int guestfs_add_cdrom (guestfs_h *g,\n"
3843 "\t\tconst char *filename);\n"
3848 #: ../src/guestfs-actions.pod:6 ../fish/guestfish-actions.pod:5
3849 msgid "This function adds a virtual CD-ROM disk image to the guest."
3853 #: ../src/guestfs-actions.pod:8 ../fish/guestfish-actions.pod:7
3854 msgid "This is equivalent to the qemu parameter C<-cdrom filename>."
3858 #: ../src/guestfs-actions.pod:16
3860 "This call checks for the existence of C<filename>. This stops you from "
3861 "specifying other types of drive which are supported by qemu such as C<nbd:> "
3862 "and C<http:> URLs. To specify those, use the general C<guestfs_config> call "
3867 #: ../src/guestfs-actions.pod:23
3869 "If you just want to add an ISO file (often you use this as an efficient way "
3870 "to transfer large files into the guest), then you should probably use "
3871 "C<guestfs_add_drive_ro> instead."
3875 #: ../src/guestfs-actions.pod:29 ../src/guestfs-actions.pod:54
3876 #: ../src/guestfs-actions.pod:112 ../src/guestfs-actions.pod:144
3877 #: ../src/guestfs-actions.pod:155 ../src/guestfs-actions.pod:173
3878 #: ../src/guestfs-actions.pod:190 ../src/guestfs-actions.pod:201
3879 #: ../src/guestfs-actions.pod:304 ../src/guestfs-actions.pod:321
3880 #: ../src/guestfs-actions.pod:332 ../src/guestfs-actions.pod:368
3881 #: ../src/guestfs-actions.pod:390 ../src/guestfs-actions.pod:405
3882 #: ../src/guestfs-actions.pod:469 ../src/guestfs-actions.pod:496
3883 #: ../src/guestfs-actions.pod:507 ../src/guestfs-actions.pod:519
3884 #: ../src/guestfs-actions.pod:600 ../src/guestfs-actions.pod:615
3885 #: ../src/guestfs-actions.pod:626 ../src/guestfs-actions.pod:637
3886 #: ../src/guestfs-actions.pod:783 ../src/guestfs-actions.pod:800
3887 #: ../src/guestfs-actions.pod:815 ../src/guestfs-actions.pod:890
3888 #: ../src/guestfs-actions.pod:905 ../src/guestfs-actions.pod:921
3889 #: ../src/guestfs-actions.pod:932 ../src/guestfs-actions.pod:949
3890 #: ../src/guestfs-actions.pod:982 ../src/guestfs-actions.pod:1040
3891 #: ../src/guestfs-actions.pod:1068 ../src/guestfs-actions.pod:1090
3892 #: ../src/guestfs-actions.pod:1121 ../src/guestfs-actions.pod:1209
3893 #: ../src/guestfs-actions.pod:1240 ../src/guestfs-actions.pod:1440
3894 #: ../src/guestfs-actions.pod:1459 ../src/guestfs-actions.pod:1540
3895 #: ../src/guestfs-actions.pod:1888 ../src/guestfs-actions.pod:2011
3896 #: ../src/guestfs-actions.pod:2066 ../src/guestfs-actions.pod:2096
3897 #: ../src/guestfs-actions.pod:2525 ../src/guestfs-actions.pod:2537
3898 #: ../src/guestfs-actions.pod:2554 ../src/guestfs-actions.pod:2662
3899 #: ../src/guestfs-actions.pod:2673 ../src/guestfs-actions.pod:2683
3900 #: ../src/guestfs-actions.pod:2694 ../src/guestfs-actions.pod:2706
3901 #: ../src/guestfs-actions.pod:2736 ../src/guestfs-actions.pod:2800
3902 #: ../src/guestfs-actions.pod:2817 ../src/guestfs-actions.pod:2831
3903 #: ../src/guestfs-actions.pod:2851 ../src/guestfs-actions.pod:2871
3904 #: ../src/guestfs-actions.pod:2900 ../src/guestfs-actions.pod:2916
3905 #: ../src/guestfs-actions.pod:2932 ../src/guestfs-actions.pod:2961
3906 #: ../src/guestfs-actions.pod:2970 ../src/guestfs-actions.pod:3003
3907 #: ../src/guestfs-actions.pod:3016 ../src/guestfs-actions.pod:3026
3908 #: ../src/guestfs-actions.pod:3038 ../src/guestfs-actions.pod:3052
3909 #: ../src/guestfs-actions.pod:3132 ../src/guestfs-actions.pod:3149
3910 #: ../src/guestfs-actions.pod:3159 ../src/guestfs-actions.pod:3204
3911 #: ../src/guestfs-actions.pod:3219 ../src/guestfs-actions.pod:3234
3912 #: ../src/guestfs-actions.pod:3247 ../src/guestfs-actions.pod:3258
3913 #: ../src/guestfs-actions.pod:3269 ../src/guestfs-actions.pod:3283
3914 #: ../src/guestfs-actions.pod:3295 ../src/guestfs-actions.pod:3312
3915 #: ../src/guestfs-actions.pod:3358 ../src/guestfs-actions.pod:3386
3916 #: ../src/guestfs-actions.pod:3402 ../src/guestfs-actions.pod:3418
3917 #: ../src/guestfs-actions.pod:3427 ../src/guestfs-actions.pod:3441
3918 #: ../src/guestfs-actions.pod:3451 ../src/guestfs-actions.pod:3463
3919 #: ../src/guestfs-actions.pod:3475 ../src/guestfs-actions.pod:3507
3920 #: ../src/guestfs-actions.pod:3519 ../src/guestfs-actions.pod:3536
3921 #: ../src/guestfs-actions.pod:3547 ../src/guestfs-actions.pod:3561
3922 #: ../src/guestfs-actions.pod:3601 ../src/guestfs-actions.pod:3632
3923 #: ../src/guestfs-actions.pod:3643 ../src/guestfs-actions.pod:3668
3924 #: ../src/guestfs-actions.pod:3682 ../src/guestfs-actions.pod:3697
3925 #: ../src/guestfs-actions.pod:3819 ../src/guestfs-actions.pod:3871
3926 #: ../src/guestfs-actions.pod:3890 ../src/guestfs-actions.pod:3905
3927 #: ../src/guestfs-actions.pod:3931 ../src/guestfs-actions.pod:3988
3928 #: ../src/guestfs-actions.pod:4002 ../src/guestfs-actions.pod:4012
3929 #: ../src/guestfs-actions.pod:4023 ../src/guestfs-actions.pod:4278
3930 #: ../src/guestfs-actions.pod:4294 ../src/guestfs-actions.pod:4305
3931 #: ../src/guestfs-actions.pod:4314 ../src/guestfs-actions.pod:4325
3932 #: ../src/guestfs-actions.pod:4334 ../src/guestfs-actions.pod:4345
3933 #: ../src/guestfs-actions.pod:4358 ../src/guestfs-actions.pod:4376
3934 #: ../src/guestfs-actions.pod:4392 ../src/guestfs-actions.pod:4408
3935 #: ../src/guestfs-actions.pod:4423 ../src/guestfs-actions.pod:4443
3936 #: ../src/guestfs-actions.pod:4458 ../src/guestfs-actions.pod:4474
3937 #: ../src/guestfs-actions.pod:4492 ../src/guestfs-actions.pod:4508
3938 #: ../src/guestfs-actions.pod:4522 ../src/guestfs-actions.pod:4547
3939 #: ../src/guestfs-actions.pod:4568 ../src/guestfs-actions.pod:4584
3940 #: ../src/guestfs-actions.pod:4605 ../src/guestfs-actions.pod:4617
3941 #: ../src/guestfs-actions.pod:4629 ../src/guestfs-actions.pod:4645
3942 #: ../src/guestfs-actions.pod:4679 ../src/guestfs-actions.pod:4699
3943 #: ../src/guestfs-actions.pod:4722 ../src/guestfs-actions.pod:4812
3944 #: ../src/guestfs-actions.pod:4918 ../src/guestfs-actions.pod:4927
3945 #: ../src/guestfs-actions.pod:4937 ../src/guestfs-actions.pod:4947
3946 #: ../src/guestfs-actions.pod:4966 ../src/guestfs-actions.pod:4976
3947 #: ../src/guestfs-actions.pod:4986 ../src/guestfs-actions.pod:4996
3948 #: ../src/guestfs-actions.pod:5008 ../src/guestfs-actions.pod:5058
3949 #: ../src/guestfs-actions.pod:5072 ../src/guestfs-actions.pod:5085
3950 #: ../src/guestfs-actions.pod:5098 ../src/guestfs-actions.pod:5112
3951 #: ../src/guestfs-actions.pod:5122 ../src/guestfs-actions.pod:5139
3952 #: ../src/guestfs-actions.pod:5169 ../src/guestfs-actions.pod:5180
3953 #: ../src/guestfs-actions.pod:5215 ../src/guestfs-actions.pod:5225
3954 #: ../src/guestfs-actions.pod:5240 ../src/guestfs-actions.pod:5266
3955 #: ../src/guestfs-actions.pod:5294 ../src/guestfs-actions.pod:5398
3956 #: ../src/guestfs-actions.pod:5413 ../src/guestfs-actions.pod:5424
3957 #: ../src/guestfs-actions.pod:5470 ../src/guestfs-actions.pod:5480
3958 #: ../src/guestfs-actions.pod:5517 ../src/guestfs-actions.pod:5544
3959 #: ../src/guestfs-actions.pod:5586 ../src/guestfs-actions.pod:5609
3960 #: ../src/guestfs-actions.pod:5666 ../src/guestfs-actions.pod:5682
3961 #: ../src/guestfs-actions.pod:5708
3962 msgid "This function returns 0 on success or -1 on error."
3966 #: ../src/guestfs-actions.pod:31 ../src/guestfs-actions.pod:157
3967 #: ../src/guestfs-actions.pod:175 ../fish/guestfish-actions.pod:28
3968 #: ../fish/guestfish-actions.pod:117 ../fish/guestfish-actions.pod:131
3970 "This function is deprecated. In new code, use the C<add_drive_opts> call "
3975 #: ../src/guestfs-actions.pod:34 ../src/guestfs-actions.pod:160
3976 #: ../src/guestfs-actions.pod:178 ../src/guestfs-actions.pod:1214
3977 #: ../src/guestfs-actions.pod:1649 ../src/guestfs-actions.pod:1667
3978 #: ../src/guestfs-actions.pod:5617 ../src/guestfs-actions.pod:5762
3979 #: ../fish/guestfish-actions.pod:31 ../fish/guestfish-actions.pod:120
3980 #: ../fish/guestfish-actions.pod:134 ../fish/guestfish-actions.pod:940
3981 #: ../fish/guestfish-actions.pod:1297 ../fish/guestfish-actions.pod:1311
3982 #: ../fish/guestfish-actions.pod:4333 ../fish/guestfish-actions.pod:4430
3984 "Deprecated functions will not be removed from the API, but the fact that "
3985 "they are deprecated indicates that there are problems with correct use of "
3990 #: ../src/guestfs-actions.pod:38
3991 msgid "guestfs_add_drive"
3995 #: ../src/guestfs-actions.pod:40
3998 " int guestfs_add_drive (guestfs_h *g,\n"
3999 "\t\tconst char *filename);\n"
4004 #: ../src/guestfs-actions.pod:43
4006 "This function is the equivalent of calling C<guestfs_add_drive_opts> with no "
4007 "optional parameters, so the disk is added writable, with the format being "
4008 "detected automatically."
4012 #: ../src/guestfs-actions.pod:47
4014 "Automatic detection of the format opens you up to a potential security hole "
4015 "when dealing with untrusted raw-format images. See CVE-2010-3851 and "
4016 "RHBZ#642934. Specifying the format closes this security hole. Therefore "
4017 "you should think about replacing calls to this function with calls to "
4018 "C<guestfs_add_drive_opts>, and specifying the format."
4022 #: ../src/guestfs-actions.pod:56
4023 msgid "guestfs_add_drive_opts"
4027 #: ../src/guestfs-actions.pod:58
4030 " int guestfs_add_drive_opts (guestfs_h *g,\n"
4031 "\t\tconst char *filename,\n"
4037 #: ../src/guestfs-actions.pod:62
4039 "You may supply a list of optional arguments to this call. Use zero or more "
4040 "of the following pairs of parameters, and terminate the list with C<-1> on "
4041 "its own. See L</CALLS WITH OPTIONAL ARGUMENTS>."
4045 #: ../src/guestfs-actions.pod:67
4048 " GUESTFS_ADD_DRIVE_OPTS_READONLY, int readonly,\n"
4049 " GUESTFS_ADD_DRIVE_OPTS_FORMAT, const char *format,\n"
4050 " GUESTFS_ADD_DRIVE_OPTS_IFACE, const char *iface,\n"
4055 #: ../src/guestfs-actions.pod:71 ../fish/guestfish-actions.pod:56
4057 "This function adds a virtual machine disk image C<filename> to libguestfs. "
4058 "The first time you call this function, the disk appears as C</dev/sda>, the "
4059 "second time as C</dev/sdb>, and so on."
4063 #: ../src/guestfs-actions.pod:76 ../fish/guestfish-actions.pod:61
4065 "You don't necessarily need to be root when using libguestfs. However you "
4066 "obviously do need sufficient permissions to access the filename for whatever "
4067 "operations you want to perform (ie. read access if you just want to read the "
4068 "image or write access if you want to modify the image)."
4072 #: ../src/guestfs-actions.pod:82 ../fish/guestfish-actions.pod:67
4073 msgid "This call checks that C<filename> exists."
4077 #: ../src/guestfs-actions.pod:84 ../fish/guestfish-actions.pod:69
4078 msgid "The optional arguments are:"
4082 #: ../src/guestfs-actions.pod:88 ../fish/guestfish-actions.pod:73
4087 #: ../src/guestfs-actions.pod:90 ../fish/guestfish-actions.pod:75
4089 "If true then the image is treated as read-only. Writes are still allowed, "
4090 "but they are stored in a temporary snapshot overlay which is discarded at "
4091 "the end. The disk that you add is not modified."
4095 #: ../src/guestfs-actions.pod:94 ../fish/guestfish-actions.pod:79
4100 #: ../src/guestfs-actions.pod:96
4102 "This forces the image format. If you omit this (or use C<guestfs_add_drive> "
4103 "or C<guestfs_add_drive_ro>) then the format is automatically detected. "
4104 "Possible formats include C<raw> and C<qcow2>."
4108 #: ../src/guestfs-actions.pod:100 ../fish/guestfish-actions.pod:85
4110 "Automatic detection of the format opens you up to a potential security hole "
4111 "when dealing with untrusted raw-format images. See CVE-2010-3851 and "
4112 "RHBZ#642934. Specifying the format closes this security hole."
4116 #: ../src/guestfs-actions.pod:105 ../fish/guestfish-actions.pod:90
4121 #: ../src/guestfs-actions.pod:107
4123 "This rarely-used option lets you emulate the behaviour of the deprecated "
4124 "C<guestfs_add_drive_with_if> call (q.v.)"
4128 #: ../src/guestfs-actions.pod:114
4129 msgid "guestfs_add_drive_opts_va"
4133 #: ../src/guestfs-actions.pod:116
4136 " int guestfs_add_drive_opts_va (guestfs_h *g,\n"
4137 "\t\tconst char *filename,\n"
4138 "\t\tva_list args);\n"
4143 #: ../src/guestfs-actions.pod:120
4144 msgid "This is the \"va_list variant\" of L</guestfs_add_drive_opts>."
4148 #: ../src/guestfs-actions.pod:122 ../src/guestfs-actions.pod:132
4149 msgid "See L</CALLS WITH OPTIONAL ARGUMENTS>."
4153 #: ../src/guestfs-actions.pod:124
4154 msgid "guestfs_add_drive_opts_argv"
4158 #: ../src/guestfs-actions.pod:126
4161 " int guestfs_add_drive_opts_argv (guestfs_h *g,\n"
4162 "\t\tconst char *filename,\n"
4163 "\t\tconst struct guestfs_add_drive_opts_argv *optargs);\n"
4168 #: ../src/guestfs-actions.pod:130
4169 msgid "This is the \"argv variant\" of L</guestfs_add_drive_opts>."
4173 #: ../src/guestfs-actions.pod:134
4174 msgid "guestfs_add_drive_ro"
4178 #: ../src/guestfs-actions.pod:136
4181 " int guestfs_add_drive_ro (guestfs_h *g,\n"
4182 "\t\tconst char *filename);\n"
4187 #: ../src/guestfs-actions.pod:139
4189 "This function is the equivalent of calling C<guestfs_add_drive_opts> with "
4190 "the optional parameter C<GUESTFS_ADD_DRIVE_OPTS_READONLY> set to 1, so the "
4191 "disk is added read-only, with the format being detected automatically."
4195 #: ../src/guestfs-actions.pod:146
4196 msgid "guestfs_add_drive_ro_with_if"
4200 #: ../src/guestfs-actions.pod:148
4203 " int guestfs_add_drive_ro_with_if (guestfs_h *g,\n"
4204 "\t\tconst char *filename,\n"
4205 "\t\tconst char *iface);\n"
4210 #: ../src/guestfs-actions.pod:152
4212 "This is the same as C<guestfs_add_drive_ro> but it allows you to specify the "
4213 "QEMU interface emulation to use at run time."
4217 #: ../src/guestfs-actions.pod:164
4218 msgid "guestfs_add_drive_with_if"
4222 #: ../src/guestfs-actions.pod:166
4225 " int guestfs_add_drive_with_if (guestfs_h *g,\n"
4226 "\t\tconst char *filename,\n"
4227 "\t\tconst char *iface);\n"
4232 #: ../src/guestfs-actions.pod:170
4234 "This is the same as C<guestfs_add_drive> but it allows you to specify the "
4235 "QEMU interface emulation to use at run time."
4239 #: ../src/guestfs-actions.pod:182
4240 msgid "guestfs_aug_clear"
4244 #: ../src/guestfs-actions.pod:184
4247 " int guestfs_aug_clear (guestfs_h *g,\n"
4248 "\t\tconst char *augpath);\n"
4253 #: ../src/guestfs-actions.pod:187 ../fish/guestfish-actions.pod:142
4255 "Set the value associated with C<path> to C<NULL>. This is the same as the "
4256 "L<augtool(1)> C<clear> command."
4260 #: ../src/guestfs-actions.pod:192
4261 msgid "guestfs_aug_close"
4265 #: ../src/guestfs-actions.pod:194
4268 " int guestfs_aug_close (guestfs_h *g);\n"
4273 #: ../src/guestfs-actions.pod:196
4275 "Close the current Augeas handle and free up any resources used by it. After "
4276 "calling this, you have to call C<guestfs_aug_init> again before you can use "
4277 "any other Augeas functions."
4281 #: ../src/guestfs-actions.pod:203
4282 msgid "guestfs_aug_defnode"
4286 #: ../src/guestfs-actions.pod:205
4289 " struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,\n"
4290 "\t\tconst char *name,\n"
4291 "\t\tconst char *expr,\n"
4292 "\t\tconst char *val);\n"
4297 #: ../src/guestfs-actions.pod:210 ../fish/guestfish-actions.pod:158
4299 "Defines a variable C<name> whose value is the result of evaluating C<expr>."
4303 #: ../src/guestfs-actions.pod:213
4305 "If C<expr> evaluates to an empty nodeset, a node is created, equivalent to "
4306 "calling C<guestfs_aug_set> C<expr>, C<value>. C<name> will be the nodeset "
4307 "containing that single node."
4311 #: ../src/guestfs-actions.pod:217 ../fish/guestfish-actions.pod:165
4313 "On success this returns a pair containing the number of nodes in the "
4314 "nodeset, and a boolean flag if a node was created."
4318 #: ../src/guestfs-actions.pod:221
4320 "This function returns a C<struct guestfs_int_bool *>, or NULL if there was "
4321 "an error. I<The caller must call C<guestfs_free_int_bool> after use>."
4325 #: ../src/guestfs-actions.pod:225
4326 msgid "guestfs_aug_defvar"
4330 #: ../src/guestfs-actions.pod:227
4333 " int guestfs_aug_defvar (guestfs_h *g,\n"
4334 "\t\tconst char *name,\n"
4335 "\t\tconst char *expr);\n"
4340 #: ../src/guestfs-actions.pod:231 ../fish/guestfish-actions.pod:173
4342 "Defines an Augeas variable C<name> whose value is the result of evaluating "
4343 "C<expr>. If C<expr> is NULL, then C<name> is undefined."
4347 #: ../src/guestfs-actions.pod:235 ../fish/guestfish-actions.pod:177
4349 "On success this returns the number of nodes in C<expr>, or C<0> if C<expr> "
4350 "evaluates to something which is not a nodeset."
4354 #: ../src/guestfs-actions.pod:238 ../src/guestfs-actions.pod:379
4355 #: ../src/guestfs-actions.pod:533 ../src/guestfs-actions.pod:558
4356 #: ../src/guestfs-actions.pod:573 ../src/guestfs-actions.pod:589
4357 #: ../src/guestfs-actions.pod:1107 ../src/guestfs-actions.pod:1422
4358 #: ../src/guestfs-actions.pod:1604 ../src/guestfs-actions.pod:1685
4359 #: ../src/guestfs-actions.pod:1716 ../src/guestfs-actions.pod:1759
4360 #: ../src/guestfs-actions.pod:1776 ../src/guestfs-actions.pod:2001
4361 #: ../src/guestfs-actions.pod:2213 ../src/guestfs-actions.pod:2231
4362 #: ../src/guestfs-actions.pod:3621 ../src/guestfs-actions.pod:3728
4363 #: ../src/guestfs-actions.pod:4082 ../src/guestfs-actions.pod:4105
4364 #: ../src/guestfs-actions.pod:5204 ../src/guestfs-actions.pod:5554
4365 #: ../src/guestfs-actions.pod:5564 ../src/guestfs-actions.pod:5574
4366 msgid "On error this function returns -1."
4370 #: ../src/guestfs-actions.pod:240
4371 msgid "guestfs_aug_get"
4375 #: ../src/guestfs-actions.pod:242
4378 " char *guestfs_aug_get (guestfs_h *g,\n"
4379 "\t\tconst char *augpath);\n"
4384 #: ../src/guestfs-actions.pod:245 ../fish/guestfish-actions.pod:184
4386 "Look up the value associated with C<path>. If C<path> matches exactly one "
4387 "node, the C<value> is returned."
4391 #: ../src/guestfs-actions.pod:248 ../src/guestfs-actions.pod:676
4392 #: ../src/guestfs-actions.pod:691 ../src/guestfs-actions.pod:748
4393 #: ../src/guestfs-actions.pod:761 ../src/guestfs-actions.pod:852
4394 #: ../src/guestfs-actions.pod:965 ../src/guestfs-actions.pod:994
4395 #: ../src/guestfs-actions.pod:1008 ../src/guestfs-actions.pod:1024
4396 #: ../src/guestfs-actions.pod:1135 ../src/guestfs-actions.pod:1299
4397 #: ../src/guestfs-actions.pod:1408 ../src/guestfs-actions.pod:1553
4398 #: ../src/guestfs-actions.pod:1567 ../src/guestfs-actions.pod:1643
4399 #: ../src/guestfs-actions.pod:1661 ../src/guestfs-actions.pod:1795
4400 #: ../src/guestfs-actions.pod:1934 ../src/guestfs-actions.pod:2115
4401 #: ../src/guestfs-actions.pod:2165 ../src/guestfs-actions.pod:2281
4402 #: ../src/guestfs-actions.pod:2316 ../src/guestfs-actions.pod:2336
4403 #: ../src/guestfs-actions.pod:2651 ../src/guestfs-actions.pod:2948
4404 #: ../src/guestfs-actions.pod:3089 ../src/guestfs-actions.pod:3185
4405 #: ../src/guestfs-actions.pod:3743 ../src/guestfs-actions.pod:3919
4406 #: ../src/guestfs-actions.pod:4060 ../src/guestfs-actions.pod:4221
4407 #: ../src/guestfs-actions.pod:4264 ../src/guestfs-actions.pod:4740
4408 #: ../src/guestfs-actions.pod:4753 ../src/guestfs-actions.pod:4767
4409 #: ../src/guestfs-actions.pod:4788 ../src/guestfs-actions.pod:5347
4410 #: ../src/guestfs-actions.pod:5363 ../src/guestfs-actions.pod:5378
4411 #: ../src/guestfs-actions.pod:5526 ../src/guestfs-actions.pod:5756
4413 "This function returns a string, or NULL on error. I<The caller must free "
4414 "the returned string after use>."
4418 #: ../src/guestfs-actions.pod:251
4419 msgid "guestfs_aug_init"
4423 #: ../src/guestfs-actions.pod:253
4426 " int guestfs_aug_init (guestfs_h *g,\n"
4427 "\t\tconst char *root,\n"
4433 #: ../src/guestfs-actions.pod:257 ../fish/guestfish-actions.pod:191
4435 "Create a new Augeas handle for editing configuration files. If there was "
4436 "any previous Augeas handle associated with this guestfs session, then it is "
4441 #: ../src/guestfs-actions.pod:261
4442 msgid "You must call this before using any other C<guestfs_aug_*> commands."
4446 #: ../src/guestfs-actions.pod:264 ../fish/guestfish-actions.pod:198
4448 "C<root> is the filesystem root. C<root> must not be NULL, use C</> instead."
4452 #: ../src/guestfs-actions.pod:267 ../fish/guestfish-actions.pod:201
4454 "The flags are the same as the flags defined in E<lt>augeas.hE<gt>, the "
4455 "logical I<or> of the following integers:"
4459 #: ../src/guestfs-actions.pod:273 ../fish/guestfish-actions.pod:207
4460 msgid "C<AUG_SAVE_BACKUP> = 1"
4464 #: ../src/guestfs-actions.pod:275 ../fish/guestfish-actions.pod:209
4465 msgid "Keep the original file with a C<.augsave> extension."
4469 #: ../src/guestfs-actions.pod:277 ../fish/guestfish-actions.pod:211
4470 msgid "C<AUG_SAVE_NEWFILE> = 2"
4474 #: ../src/guestfs-actions.pod:279 ../fish/guestfish-actions.pod:213
4476 "Save changes into a file with extension C<.augnew>, and do not overwrite "
4477 "original. Overrides C<AUG_SAVE_BACKUP>."
4481 #: ../src/guestfs-actions.pod:282 ../fish/guestfish-actions.pod:216
4482 msgid "C<AUG_TYPE_CHECK> = 4"
4486 #: ../src/guestfs-actions.pod:284 ../fish/guestfish-actions.pod:218
4487 msgid "Typecheck lenses (can be expensive)."
4491 #: ../src/guestfs-actions.pod:286 ../fish/guestfish-actions.pod:220
4492 msgid "C<AUG_NO_STDINC> = 8"
4496 #: ../src/guestfs-actions.pod:288 ../fish/guestfish-actions.pod:222
4497 msgid "Do not use standard load path for modules."
4501 #: ../src/guestfs-actions.pod:290 ../fish/guestfish-actions.pod:224
4502 msgid "C<AUG_SAVE_NOOP> = 16"
4506 #: ../src/guestfs-actions.pod:292 ../fish/guestfish-actions.pod:226
4507 msgid "Make save a no-op, just record what would have been changed."
4511 #: ../src/guestfs-actions.pod:294 ../fish/guestfish-actions.pod:228
4512 msgid "C<AUG_NO_LOAD> = 32"
4516 #: ../src/guestfs-actions.pod:296
4517 msgid "Do not load the tree in C<guestfs_aug_init>."
4521 #: ../src/guestfs-actions.pod:300
4522 msgid "To close the handle, you can call C<guestfs_aug_close>."
4526 #: ../src/guestfs-actions.pod:302 ../fish/guestfish-actions.pod:236
4527 msgid "To find out more about Augeas, see L<http://augeas.net/>."
4531 #: ../src/guestfs-actions.pod:306
4532 msgid "guestfs_aug_insert"
4536 #: ../src/guestfs-actions.pod:308
4539 " int guestfs_aug_insert (guestfs_h *g,\n"
4540 "\t\tconst char *augpath,\n"
4541 "\t\tconst char *label,\n"
4542 "\t\tint before);\n"
4547 #: ../src/guestfs-actions.pod:313 ../fish/guestfish-actions.pod:242
4549 "Create a new sibling C<label> for C<path>, inserting it into the tree before "
4550 "or after C<path> (depending on the boolean flag C<before>)."
4554 #: ../src/guestfs-actions.pod:317 ../fish/guestfish-actions.pod:246
4556 "C<path> must match exactly one existing node in the tree, and C<label> must "
4557 "be a label, ie. not contain C</>, C<*> or end with a bracketed index C<[N]>."
4561 #: ../src/guestfs-actions.pod:323
4562 msgid "guestfs_aug_load"
4566 #: ../src/guestfs-actions.pod:325
4569 " int guestfs_aug_load (guestfs_h *g);\n"
4574 #: ../src/guestfs-actions.pod:327 ../fish/guestfish-actions.pod:254
4575 msgid "Load files into the tree."
4579 #: ../src/guestfs-actions.pod:329 ../fish/guestfish-actions.pod:256
4580 msgid "See C<aug_load> in the Augeas documentation for the full gory details."
4584 #: ../src/guestfs-actions.pod:334
4585 msgid "guestfs_aug_ls"
4589 #: ../src/guestfs-actions.pod:336
4592 " char **guestfs_aug_ls (guestfs_h *g,\n"
4593 "\t\tconst char *augpath);\n"
4598 #: ../src/guestfs-actions.pod:339
4600 "This is just a shortcut for listing C<guestfs_aug_match> C<path/*> and "
4601 "sorting the resulting nodes into alphabetical order."
4605 #: ../src/guestfs-actions.pod:342 ../src/guestfs-actions.pod:355
4606 #: ../src/guestfs-actions.pod:483 ../src/guestfs-actions.pod:868
4607 #: ../src/guestfs-actions.pod:1147 ../src/guestfs-actions.pod:1163
4608 #: ../src/guestfs-actions.pod:1251 ../src/guestfs-actions.pod:1267
4609 #: ../src/guestfs-actions.pod:1498 ../src/guestfs-actions.pod:1832
4610 #: ../src/guestfs-actions.pod:1845 ../src/guestfs-actions.pod:1861
4611 #: ../src/guestfs-actions.pod:1898 ../src/guestfs-actions.pod:1919
4612 #: ../src/guestfs-actions.pod:1981 ../src/guestfs-actions.pod:2021
4613 #: ../src/guestfs-actions.pod:2187 ../src/guestfs-actions.pod:2375
4614 #: ../src/guestfs-actions.pod:2580 ../src/guestfs-actions.pod:2636
4615 #: ../src/guestfs-actions.pod:2720 ../src/guestfs-actions.pod:3066
4616 #: ../src/guestfs-actions.pod:3588 ../src/guestfs-actions.pod:4037
4617 #: ../src/guestfs-actions.pod:4146 ../src/guestfs-actions.pod:4252
4618 #: ../src/guestfs-actions.pod:4801 ../src/guestfs-actions.pod:4850
4619 #: ../src/guestfs-actions.pod:4902 ../src/guestfs-actions.pod:5018
4620 #: ../src/guestfs-actions.pod:5039 ../src/guestfs-actions.pod:5439
4621 #: ../src/guestfs-actions.pod:5456 ../src/guestfs-actions.pod:5494
4622 #: ../src/guestfs-actions.pod:5630 ../src/guestfs-actions.pod:5646
4623 #: ../src/guestfs-actions.pod:5719 ../src/guestfs-actions.pod:5735
4624 #: ../src/guestfs-actions.pod:5775 ../src/guestfs-actions.pod:5791
4626 "This function returns a NULL-terminated array of strings (like L<environ(3)"
4627 ">), or NULL if there was an error. I<The caller must free the strings and "
4628 "the array after use>."
4632 #: ../src/guestfs-actions.pod:346
4633 msgid "guestfs_aug_match"
4637 #: ../src/guestfs-actions.pod:348
4640 " char **guestfs_aug_match (guestfs_h *g,\n"
4641 "\t\tconst char *augpath);\n"
4646 #: ../src/guestfs-actions.pod:351 ../fish/guestfish-actions.pod:270
4648 "Returns a list of paths which match the path expression C<path>. The "
4649 "returned paths are sufficiently qualified so that they match exactly one "
4650 "node in the current tree."
4654 #: ../src/guestfs-actions.pod:359
4655 msgid "guestfs_aug_mv"
4659 #: ../src/guestfs-actions.pod:361
4662 " int guestfs_aug_mv (guestfs_h *g,\n"
4663 "\t\tconst char *src,\n"
4664 "\t\tconst char *dest);\n"
4669 #: ../src/guestfs-actions.pod:365 ../fish/guestfish-actions.pod:278
4671 "Move the node C<src> to C<dest>. C<src> must match exactly one node. "
4672 "C<dest> is overwritten if it exists."
4676 #: ../src/guestfs-actions.pod:370
4677 msgid "guestfs_aug_rm"
4681 #: ../src/guestfs-actions.pod:372
4684 " int guestfs_aug_rm (guestfs_h *g,\n"
4685 "\t\tconst char *augpath);\n"
4690 #: ../src/guestfs-actions.pod:375 ../fish/guestfish-actions.pod:285
4691 msgid "Remove C<path> and all of its children."
4695 #: ../src/guestfs-actions.pod:377 ../fish/guestfish-actions.pod:287
4696 msgid "On success this returns the number of entries which were removed."
4700 #: ../src/guestfs-actions.pod:381
4701 msgid "guestfs_aug_save"
4705 #: ../src/guestfs-actions.pod:383
4708 " int guestfs_aug_save (guestfs_h *g);\n"
4713 #: ../src/guestfs-actions.pod:385 ../fish/guestfish-actions.pod:293
4714 msgid "This writes all pending changes to disk."
4718 #: ../src/guestfs-actions.pod:387
4720 "The flags which were passed to C<guestfs_aug_init> affect exactly how files "
4725 #: ../src/guestfs-actions.pod:392
4726 msgid "guestfs_aug_set"
4730 #: ../src/guestfs-actions.pod:394
4733 " int guestfs_aug_set (guestfs_h *g,\n"
4734 "\t\tconst char *augpath,\n"
4735 "\t\tconst char *val);\n"
4740 #: ../src/guestfs-actions.pod:398 ../fish/guestfish-actions.pod:302
4741 msgid "Set the value associated with C<path> to C<val>."
4745 #: ../src/guestfs-actions.pod:400
4747 "In the Augeas API, it is possible to clear a node by setting the value to "
4748 "NULL. Due to an oversight in the libguestfs API you cannot do that with "
4749 "this call. Instead you must use the C<guestfs_aug_clear> call."
4753 #: ../src/guestfs-actions.pod:407
4754 msgid "guestfs_available"
4758 #: ../src/guestfs-actions.pod:409
4761 " int guestfs_available (guestfs_h *g,\n"
4762 "\t\tchar *const *groups);\n"
4767 #: ../src/guestfs-actions.pod:412 ../fish/guestfish-actions.pod:313
4769 "This command is used to check the availability of some groups of "
4770 "functionality in the appliance, which not all builds of the libguestfs "
4771 "appliance will be able to provide."
4775 #: ../src/guestfs-actions.pod:416
4777 "The libguestfs groups, and the functions that those groups correspond to, "
4778 "are listed in L<guestfs(3)/AVAILABILITY>. You can also fetch this list at "
4779 "runtime by calling C<guestfs_available_all_groups>."
4783 #: ../src/guestfs-actions.pod:421 ../fish/guestfish-actions.pod:322
4785 "The argument C<groups> is a list of group names, eg: C<[\"inotify\", \"augeas"
4786 "\"]> would check for the availability of the Linux inotify functions and "
4787 "Augeas (configuration file editing) functions."
4791 #: ../src/guestfs-actions.pod:426 ../fish/guestfish-actions.pod:327
4792 msgid "The command returns no error if I<all> requested groups are available."
4796 #: ../src/guestfs-actions.pod:428 ../fish/guestfish-actions.pod:329
4798 "It fails with an error if one or more of the requested groups is unavailable "
4803 #: ../src/guestfs-actions.pod:431 ../fish/guestfish-actions.pod:332
4805 "If an unknown group name is included in the list of groups then an error is "
4810 #: ../src/guestfs-actions.pod:434 ../fish/guestfish-actions.pod:335
4815 #: ../src/guestfs-actions.pod:440
4816 msgid "You must call C<guestfs_launch> before calling this function."
4820 #: ../src/guestfs-actions.pod:442 ../fish/guestfish-actions.pod:343
4822 "The reason is because we don't know what groups are supported by the "
4823 "appliance/daemon until it is running and can be queried."
4827 #: ../src/guestfs-actions.pod:448 ../fish/guestfish-actions.pod:349
4829 "If a group of functions is available, this does not necessarily mean that "
4830 "they will work. You still have to check for errors when calling individual "
4831 "API functions even if they are available."
4835 #: ../src/guestfs-actions.pod:455 ../fish/guestfish-actions.pod:356
4837 "It is usually the job of distro packagers to build complete functionality "
4838 "into the libguestfs appliance. Upstream libguestfs, if built from source "
4839 "with all requirements satisfied, will support everything."
4843 #: ../src/guestfs-actions.pod:462
4845 "This call was added in version C<1.0.80>. In previous versions of "
4846 "libguestfs all you could do would be to speculatively execute a command to "
4847 "find out if the daemon implemented it. See also C<guestfs_version>."
4851 #: ../src/guestfs-actions.pod:471
4852 msgid "guestfs_available_all_groups"
4856 #: ../src/guestfs-actions.pod:473
4859 " char **guestfs_available_all_groups (guestfs_h *g);\n"
4864 #: ../src/guestfs-actions.pod:475
4866 "This command returns a list of all optional groups that this daemon knows "
4867 "about. Note this returns both supported and unsupported groups. To find "
4868 "out which ones the daemon can actually support you have to call "
4869 "C<guestfs_available> on each member of the returned list."
4873 #: ../src/guestfs-actions.pod:481
4874 msgid "See also C<guestfs_available> and L<guestfs(3)/AVAILABILITY>."
4878 #: ../src/guestfs-actions.pod:487
4879 msgid "guestfs_base64_in"
4883 #: ../src/guestfs-actions.pod:489
4886 " int guestfs_base64_in (guestfs_h *g,\n"
4887 "\t\tconst char *base64file,\n"
4888 "\t\tconst char *filename);\n"
4893 #: ../src/guestfs-actions.pod:493 ../fish/guestfish-actions.pod:386
4895 "This command uploads base64-encoded data from C<base64file> to C<filename>."
4899 #: ../src/guestfs-actions.pod:498
4900 msgid "guestfs_base64_out"
4904 #: ../src/guestfs-actions.pod:500
4907 " int guestfs_base64_out (guestfs_h *g,\n"
4908 "\t\tconst char *filename,\n"
4909 "\t\tconst char *base64file);\n"
4914 #: ../src/guestfs-actions.pod:504 ../fish/guestfish-actions.pod:395
4916 "This command downloads the contents of C<filename>, writing it out to local "
4917 "file C<base64file> encoded as base64."