daemon: New command_out and sh_out APIs

These APIs allow you to capture output from guest commands that
generate more output than the protocol limit allows.

Thanks: Nijin Ashok
Fixes: https://issues.redhat.com/browse/RHEL-80159
This commit is contained in:
Richard W.M. Jones
2025-02-19 11:11:24 +00:00
parent 8d61b04dd6
commit 47ac4871b2
8 changed files with 200 additions and 1 deletions

View File

@@ -2380,6 +2380,19 @@ result into a list of lines.
See also: C<guestfs_sh_lines>" };
{ defaults with
name = "command_out"; added = (1, 55, 6);
style = RErr, [StringList (PlainString, "arguments"); String (FileOut, "output")], [];
progress = true; cancellable = true;
test_excuse = "there is a separate test in the tests directory";
shortdesc = "run a command from the guest filesystem";
longdesc = "\
This is the same as C<guestfs_command>, but streams the output
back, handling the case where the output from the command is
larger than the protocol limit.
See also: C<guestfs_sh_out>" };
{ defaults with
name = "statvfs"; added = (1, 9, 2);
style = RStruct ("statbuf", "statvfs"), [String (Pathname, "path")], [];
@@ -3489,6 +3502,18 @@ into a list of lines.
See also: C<guestfs_command_lines>" };
{ defaults with
name = "sh_out"; added = (1, 55, 6);
style = RErr, [String (PlainString, "command"); String (FileOut, "output")], [];
test_excuse = "there is a separate test in the tests directory";
shortdesc = "run a command via the shell";
longdesc = "\
This is the same as C<guestfs_sh>, but streams the output
back, handling the case where the output from the command is
larger than the protocol limit.
See also: C<guestfs_command_out>" };
{ defaults with
name = "glob_expand"; added = (1, 0, 50);
(* Use Pathname here, and hence ABS_PATH (pattern,...) in

View File

@@ -518,6 +518,8 @@ let proc_nr = [
513, "inspect_get_build_id";
514, "findfs_partuuid";
515, "findfs_partlabel";
516, "command_out";
517, "sh_out";
]
(* End of list. If adding a new entry, add it at the end of the list