FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] common: skip tests using LVM when the device is no known
@ 2025-01-28  7:16 Christoph Hellwig
  2025-01-28 19:31 ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2025-01-28  7:16 UTC (permalink / raw)
  To: zlang; +Cc: fstests

LVM has a lot of elaborate code to make the users life painful.  This
includes claiming the device type is unknown if it doesn't match it's
elaborately crafted internal list instead of just letting the user use
it.  Skip tests using LVM if this is the case to avoid arcane failures
due to missing lvm devices when using null_blk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/081 | 6 +++++-
 tests/generic/108 | 6 +++++-
 tests/generic/459 | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/generic/081 b/tests/generic/081
index 37137d937b05..97928bf4a435 100755
--- a/tests/generic/081
+++ b/tests/generic/081
@@ -66,7 +66,11 @@ lvsize=$((size * 85 / 100))	 # ~256M
 # make sure there's enough disk space for 256M lv, test for 300M here in case
 # lvm uses some space for metadata
 _scratch_mkfs_sized $((size * 1024 * 1024)) >>$seqres.full 2>&1
-$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
+
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 || \
+	_notrun "LVM is too stupid for this device"
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
 yes | $LVM_PROG lvcreate -L ${lvsize}M -n $lvname $vgname >>$seqres.full 2>&1
diff --git a/tests/generic/108 b/tests/generic/108
index f630450ec66d..4f86ec946511 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -51,7 +51,11 @@ test -b "$SCSI_DEBUG_DEV" || _notrun "Failed to initialize scsi debug device"
 echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full
 
 # create striped volume with 4MB stripe size
-$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
+#
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1 || \
+	_notrun "LVM is too stupid for this device"
 $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
diff --git a/tests/generic/459 b/tests/generic/459
index 40c87e20f8b9..3f5f0f2b7dc1 100755
--- a/tests/generic/459
+++ b/tests/generic/459
@@ -84,7 +84,11 @@ is_shutdown_or_ro()
 _scratch_mkfs_sized $((350 * 1024 * 1024)) >>$seqres.full 2>&1
 
 # Create a 200MB dm-thin POOL
-$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1
+#
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 || \
+	_notrun "LVM is too stupid for this device"
 $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
 
 $LVM_PROG lvcreate  --thinpool $poolname  --errorwhenfull y \
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] common: skip tests using LVM when the device is no known
  2025-01-28  7:16 [PATCH] common: skip tests using LVM when the device is no known Christoph Hellwig
@ 2025-01-28 19:31 ` Darrick J. Wong
  2025-01-29  5:24   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2025-01-28 19:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests

On Tue, Jan 28, 2025 at 08:16:05AM +0100, Christoph Hellwig wrote:
> LVM has a lot of elaborate code to make the users life painful.  This
> includes claiming the device type is unknown if it doesn't match it's
> elaborately crafted internal list instead of just letting the user use
> it.  Skip tests using LVM if this is the case to avoid arcane failures
> due to missing lvm devices when using null_blk.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/generic/081 | 6 +++++-
>  tests/generic/108 | 6 +++++-
>  tests/generic/459 | 6 +++++-
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/generic/081 b/tests/generic/081
> index 37137d937b05..97928bf4a435 100755
> --- a/tests/generic/081
> +++ b/tests/generic/081
> @@ -66,7 +66,11 @@ lvsize=$((size * 85 / 100))	 # ~256M
>  # make sure there's enough disk space for 256M lv, test for 300M here in case
>  # lvm uses some space for metadata
>  _scratch_mkfs_sized $((size * 1024 * 1024)) >>$seqres.full 2>&1
> -$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
> +
> +# lvm has a hardcoded list of valid devices and fails with
> +# "device type is unknown" for those not in the list like null_blk
> +$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 || \
> +	_notrun "LVM is too stupid for this device"

Should this get turned into a common helper?

_require_lvm_support() {
	local bdev="$1"

	$LVM_PROG pvcreate --test "$bdev" || \
		_notrun "$bdev: cannot use lvm here"
}

I guess the downside is that pvcreate on my system (Debian 12) will trip
over any existing disk label and ask if you want to wipe it.  If you say
no then it returns nonzero, and if you say yes then it goes into an
infinite loop.

You can of course $WIPEFS_PROG -a $bdev but ugghh.

--D


>  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
>  # (like 2.02.95 in RHEL6) don't support --yes option
>  yes | $LVM_PROG lvcreate -L ${lvsize}M -n $lvname $vgname >>$seqres.full 2>&1
> diff --git a/tests/generic/108 b/tests/generic/108
> index f630450ec66d..4f86ec946511 100755
> --- a/tests/generic/108
> +++ b/tests/generic/108
> @@ -51,7 +51,11 @@ test -b "$SCSI_DEBUG_DEV" || _notrun "Failed to initialize scsi debug device"
>  echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full
>  
>  # create striped volume with 4MB stripe size
> -$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
> +#
> +# lvm has a hardcoded list of valid devices and fails with
> +# "device type is unknown" for those not in the list like null_blk
> +$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1 || \
> +	_notrun "LVM is too stupid for this device"
>  $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
>  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
>  # (like 2.02.95 in RHEL6) don't support --yes option
> diff --git a/tests/generic/459 b/tests/generic/459
> index 40c87e20f8b9..3f5f0f2b7dc1 100755
> --- a/tests/generic/459
> +++ b/tests/generic/459
> @@ -84,7 +84,11 @@ is_shutdown_or_ro()
>  _scratch_mkfs_sized $((350 * 1024 * 1024)) >>$seqres.full 2>&1
>  
>  # Create a 200MB dm-thin POOL
> -$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1
> +#
> +# lvm has a hardcoded list of valid devices and fails with
> +# "device type is unknown" for those not in the list like null_blk
> +$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 || \
> +	_notrun "LVM is too stupid for this device"
>  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
>  
>  $LVM_PROG lvcreate  --thinpool $poolname  --errorwhenfull y \
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] common: skip tests using LVM when the device is no known
  2025-01-28 19:31 ` Darrick J. Wong
@ 2025-01-29  5:24   ` Christoph Hellwig
  2025-01-29  5:40     ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2025-01-29  5:24 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests

On Tue, Jan 28, 2025 at 11:31:22AM -0800, Darrick J. Wong wrote:
> Should this get turned into a common helper?

> I guess the downside is that pvcreate on my system (Debian 12) will trip
> over any existing disk label and ask if you want to wipe it.  If you say
> no then it returns nonzero, and if you say yes then it goes into an
> infinite loop.
> 
> You can of course $WIPEFS_PROG -a $bdev but ugghh.

Honestly, for now I just want to avoid the tests failing due to lvm
stupidity.  If someone has the time to do something more elaborate
(I don't right now), the proper thing is to stop using lvm and replace
it with something less stupid.  That might be direct use of dm,
or simulating failures with null_blk or scsi_debug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] common: skip tests using LVM when the device is no known
  2025-01-29  5:24   ` Christoph Hellwig
@ 2025-01-29  5:40     ` Darrick J. Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2025-01-29  5:40 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests

On Wed, Jan 29, 2025 at 06:24:43AM +0100, Christoph Hellwig wrote:
> On Tue, Jan 28, 2025 at 11:31:22AM -0800, Darrick J. Wong wrote:
> > Should this get turned into a common helper?
> 
> > I guess the downside is that pvcreate on my system (Debian 12) will trip
> > over any existing disk label and ask if you want to wipe it.  If you say
> > no then it returns nonzero, and if you say yes then it goes into an
> > infinite loop.
> > 
> > You can of course $WIPEFS_PROG -a $bdev but ugghh.
> 
> Honestly, for now I just want to avoid the tests failing due to lvm
> stupidity.  If someone has the time to do something more elaborate
> (I don't right now), the proper thing is to stop using lvm and replace
> it with something less stupid.  That might be direct use of dm,
> or simulating failures with null_blk or scsi_debug.

Eh, I'm not that into a weird wipefs and pvcreate --test.  If someone
feels so motivated to test that on a bunch of distros they can do that
refactoring.  I already have too many patches stuck in djwong-dev.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-29  5:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28  7:16 [PATCH] common: skip tests using LVM when the device is no known Christoph Hellwig
2025-01-28 19:31 ` Darrick J. Wong
2025-01-29  5:24   ` Christoph Hellwig
2025-01-29  5:40     ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox