"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
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
This returns the internal QEMU command line. 'debug' commands are
not part of the formal API and can be removed or changed at any time.");
- ("add_domain", (RInt "nrdisks", [String "dom"], [String "libvirturi"; Bool "readonly"; String "iface"]), -1, [FishAlias "domain"],
+ ("add_domain", (RInt "nrdisks", [String "dom"], [String "libvirturi"; Bool "readonly"; String "iface"; Bool "live"]), -1, [FishAlias "domain"],
[],
"add the disk(s) from a named libvirt domain",
"\
(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 optional C<live> flag controls whether this call will try
+to connect to a running virtual machine C<guestfsd> process if
+it sees a suitable E<lt>channelE<gt> element in the libvirt
+XML definition. The default (if the flag is omitted) is never
+to try. See L<guestfs(3)/ATTACHING TO RUNNING DAEMONS> for more
+information.
The other optional parameters are passed directly through to
C<guestfs_add_drive_opts>.");
(*
This interface is not quite baked yet. -- RWMJ 2010-11-11
- ("add_libvirt_dom", (RInt "nrdisks", [Pointer ("virDomainPtr", "dom")], [Bool "readonly"; String "iface"]), -1, [NotInFish],
+ ("add_libvirt_dom", (RInt "nrdisks", [Pointer ("virDomainPtr", "dom")], [Bool "readonly"; String "iface"; Bool "live"]), -1, [NotInFish],
[],
"add the disk(s) from a libvirt domain",
"\
will fail unless those disks are accessible via the same device path
locally too.
-The optional parameters are passed directly through to
+The optional C<live> flag controls whether this call will try
+to connect to a running virtual machine C<guestfsd> process if
+it sees a suitable E<lt>channelE<gt> element in the libvirt
+XML definition. The default (if the flag is omitted) is never
+to try. See L<guestfs(3)/ATTACHING TO RUNNING DAEMONS> for more
+information.
+
+The other optional parameters are passed directly through to
C<guestfs_add_drive_opts>.");
*)
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. For more information, see
+L<guestfs(3)/ATTACHING TO RUNNING DAEMONS>.
+
+=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
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
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 (
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, [],
See also C<guestfs_is_lv>.");
- ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"]), 278, [],
+ ("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"];
+ ["mkfs_opts"; "ext2"; "/dev/sda1"; "4096"; ""];
["mount_options"; ""; "/dev/sda1"; "/"];
["write"; "/new"; "new file contents"];
["cat"; "/new"]], "new file contents")],
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