[Libguestfs] [PATCH nbdkit v2 9/9] curl: Redefine connections= parameter as number of HTTP connections

2023-07-28 Thread Richard W.M. Jones
Previously (nbdkit 1.34) this was the number of easy handles. However it turns out that easy handles can open multiple HTTP connections, and in fact there's no good way to tell how many (and they are not shared). Now that we are using a curl multi, curl >= 7.30 provides a way to limit the total

[Libguestfs] [PATCH nbdkit v2 1/9] curl: Make times seconds field slightly wider

2023-07-28 Thread Richard W.M. Jones
Updates: commit 68dddbeb584fb9385915846d259563f74338ffe8 --- plugins/curl/nbdkit-curl-plugin.pod | 14 +++--- plugins/curl/times.c| 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/curl/nbdkit-curl-plugin.pod

[Libguestfs] [PATCH nbdkit v2 5/9] retry-request: Print operation we are retrying in debug messages

2023-07-28 Thread Richard W.M. Jones
--- filters/retry-request/retry-request.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/filters/retry-request/retry-request.c b/filters/retry-request/retry-request.c index ed566080d..e5b8344cd 100644 --- a/filters/retry-request/retry-request.c +++

[Libguestfs] [PATCH nbdkit v2 0/9] curl: Use curl multi interface

2023-07-28 Thread Richard W.M. Jones
This is a slightly cleaner version of the patch previously posted here: https://listman.redhat.com/archives/libguestfs/2023-July/032167.html Patch #8 is still irreducibly complex, but I can't see an easy way around that. I spent more time refining the commands that get passed to the worker

[Libguestfs] [PATCH nbdkit 1/3] curl: Make times seconds field slightly wider

2023-07-28 Thread Richard W.M. Jones
Updates: commit 68dddbeb584fb9385915846d259563f74338ffe8 --- plugins/curl/nbdkit-curl-plugin.pod | 14 +++--- plugins/curl/times.c| 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/curl/nbdkit-curl-plugin.pod

[Libguestfs] [PATCH nbdkit 0/3] curl: Use curl multi interface

2023-07-28 Thread Richard W.M. Jones
Sorry, patch 2 is a mess (and so am I after spending days researching and implementing the change). There's not an easy way to simplify the change that I can see, but I'll look at it again with fresh eyes later. However can't argue with the performance improvement which is spectacular. Rich.

Re: [Libguestfs] [PATCH nbdkit] curl: Try to share as much as possible between handles in the pool

2023-07-27 Thread Richard W.M. Jones
Actually once I re-read Daniel Stenberg's reply from last time I see that using the share interface is actually pessimal with HTTP/2, /3, see: https://curl.se/mail/lib-2023-02/0077.html https://curl.se/mail/lib-2023-02/0082.html I think I'll have to look at the multi interface instead. Rich.

Re: [Libguestfs] [PATCH nbdkit] curl: Try to share as much as possible between handles in the pool

2023-07-27 Thread Richard W.M. Jones
On Thu, Jul 27, 2023 at 01:59:54PM +0200, Laszlo Ersek wrote: > On 7/27/23 13:46, Richard W.M. Jones wrote: > > Using the libcurl share interface we can share data between the > > separate curl easy handles in the pool. For more about this see: > > > >

[Libguestfs] [PATCH nbdkit] curl: Try to share as much as possible between handles in the pool

2023-07-27 Thread Richard W.M. Jones
Using the libcurl share interface we can share data between the separate curl easy handles in the pool. For more about this see: https://curl.se/libcurl/c/CURLSHOPT_SHARE.html https://gist.github.com/bagder/7eccf74f8b6d70b5abefeb7f288dba9b https://everything.curl.dev/libcurl/sharing ---

Re: [Libguestfs] [libnbd PATCH v3 01/10] rust: create basic Rust bindings

2023-07-27 Thread Richard W.M. Jones
On Wed, Jul 26, 2023 at 09:58:03AM +, Tage Johansson wrote: > I have never used rpm, but if you are using Fedora, the following command > should be enough: > >     dnf install clang-devel We need to work with whatever environment we find ourselves in. We can't just fail because of a missing

Re: [Libguestfs] [libnbd PATCH v3 01/10] rust: create basic Rust bindings

2023-07-26 Thread Richard W.M. Jones
On Wed, Jul 26, 2023 at 08:55:43AM +, Tage Johansson wrote: > On 7/25/2023 9:43 PM, Richard W.M. Jones wrote: > --- stderr > ./../../include/libnbd.h:33:10: fatal error: 'stdbool.h' file not found > thread 'main' panicked at 'Unable to generate bindings: >

Re: [Libguestfs] [libnbd PATCH v3 01/10] rust: create basic Rust bindings

2023-07-25 Thread Richard W.M. Jones
Here's another compilation bug: Compiling libnbd-sys v0.1.0 (/home/rjones/d/libnbd-rust-bindings/rust/libnbd-sys) error: failed to run custom build command for `libnbd-sys v0.1.0 (/home/rjones/d/libnbd-rust-bindings/rust/libnbd-sys)` Caused by: process didn't exit successfully:

Re: [Libguestfs] [libnbd PATCH v3 01/10] rust: create basic Rust bindings

2023-07-25 Thread Richard W.M. Jones
Just a note that this patch (I think?) causes this if you don't have rustfmt installed: /bin/sh: line 1: rustfmt: command not found Fatal error: exception Failure("Rustfmt failed with exit code 127") Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33 Called from

Re: [Libguestfs] [libnbd PATCH 04/10] generator: Add information about the lifetime of closures

2023-07-24 Thread Richard W.M. Jones
On Mon, Jul 24, 2023 at 03:22:56PM -0400, Stefan Hajnoczi wrote: > On Fri, Jul 21, 2023 at 11:37:09AM +0100, Richard W.M. Jones wrote: > > On Fri, Jul 21, 2023 at 10:13:02AM +, Tage Johansson wrote: > > > > > > On 7/19/2023 4:35 PM, Richard W.M. Jones wrote: > &

Re: [Libguestfs] [libnbd PATCH 09/10] rust: async: Create an async friendly handle type

2023-07-21 Thread Richard W.M. Jones
On Fri, Jul 21, 2023 at 10:20:49AM +, Tage Johansson wrote: > > On 7/21/2023 12:05 PM, Richard W.M. Jones wrote: > >On Fri, Jul 21, 2023 at 09:58:52AM +, Tage Johansson wrote: > >>On 7/19/2023 4:47 PM, Richard W.M. Jones wrote: > >> > >> On Wed,

Re: [Libguestfs] [libnbd PATCH 04/10] generator: Add information about the lifetime of closures

2023-07-21 Thread Richard W.M. Jones
On Fri, Jul 21, 2023 at 10:13:02AM +, Tage Johansson wrote: > > On 7/19/2023 4:35 PM, Richard W.M. Jones wrote: > >On Wed, Jul 19, 2023 at 09:09:48AM +, Tage Johansson wrote: > >>Add a new field `cbkind` to the `closure` type in generator/API.ml*. > >>It te

Re: [Libguestfs] [libnbd PATCH 09/10] rust: async: Create an async friendly handle type

2023-07-21 Thread Richard W.M. Jones
On Fri, Jul 21, 2023 at 09:58:52AM +, Tage Johansson wrote: > > On 7/19/2023 4:47 PM, Richard W.M. Jones wrote: > > On Wed, Jul 19, 2023 at 09:09:53AM +, Tage Johansson wrote: > > Create another handle type: `AsyncHandle`, which makes use of Rust's

Re: [Libguestfs] [PATCH guestfs-tools] diff: Don't compare st_dev or st_ino fields

2023-07-20 Thread Richard W.M. Jones
On Thu, Jul 20, 2023 at 05:31:28PM +0200, Laszlo Ersek wrote: > On 7/20/23 16:15, Richard W.M. Jones wrote: > > See comment for details. > > > > Link: https://listman.redhat.com/archives/libguestfs/2023-July/032061.html > > --- > > diff/diff.c | 16 +++

[Libguestfs] [PATCH guestfs-tools] diff: Don't compare st_dev or st_ino fields

2023-07-20 Thread Richard W.M. Jones
See comment for details. Link: https://listman.redhat.com/archives/libguestfs/2023-July/032061.html --- diff/diff.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/diff/diff.c b/diff/diff.c index fb66a2bbd3..b6344b4ec2 100644 --- a/diff/diff.c +++

Re: [Libguestfs] [PATCH libguestfs] daemon: lvm: Do reverse device name translation on pvs_full device fields

2023-07-20 Thread Richard W.M. Jones
Upstream in commit 32cb5b45cf. I tested this using guestfs-tools & virt-v2v and nothing failed. However I was never able to reproduce the original issue. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog:

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

2023-07-20 Thread Richard W.M. Jones
On Thu, Jul 20, 2023 at 11:45:11AM +0100, Richard W.M. Jones wrote: > So I get this error with upstream libguestfs: > > Original error from libvirt: internal error: Child process (/usr/bin/passt > --one-off --socket > /run/user/1000/libvirt/qemu/run/passt/160-guestfs-s42xm02n9

Re: [Libguestfs] [PATCH libguestfs] daemon: lvm: Do reverse device name translation on pvs_full device fields

2023-07-20 Thread Richard W.M. Jones
This is another failure, this time in virt-diff (see attachment for full build log). virt-diff works by opening two handles to different disk images and the comparing the filesystems in each. When we stat files in the two handles: handle 'g1' returns st_dev = 2065 [8:17, /dev/sdb1] handle

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

2023-07-20 Thread Richard W.M. Jones
So I get this error with upstream libguestfs: Original error from libvirt: internal error: Child process (/usr/bin/passt --one-off --socket /run/user/1000/libvirt/qemu/run/passt/160-guestfs-s42xm02n9vqv-net0.socket --mac-addr 52:54:00:3d:ce:ce --pid

[Libguestfs] [PATCH libguestfs] daemon: lvm: Do reverse device name translation on pvs_full device fields

2023-07-20 Thread Richard W.M. Jones
Intermittent test failures in virt-filesystems showed that when using the pvs_full API, the pv_name field in the returned list of structures was not being reverse translated. As a result internal partition names could appear in the output of virt-filesystems. See:

[Libguestfs] Intermittent test failure in guestfs-tools test-virt-filesystems.sh

2023-07-20 Thread Richard W.M. Jones
(See attachment for full log) https://github.com/rwmjones/guestfs-tools/blob/master/cat/test-virt-filesystems.sh This test uses virt-filesystems to list the filesystems in the Fedora phony disk image. In one run of this test it found an "extra" /dev/sdb2 filesystem that obviously doesn't exist.

Re: [Libguestfs] [libnbd PATCH 07/10] rust: Add a couple of integration tests

2023-07-19 Thread Richard W.M. Jones
On Wed, Jul 19, 2023 at 09:09:51AM +, Tage Johansson wrote: > +fn test_connect_command() { > +let nbd = libnbd::Handle::new().unwrap(); > +nbd.connect_command(&[ > +c_str!("nbdkit"), > +c_str!("-s"), > +c_str!("--exit-with-parent"), > +c_str!("-v"), > +

Re: [Libguestfs] [libnbd PATCH 02/10] rust: create basic Rust bindings

2023-07-19 Thread Richard W.M. Jones
On Wed, Jul 19, 2023 at 03:28:59PM +0100, Richard W.M. Jones wrote: > On Wed, Jul 19, 2023 at 09:09:46AM +, Tage Johansson wrote: > > diff --git a/rust/Makefile.am b/rust/Makefile.am > > new file mode 100644 > > index 000..cb8d7c9 > > --- /dev/null > > +++

Re: [Libguestfs] [libnbd PATCH 09/10] rust: async: Create an async friendly handle type

2023-07-19 Thread Richard W.M. Jones
On Wed, Jul 19, 2023 at 09:09:53AM +, Tage Johansson wrote: > Create another handle type: `AsyncHandle`, which makes use of Rust's > builtin asynchronous functions (see > ) and runs on top of > the Tokio runtime (see ).

Re: [Libguestfs] [libnbd PATCH 04/10] generator: Add information about the lifetime of closures

2023-07-19 Thread Richard W.M. Jones
On Wed, Jul 19, 2023 at 09:09:48AM +, Tage Johansson wrote: > Add a new field `cbkind` to the `closure` type in generator/API.ml*. > It tells how many times the closure may be invoked and for how long time > it might be used. More specifically, it can take any of these values: > -

Re: [Libguestfs] [libnbd PATCH 02/10] rust: create basic Rust bindings

2023-07-19 Thread Richard W.M. Jones
On Wed, Jul 19, 2023 at 09:09:46AM +, Tage Johansson wrote: > diff --git a/rust/Makefile.am b/rust/Makefile.am > new file mode 100644 > index 000..cb8d7c9 > --- /dev/null > +++ b/rust/Makefile.am ... > +all-local: $(source_files) > + rm -f libnbd-sys/libnbd_version.t > +

Re: [Libguestfs] [libnbd PATCH 01/10] generator: Add copyright argument to `generate_header`

2023-07-19 Thread Richard W.M. Jones
I pushed patch 1/10, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE)

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

2023-07-18 Thread Richard W.M. Jones
On Mon, Jul 17, 2023 at 09:16:09AM -0500, Eric Blake wrote: > On Sun, Jul 16, 2023 at 04:39:18PM +, Tage Johansson wrote: > > > @@ -194,7 +198,10 @@ calls. The cookie is unique (per libnbd handle) and > > > E 1. > > > > > > You may register a function which is called when the command > >

[Libguestfs] libnbd ocaml test pipeline failure (was: Re: [libnbd PATCH] api: Fix block status assertion under set_strict bypass)

2023-07-17 Thread Richard W.M. Jones
On Sun, Jul 16, 2023 at 04:10:56PM +0100, Richard W.M. Jones wrote: > The pipeline failed after you pushed this: > > https://gitlab.com/nbdkit/libnbd/-/pipelines/932589424 > > but I think it's an unrelated OCaml failure. I'll take a proper look > at it tomorrow. The

Re: [Libguestfs] [libnbd PATCH] api: Fix block status assertion under set_strict bypass

2023-07-16 Thread Richard W.M. Jones
On Sat, Jul 15, 2023 at 08:49:51PM -0500, Eric Blake wrote: > A compliant server should not send NBD_REPLY_TYPE_BLOCK_STATUS unless > we successfully negotiated a meta context. And our default strictness > settings refuse to let us send NBD_CMD_BLOCK_STATUS unless we > negotiated a meta context.

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

2023-07-14 Thread Richard W.M. Jones
cmd_add_string_unquoted (cmd, "passt --help"); > > + if (!g->verbose) > > +guestfs_int_cmd_add_string_unquoted (cmd, " >/dev/null 2>&1"); > > + > >r = guestfs_int_cmd_run (cmd); > >if (r == -1 || !WIFEXITED (r)) > > re

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 ser

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 > >>

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 p

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 Jones

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 6/7] lib: introduce guestfs_int_make_pid_path()

2023-07-14 Thread Richard W.M. Jones
fe_asprintf (g, "%s/%s%d.pid", g->sockdir, name, ++g->unique); > +} > + > /** > * Create the supermin appliance directory under cachedir, if it does > * not exist. Reviewed-by: Richard W.M. Jones -- Richard Jones, Virtualization Group, Red Hat http://peo

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
guestfs_int_lazy_make_sockdir (g) == -1) > +return -1; > + > + r = snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", g->sockdir, filename); > + if (r >= UNIX_PATH_MAX) { > +error (g, _("socket path too long: %s/%s"), g->sockdir, filename); > +ret

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

2023-07-14 Thread Richard W.M. Jones
-If it is set, then is used to store temporary sockets. Otherwise, > -F is used. > +If it is set, then is used to store temporary sockets and PID files. > +Otherwise, F is used. > > See also L, > L<http://www.freedesktop.org/wiki/Specifications/basedir-spec/>. Reviewed-

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

2023-07-14 Thread Richard W.M. Jones
ential runtime files. > If it is set, then is used to store temporary sockets. Otherwise, > F is used. > > -See also L, > +See also L, > L<http://www.freedesktop.org/wiki/Specifications/basedir-spec/>. > > =back Reviewed-by: Richard W.M. Jones -- Richard Jones,

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

2023-07-14 Thread Richard W.M. Jones
n response to "--help", which is arguably wrong, and potentially > + * subject to change, but it doesn't really matter.) > + */ > +bool > +guestfs_int_passt_runnable (guestfs_h *g) > +{ > + CLEANUP_CMD_CLOSE struct command *cmd = NULL; > + int r, ex; > +

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
tex_unlock (pthread_mutex_t **ptr) > /* Network address and network mask (expressed as address prefix) that the > * appliance will see (if networking is enabled). > */ > -#define NETWORK_ADDRESS "169.254.0.0" > +#define NETWORK_ADDRESS "169.254.2.15" > #defin

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] 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] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 07:07:33PM +, Tage Johansson wrote: > Does this mean that the call to `aio_notify_read()` or > `aio_notify_write()` which discovered the error will also return the > error? Yes! > And that the completion callback was called by that call to > `aio_notify_*`, in the

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 05:46:56PM +0100, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 04:18:03PM +, Tage Johansson wrote: > > > > On 7/13/2023 5:37 PM, Richard W.M. Jones wrote: > > >On Thu, Jul 13, 2023 at 03:05:30PM +, Tage Johansson wrote: > > >

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 04:18:03PM +, Tage Johansson wrote: > > On 7/13/2023 5:37 PM, Richard W.M. Jones wrote: > >On Thu, Jul 13, 2023 at 03:05:30PM +, Tage Johansson wrote: > >>On 7/13/2023 4:36 PM, Eric Blake wrote: > >>>On Thu, Jul 13, 2023 at 01:37

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 03:05:30PM +, Tage Johansson wrote: > > On 7/13/2023 4:36 PM, Eric Blake wrote: > >On Thu, Jul 13, 2023 at 01:37:49PM +, Tage Johansson wrote: > >>On 7/13/2023 3:26 PM, Richard W.M. Jones wrote: > >>>On Thu, Jul 13, 2023 at 0

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 08:01:09AM -0500, Eric Blake wrote: > On Thu, Jul 13, 2023 at 07:13:37AM -0500, Eric Blake wrote: > > > > I have replaced a call to `nbd_opt_info()` with a call to > > > > `nbd_aio_opt_info()` and passed in a completion callback which just > > > > calls

Re: [Libguestfs] nbdkit build failure (was: Re: jplesnik's nbdkit-1.35.5-4.fc39 failed to build)

2023-07-13 Thread Richard W.M. Jones
On Tue, Jul 11, 2023 at 09:23:35PM +0100, Richard W.M. Jones wrote: > On Tue, Jul 11, 2023 at 07:31:07PM +0100, Richard W.M. Jones wrote: > > > > https://koji.fedoraproject.org/koji/buildinfo?buildID=2230411 > > > > It's a bit of a coincidence that this fail

Re: [Libguestfs] nbdkit build failure (was: Re: jplesnik's nbdkit-1.35.5-4.fc39 failed to build)

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 10:29:44AM +0100, Richard W.M. Jones wrote: > It's a crash in Perl code, although called from the nbdkit perl plugin > (C bindings). Still debugging this ... > > Core was generated by `/home/rjones/d/nbdkit/server/nbdkit -U > /tmp/nbdkittPN34a/sock -P

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Wed, Jul 12, 2023 at 03:19:59PM +, Tage Johansson wrote: > While writing some tests for the Rust bindings, I discovered a > memory leak with Valgrind due to a completion callback not being > freed. A note about the valgrind tests: They are quite sensitive to versions of software

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 09:53:58AM +, Tage Johansson wrote: > Apologize if resending, but I'm not sure my previous email was > actually delivered. > > > On 7/12/2023 10:33 PM, Eric Blake wrote: > > > >On Wed, Jul 12, 2023 at 03:19:59PM +, Tage Johansson wrote: > >>Hello, > >> > >> >

Re: [Libguestfs] nbdkit build failure (was: Re: jplesnik's nbdkit-1.35.5-4.fc39 failed to build)

2023-07-13 Thread Richard W.M. Jones
On Thu, Jul 13, 2023 at 11:03:35AM +0100, Richard W.M. Jones wrote: > On Thu, Jul 13, 2023 at 10:29:44AM +0100, Richard W.M. Jones wrote: > > It's a crash in Perl code, although called from the nbdkit perl plugin > > (C bindings). Still debugging this ... > > > > C

Re: [Libguestfs] nbdkit build failure (was: Re: jplesnik's nbdkit-1.35.5-4.fc39 failed to build)

2023-07-13 Thread Richard W.M. Jones
It's a crash in Perl code, although called from the nbdkit perl plugin (C bindings). Still debugging this ... Core was generated by `/home/rjones/d/nbdkit/server/nbdkit -U /tmp/nbdkittPN34a/sock -P /tmp/nbdkittPN'. Program terminated with signal SIGSEGV, Segmentation fault. warning: Section

Re: [Libguestfs] [libnbd PATCH] tests: Test free callback in synchronous nbd_opt_* calls

2023-07-13 Thread Richard W.M. Jones
On Wed, Jul 12, 2023 at 04:56:03PM -0500, Eric Blake wrote: > The documentation guarantees that a user's .free callback is reached > exactly once for all synchronous nbd_opt_* functions that take a > callback structure (nbd_opt_list, nbd_opt_list_meta, ...), regardless > of API success or failure,

Re: [Libguestfs] libnbd: When are callbacks freed

2023-07-12 Thread Richard W.M. Jones
On Wed, Jul 12, 2023 at 03:19:59PM +, Tage Johansson wrote: > Hello, > > While writing some tests for the Rust bindings, I discovered a > memory leak with Valgrind due to a completion callback not being > freed. More specificly, the completion callback of `aio_opt_info()` > doesn't seem to be

Re: [Libguestfs] nbdkit build failure (was: Re: jplesnik's nbdkit-1.35.5-4.fc39 failed to build)

2023-07-11 Thread Richard W.M. Jones
On Tue, Jul 11, 2023 at 07:31:07PM +0100, Richard W.M. Jones wrote: > > https://koji.fedoraproject.org/koji/buildinfo?buildID=2230411 > > It's a bit of a coincidence that this failed exactly in the Perl test > & you're upgrading Perl. On the other hand, it really looks like i

Re: [Libguestfs] [libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()

2023-07-11 Thread Richard W.M. Jones
+ max_fd = sysconf (_SC_OPEN_MAX); > + if (max_fd == -1) > +max_fd = 1024; > + if (max_fd > 65536) > +max_fd = 65536;/* bound the amount of work we do here */ > + for (fd = 3; fd < max_fd; ++fd) > +close (fd); > >/* Set the umask f

Re: [Libguestfs] Libnbd asynchronous API with epoll

2023-07-09 Thread Richard W.M. Jones
On Sun, Jul 09, 2023 at 11:01:47AM +0100, Richard W.M. Jones wrote: > (Sorry for the late reply, was a bit involved in a qemu bug last week ...) > > On Fri, Jul 07, 2023 at 08:58:50AM +, Tage Johansson wrote: > > On 7/6/2023 7:06 PM, Nir Soffer wrote: > > > &g

Re: [Libguestfs] Libnbd asynchronous API with epoll

2023-07-09 Thread Richard W.M. Jones
(Sorry for the late reply, was a bit involved in a qemu bug last week ...) On Fri, Jul 07, 2023 at 08:58:50AM +, Tage Johansson wrote: > On 7/6/2023 7:06 PM, Nir Soffer wrote: > > > - After calling for example aio_notify_read(3), can I know that the next > reading from the file

Re: [Libguestfs] [v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard

2023-06-30 Thread Richard W.M. Jones
On Fri, Jun 30, 2023 at 09:32:33AM +0200, Laszlo Ersek wrote: > On 6/29/23 19:16, Richard W.M. Jones wrote: > > On Thu, Jun 29, 2023 at 06:40:27PM +0200, Laszlo Ersek wrote: > > >> Either way, I can restore the parens. Do you want me to submit a v3? > > > > I thi

Re: [Libguestfs] [v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard

2023-06-29 Thread Richard W.M. Jones
On Thu, Jun 29, 2023 at 06:40:27PM +0200, Laszlo Ersek wrote: > On 6/29/23 17:48, Richard W.M. Jones wrote: > > On Thu, Jun 29, 2023 at 05:39:34PM +0200, Laszlo Ersek wrote: > >> On 6/29/23 14:54, Richard W.M. Jones wrote: > >>> On Thu, Jun 29, 2023 at 02:34:

Re: [Libguestfs] [PATCH guestfs-tools] customize: Implement --chown option

2023-06-29 Thread Richard W.M. Jones
On Thu, Jun 29, 2023 at 06:09:07PM +0200, Laszlo Ersek wrote: > On 6/29/23 14:50, Richard W.M. Jones wrote: > > This currently only works with numeric UID.GID. In theory in future > > we could look up IDs from the guest password file (eg. using Augeas) > > and do the ri

Re: [Libguestfs] [v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard

2023-06-29 Thread Richard W.M. Jones
On Thu, Jun 29, 2023 at 05:39:34PM +0200, Laszlo Ersek wrote: > On 6/29/23 14:54, Richard W.M. Jones wrote: > > On Thu, Jun 29, 2023 at 02:34:42PM +0200, Laszlo Ersek wrote: > >> Currently "chown_for_libvirt_rhbz_1045069" is best effort; if it fails, we > &g

Re: [Libguestfs] [PATCH libguestfs] generator: Add --chown option for virt-customize

2023-06-29 Thread Richard W.M. Jones
On Thu, Jun 29, 2023 at 01:49:49PM +0100, Richard W.M. Jones wrote: > Also this updates the common submodule to include the changes. > > Fixes: https://github.com/rwmjones/guestfs-tools/issues/12 > --- > common | 2 +- > generator

Re: [Libguestfs] [v2v PATCH v2 1/3] lib/utils: fix typo

2023-06-29 Thread Richard W.M. Jones
t > +(** If running as root, and if the backend is libvirt, libvirt > will run qemu as a non-root user. This prevents access > to root-owned files and directories. To fix this, provide > a function to chown things we might need to qemu:root so Reviewed-by: Richard W.M

Re: [Libguestfs] [v2v PATCH v2 3/3] docs/virt-v2v: document libvirt system instance startup

2023-06-29 Thread Richard W.M. Jones
ter installation. (This may depend on > +your distribution and vendor presets). > + > +To fix this on systemd-based distributions, do: > + > + systemctl isolate multi-user.target > + > +See also L<https://bugzilla.redhat.com/2182024>. > + > =

Re: [Libguestfs] [v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard

2023-06-29 Thread Richard W.M. Jones
On Thu, Jun 29, 2023 at 02:34:42PM +0200, Laszlo Ersek wrote: > Currently "chown_for_libvirt_rhbz_1045069" is best effort; if it fails, we > suppress the exception (we log it in verbose mode only, even). > > That's not proved helpful: it almost certainly leads to later errors, but > those errors

[Libguestfs] [PATCH guestfs-tools] customize: Implement --chown option

2023-06-29 Thread Richard W.M. Jones
This currently only works with numeric UID.GID. In theory in future we could look up IDs from the guest password file (eg. using Augeas) and do the right thing, but that's a bunch more work. For example: $ ./builder/virt-builder fedora-36 --chown 1.1:/var/tmp [ 1.0] Downloading:

[Libguestfs] [PATCH libguestfs] generator: Add --chown option for virt-customize

2023-06-29 Thread Richard W.M. Jones
Also this updates the common submodule to include the changes. Fixes: https://github.com/rwmjones/guestfs-tools/issues/12 --- common | 2 +- generator/customize.ml | 28 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/common b/common

Re: [Libguestfs] [v2v PATCH] docs/virt-v2v: document libvirt system instance startup

2023-06-28 Thread Richard W.M. Jones
On Wed, Jun 28, 2023 at 01:31:53PM +0200, Laszlo Ersek wrote: > On 6/28/23 12:05, Richard W.M. Jones wrote: > > On Tue, Jun 27, 2023 at 07:14:36PM +0200, Laszlo Ersek wrote: > >> It has frequently tripped us up that on RHEL / Fedora, installing the > >> right set of li

Re: [Libguestfs] [PATCH libguestfs 4/4] ocaml/t/guestfs_065_implicit_close.ml: Skip this test on OCaml 5

2023-06-28 Thread Richard W.M. Jones
On Wed, Jun 28, 2023 at 12:24:17PM +0200, Laszlo Ersek wrote: > On 6/27/23 14:33, Richard W.M. Jones wrote: > > Link: > > https://discuss.ocaml.org/t/ocaml-5-forcing-objects-to-be-collected-and-finalized/12492/2 > > --- > > ocaml/t/guestfs_065_implicit_close.ml | 8 +

Re: [Libguestfs] [v2v PATCH] docs/virt-v2v: document libvirt system instance startup

2023-06-28 Thread Richard W.M. Jones
On Tue, Jun 27, 2023 at 07:14:36PM +0200, Laszlo Ersek wrote: > It has frequently tripped us up that on RHEL / Fedora, installing the > right set of libvirt RPMs (such as the one pulled in by > "libvirt-daemon-kvm") does not result in an immediately running libvirt > system instance. Document the

[Libguestfs] [PATCH libguestfs 3/4] ocaml: Conditionally acquire the lock in callbacks

2023-06-27 Thread Richard W.M. Jones
This fix was originally suggested by Jürgen Hötzel (link below) which I have lightly modified so it works with OCaml <= 4 too. Link: https://listman.redhat.com/archives/libguestfs/2023-May/031640.html Link:

[Libguestfs] [PATCH libguestfs 2/4] ocaml: Release runtime lock around guestfs_close

2023-06-27 Thread Richard W.M. Jones
When finalizing the handle we call guestfs_close. This function could be long-running (eg. it may have to shut down the qemu subprocess), so release the runtime lock. --- ocaml/guestfs-c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index

[Libguestfs] [PATCH libguestfs 0/4] Fix ups for OCaml 5

2023-06-27 Thread Richard W.M. Jones
No action required here as I have pushed this already, this is just for your information. Rich. ___ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs

[Libguestfs] [PATCH libguestfs 4/4] ocaml/t/guestfs_065_implicit_close.ml: Skip this test on OCaml 5

2023-06-27 Thread Richard W.M. Jones
Link: https://discuss.ocaml.org/t/ocaml-5-forcing-objects-to-be-collected-and-finalized/12492/2 --- ocaml/t/guestfs_065_implicit_close.ml | 8 1 file changed, 8 insertions(+) diff --git a/ocaml/t/guestfs_065_implicit_close.ml b/ocaml/t/guestfs_065_implicit_close.ml index

[Libguestfs] [PATCH libguestfs 1/4] ocaml: Replace old enter/leave_blocking_section calls

2023-06-27 Thread Richard W.M. Jones
Since OCaml 4 the old and confusing caml_enter_blocking_section and caml_leave_blocking_section calls have been replaced with caml_release_runtime_system and caml_acquire_runtime_system (in that order). Use the new names. --- generator/OCaml.ml | 5 +++-- ocaml/guestfs-c.c | 5 +++-- 2 files

Re: [Libguestfs] [PATCH v2 3/3] rust: add some (but not yet all) tests

2023-06-26 Thread Richard W.M. Jones
[...] It looks like the test coverage is increasing, so that's good. > +//! This module provides facilities for capturing log output and asserting > that > +//! it does or does not contain certain messages. The primary use of this > module > +//! is to assert that certain libnbd operations are

Re: [Libguestfs] [PATCH v2 2/3] rust: create basic Rust bindings

2023-06-26 Thread Richard W.M. Jones
On Mon, Jun 26, 2023 at 08:02:08AM +, Tage Johansson wrote: > diff --git a/generator/generator.ml b/generator/generator.ml > index c73824e..18856f5 100644 > --- a/generator/generator.ml > +++ b/generator/generator.ml > @@ -61,3 +61,5 @@ let () = >output_to "golang/closures.go"

Re: [Libguestfs] [PATCH v2 1/3] generator: Move [camel_case] function from GoLang.ml to utils.ml as it will be used in Rust.ml as well

2023-06-26 Thread Richard W.M. Jones
Thanks, this one is upstream in commit 557ed93df3. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows

Re: [Libguestfs] nbdkit | Failed pipeline for master | 9d4b87e0

2023-06-26 Thread Richard W.M. Jones
On Thu, Jun 22, 2023 at 11:36:55AM +0100, Richard W.M. Jones wrote: > On Wed, Jun 21, 2023 at 10:07:34PM +, GitLab wrote: > > GitLab > >✖ Pipeline #907639365 has failed! > > > > Project nbdkit / nbdkit > > Branch● ma

Re: [Libguestfs] nbdkit | Failed pipeline for master | 9d4b87e0

2023-06-22 Thread Richard W.M. Jones
Commit Author ● Richard W.M. Jones > > Pipeline #907639365 triggered by ● Richard W.M. Jones >had 9 failed jobs > Failed jobs > ✖ builds x86_64-fedora-rawhide-clang-prebuilt-env > ✖ buildsx86_64-almalinux-8-clang-prebuilt-

[Libguestfs] [PATCH libnbd] ocaml: Release runtime lock around call to nbd_close

2023-06-21 Thread Richard W.M. Jones
OCaml 5 is stricter than earlier versions about correct locking. We must release the OCaml runtime lock when calling nbd_close since it may do some long-running operations and we want to allow concurrent threads to run. However specifically if there are callbacks (eg. a debug callback) then we

[Libguestfs] [PATCH nbdkit 1/6] configure: Recommend using -g with OCAMLOPTFLAGS

2023-06-21 Thread Richard W.M. Jones
--- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c1d83a568..39b58b44e 100644 --- a/configure.ac +++ b/configure.ac @@ -935,8 +935,8 @@ AC_SUBST([PYTHON_LDFLAGS]) dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before

[Libguestfs] [PATCH nbdkit 5/6] ocaml: Always unregister the global root and free the handle

2023-06-21 Thread Richard W.M. Jones
If the OCaml code did not provide a close method, we would never call close_wrapper, and then we ended up leaking the global root and handle. --- plugins/ocaml/plugin.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/ocaml/plugin.c

[Libguestfs] [PATCH nbdkit 6/6] ocaml: Fix thread registration for OCaml 5

2023-06-21 Thread Richard W.M. Jones
OCaml 5 is strict about registering threads before calling OCaml heap functions, and will abort the program with this error if you don't do this correctly: Fatal error: no domain lock held Fix this as explained in the comment. Note (as it's not explained well in the documentation): Threads

[Libguestfs] [PATCH nbdkit 0/6] Various fixed for OCaml 5

2023-06-21 Thread Richard W.M. Jones
(Not for review, I've already pushed this upstream as commits 35db543e3..9d4b87e03) This series fixes nbdkit for OCaml 5 (thanks Jerry James for providing the Fedora packages necessary), and I tested it and it compiles and tests fine at least as far back as OCaml 4.05. It was quite complicated

[Libguestfs] [PATCH nbdkit 3/6] ocaml: Add -I +unix before using unix.cmxa

2023-06-21 Thread Richard W.M. Jones
In OCaml 5.0 you will see this warning: Alert ocaml_deprecated_auto_include: OCaml's lib directory layout changed in 5.0. The unix subdirectory has been automatically added to the search path, but you should add -I +unix to the command-line to silence this alert (e.g. by adding unix to

[Libguestfs] [PATCH nbdkit 4/6] ocaml: Replace caml_leave_blocking_section with caml_acquire_runtime_system

2023-06-21 Thread Richard W.M. Jones
Replace: caml_leave_blocking_section ... caml_enter_blocking_section with the more sensibly named (and equivalent): caml_acquire_runtime_system ... caml_release_runtime_system In addition we must release the runtime system just after caml_startup and only acquire it around

[Libguestfs] [PATCH nbdkit 2/6] tests/test_ocaml_plugin.ml: Print a message when test plugin initializes

2023-06-21 Thread Richard W.M. Jones
It's useful to have a message which is printed as the top level statements in the plugin module are being initialized, for debugging purposes. --- tests/test_ocaml_plugin.ml | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/test_ocaml_plugin.ml b/tests/test_ocaml_plugin.ml index

Re: [Libguestfs] [PATCH] Add partprobe call in the API

2023-06-20 Thread Richard W.M. Jones
On Tue, Jun 20, 2023 at 02:09:36PM +0200, Philippe Midol-Monnet wrote: > Hello > > We are using libguestfs with nested partitions: One partition > encrypted with LUKS include a GPT and several partition. > In order to make the nested partition available to the system after > the cryptsetup-open,

Re: [Libguestfs] [PATCH 2/2] rust: add some (but not yet all) tests

2023-06-20 Thread Richard W.M. Jones
logged. > +pub fn contains(, msg: ) -> bool { > +self.messages.lock().unwrap().contains(msg) > +} > + > +/// Print all logged messages, in no particular order. > +/// > +/// Only for debug purposes. Remember to run cargo test with the `-- > -

Re: [Libguestfs] [PATCH 1/2] rust: create basic Rust bindings

2023-06-20 Thread Richard W.M. Jones
On Tue, Jun 20, 2023 at 09:31:36AM +, Tage Johansson wrote: > @@ -717,6 +744,7 @@ echo > echo "Language bindings:" > echo > feature "Go"test "x$HAVE_GOLANG_TRUE" = "x" > +feature "Rust"test "x$HAVE_RUST_TRUE" = "x" There seems to be a space vs tab

Re: [Libguestfs] [PATCH v3] ldmtool: fix NULL pointer dereference

2023-06-20 Thread Richard W.M. Jones
On Tue, Jun 20, 2023 at 11:15:15AM +0200, Laszlo Ersek wrote: > On 6/20/23 10:08, Richard W.M. Jones wrote: > > On Tue, Jun 20, 2023 at 05:00:24PM +0900, Vincent Mailhol wrote: > >> If /sys/block can not be opened, get_devices() returns NULL. > >> > >>

<    1   2   3   4   5   6   7   8   9   10   >