X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfish-actions.pod;h=8ced2e14f8e96609f7110fcde5e77d470c4b8a67;hp=74242e32aa9390c4372dc796d1e154fca503e807;hb=0884d8bbae6d76a603ec1385ada2938f88981c5c;hpb=e118c14b9552de311cbc1734e03a3226b484c1e8 diff --git a/guestfish-actions.pod b/guestfish-actions.pod index 74242e3..8ced2e1 100644 --- a/guestfish-actions.pod +++ b/guestfish-actions.pod @@ -6,6 +6,11 @@ This function adds a virtual CD-ROM disk image to the guest. This is equivalent to the qemu parameter C<-cdrom filename>. +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. + =head2 add-drive | add add-drive filename @@ -21,7 +26,33 @@ for whatever operations you want to perform (ie. read access if you just want to read the image or write access if you want to modify the image). -This is equivalent to the qemu parameter C<-drive file=filename>. +This is equivalent to the qemu parameter C<-drive file=filename,cache=off>. + +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. + +=head2 add-drive-ro | add-ro + + add-drive-ro filename + +This adds a drive in snapshot mode, making it effectively +read-only. + +Note that writes to the device are allowed, and will be seen for +the duration of the guestfs handle, but they are written +to a temporary file which is discarded as soon as the guestfs +handle is closed. We don't currently have any method to enable +changes to be committed, although qemu can support this. + +This is equivalent to the qemu parameter +C<-drive file=filename,snapshot=on>. + +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. =head2 aug-close @@ -370,7 +401,16 @@ or compatible processor architecture). The single parameter is an argv-style list of arguments. The first element is the name of the program to run. Subsequent elements are parameters. The list must be -non-empty (ie. must contain a program name). +non-empty (ie. must contain a program name). Note that +the command runs directly, and is I invoked via +the shell (see C). + +The return value is anything printed to I by +the command. + +If the command returns a non-zero exit status, then +this function returns an error message. The error message +string is the content of I from the command. The C<$PATH> environment variable will contain at least C and C. If you require a program from @@ -383,6 +423,10 @@ correct places. It is the caller's responsibility to ensure all filesystems that are needed are mounted at the right locations. +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + =head2 command-lines command-lines 'arguments ...' @@ -390,6 +434,12 @@ locations. This is the same as C, but splits the result into a list of lines. +See also: C + +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + =head2 config config qemuparam qemuvalue @@ -403,6 +453,20 @@ The first character of C string must be a C<-> (dash). C can be NULL. +=head2 cp + + cp src dest + +This copies a file from C to C where C is +either a destination filename or destination directory. + +=head2 cp-a + + cp-a src dest + +This copies a file or directory from C to C +recursively using the C command. + =head2 debug debug subcmd 'extraargs ...' @@ -415,6 +479,40 @@ There is no comprehensive help for this command. You have to look at the file C in the libguestfs source to find out what you can do. +=head2 df + + df + +This command runs the C command to report disk space used. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs. + +=head2 df-h + + df-h + +This command runs the C command to report disk space used +in human-readable format. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs. + +=head2 dmesg + + dmesg + +This returns the kernel messages (C output) from +the guest kernel. This is sometimes useful for extended +debugging of problems. + +Another way to get the same information is to enable +verbose messages with C or by setting +the environment variable C before +running the program. + =head2 download download remotefilename (filename|-) @@ -428,6 +526,54 @@ See also C, C. Use C<-> instead of a filename to read/write from stdin/stdout. +=head2 drop-caches + + drop-caches whattodrop + +This instructs the guest kernel to drop its page cache, +and/or dentries and inode caches. The parameter C +tells the kernel what precisely to drop, see +L + +Setting C to 3 should drop everything. + +This automatically calls L before the operation, +so that the maximum guest memory is freed. + +=head2 du + + du path + +This command runs the C command to estimate file space +usage for C. + +C can be a file or a directory. If C is a directory +then the estimate includes the contents of the directory and all +subdirectories (recursively). + +The result is the estimated size in I +(ie. units of 1024 bytes). + +=head2 e2fsck-f + + e2fsck-f device + +This runs C, ie. runs the ext2/ext3 +filesystem checker on C, noninteractively (C<-p>), +even if the filesystem appears to be clean (C<-f>). + +This command is only needed because of C +(q.v.). Normally you should use C. + +=head2 equal + + equal file1 file2 + +This compares the two files C and C and returns +true if their content is exactly equal, or false otherwise. + +The external L program is used for the comparison. + =head2 exists exists path @@ -449,6 +595,35 @@ The exact command which runs is C. Note in particular that the filename is not prepended to the output (the C<-b> option). +=head2 find + + find directory + +This command lists out all files and directories, recursively, +starting at C. It is essentially equivalent to +running the shell command C but some +post-processing happens on the output, described below. + +This returns a list of strings I. Thus +if the directory structure was: + + /tmp/a + /tmp/b + /tmp/c/d + +then the returned list from C C would be +4 elements: + + a + b + c + c/d + +If C is not a directory, then this command returns +an error. + +The returned list is sorted. + =head2 fsck fsck fstype device @@ -481,6 +656,15 @@ Checking or repairing NTFS volumes is not supported This command is entirely equivalent to running C. +=head2 get-append + + get-append + +Return the additional kernel options which are added to the +guest kernel command line. + +If C then no options are added. + =head2 get-autosync get-autosync @@ -501,6 +685,20 @@ C. This returns the ext2/3/4 filesystem UUID of the filesystem on C. +=head2 get-memsize + + get-memsize + +This gets the memory size in megabytes allocated to the +qemu subprocess. + +If C was not called +on this handle, and if C was not set, +then this returns the compiled-in default value for memsize. + +For more information on the architecture of libguestfs, +see L. + =head2 get-path get-path @@ -534,6 +732,21 @@ For more information on states, see L. This returns the verbose messages flag. +=head2 glob-expand + + glob-expand pattern + +This command searches for all the pathnames matching +C according to the wildcard expansion rules +used by the shell. + +If no paths match, then this returns an empty list +(note: not an error). + +It is just a wrapper around the C L function +with flags C. +See that manual page for more details. + =head2 grub-install grub-install root device @@ -541,6 +754,58 @@ This returns the verbose messages flag. This command installs GRUB (the Grand Unified Bootloader) on C, with the root directory being C. +=head2 head + + head path + +This command returns up to the first 10 lines of a file as +a list of strings. + +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + +=head2 head-n + + head-n nrlines path + +If the parameter C is a positive number, this returns the first +C lines of the file C. + +If the parameter C is a negative number, this returns lines +from the file C, excluding the last C lines. + +If the parameter C is zero, this returns an empty list. + +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + +=head2 hexdump + + hexdump path + +This runs C on the given C. The result is +the human-readable, canonical hex dump of the file. + +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + +=head2 initrd-list + + initrd-list path + +This command lists out files contained in an initrd. + +The files are listed without any initial C character. The +files are listed in the order they appear (not necessarily +alphabetical). Directory names are listed as separate items. + +Old Linux kernels (2.4 and earlier) used a compressed ext2 +filesystem as initrd. We I support the newer initramfs +format (compressed cpio files). + =head2 is-busy is-busy @@ -692,6 +957,14 @@ the path to the LV, such as C. You can also remove all LVs in a volume group by specifying the VG name, C. +=head2 lvresize + + lvresize device mbytes + +This resizes (expands or shrinks) an existing LVM logical +volume to C. When reducing, data in the reduced part +is lost. + =head2 lvs lvs @@ -724,14 +997,91 @@ Create a directory named C. Create a directory named C, creating any parent directories as necessary. This is like the C shell command. +=head2 mkdtemp + + mkdtemp template + +This command creates a temporary directory. The +C