search for: libguestfsxxxxxx

Displaying 20 results from an estimated 25 matches for "libguestfsxxxxxx".

2020 Aug 12
2
[PATCH v2] appliance: extract UUID from QCOW2 disk image
..._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"; + + uuid = do_get_root_uuid (g, appliance); + if (uuid) { + return uuid; + } + + if (!mktemp (tmp_file)) { + error (g, "get_root_uuid: mktemp failed"); + return NULL; + } + + ret = run_qemu_img_dd (g, appliance, tmp_file); + if (ret == 0) { + uuid = do_get_root...
2016 Feb 02
0
[PATCH 2/3] lib: extract lazy tmpdir creation helper
...-119,6 +119,22 @@ guestfs_impl_get_cachedir (guestfs_h *g) return safe_strdup (g, str); } +static int +lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest) +{ + if (!*dest) { + CLEANUP_FREE char *tmpdir = getdir (g); + char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir); + if (mkdtemp (tmppath) == NULL) { + perrorf (g, _("%s: cannot create temporary directory"), tmppath); + free (tmpdir); + return -1; + } + *dest = tmppath; + } + return 0; +} + /* The g->tmpdir (per-handle temporary directory) is not created w...
2018 Feb 07
1
[PATCH] tmpdirs: Make the ‘su broken’ error message actionable.
...h *g, char *(*getdir) (guestfs_h *g), char **dest) +lazy_make_tmpdir (guestfs_h *g, + char *(*getdir) (guestfs_h *g), int is_runtime_dir, + char **dest) { if (!*dest) { CLEANUP_FREE char *tmpdir = getdir (g); char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir); if (mkdtemp (tmppath) == NULL) { - int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/"); + int bad_systemd = is_runtime_dir && errno == EACCES && + STRPREFIX (tmpdir, "/run/user/"); if (!bad_...
2016 Feb 02
6
[PATCH 1/3] launch: add internal helper for socket paths creation
Introduce an internal helper to create paths for sockets; will be useful for changing later the logic for placing sockets. --- src/guestfs-internal.h | 1 + src/launch-direct.c | 4 +++- src/launch-libvirt.c | 10 ++++++---- src/launch.c | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index
2017 Dec 18
0
[PATCH] tmpdirs: Blame systemd because su is broken.
...clude <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <libintl.h> @@ -185,7 +186,12 @@ lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest) CLEANUP_FREE char *tmpdir = getdir (g); char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir); if (mkdtemp (tmppath) == NULL) { - perrorf (g, _("%s: cannot create temporary directory"), tmppath); + int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/"); + + if (!bad_systemd) + perrorf (g, _("%s: cannot...
2020 Aug 12
0
[PATCH] appliance: extract UUID from QCOW2 disk image
..._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"; + + if (!mktemp (tmp_file)) { + error (g, "get_root_uuid: mktemp failed"); + return NULL; + } + + ret = run_qemu_img_dd (g, appliance, tmp_file); + if (ret == 0) { + UUID = do_get_root_uuid (g, tmp_file); + if (UUID) { + goto out; + } + } + + /* We get her...
2016 Feb 09
2
[PATCH 1/2] tmpdirs: centralize permissions handling
Move to lazy_make_tmpdir the logic for making world-readable (but only for root) newly-created temporary directories, removing the non-fatal code doing that in guestfs_impl_launch. Followup of commit 772f649e595d202bdb67f05aeb62157c1104be89. --- src/launch.c | 7 ------- src/tmpdirs.c | 30 ++++++++++++------------------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...+ */ > >+static char * > >+get_root_uuid (guestfs_h *g, const char *appliance) > >+{ > >+ char *UUID = NULL; > > Generally, don't use uppercase for local variables, I'd rename it s/UUID/uuid/ > > >+ int ret; > >+ char tmp_file[] = "/tmp/libguestfsXXXXXX"; > >+ > >+ if (!mktemp (tmp_file)) { > >+ error (g, "get_root_uuid: mktemp failed"); > >+ return NULL; > > Hmm, if failed to create temp file, we still can try call do_get_root_uuid on original appliance image. This is related to the only issue...
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...; >>+get_root_uuid (guestfs_h *g, const char *appliance) > >>+{ > >>+  char *UUID = NULL; > > > >Generally, don't use uppercase for local variables, I'd rename it s/UUID/uuid/ > > > >>+  int ret; > >>+  char tmp_file[] = "/tmp/libguestfsXXXXXX"; > >>+ > >>+  if (!mktemp (tmp_file)) { > >>+    error (g, "get_root_uuid: mktemp failed"); > >>+    return NULL; > > > >Hmm, if failed to create temp file, we still can try call do_get_root_uuid on original appliance image. > >...
2011 Mar 25
0
Some notes on using QMP to hot plug disks
...qmp-spec.txt I added '-qmp unix:$tmpdir/qemu.sock,server' to the QEMU command line that we generate. At start up, QEMU blocks until someone connects to the qmp socket. You can connect manually by starting guestfish + launch, then in another terminal doing: rlwrap socat STDIO UNIX:/tmp/libguestfsXXXXXX/qmp.sock I'm using the convention of "->" to mean client to server and "<-" to mean server to client. QMP does not actually print these characters. At start up (just after you connect) QMP sends: <- {"QMP": {"version": {"qemu": {&qu...
2015 Oct 06
3
[PATCH 1/2] tests: Fix test-launch-race.
This test has been broken for a while. It is meant to test that when the appliance cachedir is empty, two simultaneous runs of libguestfs (both rebuilding the full appliance) will not cause conflicts, because (eg) the locking in either supermin or libguestfs is not working. However the test only set $TMPDIR, but the ./run script sets $LIBGUESTFS_CACHEDIR which overrides $TMPDIR, so it was simply
2017 Jul 14
0
[PATCH 12/27] daemon: Reimplement ‘file_architecture’ API in OCaml.
...- CLEANUP_FREE char *tmpdir = guestfs_get_tmpdir (g), *dir = NULL; - CLEANUP_FREE char *initrd = NULL; - CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); - char *ret = NULL; - const char *method; - int64_t size; - int r; - size_t i; - - if (asprintf (&dir, "%s/libguestfsXXXXXX", tmpdir) == -1) { - perrorf (g, "asprintf"); - return NULL; - } - - if (strstr (file, "gzip")) - method = "zcat"; - else if (strstr (file, "bzip2")) - method = "bzcat"; - else - method = "cat"; - - /* Security: Re...
2014 Aug 28
14
[PATCH 00/13] code refactorings for tools
Hi, this series does a couple of code reorganizations/refactoring in code used by tools: the windows path handling code, and the two types of file editing (using editor, and using perl expression). There's still a code duplication between the two variants of file editing, but it is just within a single source, and can be easily solved now (planning as next step). Pino Toscano (13): edit:
2014 Jun 27
3
[PATCH WIP] Can't generate argv variant
Hi everyone, lately I've been getting familiar with library and working on slight re-layering of the library. It's about having locking layer in public API and tracing one layer below that (let's call it __t_ layer. I'm not very good at making up names, so this is temporary:) ). Then making sure that all generated public stuff call __t_ layer and all other internal stuff
2010 Jul 05
5
[PATCH 0/3] RFC: Allow use of external QEMU process with libguestfs
This attempts to implement the idea proposed in https://www.redhat.com/archives/libguestfs/2010-April/msg00087.html The idea is that an externally managed QEMU (manual, or via libvirt) can boot the appliance kernel/initrd. libguestfs can then be just told of the UNIX domain socket associated with the guest daemon. An example based on guestfish. 1. Step one, find the appliance kernel/initrd
2012 Jul 24
11
[PATCH 01/12] configure: Add -nographic command line option to qemu.
Without this option, configure will fail when there is no display. Signed-off-by: Masami HIRATA <msmhrt at gmail.com> --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index de8a064..61d6f69 100644 --- a/configure.ac +++ b/configure.ac @@ -593,16 +593,16 @@ working. AC_MSG_FAILURE([$QEMU version must be >=
2017 Jun 03
12
[PATCH v2 00/12] Allow APIs to be implemented in OCaml.
Version 1 was here: https://www.redhat.com/archives/libguestfs/2017-June/msg00003.html This patch series reimplements a few more APIs in OCaml, including some very important core APIs like ?list_filesystems? and ?mount?. All the tests pass after this. The selection of APIs that I have moved may look a little random, but in fact they are all APIs consumed by the inspection code (and some more
2017 Jun 05
19
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
v2 was here: https://www.redhat.com/archives/libguestfs/2017-June/msg00008.html This series gets as far as a working (and faster) reimplementation of ‘guestfs_list_filesystems’. I also have another patch series on top of this one which reimplements the inspection APIs inside the daemon, but that needs a bit more work still, since inspection turns out to be a very large piece of code. Rich.
2017 Jul 27
23
[PATCH v3 00/23] Reimplement many daemon APIs in OCaml.
I think this fixes everything mentioned: - Added the Optgroups module as suggested. - Remove command temporary files. - Replace command ~flags with ?fold_stdout_on_stderr. - Nest _with_mounted function. - Rebase & retest. Rich.
2017 Jul 21
27
[PATCH v2 00/23] Reimplement many daemon APIs in OCaml.
v1 was posted here: https://www.redhat.com/archives/libguestfs/2017-July/msg00098.html This series now depends on two small patches which I posted separately: https://www.redhat.com/archives/libguestfs/2017-July/msg00207.html https://www.redhat.com/archives/libguestfs/2017-July/msg00209.html v1 -> v2: - Previously changes to generator/daemon.ml were made incrementally through the patch