X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=d35d1aa22dba91be38249dd0949f0745f0b1912c;hp=53bfa54e1e155686b0cb4e1fd9015f0983206305;hb=ad8a256f54a6cb99f89bb444c8597a152a793dce;hpb=5d628a4a9cc11eb9a61a1dc683aadca9ac378736 diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 53bfa54..d35d1aa 100644 --- a/guestfs-actions.pod +++ b/guestfs-actions.pod @@ -7,6 +7,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. + This function returns 0 on success or -1 on error. =head2 guestfs_add_drive @@ -27,6 +32,35 @@ image). This is equivalent to the qemu parameter C<-drive file=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. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_add_drive_ro + + int guestfs_add_drive_ro (guestfs_h *handle, + const char *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. + This function returns 0 on success or -1 on error. =head2 guestfs_aug_close @@ -477,7 +511,9 @@ 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. @@ -512,6 +548,8 @@ FTP. This is the same as C, but splits the result into a list of lines. +See also: C + This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. @@ -624,6 +662,20 @@ so that the maximum guest memory is freed. This function returns 0 on success or -1 on error. +=head2 guestfs_e2fsck_f + + int guestfs_e2fsck_f (guestfs_h *handle, + const char *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. + +This function returns 0 on success or -1 on error. + =head2 guestfs_end_busy int guestfs_end_busy (guestfs_h *handle); @@ -677,6 +729,40 @@ particular that the filename is not prepended to the output This function returns a string, or NULL on error. I. +=head2 guestfs_find + + char **guestfs_find (guestfs_h *handle, + const char *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. + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_fsck int guestfs_fsck (guestfs_h *handle, @@ -798,6 +884,26 @@ This returns the verbose messages flag. This function returns a C truth value on success or -1 on error. +=head2 guestfs_glob_expand + + char **guestfs_glob_expand (guestfs_h *handle, + const char *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. + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_grub_install int guestfs_grub_install (guestfs_h *handle, @@ -1026,6 +1132,18 @@ the VG name, C. This function returns 0 on success or -1 on error. +=head2 guestfs_lvresize + + int guestfs_lvresize (guestfs_h *handle, + const char *device, + int mbytes); + +This resizes (expands or shrinks) an existing LVM logical +volume to C. When reducing, data in the reduced part +is lost. + +This function returns 0 on success or -1 on error. + =head2 guestfs_lvs char **guestfs_lvs (guestfs_h *handle); @@ -1172,6 +1290,26 @@ either a destination filename or destination directory. This function returns 0 on success or -1 on error. +=head2 guestfs_ntfs_3g_probe + + int guestfs_ntfs_3g_probe (guestfs_h *handle, + int rw, + const char *device); + +This command runs the L command which probes +an NTFS C for mountability. (Not all NTFS volumes can +be mounted read-write, and some cannot be mounted at all). + +C is a boolean flag. Set it to true if you want to test +if the volume can be mounted read-write. Set it to false if +you want to test if the volume can be mounted read-only. + +The return value is an integer which C<0> if the operation +would succeed, or some non-zero value documented in the +L manual page. + +On error this function returns -1. + =head2 guestfs_ping_daemon int guestfs_ping_daemon (guestfs_h *handle); @@ -1208,6 +1346,16 @@ to remove those first. This function returns 0 on success or -1 on error. +=head2 guestfs_pvresize + + int guestfs_pvresize (guestfs_h *handle, + const char *device); + +This resizes (expands or shrinks) an existing LVM physical +volume to match the new size of the underlying device. + +This function returns 0 on success or -1 on error. + =head2 guestfs_pvs char **guestfs_pvs (guestfs_h *handle); @@ -1255,6 +1403,22 @@ This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. +=head2 guestfs_resize2fs + + int guestfs_resize2fs (guestfs_h *handle, + const char *device); + +This resizes an ext2 or ext3 filesystem to match the size of +the underlying device. + +I It is sometimes required that you run C +on the C before calling this command. For unknown reasons +C sometimes gives an error about this and sometimes not. +In any case, it is always safe to call C before +calling this function. + +This function returns 0 on success or -1 on error. + =head2 guestfs_rm int guestfs_rm (guestfs_h *handle, @@ -1440,11 +1604,119 @@ To create a single partition occupying the whole disk, you would pass C as a single element list, when the single element being the string C<,> (comma). +See also: C, C + This function returns 0 on success or -1 on error. B. +=head2 guestfs_sfdisk_N + + int guestfs_sfdisk_N (guestfs_h *handle, + const char *device, + int n, + int cyls, + int heads, + int sectors, + const char *line); + +This runs L option to modify just the single +partition C (note: C counts from 1). + +For other parameters, see C. You should usually +pass C<0> for the cyls/heads/sectors parameters. + +This function returns 0 on success or -1 on error. + +B. + +=head2 guestfs_sfdisk_disk_geometry + + char *guestfs_sfdisk_disk_geometry (guestfs_h *handle, + const char *device); + +This displays the disk geometry of C read from the +partition table. Especially in the case where the underlying +block device has been resized, this can be different from the +kernel's idea of the geometry (see C). + +The result is in human-readable format, and not designed to +be parsed. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_sfdisk_kernel_geometry + + char *guestfs_sfdisk_kernel_geometry (guestfs_h *handle, + const char *device); + +This displays the kernel's idea of the geometry of C. + +The result is in human-readable format, and not designed to +be parsed. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_sfdisk_l + + char *guestfs_sfdisk_l (guestfs_h *handle, + const char *device); + +This displays the partition table on C, in the +human-readable output of the L command. It is +not intended to be parsed. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_sh + + char *guestfs_sh (guestfs_h *handle, + const char *command); + +This call runs a command from the guest filesystem via the +guest's C. + +This is like C, but passes the command to: + + /bin/sh -c "command" + +Depending on the guest's shell, this usually results in +wildcards being expanded, shell expressions being interpolated +and so on. + +All the provisos about C apply to this call. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_sh_lines + + char **guestfs_sh_lines (guestfs_h *handle, + const char *command); + +This is the same as C, but splits the result +into a list of lines. + +See also: C + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + +=head2 guestfs_sleep + + int guestfs_sleep (guestfs_h *handle, + int secs); + +Sleep for C seconds. + +This function returns 0 on success or -1 on error. + =head2 guestfs_stat struct guestfs_stat *guestfs_stat (guestfs_h *handle, @@ -1645,6 +1917,40 @@ See also C. This function returns 0 on success or -1 on error. +=head2 guestfs_vg_activate + + int guestfs_vg_activate (guestfs_h *handle, + int activate, + char * const* const volgroups); + +This command activates or (if C is false) deactivates +all logical volumes in the listed volume groups C. +If activated, then they are made known to the +kernel, ie. they appear as C devices. If deactivated, +then those devices disappear. + +This command is the same as running C + +Note that if C is an empty list then B volume groups +are activated or deactivated. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_vg_activate_all + + int guestfs_vg_activate_all (guestfs_h *handle, + int activate); + +This command activates or (if C is false) deactivates +all logical volumes in all volume groups. +If activated, then they are made known to the +kernel, ie. they appear as C devices. If deactivated, +then those devices disappear. + +This command is the same as running C + +This function returns 0 on success or -1 on error. + =head2 guestfs_vgcreate int guestfs_vgcreate (guestfs_h *handle, @@ -1747,3 +2053,21 @@ any partition tables, filesystem superblocks and so on. This function returns 0 on success or -1 on error. +=head2 guestfs_zerofree + + int guestfs_zerofree (guestfs_h *handle, + const char *device); + +This runs the I program on C. This program +claims to zero unused inodes and disk blocks on an ext2/3 +filesystem, thus making it possible to compress the filesystem +more effectively. + +You should B run this program if the filesystem is +mounted. + +It is possible that using this program can damage the filesystem +or data on the filesystem. + +This function returns 0 on success or -1 on error. +