All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
	 qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] iotests/108: probe loop device setup
Date: Tue, 13 Oct 2026 13:53:51 -0500	[thread overview]
Message-ID: <as59GEf23kbWM-Kc@redhat.com> (raw)
In-Reply-To: <20261013182804.103882-1-iii@linux.ibm.com>

On Tue, Oct 13, 2026 at 08:28:00PM +0200, Ilya Leoshkevich wrote:
> Running iotests/108 in a Docker container, that has passwordless sudo
> configured, fails with:
> 
>     losetup: /home/user/src/qemu/build/scratch/qcow2-file-108/t.qcow2: failed to set up loop device: No such file or directory
> 
> because it incorrectly assumes losetup is allowed to do loop device
> setup, when in reality it can only list devices.
> 
> Fix by probing loop device setup, using the test script as a backing
> file. With this, the test is correctly skipped.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tests/qemu-iotests/108 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
> index 1de718188aa..adbaaf87095 100755
> --- a/tests/qemu-iotests/108
> +++ b/tests/qemu-iotests/108
> @@ -53,7 +53,8 @@ _supported_os Linux
>  _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
>  
>  # This test either needs sudo -n losetup or FUSE exports to work
> -if sudo -n losetup &>/dev/null; then
> +if probe_dev=$(sudo -n losetup -r --show -f "$0" 2>/dev/null); then
> +    sudo -n losetup -d "$probe_dev"

Is 'sudo -n losetup -f' a simpler test?  It prints out the next
/dev/loopN value available only if a mount would succeed, which means
that it is a stronger test than the existing 'sudo -n losetup', but
also does not require a subsequent cleanup.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



  reply	other threads:[~2026-10-13 18:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 18:28 [PATCH] iotests/108: probe loop device setup Ilya Leoshkevich
2026-10-13 18:53 ` Eric Blake [this message]
2026-10-13 19:08   ` Ilya Leoshkevich
2026-10-13 19:14     ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=as59GEf23kbWM-Kc@redhat.com \
    --to=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.