New APIs: set-attach-method, get-attach-method.
[libguestfs.git] / generator / generator_actions.ml
index a405fd4..a2e7467 100644 (file)
@@ -282,8 +282,8 @@ If C<NULL> then no options are added.");
    "set autosync mode",
    "\
 If C<autosync> is true, this enables autosync.  Libguestfs will make a
-best effort attempt to run C<guestfs_umount_all> followed by
-C<guestfs_sync> when the handle is closed
+best effort attempt to make filesystems consistent and synchronized
+when the handle is closed
 (also if the program exits without closing handles).
 
 This is enabled by default (since libguestfs 1.5.24, previously it was
@@ -907,6 +907,10 @@ This returns a hash of where we think the filesystems
 associated with this operating system should be mounted.
 Callers should note that this is at best an educated guess
 made by reading configuration files such as C</etc/fstab>.
+I<In particular note> that this may return filesystems
+which are non-existent or not mountable and callers should
+be prepared to handle or ignore failures if they try to
+mount them.
 
 Each element in the returned hashtable has a key which
 is the path of the mountpoint (eg. C</boot>) and a value
@@ -1095,9 +1099,7 @@ The optional C<libvirturi> parameter sets the libvirt URI
 (see L<http://libvirt.org/uri.html>).  If this is not set then
 we connect to the default libvirt URI (or one set through an
 environment variable, see the libvirt documentation for full
-details).  If you are using the C API directly then it is more
-flexible to create the libvirt connection object yourself, get
-the domain object, and call C<guestfs_add_libvirt_dom>.
+details).
 
 The other optional parameters are passed directly through to
 C<guestfs_add_drive_opts>.");
@@ -1291,6 +1293,111 @@ string C<unknown> is returned.
 
 Please read L<guestfs(3)/INSPECTION> for more details.");
 
+  ("inspect_get_format", (RString "format", [Device "root"], []), -1, [],
+   [],
+   "get format of inspected operating system",
+   "\
+This function should only be called with a root device string
+as returned by C<guestfs_inspect_os>.
+
+This returns the format of the inspected operating system.  You
+can use it to detect install images, live CDs and similar.
+
+Currently defined formats are:
+
+=over 4
+
+=item \"installed\"
+
+This is an installed operating system.
+
+=item \"installer\"
+
+The disk image being inspected is not an installed operating system,
+but a I<bootable> install disk, live CD, or similar.
+
+=item \"unknown\"
+
+The format of this disk image is not known.
+
+=back
+
+Future versions of libguestfs may return other strings here.
+The caller should be prepared to handle any string.
+
+Please read L<guestfs(3)/INSPECTION> for more details.");
+
+  ("inspect_is_live", (RBool "live", [Device "root"], []), -1, [],
+   [],
+   "get live flag for install disk",
+   "\
+This function should only be called with a root device string
+as returned by C<guestfs_inspect_os>.
+
+If C<guestfs_inspect_get_format> returns C<installer> (this
+is an install disk), then this returns true if a live image
+was detected on the disk.
+
+Please read L<guestfs(3)/INSPECTION> for more details.");
+
+  ("inspect_is_netinst", (RBool "netinst", [Device "root"], []), -1, [],
+   [],
+   "get netinst (network installer) flag for install disk",
+   "\
+This function should only be called with a root device string
+as returned by C<guestfs_inspect_os>.
+
+If C<guestfs_inspect_get_format> returns C<installer> (this
+is an install disk), then this returns true if the disk is
+a network installer, ie. not a self-contained install CD but
+one which is likely to require network access to complete
+the install.
+
+Please read L<guestfs(3)/INSPECTION> for more details.");
+
+  ("inspect_is_multipart", (RBool "multipart", [Device "root"], []), -1, [],
+   [],
+   "get multipart flag for install disk",
+   "\
+This function should only be called with a root device string
+as returned by C<guestfs_inspect_os>.
+
+If C<guestfs_inspect_get_format> returns C<installer> (this
+is an install disk), then this returns true if the disk is
+part of a set.
+
+Please read L<guestfs(3)/INSPECTION> for more details.");
+
+  ("set_attach_method", (RErr, [String "attachmethod"], []), -1, [FishAlias "attach-method"],
+   [],
+   "set the attach method",
+   "\
+Set the method that libguestfs uses to connect to the back end
+guestfsd daemon.  Possible methods are:
+
+=over 4
+
+=item C<appliance>
+
+Launch an appliance and connect to it.  This is the ordinary method
+and the default.
+
+=item C<unix:I<path>>
+
+Connect to the Unix domain socket I<path>.
+
+This method lets you connect to an existing daemon or (using
+virtio-serial) to a live guest.
+
+=back");
+
+  ("get_attach_method", (RString "attachmethod", [], []), -1, [],
+   [InitNone, Always, TestOutput (
+      [["get_attach_method"]], "appliance")],
+   "get the attach method",
+   "\
+Return the current attach method.  See C<guestfs_set_attach_method>.");
+
 ]
 
 (* daemon_functions are any functions which cause some action
@@ -3402,7 +3509,7 @@ This command runs the C<df> command to report disk space used.
 
 This command is mostly useful for interactive sessions.  It
 is I<not> intended that you try to parse the output string.
-Use C<statvfs> from programs.");
+Use C<guestfs_statvfs> from programs.");
 
   ("df_h", (RString "output", [], []), 126, [],
    [], (* XXX Tricky to test because it depends on the exact format
@@ -3415,7 +3522,7 @@ in human-readable format.
 
 This command is mostly useful for interactive sessions.  It
 is I<not> intended that you try to parse the output string.
-Use C<statvfs> from programs.");
+Use C<guestfs_statvfs> from programs.");
 
   ("du", (RInt64 "sizekb", [Pathname "path"], []), 127, [],
    [InitISOFS, Always, TestOutputInt (
@@ -3765,7 +3872,7 @@ pathnames, as in the example code above.
 For more details see L<https://bugzilla.redhat.com/show_bug.cgi?id=599503>
 
 Autosync [see C<guestfs_set_autosync>, this is set by default on
-handles] means that C<guestfs_umount_all> is called when the handle
+handles] can cause C<guestfs_umount_all> to be called when the handle
 is closed which can also trigger these issues.");
 
   ("rmmountpoint", (RErr, [String "exemptpath"], []), 149, [],
@@ -4186,7 +4293,7 @@ This gets the SELinux security context of the daemon.
 See the documentation about SELINUX in L<guestfs(3)>,
 and C<guestfs_setcon>");
 
-  ("mkfs_b", (RErr, [String "fstype"; Int "blocksize"; Device "device"], []), 187, [],
+  ("mkfs_b", (RErr, [String "fstype"; Int "blocksize"; Device "device"], []), 187, [DeprecatedBy "mkfs_opts"],
    [InitEmpty, Always, TestOutput (
       [["part_disk"; "/dev/sda"; "mbr"];
        ["mkfs_b"; "ext2"; "4096"; "/dev/sda1"];
@@ -5606,6 +5713,109 @@ not refer to a logical volume.
 
 See also C<guestfs_is_lv>.");
 
+  ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"; String "features"]), 278, [],
+   [InitEmpty, Always, TestOutput (
+      [["part_disk"; "/dev/sda"; "mbr"];
+       ["mkfs_opts"; "ext2"; "/dev/sda1"; "4096"; ""];
+       ["mount_options"; ""; "/dev/sda1"; "/"];
+       ["write"; "/new"; "new file contents"];
+       ["cat"; "/new"]], "new file contents")],
+   "make a filesystem",
+   "\
+This function creates a filesystem on C<device>.  The filesystem
+type is C<fstype>, for example C<ext3>.
+
+The optional arguments are:
+
+=over 4
+
+=item C<blocksize>
+
+The filesystem block size.  Supported block sizes depend on the
+filesystem type, but typically they are C<1024>, C<2048> or C<4096>
+for Linux ext2/3 filesystems.
+
+For VFAT and NTFS the C<blocksize> parameter is treated as
+the requested cluster size.
+
+For UFS block sizes, please see L<mkfs.ufs(8)>.
+
+=item C<features>
+
+This passes the C<-O> parameter to the external mkfs program.
+
+For certain filesystem types, this allows extra filesystem
+features to be selected.  See L<mke2fs(8)> and L<mkfs.ufs(8)>
+for more details.
+
+You cannot use this optional parameter with the C<gfs> or
+C<gfs2> filesystem type.
+
+=back");
+
+  ("getxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 279, [Optional "linuxxattrs"],
+   [],
+   "get a single extended attribute",
+   "\
+Get a single extended attribute from file C<path> named C<name>.
+This call follows symlinks.  If you want to lookup an extended
+attribute for the symlink itself, use C<guestfs_lgetxattr>.
+
+Normally it is better to get all extended attributes from a file
+in one go by calling C<guestfs_getxattrs>.  However some Linux
+filesystem implementations are buggy and do not provide a way to
+list out attributes.  For these filesystems (notably ntfs-3g)
+you have to know the names of the extended attributes you want
+in advance and call this function.
+
+Extended attribute values are blobs of binary data.  If there
+is no extended attribute named C<name>, this returns an error.
+
+See also: C<guestfs_getxattrs>, C<guestfs_lgetxattr>, L<attr(5)>.");
+
+  ("lgetxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 280, [Optional "linuxxattrs"],
+   [],
+   "get a single extended attribute",
+   "\
+Get a single extended attribute from file C<path> named C<name>.
+If C<path> is a symlink, then this call returns an extended
+attribute from the symlink.
+
+Normally it is better to get all extended attributes from a file
+in one go by calling C<guestfs_getxattrs>.  However some Linux
+filesystem implementations are buggy and do not provide a way to
+list out attributes.  For these filesystems (notably ntfs-3g)
+you have to know the names of the extended attributes you want
+in advance and call this function.
+
+Extended attribute values are blobs of binary data.  If there
+is no extended attribute named C<name>, this returns an error.
+
+See also: C<guestfs_lgetxattrs>, C<guestfs_getxattr>, L<attr(5)>.");
+
+  ("resize2fs_M", (RErr, [Device "device"], []), 281, [],
+   [],
+   "resize an ext2, ext3 or ext4 filesystem to the minimum size",
+   "\
+This command is the same as C<guestfs_resize2fs>, but the filesystem
+is resized to its minimum size.  This works like the C<-M> option
+to the C<resize2fs> command.
+
+To get the resulting size of the filesystem you should call
+C<guestfs_tune2fs_l> and read the C<Block size> and C<Block count>
+values.  These two numbers, multiplied together, give the
+resulting size of the minimal filesystem in bytes.");
+
+  ("internal_autosync", (RErr, [], []), 282, [NotInFish; NotInDocs],
+   [],
+   "internal autosync operation",
+   "\
+This command performs the autosync operation just before the
+handle is closed.  You should not call this command directly.
+Instead, use the autosync flag (C<guestfs_set_autosync>) to
+control whether or not this operation is performed when the
+handle is closed.");
+
 ]
 
 let all_functions = non_daemon_functions @ daemon_functions