[Libguestfs] [PATCH libnbd] docs: Document limits on export name.

2019-09-17 Thread Richard W.M. Jones
This commit documents the limits on export name, encoding, etc. --- generator/generator | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/generator/generator b/generator/generator index a72f36c..87a8cdf 100755 --- a/generator/generator +++ b/generator/generator @@

Re: [Libguestfs] [PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 11:01:49AM -0500, Eric Blake wrote: > On 9/15/19 9:55 AM, Richard W.M. Jones wrote: > > +Another use for the reflection plugin is to send back the client's IP > > +address: > > + > > + $ nbdkit reflection mode=address > > + $ nbdsh -u 'nbd://localhost' -c

Re: [Libguestfs] [libnbd PATCH] states: Avoid magic number for h->tls

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 02:29:38PM -0500, Eric Blake wrote: > When we moved to an enum instead of raw int for nbd_set_tls(), we > should have also updated our code to prefer the enum values. While at > it, improve the grammar of error messages (confusing since 632196ec, > and copy-and-pasted into

Re: [Libguestfs] [libnbd PATCH] api: Add set_handshake_flags for integration

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 02:35:33PM -0500, Eric Blake wrote: > Similar to the recent --mask-handshake command line added to nbdkit to > test client fallbacks to crippled servers, it can be worth testing > server fallbacks to crippled clients. And just as we have exposed > whether the client will

Re: [Libguestfs] [PATCH 1/8] v2v: -o rhv-upload: split vmcheck out of precheck

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:44PM +0200, Pino Toscano wrote: > Split the VM existance check out of the precheck script to a new vmcheck > script, and invoke that in #prepare_targets. Invoke the precheck script > in #precheck, as now it can be run with only values of command line > options. > >

Re: [Libguestfs] [PATCH 3/8] v2v: -o rhv-upload: improve lookup of specified resources (RHBZ#1612653)

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:46PM +0200, Pino Toscano wrote: > -(* We don't have the storage domain UUID, but instead we write > - * in a magic value which the Python code (which can get it) > - * will substitute. > - *) > -let sd_uuid = "@SD_UUID@" in > +(* The storage

Re: [Libguestfs] [PATCH nbdkit 1/4] Add reflection plugin.

2019-09-17 Thread Eric Blake
On 9/17/19 2:42 AM, Richard W.M. Jones wrote: > On Mon, Sep 16, 2019 at 10:33:18AM -0500, Eric Blake wrote: >> Is it worth noting that the NBD protocol imposes a 4k limit on the >> export name, which would limit things to about a 3k disk image when >> using base64? (It looks like nbdkit does not

[Libguestfs] [PATCH libnbd 2/2] api: New API for reading NBD protocol.

2019-09-17 Thread Richard W.M. Jones
This commit adds a new API which can be used from the connected to state to read back which NBD protocol (eg. oldstyle, newstyle-fixed) we are using. It was helpful to add a new state in newstyle negotiation (%NEWSTYLE.FINISHED) so we can route all successful option negotiations through a single

[Libguestfs] [PATCH libnbd 1/2] api: Add new API to read whether TLS was negotiated.

2019-09-17 Thread Richard W.M. Jones
When LIBNBD_TLS_ALLOW is used we don't have a way to find out if TLS was really negotiated. This adds a flag and a way to read it back. Unfortunately there is no test yet, because LIBNBD_TLS_ALLOW is not tested -- it really should be but requires quite a complicated set of tests because ideally

Re: [Libguestfs] [PATCH 4/8] v2v: -o rhv-upload: tell whether a SD actually exists

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:47PM +0200, Pino Toscano wrote: > If there is no DC with the specified storage domain attached to it, it > can mean that the SD does not exist. > --- > v2v/rhv-upload-precheck.py | 9 + > 1 file changed, 9 insertions(+) > > diff --git

Re: [Libguestfs] [PATCH libnbd] docs: Document limits on export name.

2019-09-17 Thread Eric Blake
On 9/17/19 3:32 AM, Richard W.M. Jones wrote: > This commit documents the limits on export name, encoding, etc. > --- > generator/generator | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > ACK. > diff --git a/generator/generator b/generator/generator > index

Re: [Libguestfs] [PATCH 5/8] v2v: add output#disk_copied hook

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:48PM +0200, Pino Toscano wrote: > Add a simple method in the Output class to do work right after a disk > was successfully copied. > --- > v2v/types.ml | 1 + > v2v/types.mli | 4 > v2v/v2v.ml| 9 - > 3 files changed, 13 insertions(+), 1 deletion(-)

Re: [Libguestfs] [PATCH 7/8] v2v: -o rhv-upload: remove uploaded disks on failure

2019-09-17 Thread Richard W.M. Jones
I think we should do this slightly differently for consistency with other classes. See here for example: https://github.com/libguestfs/libguestfs/blob/dea9636c596acd030c9955057863cf080bdd89fb/v2v/output_openstack.ml#L395-L398 (1) Declare a val mutable in the object: val mutable

Re: [Libguestfs] [PATCH 8/8] v2v: -o rhv-upload: cancel disk transfer on failure

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:51PM +0200, Pino Toscano wrote: > Make sure to cancel the trasfer in RHV in case of failure during the > copying of a disk: this way, the disk can be actually removed by RHV > itself. > --- > v2v/rhv-upload-plugin.py | 2 ++ > 1 file changed, 2 insertions(+) > >

Re: [Libguestfs] [PATCH 7/8] v2v: -o rhv-upload: remove uploaded disks on failure

2019-09-17 Thread Richard W.M. Jones
On Tue, Sep 17, 2019 at 11:43:33AM +0100, Richard W.M. Jones wrote: > > +(* The virtual machine was created successfully, so there are no disks > > + * to remove manually. > > + *) > > +disks_uuids <- [] > > (3) Remove this hunk. Sorry, don't remove it, change it to

Re: [Libguestfs] [PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.

2019-09-17 Thread Eric Blake
On 9/17/19 3:14 AM, Richard W.M. Jones wrote: > On Mon, Sep 16, 2019 at 11:01:49AM -0500, Eric Blake wrote: >> On 9/15/19 9:55 AM, Richard W.M. Jones wrote: >>> +Another use for the reflection plugin is to send back the client's IP >>> +address: >>> + >>> + $ nbdkit reflection mode=address >>> + $

Re: [Libguestfs] [PATCH 6/8] v2v: -o rhv-upload: collect disks UUIDs right after copy

2019-09-17 Thread Richard W.M. Jones
On Mon, Sep 16, 2019 at 07:13:49PM +0200, Pino Toscano wrote: > Instead of waiting for the completion of the nbdkit transfers to get the > UUIDs of the disks, use the new #disk_copied hook to do that after each > disk is copied. > > This has almost no behaviour on rhv-upload, except for the

Re: [Libguestfs] [PATCH libnbd 1/2] api: Add new API to read whether TLS was negotiated.

2019-09-17 Thread Eric Blake
On 9/17/19 5:02 AM, Richard W.M. Jones wrote: > When LIBNBD_TLS_ALLOW is used we don't have a way to find out if TLS > was really negotiated. This adds a flag and a way to read it back. > > Unfortunately there is no test yet, because LIBNBD_TLS_ALLOW is not > tested -- it really should be but

Re: [Libguestfs] [PATCH nbdkit 1/4] Add reflection plugin.

2019-09-17 Thread Richard W.M. Jones
On Tue, Sep 17, 2019 at 05:51:15AM -0500, Eric Blake wrote: > >>> +#define reflection_config_help \ > >>> + "mode=MODEPlugin mode." > >>> + > >> > >> Worth listing the valid values of MODE, or the fact that this parameter > >> is optional because it defaults to exportname? > > > > OK. > > I

Re: [Libguestfs] [PATCH libnbd 2/2] api: New API for reading NBD protocol.

2019-09-17 Thread Eric Blake
On 9/17/19 5:02 AM, Richard W.M. Jones wrote: > This commit adds a new API which can be used from the connected to > state to read back which NBD protocol (eg. oldstyle, newstyle-fixed) > we are using. Somewhat of an overlap with my get_handshake_flags (as newstyle-fixed corresponds to whether

Re: [Libguestfs] [PATCH libnbd] docs: Document limits on export name.

2019-09-17 Thread Eric Blake
On 9/17/19 6:38 AM, Eric Blake wrote: >> +++ b/generator/generator >> @@ -1066,10 +1066,16 @@ C<\"nbd2\">, etc."; >> longdesc = "\ >> For servers which require an export name or can serve different >> content on different exports, set the C to >> -connect to. This is only relevant for the

[Libguestfs] [libnbd PATCH] api: Add nbd_get_structured_replies_negotiated

2019-09-17 Thread Eric Blake
Similar to nbd_get_tls_negotiated, for observing what we actually settled on with the server, rather than what was requested. --- generator/generator | 30 +- lib/handle.c | 6 ++ tests/meta-base-allocation.c | 15 +++

Re: [Libguestfs] [PATCH libnbd 2/2] api: New API for reading NBD protocol.

2019-09-17 Thread Richard W.M. Jones
Thanks - I pushed the series now. I will be doing a release of 1.0 and 1.1 today to include the security fix that you found. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com

Re: [Libguestfs] [libnbd PATCH] api: Add nbd_get_structured_replies_negotiated

2019-09-17 Thread Richard W.M. Jones
ACK (Was pushed already after discussion on IRC) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring

[Libguestfs] [PATCH libnbd 4/5] interop: Add -DTLS_MODE to the test.

2019-09-17 Thread Richard W.M. Jones
This neutral refactoring adds -DTLS_MODE. We can in future change the requested TLS mode, but not in this commit. It also checks that nbd_get_tls_negotiated returns true after connecting, when the requested mode was set to LIBNBD_TLS_REQUIRE. --- interop/Makefile.am | 4 interop/interop.c

[Libguestfs] [PATCH libnbd 5/5] interop: Add tests of nbdkit + LIBNBD_TLS_ALLOW.

2019-09-17 Thread Richard W.M. Jones
Test both the TLS enabled and fallback paths. nbd-server doesn't appear to support TLS at all, and qemu-nbd is known not to allow fallback to unencrypted, and therefore it only makes sense to test nbdkit at the moment. --- .gitignore | 4 TODO| 3 ---

[Libguestfs] [PATCH libnbd 0/5] interop: Check that LIBNBD_TLS_ALLOW works against nbdkit.

2019-09-17 Thread Richard W.M. Jones
I was a little surprised to find that LIBNBD_TLS_ALLOW worked out of the box, so I had to examine the logs whereupon I saw the magic message ... libnbd: debug: nbd1: nbd_connect_command: server refused TLS (policy), continuing with unencrypted connection I don't believe this path has ever

[Libguestfs] [PATCH libnbd 1/5] interop: Don't build various check_PROGRAMS unless we run those tests.

2019-09-17 Thread Richard W.M. Jones
Simple refactoring with no effect. --- interop/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interop/Makefile.am b/interop/Makefile.am index 1d2d187..7bb44d9 100644 --- a/interop/Makefile.am +++ b/interop/Makefile.am @@ -47,8 +47,6 @@ if HAVE_QEMU_NBD

[Libguestfs] [PATCH libnbd 2/5] interop: Allow -DEXPORT_NAME to be defined optionally.

2019-09-17 Thread Richard W.M. Jones
Neutral refactoring. --- interop/interop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interop/interop.c b/interop/interop.c index a3ab39b..0b7b1a5 100644 --- a/interop/interop.c +++ b/interop/interop.c @@ -66,10 +66,12 @@ main (int argc, char *argv[]) goto out; } +#ifdef