Richard W.M. Jones
2018-Jun-21 10:01 UTC
[Libguestfs] [PATCH v3] lib: libvirt: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
https://bugzilla.redhat.com/show_bug.cgi?id=1588451 v2 was here: https://www.redhat.com/archives/libguestfs/2018-June/msg00067.html This is a greatly simplified version, which just changes the libvirt backend to make the path absolute. None of the tests need to be adjusted. Rich.
Richard W.M. Jones
2018-Jun-21 10:01 UTC
[Libguestfs] [PATCH v3] lib: libvirt: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
--- lib/launch-libvirt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c index b279aa6b9..48404ef93 100644 --- a/lib/launch-libvirt.c +++ b/lib/launch-libvirt.c @@ -23,6 +23,7 @@ #include <stdarg.h> #include <stdbool.h> #include <unistd.h> +#include <limits.h> #include <fcntl.h> #include <grp.h> #include <errno.h> @@ -1698,8 +1699,20 @@ construct_libvirt_xml_disk_source_hosts (guestfs_h *g, } case drive_transport_unix: { + /* libvirt requires sockets to be specified as an absolute path + * (RHBZ#1588451). + */ + const char *socket = src->servers[i].u.socket; + CLEANUP_FREE char *abs_socket = realpath (socket, NULL); + + if (abs_socket == NULL) { + perrorf (g, _("realpath: could not convert ā%sā to absolute path"), + socket); + return -1; + } + attribute ("transport", "unix"); - attribute ("socket", src->servers[i].u.socket); + attribute ("socket", abs_socket); break; } } -- 2.16.2
Pino Toscano
2018-Jun-21 10:16 UTC
Re: [Libguestfs] [PATCH v3] lib: libvirt: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
On Thursday, 21 June 2018 12:01:50 CEST Richard W.M. Jones wrote:> --- > lib/launch-libvirt.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-)LGTM. Thanks, -- Pino Toscano
Apparently Analagous Threads
- [PATCH v3] lib: libvirt: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
- lib: Convert all drive socket parameters to an absolute path
- [PATCH v2] lib: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
- [PATCH 0/2] Don't use snapshot=on
- [PATCH 0/2] Use common macros to help with libxml2 writer.