search for: guestfs_int_external_command_fail

Displaying 20 results from an estimated 45 matches for "guestfs_int_external_command_fail".

2018 Aug 22
1
[PATCH] lib: create: avoid one extra string allocation
...estfs_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
2017 Sep 12
0
[PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...rg (cmd, "-help"); + guestfs_int_cmd_set_stdout_callback (cmd, read_all, &data->qemu_help, + CMD_STDOUT_FLAG_WHOLE_BUFFER); + r = guestfs_int_cmd_run (cmd); + if (r == -1) + return -1; + if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { + guestfs_int_external_command_failed (g, r, g->hv, NULL); + return -1; + } + return 0; +} + +static int +read_cache_qemu_help (guestfs_h *g, struct qemu_data *data, + const char *filename) +{ + return generic_read_cache (g, filename, &data->qemu_help); +} + +static int +write_cache_qemu_help (gue...
2020 Aug 12
2
[PATCH v2] appliance: extract UUID from QCOW2 disk image
...t_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 appliance disk image. + */ +static char * +get_root_uuid (guestfs_h *g, const char *appliance) +{ + char *uuid = NULL; + int ret; + char tmp_file[] = "/tmp/libguestfsXXXXXX"...
2017 Oct 06
2
[PATCH] lib: Pick up qemu-img path at build time.
...eate"); guestfs_int_cmd_add_arg (cmd, "-f"); guestfs_int_cmd_add_arg (cmd, "qcow2"); @@ -347,7 +347,7 @@ disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t 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, orig_filename); return -1; } diff --git a/lib/info.c b/lib/info.c index f7378adfd..4464df994 100644 --- a/lib/info.c +++ b/lib/info.c @@ -191,7 +191,7 @@ get_json_output (guestfs_h *g,...
2020 Aug 13
2
[PATCH v3] appliance: extract UUID from QCOW2 disk image
...t_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 appliance disk image. + */ +static char * +get_root_uuid (guestfs_h *g, const char *appliance) +{ + char *uuid = NULL; + int ret; + CLEANUP_UNLINK_FREE char *tmpfile = NULL; + + uuid...
2016 Apr 14
0
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
...id > 0) { - if (waitpid (data->pid, &status, 0) == -1) { - perrorf (g, "waitpid (qemu)"); + if (guestfs_int_waitpid (g, data->pid, &status, "qemu") == -1) ret = -1; - } else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { guestfs_int_external_command_failed (g, status, g->hv, NULL); ret = -1; } } - if (data->recoverypid > 0) waitpid (data->recoverypid, NULL, 0); + if (data->recoverypid > 0) guestfs_int_waitpid_noerror (data->recoverypid); data->pid = data->recoverypid = 0; diff --git a/src/launch-um...
2016 Apr 14
2
[PATCH v3 libguestfs] launch: Implement a safer getumask.
...quot;read"); + close (fd[0]); + return -1; + } + close (fd[0]); + + again: + if (waitpid (pid, &status, 0) == -1) { + if (errno == EINTR) goto again; + perrorf (g, "waitpid"); + return -1; + } + else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { + guestfs_int_external_command_failed (g, status, "umask", NULL); + return -1; + } + + return mask; +} -- 2.7.4
2016 Apr 14
2
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
As Eric Blake noted in: https://www.redhat.com/archives/libguestfs/2016-April/msg00154.html libguestfs doesn't correctly handle the case where waitpid receives a SIGCHLD signal and the main program has registered a non-restartable signal handler. In this case waitpid would return -EINTR and we would print an error, but actually we should retry this case. This adds two new internal functions,
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...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_option = WEXITSTATUS (r) == 0; + return g->qemu_img_supports_U_option; +} -- 2.19.0.rc0
2016 Apr 13
3
[PATCH libguestfs] launch: Implement a safer getumask.
...eof mask) != sizeof mask) { + perrorf (g, "read"); + close (fd[0]); + return -1; + } + close (fd[0]); + + if (waitpid (pid, &status, 0) == -1) { + perrorf (g, "waitpid"); + return -1; + } + else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { + guestfs_int_external_command_failed (g, status, "umask", NULL); + return -1; + } + + return mask; +} -- 2.7.4
2016 Apr 14
0
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
...gt; + } > + close (fd[0]); > + > + again: > + if (waitpid (pid, &status, 0) == -1) { > + if (errno == EINTR) goto again; > + perrorf (g, "waitpid"); > + return -1; > + } > + else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { > + guestfs_int_external_command_failed (g, status, "umask", NULL); > + return -1; > + } Getting closer. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
2016 Apr 13
0
Re: [PATCH libguestfs] launch: Implement a safer getumask.
...e (fd[0]); > + > + if (waitpid (pid, &status, 0) == -1) { > + perrorf (g, "waitpid"); > + return -1; > + } Doesn't this need to loop on EINTR, rather than immediately giving up? > + else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { > + guestfs_int_external_command_failed (g, status, "umask", NULL); > + return -1; > + } > + > + return mask; > +} > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
2018 Oct 02
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...d (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_option = WEXITSTATUS (r) == 0; > + return g->qemu_img_supports_U_opt...
2020 Aug 12
0
[PATCH] appliance: extract UUID from QCOW2 disk image
...t_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 appliance disk image. + */ +static char * +get_root_uuid (guestfs_h *g, const char *appliance) +{ + char *UUID = NULL; + int ret; + char tmp_file[] = "/tmp/libguestfsXXXXXX"...
2020 Aug 13
0
Re: [PATCH v3] appliance: extract UUID from QCOW2 disk image
...ot;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 appliance disk image. > + */ > +static char * > +get_root_uuid (guestfs_h *g, const char *appliance) > +{ > + char *uuid = NULL; &...
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...fs_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 appliance disk image. > >+ */ > >+static char * > >+get_root_uuid (guestfs_h *g, const char *app...
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...ount=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 appliance disk image. > >>+ */ > >>+static char * > >>+...
2018 Nov 02
0
[PATCH v2 REPOST] lib: Allow db_dump package to be a weak dependency (RHBZ#1409024).
...D (r) && WEXITSTATUS (r) == 127) { + /* Allow the command to be missing at runtime so that packagers can + * use weak dependencies. In this case it's not an error, we + * return an empty list. + */ + return 0; + } if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { guestfs_int_external_command_failed (g, r, DB_DUMP, NULL); return -1; @@ -225,5 +230,3 @@ convert_hex_to_binary (guestfs_h *g, const char *hex, size_t hexlen, *binlen_rtn = binlen; return bin; } - -#endif /* defined(DB_DUMP) */ diff --git a/lib/inspect-apps.c b/lib/inspect-apps.c index f0cf16b38..57428a3ba 100644 --- a/...
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.
2016 May 12
0
[PATCH 4/4] lib: qemu: Memoize qemu feature detection.
...stfs_int_cmd_add_arg (cmd1, "-display"); @@ -107,16 +247,14 @@ guestfs_int_test_qemu (guestfs_h *g) if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) goto error; - return data; + return 0; error: - free (data); - if (r == -1) - return NULL; + return -1; guestfs_int_external_command_failed (g, r, g->hv, NULL); - return NULL; + return -1; } /* Parse the first line of data->qemu_help (if not NULL) into the -- 2.7.4