[Libguestfs] [nbdkit PATCH] vddk: advise user on obscure thumbprint mismatch error condition

Richard W.M. Jones rjones at redhat.com
Tue May 17 08:09:24 UTC 2022


On Tue, May 17, 2022 at 10:02:28AM +0200, Laszlo Ersek wrote:
> If the thumbprint parameter is wrong, it's only reported in
> VixDiskLib_Open(), and then with the non-descript VIX_E_FAIL error code.
> If the user typed or cut-and-pasted the thumbprint incorrectly, said
> "Unkown error" message is not helpful for fixing the nbkit command line.

^^ Typo: Unknown

> Hint at the thumbprint as the potential culprit.
> 
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1905772
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> ---
>  plugins/vddk/vddk-structs.h |  1 +
>  plugins/vddk/vddk.c         | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/plugins/vddk/vddk-structs.h b/plugins/vddk/vddk-structs.h
> index 799c4aecc5b8..4c7c6fe2e4fc 100644
> --- a/plugins/vddk/vddk-structs.h
> +++ b/plugins/vddk/vddk-structs.h
> @@ -43,6 +43,7 @@
>  
>  typedef uint64_t VixError;
>  #define VIX_OK 0
> +#define VIX_E_FAIL 1
>  #define VIX_E_NOT_SUPPORTED 6
>  #define VIX_ASYNC 25000
>  
> diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
> index 2ea071d641e6..dbd3fdbe09af 100644
> --- a/plugins/vddk/vddk.c
> +++ b/plugins/vddk/vddk.c
> @@ -769,6 +769,26 @@ vddk_open (int readonly)
>    VDDK_CALL_END (VixDiskLib_Open, 0);
>    if (err != VIX_OK) {
>      VDDK_ERROR (err, "VixDiskLib_Open: %s", filename);
> +
> +    /* Attempt to advise the user on the extremely helpful "Unknown error"
> +     * result of VixDiskLib_Open().  The one reason we've seen for this error
> +     * mode is a thumbprint mismatch (RHBZ#1905772).  Note that:
> +     *
> +     * (1) The thumbprint (as a part of "h->params") is passed to
> +     *     VixDiskLib_ConnectEx() above, but the fingerprint mismatch is
> +     *     detected only inside VixDiskLib_Open().
> +     *
> +     * (2) "thumb_print" may be NULL -- vddk_config_complete() is correct not to
> +     *     require a non-NULL "thumb_print" for a remote connection; the sample
> +     *     program "vixDiskLibSample.cpp" in vddk-7.0.3 explicitly permits
> +     *     "-thumb" to be absent.
> +     */
> +    if (is_remote && err == VIX_E_FAIL)
> +      nbdkit_error ("Please verify whether the \"thumbprint\" parameter (%s) "
> +                    "matches the SHA1 fingerprint of the remote VMware "
> +                    "server.  Refer to nbdkit-vddk-plugin(1) section "
> +                    "\"THUMBPRINTS\" for details.",
> +                    thumb_print == NULL ? "not specified" : thumb_print);
>      goto err2;
>    }

Seems fine, ACK

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 installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW


More information about the Libguestfs mailing list