1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

3197 Commits

Author SHA1 Message Date
Tony Asleson
47c61907b4 lvmdbusd: Change unit test vdo minimum size 2022-06-30 10:55:16 -05:00
Zdenek Kabelac
2bea95764e tests: skip running tests for non root user
Testing needs 'root' privileges.
Only 'make run-unit-test' can work without them.
2022-06-07 17:14:09 +02:00
Zdenek Kabelac
4a49851207 tests: update for wrapper
Update calling vdo manager since our vdo wrapper has a simple shell
arg parser so it needs args without '='

Also correct using  DM_DEV_DIR for 'pvcreate'
2022-06-07 17:14:09 +02:00
Zdenek Kabelac
2ecfd503ed tests: add lvm_vdo_wrapper
Introduce a replacement vdo manager wrapper for testing.
When using test suite on a system without vdo manager (which has got
deprecated) - we still need its functionality to prepare 'vdo volume'
for testing lvm_import_vdo.

Wrapper currently need 2 binaries from older 'vdo 6.2' package -
to be named:
oldvdoformat - format VDO metadata with older format
oldvdoprepareforlvm - shift vdo metadata by 1MiB
2022-06-07 17:14:08 +02:00
David Teigland
bfe072e438 devices file: fail if --devicesfile filename doesn't exist
A typo of the filename after --devicesfile should result in a
command error rather than the command falling back to using no
devices file at all.  Exception is vgcreate|pvcreate which
create a new devices file if the file name doesn't exist.
2022-05-27 14:27:03 -05:00
Zdenek Kabelac
5e060b8fa7 vdo: support --vdosettings
Allow to use --vdosettings with lvcreate,lvconvert,lvchange.
Support settings currenly only configurable via lvm.conf.
With lvchange we require inactivate LV for changes to be applied.

Settings block_map_era_length has supported alias block_map_period.
2022-05-03 19:09:52 +02:00
David Teigland
494372b4ee filter-mpath: use multipath blacklist
Explicit wwid's from these sections control whether the
same wwid in /etc/multipath/wwids is recognized as a
multipath component.  Other non-wwid keywords are not
used, and may require disabling the use of the multipath
wwids file in lvm.conf.
2022-04-22 16:07:47 -05:00
David Teigland
5c50590b22 tests: devicesfile-edit.sh fix loop file name
don't remove dash from loop file name
2022-04-21 11:31:06 -05:00
David Teigland
fb7698b0ce lvmdevices: --deldev using device id
When used with --deviceidtype, --deldev can specify
a device id to remove.
2022-04-06 12:51:34 -05:00
Zdenek Kabelac
0937113146 thin: fix message processing on thin-pool extension
When thin-pool had queued some delete message on extension operation
such message has been 'lost' and thin-pool kernel metadata has been
left with a thin volume that no longer existed for lvm2 metadata.
2022-03-30 14:49:04 +02:00
David Teigland
4eb04c8c05 devices: fix dev_name assumptions
dev_name(dev) returns "[unknown]" if there are no names
on dev->aliases.  It's meant mainly for log messages.

Many places assume a valid path name is returned, and
use it directly.  A caller that wants to use the path
from dev_name() must first check if the dev has any
paths with dm_list_empty(&dev->aliases).
2022-02-24 17:22:04 -06:00
David Teigland
ac1f4bbbfd writecache: display block size from lvs
lvs was missing the ability to display writecache block size.
now possible with lvs -o writecache_block_size
2022-02-21 16:11:13 -06:00
David Teigland
6626adb467 tests: skip vgchange-pvs-online.sh on rhel5
the /dev/mapper/ paths to test devices don't seem to work there
2022-02-15 15:56:46 -06:00
David Teigland
61f23fe15e tests: udev-pvscan-vgchange fix service wait
As a result of removing -r from systemd-run in
commit fbd8b0cf43
this test needs to change how it handles the
transient services.
2022-02-07 16:44:57 -06:00
David Teigland
563105bba9 tests: devicesfile-edit
test lvmdevices add/del
2022-02-03 16:58:12 -06:00
Zdenek Kabelac
208af8db2a tests: skip test part when missed in kernel 2022-01-31 15:11:47 +01:00
David Teigland
ee8fb0310c remove static autoactivation
event based autoactivation is now the only method that lvm
provides for autoactivation.

Setting lvm.conf event_activation=0 can still be used to disable
event based autoactivation commands, but doing so will no longer
enable static autoactivation.
2022-01-27 16:43:11 -06:00
Zdenek Kabelac
a425729da9 test: remove leaked exit 2022-01-26 15:32:30 +01:00
Zdenek Kabelac
89cec5b65a test: check writecache profile support
FIXME
2022-01-26 15:09:58 +01:00
David Teigland
de7892f0af Revert "pvcreate: overwrite partition header with -f"
This reverts commit d5a950ca67.

This commit did not properly recognize GPT cases.
2022-01-18 12:15:03 -06:00
David Teigland
a972d63c54 lvmdevices check: error exit if update is needed
. error exit means that lvmdevices --update would make a change.

. remove check of PART field from --check because it isn't used.

. unlink searched_devnames file to ensure check|update will search
2022-01-14 14:59:28 -06:00
David Teigland
d5a950ca67 pvcreate: overwrite partition header with -f
$ pvcreate /dev/sdc
  Cannot use /dev/sdc: device is partitioned
$ pvcreate -f /dev/sdc
  Physical volume "/dev/sdc" successfully created.
2022-01-14 13:57:20 -06:00
David Teigland
18f451e09e handle duplicate vgids
The approach to duplicate VGIDs has been that it is not possible
or not allowed, so the behavior has been undefined.  The actual
result was unpredictable and/or broken, and generally unhelpful.

Improve this by recognizing the problem, displaying the VGs,
and printing a warning to fix the problem.  Beyond this,
using VGs with duplicate VGIDs remains undefined, but should
work well enough to correct the problem with vgchange -u.

It's possible to create this condition without too much difficulty
by cloning PVs, followed by an incomplete attempt at making the two
VGs unique (vgrename and pvchange -u, but missing vgchange -u.)
2022-01-13 10:01:24 -06:00
David Teigland
7502f78678 Revert "handle duplicate vgids"
This reverts commit bd2baeaaa6.

This commit broke vgrename because vgrename relies on old bugs
in lvmcache_update_vg_from_write and lvmcache_update_vgname
which need to be fixed first.
2022-01-11 16:04:51 -06:00
David Teigland
bd2baeaaa6 handle duplicate vgids
The approach to duplicate VGIDs has been that it is not possible
or not allowed, so the behavior has been undefined.  The actual
result was unpredictable and/or broken, and generally unhelpful.

Improve this by recognizing the problem, displaying the VGs,
and printing a warning to fix the problem.  Beyond this,
using VGs with duplicate VGIDs remains undefined, but should
work well enough to correct the problem with vgchange -u.

It's possible to create this condition without too much difficulty
by cloning PVs, followed by an incomplete attempt at making the two
VGs unique (vgrename and pvchange -u, but missing vgchange -u.)
2022-01-06 10:15:16 -06:00
David Teigland
71e7ebb3e4 tests devicesfile-devname.sh drop mdadm chunk 2021-12-01 08:56:05 -06:00
David Teigland
d12baba1a9 pvscan: match device arg to filter symlink
This fixes an issue related to the optimization in
  "pvscan: only add device args to dev cache"

If the devices file is not used, and the lvm.conf filter
accepts devices via symlink names, then those devices won't
be accepted by pvscan for autoactivation.  To resolve this,
recognize when the filter contains symlinks and disable the
optimization.  When the optimization is disabled, a full
dev_cache_scan is performed, and symlinks are associated
with the device names passed to pvscan.  filter-regex
will accept a device if symlinks to that device are accepted.
2021-11-29 17:13:44 -06:00
David Teigland
212b1fc529 devices: exclude multipath components based on matching wwid
If multipath component devices get through the filter and
cause lvm to see duplicate PVs, then check the wwid of the
devs and drop the component devices as if they had been
filtered.  If a dm mpath device was found among the duplicates
then use that as the PV, otherwise do not use any of the
components as the PV.

"duplicate PVs" associated with multipath configs will no
longer stop commands from working.
2021-11-18 17:41:00 -06:00
David Teigland
e4b8726b6d Revert "tests devicesfile-devname: remove searched_devnames"
This reverts commit 8e61c0ad6e.

The changes from "device_id: searched_devnames improvements"
allow this to work without the external removal.
2021-11-16 14:30:09 -06:00
David Teigland
5c71aa7510 tests pv-ext-flags: work with devices file 2021-11-16 14:29:22 -06:00
David Teigland
fee3937002 device_id: fix search on filtered device
When devnames are used as device ids and devnames change,
then new devices need to be located for the PVs.  If the old
devname is now used by a filtered device, this was preventing
the code from searching for the new device, so the PV was
reported as missing.
2021-11-16 09:29:24 -06:00
David Teigland
8e61c0ad6e tests devicesfile-devname: remove searched_devnames
remove /run/lvm/searched_devnames when preparing each test
in case it has appeared on the system
2021-11-15 18:04:10 -06:00
David Teigland
4926061d32 tests: udev-pvscan-vgchange clear services 2021-11-12 12:10:26 -06:00
David Teigland
b945ea1c93 tests vgchange-pvs-online: clean up with devices file
changing the dev names resulted in stale devices file
entries that created noise in the output.
2021-11-11 16:38:10 -06:00
David Teigland
20c550ab10 tests: udev-pvscan-vgchange fix wait
the service now remains after completion
2021-11-11 16:04:24 -06:00
David Teigland
0e0faf30e0 vgchange autoactivation: lock vg early to avoid second label scan
Copy another optimization from pvscan -aay to vgchange -aay.
When using the optimized label scan for only one VG, acquire the
VG lock prior to the scan.  This allows vg_read to then skip the
repeated label scan that normally happens after locking the vg.
2021-11-10 16:50:50 -06:00
David Teigland
024ce50f06 vgchange -aay: improve unexpected command variations
For completeness and consistency, adjust the behavior
for some variations of:

  vgchange -aay --autoactivation event [vgname]

The current standard use is with a VG name arg, and the
command is only called when all pvs_online files exist.
This is the optimal case, in which only pvs_online devs
are read.  This remains the same.

Clean up behaviors for some other unexpected uses of the
command:

. With no VG name arg, the command activates any VGs
  that are complete according to pvs_online.  If no
  pvs_online files exist, it does nothing.

. If a VG name is used but no PVs online files exist for
  the VG, or the PVs online files are incomplete, then
  consider there could be a problem with the pvs_online
  files, and fall back to a full label scan prior to
  attempting the activation.
2021-11-08 15:19:25 -06:00
David Teigland
62533ae3fa vgchange -aay: optimize device list using pvs_online files
Port another optimization from pvscan -aay to vgchange -aay:
  "pvscan: only add device args to dev cache"

This optimization avoids doing a full dev_cache_scan, and
instead populates dev-cache with only the devices in the
VG being activated.

This involves shifting the use of pvs_online files from
the hints interface up to the higher level label_scan
interface.  This specialized label_scan is structured
around creating a list of devices from the pvs_online
files.  Previously, a list of all devices was created
first, and then reduced based on the pvs_online files.
The initial step of listing all devices was slow when
thousands of devices are present on the system.

This optimization extends the previous optimization that
used pvs_online files to limit the devices that were
actually scanned (i.e. reading to identify the device):
  "vgchange -aay: optimize device scan using pvs_online files"
2021-11-05 12:19:35 -05:00
David Teigland
d558b3ad7e vgchange -aay: optimize device scan using pvs_online files
Port the old pvscan -aay scanning optimization to vgchange -aay.
The optimization uses pvs_online files created by pvscan --cache
to derive a list of devices to use when activating a VG.  This
allows autoactivation of a VG to avoid scanning all devices, and
only scan the devices used by the VG itself.  The optimization is
applied internally using the device hints interface.

The new option "--autoactivation event" is given to pvscan and
vgchange commands that are called by event activation.  This
informs the command that it is being used for event activation,
so that it can apply checks and optimizations that are specific
to event activation.  Those include:

- skipping the command if lvm.conf event_activation=0
- checking that a VG is complete before activating it
- using pvs_online files to limit device scanning
2021-11-04 11:08:38 -05:00
David Teigland
33e47182f7 pvscan: only add device args to dev cache
Optimize the common pvscan --cache command by only adding
the necessary devs to dev-cache.
2021-10-19 17:13:57 -05:00
Zdenek Kabelac
e7b5f490c5 cov: ignore close result 2021-10-15 23:40:29 +02:00
Zdenek Kabelac
2e2d673780 makefile: enhance run-unit-test target
Use TMPDIR for executing test and also ensure
all libraries linked to the test are from builddir.
2021-10-15 09:55:54 +02:00
Zdenek Kabelac
037165300e unit-test: better check for O_DIRECT
Instead of guessing tmpfs usage, just directly try if we could
reopen file with O_DIRECT on the used filesystem.
2021-10-15 09:55:54 +02:00
David Teigland
67722b3123 new udev autoactivation
new udev rule 69-dm-lvm.rules replaces
69-dm-lvm-meta.rules and lvm2-pvscan.service

udev rule calls pvscan directly on the added device

pvscan output indicates if a complete VG can be activated

udev env var LVM_VG_NAME_COMPLETE is used to pass complete
VG name from pvscan to the udev rule

udev rule uses systemd-run to run vgchange -aay <vgname>
2021-10-07 12:42:31 -05:00
David Teigland
3e1316bb09 system_id: new appmachineid option
The new system_id_source="appmachineid" will cause
lvm to use an lvm-specific derivation of the machine-id,
instead of the machine-id directly.  This is now
recommended in place of using machineid.
2021-10-07 12:06:49 -05:00
David Teigland
8e62cbb18e device_id: update stacked PVs for vgchange uuid
If a VG uuid is changed, update the device_id of any
PVs stacked on LVs in the changed VG.
2021-10-04 16:54:44 -05:00
David Teigland
939b4bc587 handle bad metadata text in vg_read path
Corrupt metadata text (with good mda header) was being handled
in the label_scan phase, but not in the vg_read phase.  This
was sufficient because metadata areas would always be read and
checksummed during label_scan (metadata parsing was skipped
previously as an optimization.)

This changed with the optimization in
commit 61a6f9905e
"metadata: optimize reading metadata copies in scan"

Now, some metadata areas will not be read and checksummed
at all during the label_scan phase, only during the vg_read
phase.  This means that bad metadata text may first be detected
in the vg_read phase.  So, add equivalent bad metadata handling
to the vg_read path to match the label_scan path.
2021-09-28 15:17:43 -05:00
Zdenek Kabelac
bf0d558067 cov: ignoring 2021-09-27 18:56:14 +02:00
Zdenek Kabelac
4cfa80f02f tests: raise required version for conversion
Real conversion needs this version driver.
TODO: handle properly older versions.
2021-09-21 21:43:02 +02:00
Zdenek Kabelac
a13dfcbc77 cov: check for function result 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
bb6fd1a15f shellcheck: warning enhancements 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
5bd99d55b0 shellcheck: tests fixes
Correcting some shell problems.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
b1f33a4000 tests: len always initialized 2021-09-20 16:24:08 +02:00
Zdenek Kabelac
1a8a33ae9b tests: a bit more fancy way to initialized struct
Older g++ is not smart enough to figure this out, so add a bit more push.
2021-09-20 16:01:22 +02:00
Zdenek Kabelac
1b52451996 cov: mask some warning about leakage
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
efaab93491 cov: ignore syscall 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
055406bb39 cov: validate syscall result 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
9721f3e0ff cov: test for fixture being NULL pointer
Explicit check for teoretical NULL pointer passed as fixture.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
3f946bfce7 cov: capture runtime exception 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
d5c82b0e73 cov: better defined constructors
Ensure C++ initializes all struct members.
Also some deterministic buffer initialization.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ebd150366f cov: add explicit NULL pointer check
Make obvious to coverity strcmp() is not getting NULL pointer.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ce907bcd26 cov: handle teoretical sysconf failure
sysconf() may also return -1 although rather theoretically.
Default to 4K when such case would happen.
Also in function call it just once and keep as static variable.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
b6e9892bc6 tests: use single funtion to get random value 2021-09-20 14:18:13 +02:00
Zdenek Kabelac
a428856a21 tests: fix test of read buffer
Patch 7aba7fe68b incorrectly
converted  SECTOR_SIZE * BLOCK_SIZE_SECTORS to sizeof(f->data).
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
30b188857c gcc-fanalyzer: some explicit NULL checks for tests
Testing code being happier with these extra checks...
2021-09-20 14:17:46 +02:00
Zdenek Kabelac
834f17bb33 clang: ensure new_len is at least 1 2021-09-20 10:51:30 +02:00
David Teigland
9857b5a3dc add --nohints option
The command will not use the hints file to locate devices for PVs.
It will still do standard hint file invalidation where appropriate.
2021-09-13 10:55:07 -05:00
Zdenek Kabelac
7af0a1b9d8 tests: increase size of thin-pool for newer mkfs
Looks like newer version of mkfs.ext4 consumes more 'real' disk space,
when formating virtual volumes - so double the size of thin-pool to
have enough backend chunks for provisioning.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
fc5f9924c7 tests: add test for handling unknown cache settings 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
bd2dae4643 tests: check lvm2 parses vdo statistics 2021-09-09 15:24:21 +02:00
Zdenek Kabelac
89595a3665 vdo: more lvm_import_vdo fixes
Do not call 'dmsetup info' for non-dm devices.

Better handling for VGNAME and LVNAME - so when convering LV as
backend device automatically recognize it and reuse LV name for VDOLV.

Add prompt for final confirmation before actual conversion is started
(once confirmed, lvm2 commands no longer prompts to avoid leaving
conversion in the middle of its process.)
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
337053c56a tests: remove all debug logs when using die
Since die is called from a shell script, there is no need
to report any recent lvm2 command debug traces.
2021-09-06 15:01:11 +02:00
Zdenek Kabelac
1ae157a0f6 vdo: fixes
Better identify VDO device with major:minor.
Handle different LV name from originally converted origin LV.
Improve --dry-run handling.
2021-08-31 22:05:47 +02:00
Zdenek Kabelac
419c93c873 vdo: support lvcreate with skipped activation
Support creation of VDO LV for 'lvcreate -ky...'.
2021-08-31 22:05:47 +02:00
Marian Csontos
bbbd4fed69 vdo: Rename vdoimport to lvm_import_vdo. 2021-08-26 17:13:59 +02:00
David Teigland
0969e90d45 devices: restrict device id types to specific major numbers
Some device id types can only be used with specific device major
numbers, so use this restriction to avoid some comparisions.
This is more efficient, and can avoid some incorrect matches.
2021-08-23 15:54:41 -05:00
David Teigland
72af1cb085 vgimportclone: fix when duplicates are both in the devices file
Fix case where duplicate PVs are created (e.g. with dd) from
devices that are both already in the devices file.
2021-08-20 15:06:33 -05:00
David Teigland
4df6931c4c tests: adjust for check_devicesfile 2021-08-20 14:06:55 -05:00
Zdenek Kabelac
8ebcbe9ace tests: extend vgmerge testing 2021-07-23 16:36:31 +02:00
Zdenek Kabelac
b70c341c9e test 2021-07-21 15:56:33 +02:00
Zdenek Kabelac
d38fdb25e4 thin: fix component detection of external origin
When check active componet of thinLV with external origin,
we need to check if the external origin isn't already active.
For this however we need to use layered check for -real device.
2021-07-14 12:56:08 +02:00
Zdenek Kabelac
ed48cb26a3 vdo: add vdoimport support
Add tool 'vdoimport' to support easy conversion of an existing VDO manager managed
VDO volumes into lvm2 managed VDO LV.

When physical converted volume is already a logical volume, conversion
happens with the VG itself, just with validation for extent_size, so
the virtually sized logical VDO volume size can be expressed in extents.

Example of basic simple usage:

vdoimport --name vg/vdolv  /dev/mapper/vdophysicalvolume
2021-07-09 14:57:59 +02:00
David Teigland
a47e20a092 tests: skip tests that require blkid BLOCK_SIZE
Recent commit 84bd394cf9
  "writecache: use block size 4096 when no fs is found"

changed the default writecache block size from 512 to 4096
when no file system is detected.  The fs block size detection
requires the libblkid BLOCK_SIZE feature, so skip tests on
systems without this.  Otherwise, 4096 writecache added to
512 xfs leads fs io or mount failures.
2021-06-30 11:56:42 -05:00
Leo Yan
27abb03a0d tests: Fix building for IDM program
When execute IDM testing, the command reports error:

  /usr/bin/install: cannot stat ‘lib/idm_inject_failure’: No such file
  or directory

Since there have a stale program in my local environment, thus Makefile
always uses the stale program and doesn't report any issue.  In the
brand new repository, it doesn't contain an idm_inject_failure program,
and Makefile doesn't build it without specifying the dependency, thus
the test command complaints the file 'idm_inject_failure' is not found.

This patch adds the dependency 'lib/idm_inject_failure' for IDM testing,
so it can firstly build the injection program and dismiss the error.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-16 10:35:12 -05:00
Leo Yan
f25df0386e tests: stress: Change to use $SHARED for vgcreate
Use the variable $SHARED to replace "--shared" for vgcreate commands.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-16 10:35:12 -05:00
David Teigland
e5740e9646 tests: fix skip in stress_single_thread.sh 2021-06-16 09:37:04 -05:00
David Teigland
f8742b6df2 tests: add some LVM_TEST_LOCK_TYPE_IDM 2021-06-15 14:02:45 -05:00
David Teigland
9759f915e7 tests: add writecache-cache-blocksize-2
inconsistent physical block size of devs used
for main LV and cache
2021-06-07 15:40:40 -05:00
David Teigland
ff677aa69f tests: rename test 2021-06-07 12:12:33 -05:00
David Teigland
a7f334a532 tests: writecache-blocksize add dm-cache tests
Add the same tests for dm-cache as exist for dm-writecache,
dm-cache uses a different blocksize in a couple cases.
2021-06-07 12:11:12 -05:00
Leo Yan
fe05828e7e tests: multi-hosts: Test lease timeout with LV shareable mode
This patch is to test timeout handling after activate LV with shareable
mode.  It has the same logic with the testing for LV exclusive mode,
except it verifies the locking with shareable mode.

  On the host A:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hosta.sh

  On the host B:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_sh_timeout_hostb.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
0a4d6d9d1d tests: multi-hosts: Test lease timeout with LV exclusive mode
This patch is to test timeout handling after activate LV with exclusive
mode.  It contains two scripts for host A and host B separately.

The script on host A firstly creates VGs and LVs based on the passed
back devices, every back device is for a dedicated VG and a LV is
created as well in the VG.  Afterwards, all LVs are activated by host A,
so host A acquires the lease for these LVs.  Then the test is designed
to fail on host A.

After the host A fails, host B starts to run the paired testing script,
it firstly fails to activate the LVs since the locks are leased by
host A; after lease expiration (after 70s), host B can achieve the lease
for LVs and it can operate LVs and VGs.

  On the host A:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hosta.sh

  On the host B:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_ex_timeout_hostb.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
e9950efff1 tests: multi-hosts: Add LV testing
This patch is to add LV testing on multi hosts.  There have two scripts,
the script multi_hosts_lv_hosta.sh is used to create LVs on one host,
and the second script multi_hosts_lv_hostb.sh will acquire
global lock and VG lock, and remove VGs.  The testing flow verifies the
locking operations between two hosts with lvmlockd and the backend
locking manager.

  On the host A:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hosta.sh

  On the host B:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_lv_hostb.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
e75bd71aae tests: multi-hosts: Add VG testing
This patch is to add VG testing on multi hosts.  There have two scripts,
the script multi_hosts_vg_hosta.sh is used to create VGs on one host,
and the second script multi_hosts_vg_hostb.sh afterwards will acquire
global lock and VG lock, and remove VGs.  The testing flow verifies the
locking operations between two hosts with lvmlockd and the backend
locking manager.

  On the host A:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hosta.sh

  On the host B:
    make check_lvmlockd_idm \
      LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3,/dev/sdl3 \
      LVM_TEST_MULTI_HOST=1 T=multi_hosts_vg_hostb.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
92b47d8eb8 tests: idm: Add testing for IDM lock manager failure
If the IDM lock manager fails to access drives, might partially fail to
access drives (e.g. it fails to access one of three drives), or totally
fail to access drives, the lock manager should handle properly for these
cases.  When the drives are partially failure, if the lock manager still
can renew the lease for the locking, then it doesn't need to take any
action for the drive failure; otherwise, if it detects it cannot renew
the locking majority, it needs ti immediately kill the VG from the
lvmlockd.

This patch adds the test for verification the IDM lock manager failure;
the command can be used as below:

  # make check_lvmlockd_idm \
    LVM_TEST_BACKING_DEVICE=/dev/sdp3,/dev/sdl3,/dev/sdq3 \
    LVM_TEST_FAILURE=1 T=idm_ilm_failure.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
38abd6bb2c tests: idm: Add testing for the fabric's half brain failure
If the fabric is broken instantly and the partial drives connected on
the fabric disappear from the system.  For this case, according to the
locking algorithm in idm, the lease will not lose since the half drives
are still alive so can renew the lease for the half drives.  On the
other hand, since the VG lock requires to acquire the majority of drive
number, but half drives failure cannot achieve the majority, so it
cannot acquire the lock for VG and thus cannot change metadata for VG.

This patch is to add half brain failure for idm; the test command is as
below:

  # make check_lvmlockd_idm \
	LVM_TEST_BACKING_DEVICE=/dev/sdp3,/dev/sdo3 LVM_TEST_FAILURE=1 \
	T=idm_fabric_failure_half_brain.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
91d3b56875 tests: idm: Add testing for the fabric failure and timeout
If the fabric is broken instantly, the drives connected on the fabric
will disappear from the system.  For worst case, the lease is timeout
and the drives cannot recovery back.  So a new test is added to emulate
this scenario, it uses a drive for LVM operations and this drive is also
used for locking scheme; if the drive and all its associated paths (if
the drive supports multiple paths) are disconnected, the lock manager
should stop the lockspace for the VG/LVs.

And afterwards, if the drive recovers back, the VG/LV resident in the
drive should be operated properly.  The test command is as below:

  # make check_lvmlockd_idm \
	LVM_TEST_BACKING_DEVICE=/dev/sdp3 LVM_TEST_FAILURE=1 \
	T=idm_fabric_failure_timeout.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
fc0495ea04 tests: idm: Add testing for the fabric failure
When the fabric failure occurs, it will lose the connection with hosts
instantly, and after a while it can recovery back so that the hosts can
continue to access the drives.

For this case, the locking manager should be reliable for this case and
can dynamically handle this case and allows user to continue to use the
VG/LV with associated locking scheme.

This patch adds a testing to emulate the fabric faliure, verify LVM
commands for this case.  The testing usage is:

  # make check_lvmlockd_idm \
	LVM_TEST_BACKING_DEVICE=/dev/sdo3,/dev/sdp3,/dev/sdp4 \
	LVM_TEST_FAILURE=1 T=idm_fabric_failure.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
874001ee6e tests: Add testing for lvmlockd failure
After the lvmlockd abnormally exits and relaunch the daemon, if LVM
commands continue to run, lvmlockd and the backend lock manager (e.g.
sanlock lock manager or IDM lock manager) should can continue to serve
the requests from LVM commands.

This patch adds a test to emulate lvmlockd failure, and verify the LVM
commands after lvmlockd recovers back.  Below is an example for testing
the case:

  # make check_lvmlockd_idm \
	LVM_TEST_BACKING_DEVICE=/dev/sdo3,/dev/sdp3,/dev/sdp4 \
	LVM_TEST_FAILURE=1 T=lvmlockd_failure.sh

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
8c7b2df41f tests: Support idm failure injection
When the drive failure occurs, the IDM lock manager and lvmlockd should
handle this case properly.  E.g. when the IDM lock manager detects the
lease renewal failure caused by I/O errors, it should invoke the kill
path which is predefined by lvmlockd, so that the kill path program
(like lvmlockctl) can send requests to lvmlockd to stop and drop lock
for the relevant VG/LVs.

To verify the failure handling flow, this patch introduces an idm
failure injection program, it can input the "percentage" for drive
failures so that can emulate different failure cases.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
f83e11ff43 tests: stress: Add multi-threads stress testing for PV/VG/LV
This patch is to add the stress testing, which launches three threads,
one thread is for creating/removing PV, one thread is for
creating/removing VG, and the last one thread is for LV operations.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
692fe7bb31 tests: stress: Add multi-threads stress testing for VG/LV
This patch is to add the stress testing, which launches two threads,
each thread creates LV, activate and deactivate LV in the loop; so this
can test for multi-threading in lvmlockd and its backend lock manager.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
fe660467fa tests: stress: Add single thread stress testing
This patch is to add the stress testing, which loops to create LV,
activate and deactivate LV in the single thread.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
5b361b197e tests: Add checking for lvmlockd log
Add checking for lvmlockd log, this can be used for the test cases which
are interested in the interaction with lvmlockd.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
2097c27c05 tests: Cleanup idm context when prepare devices
For testing idm locking scheme, it's good to cleanup the idm context
before run the test cases.  This can give a clean environment for the
testing.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
759b0392d5 tests: Support multiple backing devices
In current implementation, the option "LVM_TEST_BACKING_DEVICE" only
supports to specify one backing device; this patch is to extend the
option to support multiple backing devices by using comma as separator,
e.g. below command specifies two backing devices:

  make check_lvmlockd_idm LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3

This can allow the testing works on multiple drives and verify the
locking scheme if can work as expected for multiple drives case.  For
example, for Seagate IDM locking scheme, if a VG uses two PVs, every PV
is resident on a drive, thus the locking operations will be sent to two
drives respectively; so the extension for "LVM_TEST_BACKING_DEVICE" can
help to verify different drive configurations for locking.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
c64dbc7ee8 tests: Enable the testing for IDM locking scheme
This patch is to introduce testing option LVM_TEST_LOCK_TYPE_IDM, with
specifying this option, the Seagate IDM lock manager will be launched as
backend for testing.  Also add the prepare and remove shell scripts for
IDM.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
David Teigland
4a746f7ffc lvremove: fix removing thin pool with writecache on data 2021-05-24 16:09:35 -05:00
David Teigland
00f603de2c tests: add lvextend-caches-on-thindata
to test lvextend of thin pool data while it has
cache|writecache attached
2021-05-06 16:23:26 -05:00
David Teigland
92fcfc59b2 tests: new lvextend-caches
to test lvextend of LVs with attached cache|writecache
2021-05-06 14:43:10 -05:00
Zdenek Kabelac
64a8505b96 tests: use should for expected state
While we heavily try to spot arrays that are not yet in-sync,
some kernels tends to block our lvm2 command in kernel,
while we resume these smaller raid arrays even for 5 seconds.

But since the result is not really wrong - report these
check failures only as TEST WARNING.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
f678052385 shellcheck: updates
Ehance some shellcheck reported issues.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
94c264b975 Revert "tests: add check for lvconvert without zeroing"
This reverts commit accf324ccb.
2021-04-14 10:53:34 +02:00
Zdenek Kabelac
9a33388c1a tests: race on md raid still being hit on 5.12-rc6
Still hits the race in initialization:

kernel BUG at drivers/md/raid5.c:7549!
invalid opcode: 0000 [#1] SMP PTI
CPU: 0 PID: 525149 Comm: dmsetup Tainted: G           OEi
    --------- ---  5.12.0-0.rc6.184.fc35.x86_64 #1
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
RIP: 0010:raid5_run+0x40b/0x4b0 [raid456]
Code: 00 8b 83 3c 01 00 00 39 83 bc 00 00 00 0f 85 ac 00 00 00
      48 c7 44 24 08 00 00 00 00 8b bb 30 01 00 00 85 ff 0f 84
      88 fd ff ff <0f> 0b 48 8b 43 48 48 c7 c6 40 93 92 c0 48
      c7 c7 70 2c 93 c0 48 85
Call Trace:
 md_run+0x4d6/0xbc0
 ? super_validate+0x2e1/0x4b0 [dm_raid]
 raid_ctr+0x133e/0x281b [dm_raid]
 dm_table_add_target+0x167/0x330
 table_load+0x103/0x350
 ctl_ioctl+0x1b4/0x430
 ? dev_suspend+0x2c0/0x2c0
 dm_ctl_ioctl+0xa/0x10
 __x64_sys_ioctl+0x82/0xb0
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xae
2021-04-12 12:04:50 +02:00
Zdenek Kabelac
396d93937d tests: enable for 5.12+ kernels
Should not longer kill kernel.
2021-04-12 10:47:06 +02:00
Zdenek Kabelac
aee0cd6530 makefiles: static linking enhancements 2021-04-12 09:54:15 +02:00
David Teigland
01f108c4d0 tests: skip autoactivation-metadata with lvmlockd
shared vgs are not autoactivated
2021-04-08 16:08:45 -05:00
David Teigland
0a28e3c44b Add metadata-based autoactivation property for VG and LV
The autoactivation property can be specified in lvcreate
or vgcreate for new LVs/VGs, and the property can be changed
by lvchange or vgchange for existing LVs/VGs.

 --setautoactivation y|n
 enables|disables autoactivation of a VG or LV.

Autoactivation is enabled by default, which is consistent with
past behavior.  The disabled state is stored as a new flag
in the VG metadata, and the absence of the flag allows
autoactivation.

If autoactivation is disabled for the VG, then no LVs in the VG
will be autoactivated (the LV autoactivation property will have
no effect.)  When autoactivation is enabled for the VG, then
autoactivation can be controlled on individual LVs.

The state of this property can be reported for LVs/VGs using
the "-o autoactivation" option in lvs/vgs commands, which will
report "enabled", or "" for the disabled state.

Previous versions of lvm do not recognize this property.  Since
autoactivation is enabled by default, the disabled setting will
have no effect in older lvm versions.  If the VG is modified by
older lvm versions, the disabled state will also be dropped from
the metadata.

The autoactivation property is an alternative to using the lvm.conf
auto_activation_volume_list, which is still applied to to VGs/LVs
in addition to the new property.

If VG or LV autoactivation is disabled either in metadata or in
auto_activation_volume_list, it will not be autoactivated.

An autoactivation command will silently skip activating an LV
when the autoactivation property is disabled.

To determine the effective autoactivation behavior for a specific
LV, multiple settings would need to be checked:
the VG autoactivation property, the LV autoactivation property,
the auto_activation_volume_list.  The "activation skip" property
would also be relevant, since it applies to both normal and auto
activation.
2021-04-07 15:32:49 -05:00
Zdenek Kabelac
79a168d119 tests: pvmove updates
Switch to plain 'kill' we should no longer need SIGKILL
as polling can be interrupted.

Resolve problem in aux wait_pvmove_lv_ready() that was using
lvm command to check for UUID - but this was interferring with
VG lock and it's been delaying confirmation.

So reducing slow-down of test - so it can run faster.
2021-04-06 22:02:31 +02:00
Samanta Navarro
01d5e4d1ca all: fix typos 2021-03-30 13:08:14 +02:00
Zdenek Kabelac
1a17a5ab80 tests: sleep tunning
Check different sleep properties for lvmpolld.
Use aux remove_dm_devs.
2021-03-28 14:22:11 +02:00
Zdenek Kabelac
d9b9751032 tests: add aux remove_dm_devs
Add function to remove DM devices and dies
if some device can't be removed.
2021-03-28 14:22:11 +02:00
Zdenek Kabelac
0ddbc4c5cd tests: bash quotes 2021-03-28 11:39:58 +02:00
Zdenek Kabelac
8a550fa3e8 tests: test_pv_symlinks works only with /dev dir
Skip test with LVM_TEST_DEVDIR != /dev
2021-03-28 00:21:38 +01:00
Zdenek Kabelac
afbaab20c7 tests: fix unfinished check for 4.18 kernel 2021-03-28 00:21:38 +01:00
Zdenek Kabelac
f584f0cd9e tests: ensure raid is synchronized 2021-03-27 23:19:08 +01:00
Zdenek Kabelac
5ec7992e29 tests: reoder killing order
We need to stop pvmove while still in progress,
so restart lvmpolld after pvmoving devices are gone
2021-03-27 23:19:08 +01:00
Zdenek Kabelac
feb7fef6c8 tests: fight with losetup creation error
Try losetup few times in loop if we can succeed.
2021-03-27 23:19:08 +01:00
Zdenek Kabelac
1f7bd719d0 tests: restore removed prefix
During debugging this prefix was unintentionally lost, restore.
2021-03-27 23:19:08 +01:00
Zdenek Kabelac
12222add1a tests: use known path for test in find
Actually make sure which 'test' binary is executed.
Since we used to have 'test' binary in tests.
2021-03-27 23:18:38 +01:00
Zdenek Kabelac
37d603268f tests: for 4.18 use already 1.20 logic
Looks like there was some missed versioning increase during devel.
So with kernel >= 4.18 version 1.19 is enough to look like 1.20

However backported 1.19 targets seems to not provide all
the capabilities.
2021-03-27 23:16:52 +01:00
Zdenek Kabelac
f07a793813 tests: correct thin-pool version
Use thin-pool target version 1.20 for changed behavior.
2021-03-27 00:34:00 +01:00
Zdenek Kabelac
53338cf566 tests: increase mirror throttling 2021-03-27 00:29:28 +01:00
Zdenek Kabelac
8e9bc52b15 tests: more skipped tests for lvmpolld 2021-03-26 22:13:37 +01:00
Zdenek Kabelac
a55f4a8fe2 tests: use shell comment 2021-03-26 22:12:42 +01:00
Zdenek Kabelac
93336685f6 tests: update dbus test_nesting
Test has to use PV with suffix  pv[0..9]  otherwise
it's ignored by test suite filter.

Better fix for VG names to use prefix LVMTEST.

Skip the test for runs without LVM_TEST_DEVDIR != /dev
2021-03-26 20:39:41 +01:00
Zdenek Kabelac
1d6e1d08a8 tests: update for newer thin-pool
Newer thin-pool handle metadata read-only recovery better.
2021-03-26 20:39:41 +01:00
Zdenek Kabelac
51ac56a05e tests: use blkid without caching
Always use blkid without caching to avoid poluting
cache stored in /run/blkid or /etc on older distros
2021-03-26 20:39:41 +01:00
Zdenek Kabelac
02e02a5ccc tests: use aux mdadm_assemble wrapper 2021-03-26 20:39:41 +01:00
Zdenek Kabelac
4c59b2aa21 tests: add aux mdadm_assemble
Wrapper for slowed version of mdadm --assemble
2021-03-26 20:39:41 +01:00
Zdenek Kabelac
5ef8d84569 tests: better reporting of problematic services 2021-03-26 20:39:40 +01:00
Zdenek Kabelac
49575a6ce1 tests: skip more tests for lvmpolld pass
These test do not test polling, so skip them for lvmpolld pass.
2021-03-26 20:39:40 +01:00
Zdenek Kabelac
7768650d87 tests: add commented example
How to run individual test.
2021-03-26 13:16:44 +01:00
Zdenek Kabelac
25c665d555 tests: dbus update
Always use  PREFIX for vg header - all tests must use this prefix,
VGs without are not allowed.

Modify pv_symlink test - as the test was checking unsupportable
combination - since lvm2 commands withing testsuite are only
allowed to manipulate with /dev/mapper/LVMTESTXXXX path -
nothing else allowed and fails on being filtered.
2021-03-26 13:13:26 +01:00
Zdenek Kabelac
6db533c439 tests: try to observe some unusual problem
Lets see, why it's very occasionaly able to active LV.
2021-03-26 11:36:22 +01:00
Zdenek Kabelac
3ed79d8dfe tests: move setting of dmeventd pid
Added comment the  'lvs' already initiates dmeventd

Note: we don't have any query mechanism to check if dmeventd
is already running except access of socket which basically
starts dmeventd if it's not running.
2021-03-26 11:16:32 +01:00
Zdenek Kabelac
85fae836c0 tests: add basic validation of running services
For determinist test results lvm2/dm service shall not be present
and running in the system as it may randomize test results.

In case they are found present, this test ends with warning (not failure).
2021-03-26 11:13:56 +01:00
Zdenek Kabelac
9bcc76b63c tests: add should for racy test
Depending on kernel, the race may or may not happen.
2021-03-26 00:43:44 +01:00
Zdenek Kabelac
5feb99dda6 tests: add workaround for older mdadm
Some older instancies of 'mdadm' opened legs in RW and
closed and opened again and expected exlusive access.
But here udev rule can be fired - so on these versions
slow down whole mdadm runtime by using strace, to
give system a bit more time to finish udev rule.
2021-03-26 00:35:28 +01:00
Zdenek Kabelac
0558b223b8 tests: aux fix check_lvmpolld_init_rq_count
Make check_lvmpolld_init_rq_count() more compatible with older gawk,
where some functionality was not working properly.
Also change 'not not' condition.
2021-03-26 00:33:21 +01:00
Zdenek Kabelac
c1f5ca6751 tests: improve check raid_leg_status
Enhance function to wait until raid status gets consisten
(shifts from 0/xxxxx to something else)

If it would took too long fail the check.
2021-03-24 16:38:12 +01:00
Zdenek Kabelac
0783c661b9 tests: handle case of missing /dev/disk
In case there is no symlink - udev can optimize /dev/disk away,
thus find would fail in teardown.
2021-03-24 16:38:12 +01:00
Zdenek Kabelac
2151b71819 tests: check fsadm with missing filesystem 2021-03-24 16:38:12 +01:00
Zdenek Kabelac
9684e82cc4 tests: ignore incosistent raid status
Just like lvm command ignores  0/xxxx report from judging the status.
Avoid using infinite loop and limit report checking to 100 checks.
If it would need more - something is not right.
2021-03-24 12:40:17 +01:00
Zdenek Kabelac
afd43a75f2 tests: skip stray testing on real dev dir
Do not modify /dev dir maintained by udev.
2021-03-24 12:23:07 +01:00
Zdenek Kabelac
a126dde069 tests: remove more file in teardonw
Our tests may result in producation of huge set of
invalid links in /dev/disk directory depeding on version
of udev and various kinds of failures.

Also we happen to invoke some on-system pvscans generating
local /etc/lvm/archive & backups - remove them when
test is finished.
2021-03-24 12:23:07 +01:00
Zdenek Kabelac
18f2475fa1 tests: query info instead of table
No need to access table when we just check presence,
so generate smaller error message about missing device.
2021-03-24 12:22:27 +01:00
Zdenek Kabelac
8df0a32abb tests: this test has race in it depending on kernel
Some kernel seems to keep 'lvextend' busy so long,
that actual resize already happens.

So ATM use 'should'  until something better is invented.
2021-03-23 21:32:51 +01:00
Zdenek Kabelac
dd1f5f9a24 tests: aux clean DM on top of MD
Before cleaning MD, try to remove any DM on top such MD.
Check is made through DM table check.
Maybe parse /proc/mdstat for this???
2021-03-23 21:28:28 +01:00
Zdenek Kabelac
93f2d194ac tests: wipefs with udev_wait
Try to synchronize with colliding udev.
Also retry once if there is some failure with some
sleep between next retry.

Use oflag=direct for wipping without wipefs.
2021-03-23 14:57:10 +01:00
Zdenek Kabelac
14a3c34983 tests: increase required version
Seems like version 1.13.2 remains crashing kernel - so increase
the required version for this reshaping test.
2021-03-23 14:39:13 +01:00
Zdenek Kabelac
d0644fb2c3 tests: use prefix for VG name 2021-03-23 14:38:54 +01:00
Zdenek Kabelac
712f7dfb4c tests: ignore failure of zeroing
Older mdadm fails the command, when the signature is already gone.
2021-03-23 12:05:55 +01:00
Zdenek Kabelac
26d76d31c5 tests: use mirror throttling
Combination of throttling and slowed device is a bit faster.

Also add FIXME about the mutliple spawn polling processing
when activating invidual LV for a pvmove.
2021-03-23 11:34:34 +01:00
Zdenek Kabelac
a5fc6a0fe7 tests: set default basic flavour 2021-03-23 11:33:30 +01:00
Zdenek Kabelac
0b2a037c80 tests: try to move more date
Throttling was not helping with race - try to use more data.
2021-03-23 10:53:02 +01:00
Zdenek Kabelac
acac3cb524 tests: test needs to have playable locking dir 2021-03-23 09:48:47 +01:00
Zdenek Kabelac
b19e036918 tests: aux updates
Select unused md from /proc/mdstat
Check for wipefs once.
2021-03-23 09:48:03 +01:00
Zdenek Kabelac
370749a4b8 tests: enhance mdadm_create
For older mdadm its hard to support new names - to simplify things
keep using  /dev/mdXXX name which is automatically selected.
2021-03-23 01:16:21 +01:00
Zdenek Kabelac
7575c7ae5c tests: set known locking dir
Tests running in the system may use locking dir of the system.
2021-03-23 01:15:29 +01:00
Zdenek Kabelac
077040199d tests: remove unused wait_md_create 2021-03-22 22:51:24 +01:00
Zdenek Kabelac
7166bbd9c2 tests: avoid sleep on kill path
Before sleeping, check if pid is still there.
2021-03-22 22:51:24 +01:00
Zdenek Kabelac
a7d7471906 tests: convert to use mdadm_create
Flip usage from prepare_md_dev to mdadm_create.
2021-03-22 22:50:36 +01:00
Zdenek Kabelac
b1483dcbac tests: more usage of new aux mdadm_create
Condense tests and use the new mdadm_create.
2021-03-22 22:49:11 +01:00
Zdenek Kabelac
76d203517b tests: use mdadm support
Use for testing new mdadm_create  aux wrapper.
Place functionality into a 2 pass loop - one for 'auto' other for 'start'.
Share same tests between raid level 0 and level 1 version of raid.
2021-03-22 22:46:21 +01:00
Zdenek Kabelac
ada99f939f tests: new aux mdadm_create
Add generic wrapper for mdadm --create which takes
normal 'mdadm' args - but allows us to handle differences of
mdadm usage across various version of mdadm tool.

Resulting MD device is availalble in  $(< MD_DEV).

Automatic cleaning is made through   cleanup_md_dev

Calling of mdadm_create cleans previous MD dev if it exists.
2021-03-22 22:42:52 +01:00
Zdenek Kabelac
77432ee137 tests: remove local changes
Use aux for preparing profile.
Avoid playing with LVM_BINARY localy - we already
preset this variable in lib/utils.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
daca6e2c22 tests: even more aggressive throttling
Try if the test gets slowed down with slower mirroring (1)
or we would need something better to beat the race.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
bee8027cfa tests: skip only portion of test
Seems this kernel bug is taking more time to get it fixed,
so skipping only failing portion of test and ending with WARNING.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
8d2ad4419a tests: more system defaults for installed tests
When testing installed binaries on system, use more 'built-in'
predefined settings to usethem with their  compiled-in values.

Also it's better to use same locking dir so the system's pvscan
is not unexpectedly interferring with test commands.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
f1858d209d tests: remove incorrect check
We would need to be check same status value - otherwise
we can hit race in validating 2 different states.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
d6bc11bf72 tests: use mirror throttling
With small mirrors its better to throttle speed of mirror in dm-mirror.
2021-03-20 10:52:24 +01:00
Zdenek Kabelac
2dd43a7314 tests: slow down device more
Make the race with too fast merging less likely to occure.
2021-03-20 10:52:24 +01:00
Zdenek Kabelac
94c4af232c tests: prohibit 4K brd device with integrity
Older kernels hit these errors:

device-mapper: integrity: Bio not aligned on 8 sectors: 0x8ffc, 0x4
2021-03-20 10:52:24 +01:00
Zdenek Kabelac
179f59a0ca tests: add FIXME to raid test
We have here some kind of catch-22 - since older kernels do
use 'resync' while new 'recover' for initial raid synchronization.

So now - how do we recognize in which state of raid we are.
ATM seems to be simplest to simply keep disabled droping of primary raid
leg unless we are in sync.

FIXME: we should add a target version check and enable removal
2021-03-20 10:52:24 +01:00
Zdenek Kabelac
edcc410835 tests: fix condition for exclusion of /dev 2021-03-20 00:28:13 +01:00
Zdenek Kabelac
d5b37f24f4 tests: aux reject /dev as testing dir
If LVM_TEST_DIR would be set to /dev, reject such selection.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
e27baa791f tests: drop status workaround
lvconvert should now recognize resync from older kernels.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
ed90a3d9b4 tests: copy more data
Give pvmove --abort bigger aborting window.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
fe3ef6867f tests: require newer raid version
Tests needs reshape support - so require newer target version
as quick fix.

TODO: inspect indiviual supportable conversion with older versions.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
26fb6b5e8d tests: check for raid sync in progress
TODO: this needs to be built-in in lvm command itself.
2021-03-18 19:12:00 +01:00
Zdenek Kabelac
accf324ccb tests: add check for lvconvert without zeroing
Check lvconvert -Zn does not zero thin-pool metadata.
Also check --type zero is usable for thin-pool data.
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
c06325263f tests: check mixing striped with error and zero 2021-03-18 18:57:45 +01:00
Zdenek Kabelac
1880b573f3 tests: aux always shift emulated devices by 1MiB
Always shift created virtual PVs on backing device by 1MiB
and leave 1MiB free space at the end of device.

This way the system doesn't see same PV headers at multiple devices.
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
583cf413d5 tests: avoid leaking unkilled commands
Between each new test here we want to kill previous commands,
otherwise they will influence results of next test.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
fda7bc1297 tests: wait for Aa status 2021-03-17 00:59:50 +01:00
Zdenek Kabelac
80d0f200d0 tests: increase version of targets for progress 2021-03-17 00:59:50 +01:00
Zdenek Kabelac
e793ff1e18 tests: workaround for some raid targets
Problem with some target is that shortly after initialization it
returns incorrect status letters.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
db37905d7f tests: no further fixes likely to be expected
Skip tests for these kernels.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
87659256f0 tests: require newer version of raid target 2021-03-17 00:59:50 +01:00