[Libguestfs] [libnbd PATCH 1/6] info: Require nbdkit >= 1.14 for info-can.sh

Eric Blake eblake at redhat.com
Thu Jul 15 17:46:41 UTC 2021


On Tue, Jul 13, 2021 at 11:26:03PM +0200, Martin Kletzander wrote:
> The can_cache flag was introduced in 1.13.4, so the tests might fail on an older
> one.  To make the check easier, only run this test with nbdkit >= 1.14
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  info/info-can.sh | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/info/info-can.sh b/info/info-can.sh
> index 4154e38e85ba..afa6043e24bc 100755
> --- a/info/info-can.sh
> +++ b/info/info-can.sh
> @@ -24,6 +24,10 @@ set -x
>  requires nbdkit --version
>  requires nbdkit sh --version
>  
> +# This test requires nbdkit >= 1.13.3 due to can_cache, check for at least 1.14.
> +minor=$( nbdkit --dump-config | grep ^version_minor | cut -d= -f2 )
> +requires test $minor -ge 14

Version tests are fragile (although we are unlikely to ever backport
can_cache support to any downstream build of 1.13.x).  You could
instead check for:

nbdkit sh --dump-plugin | grep can_cache

as a witness that the nbdkit plugin understands it.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list