Displaying 20 results from an estimated 48 matches for "guestfs_int_cmd_run".
2017 Oct 05
0
[PATCH 2/2] lib/inspect-icon.c: Return error if guestfs_int_cmd_run has internal error.
...anged, 1 insertion(+), 1 deletion(-)
diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c
index 533e9fb4b..0edd3d1b0 100644
--- a/lib/inspect-icon.c
+++ b/lib/inspect-icon.c
@@ -400,7 +400,7 @@ icon_cirros (guestfs_h *g, size_t *size_r)
guestfs_int_cmd_add_string_quoted (cmd, pngfile);
r = guestfs_int_cmd_run (cmd);
if (r == -1)
- return NOT_FOUND;
+ return NULL;
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0)
return NOT_FOUND;
--
2.13.2
2016 Mar 22
0
[PATCH v3 07/11] launch: direct: Don't run qemu -version.
...guestfs_int_cmd_add_arg (cmd2, "-display");
guestfs_int_cmd_add_arg (cmd2, "none");
- guestfs_int_cmd_add_arg (cmd2, "-version");
- guestfs_int_cmd_set_stdout_callback (cmd2, read_all, &data->qemu_version,
- CMD_STDOUT_FLAG_WHOLE_BUFFER);
- r = guestfs_int_cmd_run (cmd2);
- if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0)
- goto error;
-
- parse_qemu_version (g, data);
-
- guestfs_int_cmd_add_arg (cmd3, g->hv);
- guestfs_int_cmd_add_arg (cmd3, "-display");
- guestfs_int_cmd_add_arg (cmd3, "none");
- guestfs_int_cmd_add_a...
2015 Sep 29
8
[PATCH 0/7] copy-in/copy-out: Capture errors from tar subprocess (RHBZ#1267032).
Commits 3c27f3d91e1566854747bbe844186783fc84f3a8 and
1b6f0daa9ae7fcc94e389232d0c397816cda973d added an internal API for
running commands asynchronously. It is only used by the copy-in and
copy-out APIs.
Unfortunately this made the command code very complex: it was almost
impossible to redirect stderr to a file, and there were a lot of
long-range dependencies through the file. It was also buggy:
2017 Sep 11
1
[PATCH] lib: command: Print command before running it with guestfs_int_cmd_pipe_run.
Unlike ordinary guestfs_int_cmd_run, the pipe version did not print
the command it was about to run when debugging was enabled.
Fixes commit e98bb8692929a037f3452686719504aea31f311d.
---
lib/command.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/command.c b/lib/command.c
index 970acf6e5..bc469de59 100644
--- a/lib/com...
2017 Sep 12
0
[PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...hv);
- guestfs_int_cmd_add_arg (cmd1, "-display");
- guestfs_int_cmd_add_arg (cmd1, "none");
- guestfs_int_cmd_add_arg (cmd1, "-help");
- guestfs_int_cmd_set_stdout_callback (cmd1, read_all, &data->qemu_help,
- CMD_STDOUT_FLAG_WHOLE_BUFFER);
- r = guestfs_int_cmd_run (cmd1);
- if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0)
- goto error;
+ guestfs_int_cmd_add_arg (cmd, g->hv);
+ guestfs_int_cmd_add_arg (cmd, "-display");
+ guestfs_int_cmd_add_arg (cmd, "none");
+ guestfs_int_cmd_add_arg (cmd, "-help");
+ guestfs_...
2017 Oct 05
4
[PATCH 0/2] lib: Allow db_dump package to be a weak dependency.
Fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=1409024
2018 Aug 22
1
[PATCH] lib: create: avoid one extra string allocation
...t try to interpret such a path.
+ */
+ if (filename[0] == '/')
+ guestfs_int_cmd_add_arg (cmd, filename);
+ else
+ guestfs_int_cmd_add_arg_format (cmd, "./%s", filename);
if (size >= 0)
guestfs_int_cmd_add_arg_format (cmd, "%" PRIi64, size);
r = guestfs_int_cmd_run (cmd);
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
- guestfs_int_external_command_failed (g, r, "qemu-img", orig_filename);
+ guestfs_int_external_command_failed (g, r, "qemu-img", filename);
return -1;
}
--
2.17.1
2015 May 26
0
[PATCH] lib: Limit space and time used by 'qemu-img info' subprocess.
...FLAG_WHOLE_BUFFER);
+ CMD_STDOUT_FLAG_WHOLE_BUFFER);
+#ifdef RLIMIT_AS
+ guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_AS, 1000000000 /* 1GB */);
+#endif
+#ifdef RLIMIT_CPU
+ guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */);
+#endif
r = guestfs_int_cmd_run (cmd);
close (fd);
if (r == -1)
@@ -548,6 +562,12 @@ old_parser_run_qemu_img_info (guestfs_h *g, const char *filename,
guestfs_int_cmd_add_arg (cmd, "info");
guestfs_int_cmd_add_arg (cmd, safe_filename);
guestfs_int_cmd_set_stdout_callback (cmd, fn, data, 0);
+#ifdef RLIMIT...
2023 Jul 11
1
[libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()
...mmand *, int resource, long limit);
extern void guestfs_int_cmd_clear_capture_errors (struct command *);
-extern void guestfs_int_cmd_clear_close_files (struct command *);
extern void guestfs_int_cmd_set_child_callback (struct command *, cmd_child_callback child_callback, void *data);
extern int guestfs_int_cmd_run (struct command *);
extern void guestfs_int_cmd_close (struct command *);
diff --git a/lib/command.c b/lib/command.c
index 515ef624bd96..82a47bafa9e5 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -152,9 +152,6 @@ struct command
/* When using the pipe_* APIs, stderr is pointed to a temporary...
2020 Aug 12
2
[PATCH v2] appliance: extract UUID from QCOW2 disk image
...fs_int_cmd_add_arg (cmd, "dd");
+ guestfs_int_cmd_add_arg_format (cmd, "if=%s", in_file);
+ guestfs_int_cmd_add_arg_format (cmd, "of=%s", out_file);
+ guestfs_int_cmd_add_arg (cmd, "bs=256k");
+ guestfs_int_cmd_add_arg (cmd, "count=1");
+
+ r = guestfs_int_cmd_run (cmd);
+ if (r == -1) {
+ error (g, "Failed to run qemu-img");
+ return -1;
+ }
+ if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
+ guestfs_int_external_command_failed (g, r, "qemu-img dd", NULL);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Get the UUID from the...
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
...CMD_STDOUT_FLAG_WHOLE_BUFFER);
-#ifdef RLIMIT_AS
- guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_AS, 1000000000 /* 1GB */);
-#endif
-#ifdef RLIMIT_CPU
- guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */);
-#endif
+ set_child_rlimits (cmd);
r = guestfs_int_cmd_run (cmd);
close (fd);
if (r == -1)
@@ -560,12 +556,7 @@ old_parser_run_qemu_img_info (guestfs_h *g, const char *filename,
guestfs_int_cmd_add_arg (cmd, "info");
guestfs_int_cmd_add_arg (cmd, safe_filename);
guestfs_int_cmd_set_stdout_callback (cmd, fn, data, 0);
-#ifdef RLIMIT...
2020 Aug 13
2
[PATCH v3] appliance: extract UUID from QCOW2 disk image
...fs_int_cmd_add_arg (cmd, "dd");
+ guestfs_int_cmd_add_arg_format (cmd, "if=%s", in_file);
+ guestfs_int_cmd_add_arg_format (cmd, "of=%s", out_file);
+ guestfs_int_cmd_add_arg (cmd, "bs=256k");
+ guestfs_int_cmd_add_arg (cmd, "count=1");
+
+ r = guestfs_int_cmd_run (cmd);
+ if (r == -1) {
+ error (g, "Failed to run qemu-img");
+ return -1;
+ }
+ if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
+ guestfs_int_external_command_failed (g, r, "qemu-img dd", NULL);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Get the UUID from the...
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...+
+ CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g);
+ int r;
+
+ guestfs_int_cmd_add_string_unquoted (cmd,
+ "qemu-img info --help | "
+ "grep -sq -- 'info.*-U'");
+ r = guestfs_int_cmd_run (cmd);
+ if (r == -1)
+ return -1;
+ if (!WIFEXITED (r)) {
+ guestfs_int_external_command_failed (g, r,
+ "qemu-img info -U option test",
+ NULL);
+ return -1;
+ }
+
+ g->qemu_img_supports_U_op...
2017 Sep 11
4
[PATCH 0/4] lib: qemu: Add test for mandatory locking.
The patch I posted last week to disable mandatory locking for readonly
drives
(https://www.redhat.com/archives/libguestfs/2017-September/msg00013.html)
was wrong in a couple of respects. Firstly it didn't work, which I
didn't detect because my tests were testing the wrong thing. Oops.
Secondly it used a simple version number check to detect qemu binaries
implementing mandatory locking.
2017 Dec 15
0
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...e {
+ rel_filename = safe_asprintf (g, "./%s", filename);
+ guestfs_int_cmd_add_arg (cmd, rel_filename);
+ }
guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree,
CMD_STDOUT_FLAG_WHOLE_BUFFER);
set_child_rlimits (cmd);
r = guestfs_int_cmd_run (cmd);
- close (fd);
if (r == -1)
return NULL;
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
--
2.15.1
2018 Oct 02
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...command *cmd = guestfs_int_new_command (g);
> + int r;
> +
> + guestfs_int_cmd_add_string_unquoted (cmd,
> + "qemu-img info --help | "
> + "grep -sq -- 'info.*-U'");
> + r = guestfs_int_cmd_run (cmd);
> + if (r == -1)
> + return -1;
> + if (!WIFEXITED (r)) {
> + guestfs_int_external_command_failed (g, r,
> + "qemu-img info -U option test",
> + NULL);
> + return -1;
>...
2020 Aug 12
0
[PATCH] appliance: extract UUID from QCOW2 disk image
...fs_int_cmd_add_arg (cmd, "dd");
+ guestfs_int_cmd_add_arg_format (cmd, "if=%s", in_file);
+ guestfs_int_cmd_add_arg_format (cmd, "of=%s", out_file);
+ guestfs_int_cmd_add_arg (cmd, "bs=256k");
+ guestfs_int_cmd_add_arg (cmd, "count=1");
+
+ r = guestfs_int_cmd_run (cmd);
+ if (r == -1) {
+ error (g, "Failed to run qemu-img");
+ return -1;
+ }
+ if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
+ guestfs_int_external_command_failed (g, r, "qemu-img dd", NULL);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Get the UUID from the...
2017 Dec 15
2
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename
v1 posted here:
https://www.redhat.com/archives/libguestfs/2017-December/msg00050.html
v2 fixes the tests by rewriting relative paths as ./filename
(so that filenames like "file:foo" work).
2020 Aug 13
0
Re: [PATCH v3] appliance: extract UUID from QCOW2 disk image
...;dd");
> + guestfs_int_cmd_add_arg_format (cmd, "if=%s", in_file);
> + guestfs_int_cmd_add_arg_format (cmd, "of=%s", out_file);
> + guestfs_int_cmd_add_arg (cmd, "bs=256k");
> + guestfs_int_cmd_add_arg (cmd, "count=1");
> +
> + r = guestfs_int_cmd_run (cmd);
> + if (r == -1) {
> + error (g, "Failed to run qemu-img");
> + return -1;
> + }
> + if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
> + guestfs_int_external_command_failed (g, r, "qemu-img dd", NULL);
> + return -1;
> + }
> +
>...
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...guestfs_int_cmd_add_arg_format (cmd, "if=%s", in_file);
> >+ guestfs_int_cmd_add_arg_format (cmd, "of=%s", out_file);
> >+ guestfs_int_cmd_add_arg (cmd, "bs=256k");
> >+ guestfs_int_cmd_add_arg (cmd, "count=1");
> >+
> >+ r = guestfs_int_cmd_run (cmd);
> >+ if (r == -1) {
> >+ error (g, "Failed to run qemu-img");
> >+ return -1;
> >+ }
> >+ if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
> >+ guestfs_int_external_command_failed (g, r, "qemu-img dd", NULL);
> >+ retu...