Re: [Libguestfs] [libnbd PATCH 1/2] api: Tighten rules on completion.callback

2023-07-14 Thread Laszlo Ersek
On 7/13/23 21:29, Eric Blake wrote: > The documentation has claimed since commit 6f4dcdab that any > completion callback will be called exactly once; but this is not > consistent with the code: if nbd_aio_* itself returns an error, then > nothing is queued and the user does not need to wait for a

Re: [Libguestfs] [libnbd PATCH 2/2] tests: Add coverage of nbd_aio_opt_* in wrong state

2023-07-14 Thread Laszlo Ersek
On 7/13/23 21:29, Eric Blake wrote: > Enhance the regression tests to prove that the completion callback is > not reached if the aio call itself reports an error; only the .free > callback is guaranteed. > > Also add some asserts to the library code that may aid future readers > in seeing how we

Re: [Libguestfs] [libguestfs PATCH 1/7] lib: fix NETWORK_ADDRESS: make it an actual IP address, not a subnet base

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:46PM +0200, Laszlo Ersek wrote: > Currently we #define NETWORK_ADDRESS as "169.254.0.0". That's a bug in > libguestfs, but it's been invisible -- thus far it's been canceled out by > *independent* bugs in *both* QEMU and libvirt. > > (1) With the direct backend, the

Re: [Libguestfs] [libnbd PATCH 2/2] tests: Add coverage of nbd_aio_opt_* in wrong state

2023-07-14 Thread Richard W.M. Jones
For the series: Acked-by: Richard W.M. Jones This definitely matches my expectations, which were only that .free functions are guaranteed to be called (and the reason why they exist at all). Laszlo has some good suggestions for tightening up the language of patch 1. Rich. -- Richard

Re: [Libguestfs] [libguestfs PATCH 2/7] lib/launch-libvirt: support networking with passt

2023-07-14 Thread Laszlo Ersek
On 7/14/23 11:40, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 07:10:47PM +0200, Laszlo Ersek wrote: >> We generate the element on libvirt 3.8.0+ already. >> >> For selecting passt rather than SLIRP, we only need to insert the child >> element . Make that child element conditional on >>

Re: [Libguestfs] [libguestfs PATCH v2 0/7] lib: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Fri, Jul 14, 2023 at 03:22:06PM +0200, Laszlo Ersek wrote: > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 > v1: https://listman.redhat.com/archives/libguestfs/2023-July/031984.html > > V2 implements small updates; the cumulative v1->v2 diff is just > > > diff --git

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 09:55:00AM -0500, Eric Blake wrote: > On Thu, Jul 13, 2023 at 09:36:58AM -0500, Eric Blake wrote: > > > The user needs a way to know if an error occurred. So the completion > > > callback must be called if the asynchronous function did not fail > > > (returned > > > 0). If

Re: [Libguestfs] [libguestfs PATCH 4/7] docs: clarify sockdir's separation

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:49PM +0200, Laszlo Ersek wrote: > There's another reason for separating sockdir from tmpdir, beyond "shorter > pathnames needed": permissions. For example, passt drops privileges such > that it cannot access "/tmp", and that restricts both the unix domain > socket and

Re: [Libguestfs] [libguestfs PATCH 7/7] lib/launch-direct: support networking with passt

2023-07-14 Thread Laszlo Ersek
On 7/14/23 11:53, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 07:10:52PM +0200, Laszlo Ersek wrote: >> On QEMU 7.2.0+, if "passt" is available, ask QEMU for passt ("stream") >> rather than SLIRP ("user") networking. >> >> For this, we need to run passt ourselves. Given that passt

Re: [Libguestfs] [libnbd PATCH 1/2] api: Tighten rules on completion.callback

2023-07-14 Thread Laszlo Ersek
On 7/14/23 16:13, Eric Blake wrote: > On Fri, Jul 14, 2023 at 09:13:42AM +0200, Laszlo Ersek wrote: >> On 7/13/23 21:29, Eric Blake wrote: >>> The documentation has claimed since commit 6f4dcdab that any >>> completion callback will be called exactly once; but this is not >>> consistent with the

Re: [Libguestfs] [libguestfs PATCH v2 0/7] lib: support networking with passt

2023-07-14 Thread Laszlo Ersek
On 7/14/23 15:32, Richard W.M. Jones wrote: > On Fri, Jul 14, 2023 at 03:22:06PM +0200, Laszlo Ersek wrote: >> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 >> v1: https://listman.redhat.com/archives/libguestfs/2023-July/031984.html >> >> V2 implements small updates; the cumulative

Re: [Libguestfs] [libguestfs PATCH 2/7] lib/launch-libvirt: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:47PM +0200, Laszlo Ersek wrote: > We generate the element on libvirt 3.8.0+ already. > > For selecting passt rather than SLIRP, we only need to insert the child > element . Make that child element conditional on > libvirt 9.0.0+, plus "passt --help" being

Re: [Libguestfs] [libguestfs PATCH 3/7] docs: fix broken link in the guestfs manual

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:48PM +0200, Laszlo Ersek wrote: > Commit 55202a4d49a1 ("New API: get-sockdir", 2016-02-03) added identical > language to "fish/guestfish.pod" and "src/guestfs.pod", including an > internal link L. That's appropriate for > "fish/guestfish.pod", but the same API

Re: [Libguestfs] [libguestfs PATCH 4/7] docs: clarify sockdir's separation

2023-07-14 Thread Laszlo Ersek
On 7/14/23 11:42, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 07:10:49PM +0200, Laszlo Ersek wrote: >> There's another reason for separating sockdir from tmpdir, beyond "shorter >> pathnames needed": permissions. For example, passt drops privileges such >> that it cannot access "/tmp", and

Re: [Libguestfs] [libguestfs PATCH 0/7] lib: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Fri, Jul 14, 2023 at 12:41:52PM +0200, Laszlo Ersek wrote: > On 7/14/23 11:29, Richard W.M. Jones wrote: > > On Thu, Jul 13, 2023 at 07:10:45PM +0200, Laszlo Ersek wrote: > >> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 > >> > >> This series makes both backends prefer passt

Re: [Libguestfs] [libnbd PATCH 1/2] api: Tighten rules on completion.callback

2023-07-14 Thread Eric Blake
On Fri, Jul 14, 2023 at 09:13:42AM +0200, Laszlo Ersek wrote: > On 7/13/23 21:29, Eric Blake wrote: > > The documentation has claimed since commit 6f4dcdab that any > > completion callback will be called exactly once; but this is not > > consistent with the code: if nbd_aio_* itself returns an

Re: [Libguestfs] [libguestfs PATCH 6/7] lib: introduce guestfs_int_make_pid_path()

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:51PM +0200, Laszlo Ersek wrote: > Introduce a small function for creating pathnames for PID files. > > guestfs_int_make_pid_path() is something of an amalgamation of > guestfs_int_make_temp_path() [1] and guestfs_int_create_socketname() [2]: > > - it creates a

Re: [Libguestfs] [libguestfs PATCH 5/7] lib: move guestfs_int_create_socketname() from "launch.c" to "tmpdirs.c"

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:50PM +0200, Laszlo Ersek wrote: > Consider the following inverted call tree (effectively a dependency tree > -- callees are at the top and near the left margin): > > lazy_make_tmpdir() [lib/tmpdirs.c] > guestfs_int_lazy_make_tmpdir()

[Libguestfs] [libguestfs PATCH v2 7/7] lib/launch-direct: support networking with passt

2023-07-14 Thread Laszlo Ersek
On QEMU 7.2.0+, if "passt" is available, ask QEMU for passt ("stream") rather than SLIRP ("user") networking. For this, we need to run passt ourselves. Given that passt daemonizes by default, start it with our traditional function guestfs_int_cmd_run(). Ask passt to save its PID file, because in

[Libguestfs] [libguestfs PATCH v2 2/7] lib/launch-libvirt: support networking with passt

2023-07-14 Thread Laszlo Ersek
We generate the element on libvirt 3.8.0+ already. For selecting passt rather than SLIRP, we only need to insert the child element . Make that child element conditional on libvirt 9.0.0+, plus "passt --help" being executable. For the latter, place the new helper function

[Libguestfs] [libguestfs PATCH v2 4/7] docs: clarify sockdir's separation

2023-07-14 Thread Laszlo Ersek
There's another reason for separating sockdir from tmpdir, beyond "shorter pathnames needed": permissions. For example, passt drops privileges such that it cannot access "/tmp", and that restricts both the unix domain socket and the PID file of passt. Bugzilla:

[Libguestfs] [libguestfs PATCH v2 6/7] lib: introduce guestfs_int_make_pid_path()

2023-07-14 Thread Laszlo Ersek
Introduce a small function for creating pathnames for PID files. guestfs_int_make_pid_path() is something of an amalgamation of guestfs_int_make_temp_path() [1] and guestfs_int_create_socketname() [2]: - it creates a pathname under sockdir, like [2], - it uses the handle's unique counter, like

[Libguestfs] [libguestfs PATCH v2 3/7] docs: fix broken link in the guestfs manual

2023-07-14 Thread Laszlo Ersek
Commit 55202a4d49a1 ("New API: get-sockdir", 2016-02-03) added identical language to "fish/guestfish.pod" and "src/guestfs.pod", including an internal link L. That's appropriate for "fish/guestfish.pod", but the same API description is generated with a different anchor for "src/guestfs.pod". Adapt

[Libguestfs] [libguestfs PATCH v2 0/7] lib: support networking with passt

2023-07-14 Thread Laszlo Ersek
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 v1: https://listman.redhat.com/archives/libguestfs/2023-July/031984.html V2 implements small updates; the cumulative v1->v2 diff is just > diff --git a/lib/launch-direct.c b/lib/launch-direct.c > index 8d6ad025a4e1..cdfd25a9afed

[Libguestfs] [libguestfs PATCH v2 1/7] lib: fix NETWORK_ADDRESS: make it an actual IP address, not a subnet base

2023-07-14 Thread Laszlo Ersek
Currently we #define NETWORK_ADDRESS as "169.254.0.0". That's a bug in libguestfs, but it's been invisible -- thus far it's been canceled out by *independent* bugs in *both* QEMU and libvirt. (1) With the direct backend, the current definition of NETWORK_ADDRESS results in the following QEMU

[Libguestfs] [libguestfs PATCH v2 5/7] lib: move guestfs_int_create_socketname() from "launch.c" to "tmpdirs.c"

2023-07-14 Thread Laszlo Ersek
Consider the following inverted call tree (effectively a dependency tree -- callees are at the top and near the left margin): lazy_make_tmpdir() [lib/tmpdirs.c] guestfs_int_lazy_make_tmpdir()[lib/tmpdirs.c] guestfs_int_make_temp_path()[lib/tmpdirs.c]

Re: [Libguestfs] [libguestfs PATCH 0/7] lib: support networking with passt

2023-07-14 Thread Laszlo Ersek
On 7/14/23 11:29, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 07:10:45PM +0200, Laszlo Ersek wrote: >> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 >> >> This series makes both backends prefer passt over slirp for appliance >> networking, if QEMU or libvirt (respectively)

Re: [Libguestfs] [libguestfs PATCH 0/7] lib: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:45PM +0200, Laszlo Ersek wrote: > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967 > > This series makes both backends prefer passt over slirp for appliance > networking, if QEMU or libvirt (respectively) is recent enough, and > passt is installed. > >

Re: [Libguestfs] [libguestfs PATCH 7/7] lib/launch-direct: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:10:52PM +0200, Laszlo Ersek wrote: > On QEMU 7.2.0+, if "passt" is available, ask QEMU for passt ("stream") > rather than SLIRP ("user") networking. > > For this, we need to run passt ourselves. Given that passt daemonizes by > default, start it with our traditional

Re: [Libguestfs] [libguestfs PATCH 4/7] docs: clarify sockdir's separation

2023-07-14 Thread Richard W.M. Jones
On Fri, Jul 14, 2023 at 12:29:26PM +0200, Laszlo Ersek wrote: > On 7/14/23 11:42, Richard W.M. Jones wrote: > > On Thu, Jul 13, 2023 at 07:10:49PM +0200, Laszlo Ersek wrote: > >> There's another reason for separating sockdir from tmpdir, beyond "shorter > >> pathnames needed": permissions. For

Re: [Libguestfs] [libguestfs PATCH 2/7] lib/launch-libvirt: support networking with passt

2023-07-14 Thread Richard W.M. Jones
On Fri, Jul 14, 2023 at 12:18:21PM +0200, Laszlo Ersek wrote: > On 7/14/23 11:40, Richard W.M. Jones wrote: > > On Thu, Jul 13, 2023 at 07:10:47PM +0200, Laszlo Ersek wrote: > >> We generate the element on libvirt 3.8.0+ already. > >> > >> For selecting passt rather than SLIRP, we only need to