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
3e616230f2 lvmdbustest: Add more info on asserts 2023-03-02 11:44:16 -06:00
Tony Asleson
95afd315b1 lvmdbustest: Don't hard code to /tmp
During lvm testing they use an alternative tmp directory.
2023-03-01 15:59:18 -06:00
Tony Asleson
50e6efafb9 lvmdbustest: Add more output for test_log_file_option 2023-03-01 15:52:23 -06:00
Tony Asleson
80f6655956 lvmdbustest.py: Increase udev timeout 2023-03-01 15:26:37 -06:00
Tony Asleson
e3b7395af4 lvmdbustest.py: Remove use of root_dir in glob
This feature has only been in python since 10/2021.
2023-02-27 09:07:37 -06:00
David Teigland
1857eb9fe0 lvresize: fix check for mounted and renamed LV to handle spaces
Replace spaces with \040 in directory paths from getmntent (mtab).

The recent commit 5374a44c57 compares mount point directory paths
from /etc/mtab and /proc/mounts, in order to detect when a mounted
LV has been renamed.  The directory path comparison does not work
correctly when the path contains spaces because getmntent uses
ascii space chars and proc replaces spaces with \040.
2023-02-23 16:55:36 -06:00
Zdenek Kabelac
c1cecc3dc5 aux: lvmdbus checks for JSONDecodeError
Skip lvmdbus testing with too old python.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
d11e12264f tests: add missing quotes
Add quotes around paths and also add fixme for checking
system is actually usable for a test with all running
services.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
f5acdc2d79 tests: use aux mdadm wrapper
Wrapper takes care of proper MD device name around its various
incarnations.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
d7c4fb7743 tests: remove option chunk for mdadm raid1
Not sure why, but --chunk specification for mdadm raid1 is no longer
'wanted' ???
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
6943afe9d5 tests: add fixme 2023-02-23 16:01:50 +01:00
Zdenek Kabelac
d5c0b68dde tests: some skips with 6.2 kernel
Fix did not managed to get to final release so skip test on this kernel.
2023-02-23 16:01:50 +01:00
Tony Asleson
993bd2ffc8 lvmdbustest: Check and remove lvm debug collection files
In setup/teardown ensure we check for and remove any lvm debug
collection, to prevent FS from filling up.
2023-02-20 12:01:53 -06:00
Zdenek Kabelac
13b216fbdf tests: safety first... 2023-02-17 00:08:50 +01:00
Zdenek Kabelac
1788b4b3aa tests: lvmdbus testing use --debug optinally now
To shorten down logging output of lvmdbus - use for now lvmdbus
with --debug option only when LVM_DEBUG_LVMDBUS=1 is set.
2023-02-17 00:08:50 +01:00
Zdenek Kabelac
06c5c29443 tests: check failing vdo conversion
When we detect not usable vdo on a machine, check lvconvert fails.
2023-02-17 00:08:50 +01:00
Zdenek Kabelac
8630a19d1e tests: use PWD for dbus testing
lvmdbusd ATM is leaking too many log files.
At least try to keep them removed with test failure.
2023-02-13 14:30:43 +01:00
Zdenek Kabelac
7ea62f640c tests: skip test without mkfs.ext4 2023-02-13 13:41:59 +01:00
Zdenek Kabelac
7d419b374a tests: reduce shellcheck warns
Reduce warnings in tests.
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
773bc01377 tests: cleanup some shellcheck warns
Reduce shellcheck warnings about missing {} for possible array
dereference.

Make sure we are not loosing error code when assigning local vars
and explicitely ignore 'errors' from standalone lines when needed.

Add some missing quotes.

Use $() instead of ancient ``

Avoid writing some temporary data into /tmp - test need to store
files within its own 'testdir' - so it can be properly discarded.
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
cc2293f18e tests: avoid using length
Use ${#  for length instead.
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
30b9d4d4aa tests: remove blank line 2023-02-10 17:50:27 +01:00
Zdenek Kabelac
b29b8e0bb2 tests: fix cutandpaste bug in wrapper
Use correct variable name for assign.
2023-02-10 17:50:27 +01:00
David Teigland
be124ae810 vgimportclone: fix non-duplicate PV with non-unique basevgname arg
Fix hang of vgimportclone command when:
the PV(s) being imported are not actually clones/duplicates, and
the -n vgname arg is the same as the current vgname.

(Not the intended use of the command, but it should still work.)

In this case, the old and new vgnames ended up being the same, when
the code expected they would be different.  A file lock on both the
old and new vgnames is used, so when both flocks are on the same
file, the second blocks indefinitely.

Fix the new vgname to be the old name plus a numeric suffix, which
is the expected result.
2023-02-09 17:37:22 -06:00
David Teigland
dc99f0def1 device_id: ignore quotes in device id
A t10 wwid string was found containing a " character
which breaks vg metadata parsing.  Ignore any quotation
marks in device id strings.
2023-02-06 12:24:18 -06:00
David Teigland
5374a44c57 lvresize: fail early if mounted LV was renamed
If a mounted LV is renamed, then fs resizing utilities will fail,
so detect this condition and fail the command before any changes
are made.
2023-01-26 14:02:20 -06:00
David Teigland
3bb5576528 lvresize: only resize crypt when fs resize is enabled
There were a couple of cases where lvresize, without --fs resize,
was resizing the crypt layer above the LV.  Resizing the crypt
layer should only be done when fs resizing is enabled (even if the
fs is already small enough due to being independently reduced.)

Also, check the size of the crypt device to see if it's already
been reduced independently, and skip the cryptsetup resize if
it's not needed.
2023-01-19 11:52:14 -06:00
Zdenek Kabelac
aa09232dc4 tests: vdo resizing 2023-01-16 12:37:40 +01:00
lilinjie
bb34ebd4e4 fix typo
Signed-off-by: lilinjie <lilinjie@uniontech.com>
(cherry picked from commit 81b1f5bc3bac0e2e9099b67162da7d1a4995c5f4)
2023-01-11 13:52:12 +01:00
David Teigland
789904bd57 tests: vgimportclone with incomplete pv list and nomda pv 2023-01-05 14:47:49 -06:00
David Teigland
2580f007f0 tests: lvresize-fs-crypt using helper only for crypt dev 2023-01-03 14:35:26 -06:00
David Teigland
6613a61d3b device_id: fix segfault verifying serial for non-pv
The recent change that verifies sys_serial system.devices entries
using the PVID did not exclude non-PV devices from being checked.
The verification code would attempt to use du->pvid which was null
for the non-PVs causing a segfault.
2022-12-02 12:25:10 -06:00
Tony Asleson
61917fbac2 lvmdbustest: Add test to ensure error collection
Recreates https://bugzilla.redhat.com/show_bug.cgi?id=2145114
2022-11-29 12:56:55 -06:00
David Teigland
2da4ca7ce1 tests: devicesfile-vpd-ids add nvme wwid 2022-11-21 10:57:30 -06:00
Zdenek Kabelac
0fed9b0971 tests: update test to handle different status
Since now we change deduplication with V4 table line change,
the modification tends to be faster and we can capture for a few ms
also 'status' about opening or closing deduplication index.
Use 'grep -E' to handle both words.
2022-11-08 11:10:21 +01:00
David Teigland
761b922178 device_id: handle duplicate serial numbers
Handle multiple devices using the same serial number as
their device id.  After matching devices to devices file
entries, if there is a discrepency between the ondisk PVID
and the devices file PVID, then rematch devices to
devices file entries using PVID, looking at all disks
on the system with the same serial number.
2022-11-07 08:56:02 -06:00
Tony Asleson
736547e7bb lvmdbustest: Add test for copy signature
Add test to ensure we detect when a PV signature is copied to a block
device.
2022-10-20 15:10:35 -05:00
Tony Asleson
5a6ae2d4d8 lvmdbustest: Add test for wipefs
Ensure that if an external program or user calles wipefs on a PV that we
correctly update the state of the daemon.
2022-10-20 15:10:35 -05:00
David Teigland
f6f2737015 lvreduce: require active LV when no fs option is used
Without an --fs option set, make lvreduce of an inactive LV
fail and report that the LV must be active.
2022-10-11 12:48:31 -05:00
David Teigland
fc52e87f06 tests: add comments to fsadm-renamed
to explain the what and why of the steps that are
not obvious
2022-10-11 12:48:31 -05:00
David Teigland
fc01dd8900 tests: skip lvresize tests without mkfs.xfs 2022-10-10 13:25:50 -05:00
David Teigland
c4e6d675de tests: device ids using vpd data 2022-10-10 11:47:29 -05:00
Tony Asleson
599cbd7dd3 lvmdbusd: Correct env. variable
Make this match the unit test expectation and the form we use for
other env. variables.
2022-09-30 11:51:23 -05:00
Tony Asleson
fd05b79aad lvmdbustest: Add test to stress mode changing
Add a test to toggle from fork & exec to lvm shell repeatedly, to stress
test it.
2022-09-22 17:14:10 -05:00
Tony Asleson
897b326ccc lvmdbustest: Re-work setUp
Place the addCleanup at the end as we don't want to go through clean up
if we don't make it through setUp.  If we don't do this we can remove VGs
that we didn't create in the unit test.
2022-09-22 17:10:13 -05:00
Tony Asleson
7966f1dd18 lvmdbustest: Refuse to remove a VG we didn't create
One of our previous commits introduced the side effect that we could
inadvertently remove a VG we didn't create, and lose data.
2022-09-22 16:19:16 -05:00
Tony Asleson
40018cbf53 lvmdbustest: Make vg name suffix more unique 2022-09-22 16:17:20 -05:00
Zdenek Kabelac
3a7aeebf7d tests: validate CONFIG_HZ_1000
If we plan to use dm throttling for mirror targets - we actually
have to check whether kernel runs with CONFIG_HZ_1000 - if it does
not the whole idea of throttling is actually not working in the
testsuite as within a single 'tick' with HZ 100 way too much date
is being moved on any modern hardware - and since there is no plan
to change this in kernel - we simply avoid using throttling on such
kernel and test needs to work differently - either ignore results
or use much larger mirror sizes...
2022-09-21 14:58:34 +02:00
Zdenek Kabelac
96f303eb08 tests: discard update 2022-09-21 14:58:34 +02:00
Zdenek Kabelac
1bf1aca544 tests: integrity switch to ext4
Since we would need to create a lot of 300M filesystem,
switch this test suite to ext4.
2022-09-21 14:58:34 +02:00
Tony Asleson
3d3c517b0b lvmdbustest: Add wrapper for injecting errors
Useful for forcing lvmdbusd down error paths.
2022-09-16 10:49:37 -05:00
Tony Asleson
a326e35cda lvmdbustest: Check for self.pvs
If we don't make it through setUp, self.pvs will not exist.
2022-09-16 10:49:37 -05:00
Tony Asleson
ead80d134d lvmdbustest: Move signals to last
When we do the signal testing we default back to fork & exec.  Put these
on the end to maximize our lvm shell testing until we fix this proper.
2022-09-16 10:49:37 -05:00
Tony Asleson
b6dc96d8ef lvmdbustest: Utilize addCleanup in unit test
Register the clean up with addCleanup so we ensure clean_up gets run
regardless of what happens in setUp.
2022-09-16 10:49:37 -05:00
Tony Asleson
f5876a1f3f lvmdbustest: Skip test_nesting if scan_lvs is not enabled 2022-09-16 10:49:37 -05:00
Tony Asleson
f65f7da760 lvmdbustest: Skip test_singleton_daemon running systemd svc. 2022-09-16 10:49:37 -05:00
Tony Asleson
9693709b46 lvmdbustest: Add systemctl daemon start 2022-09-16 10:49:37 -05:00
Tony Asleson
f252e05aae lvmdbustest: Add test for ensuring only 1 instance of daemon 2022-09-16 10:49:37 -05:00
Tony Asleson
d16c0a3e2b lvmdbustest: Add test_sigint test
Get the daemon busy and send it SIGINT to ensure the daemon exits.
2022-09-16 10:49:37 -05:00
Tony Asleson
52415b5708 lvmdbustest: Add optional option to _create_num_lvs
This allows us to create the LVs async., thus queuing them up in daemon.
2022-09-16 10:49:37 -05:00
Tony Asleson
d05d2328e0 lvmdbustest: Factor out tearDown implementation for re-use 2022-09-16 10:49:37 -05:00
Tony Asleson
de0258a600 lvmdbustest: Add DaemonInfo class
This class handles identifying daemon, sending signals to it, and starting
it back up again.
2022-09-16 10:49:37 -05:00
Tony Asleson
ec50979b03 lvmdbusd: Correct typos 2022-09-16 10:49:37 -05:00
Tony Asleson
f4cb78a4e1 lvmdbustest: Add test removing incomplete job
When you try to remove a job that is incomplete you get a dbus exception.
Test for this error condition.
2022-09-16 10:49:37 -05:00
Tony Asleson
2ca4a2dbf3 lvmdbustest: Add test for external event
Ensure that when we trigger an external event that we don't incorrectly
handle multiple --config options.
2022-09-16 10:49:37 -05:00
Tony Asleson
4a202c11ff lvmdbustest: Add test for passing log file in options 2022-09-16 10:49:37 -05:00
Tony Asleson
cef3c75dd4 lvmdbustest: nesting improvements 2022-09-16 10:49:36 -05:00
Tony Asleson
ea45ba753e lvmdbustest: Remove force exception in _wait_for_job
We put this in to test one of the paths in the damon, but unfortunately
if we hit the race condition where the job actually is done we will try
to call j.Wait(1) after the remove.  This fails with:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "Wait" with signature "i" on interface "com.redhat.lvmdbus1.Job"
doesn't exist

Which is caused by the dbus object no longer existing.  We could handle
this, but the issue is we no longer have the ability to get the result to
return, they have been lost.

A better solution would be to write a specific unit test to force this code
path and handle all the possible outcomes.
2022-09-16 10:49:36 -05:00
Tony Asleson
4b4d431631 lvmdbustest: Include major number 259
When you have > 16 partitions for a block device the major number
changes, include them for testing.
2022-09-16 10:49:36 -05:00
Tony Asleson
9ffa1ef884 lvmdbustest: Use updated pyudev syntax
Previous syntax has been deprecated.
2022-09-16 10:49:36 -05:00
David Teigland
0887896847 vgremove: remove online files in run dir
These files are automatically cleared on reboot given
that /run is tmpfs, and that remains the primary way
of clearing online files.

But, if there's extreme use of vgcreate+pvscan+vgremove
between reboots, then removing online files in vgremove
will limit the number of unused online files using space
in /run.
2022-09-14 14:19:29 -05:00
David Teigland
bf386411b8 tests: skip new lvresize tests when missing new libblkid 2022-09-13 15:37:10 -05:00
David Teigland
264827cb98 lvresize: add new options and defaults for fs handling
The new option "--fs String" for lvresize/lvreduce/lvextend
controls the handling of file systems before/after resizing
the LV.  --resizefs is the same as --fs resize.

The new option "--fsmode String" can be used to control
mounting and unmounting of the fs during resizing.

Possible --fs values:

checksize
  Only applies to reducing size; does nothing for extend.
  Check the fs size and reduce the LV if the fs is not using
  the affected space, i.e. the fs does not need to be shrunk.
  Fail the command without reducing the fs or LV if the fs is
  using the affected space.

resize
  Resize the fs using the fs-specific resize command.
  This may include mounting, unmounting, or running fsck.
  See --fsmode to control mounting behavior, and --nofsck to
  disable fsck.

resize_fsadm
  Use the old method of calling fsadm to handle the fs
  (deprecated.) Warning: this option does not prevent lvreduce
  from destroying file systems that are unmounted (or mounted
  if prompts are skipped.)

ignore
  Resize the LV without checking for or handling a file system.
  Warning: using ignore when reducing the LV size may destroy the
  file system.

Possible --fsmode values:

manage
  Mount or unmount the fs as needed to resize the fs,
  and attempt to restore the original mount state at the end.

nochange
  Do not mount or unmount the fs. If mounting or unmounting
  is required to resize the fs, then do not resize the fs or
  the LV and fail the command.

offline
  Unmount the fs if it is mounted, and resize the fs while it
  is unmounted. If mounting is required to resize the fs,
  then do not resize the fs or the LV and fail the command.

Notes on lvreduce:

When no --fs or --resizefs option is specified:
. lvextend default behavior is fs ignore.
. lvreduce default behavior is fs checksize
  (includes activating the LV.)

With the exception of --fs resize_fsadm|ignore, lvreduce requires
the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE.
FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV,
which determines if reducing the fs is necessary.
2022-09-13 15:15:05 -05:00
David Teigland
18722dfdf4 lvresize: restructure code
Rewrite top level resize function to prepare for adding
new fs resizing.
2022-09-09 16:18:55 -05:00
David Teigland
b869a6ff7a fix fs block size detection
blkid_get_tag_value() is not a reliable way to query the fs
BLOCK_SIZE, so use the "probe" functions instead.
2022-09-09 15:50:00 -05:00
Zdenek Kabelac
19db3b3e45 tests: cache use 300M XFS 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
e295610d42 tests: fsadm 300m xfs 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
570dbad527 tests: writecache adapt to 300M XFS 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
6990cbc166 tests: use conv=fdatasync
When we only need wait for result - avoid using slow 'oflag=sync'
with virtual layers
2022-09-07 15:00:15 +02:00
Zdenek Kabelac
9f39977344 tests: add /dev requirement
This test could only be run when user passes  LVM_TEST_DEVDIR=/dev
as it requires and expects actions to be going in this dir, skip
otherwise.

Also 'extend_filter' manages multiple args in on lvm.conf update.
2022-09-07 15:00:15 +02:00
Zdenek Kabelac
0ed3f7a1bf tests: add thin requirement 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
1a3e773f37 tests: lvextend update for 300M XFS 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
afcf954491 tests: no caching for blkid in testing 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
80b782f86f tests: make damage optional
Investigate how to damage thin-pool across different versions/platforms.
Until them - use  'should' for test result.
2022-09-07 15:00:15 +02:00
Zdenek Kabelac
e1e05cf2b5 tests: check for at least 1G of RAM
This test requires quite some RAM to be there.
2022-09-07 15:00:15 +02:00
Zdenek Kabelac
a6e47a1612 tests: remove slash 2022-09-07 15:00:15 +02:00
Zdenek Kabelac
8a92a526a0 tests: skip this test for 5.19
mdraid has some breakage - so 5.19 is crashing
(possibly even some more older version - that can be added as well)
Test seems to pass with 6.0-rc kernel.
2022-09-07 15:00:15 +02:00
Zdenek Kabelac
15ad2b8e55 tests: vdo emulation without vdo binary
Avoid inserting 'vdo' binary into path - and use
alias and VDO_BINARY shell vars for emulation.
2022-09-07 14:58:01 +02:00
Zdenek Kabelac
acbeaa7a8d tests: rework makefile
Improve dependency tracking
Use 'foreach()' with better tracing support
Link whole 'shell' dir instead of linking individual *.sh files
2022-09-07 14:58:01 +02:00
David Teigland
3c49a2e43c vgimportdevices: change result when devices are not added
When using --all, if one VG is skipped, continue adding
other VGs, and do not return an error from the command
if some VGs are added. (A VG is skipped if it's missing PVs.)

If the command fails during devices file setup or device
scanning, then remove the devices file if it has been
newly created by the command, and exit with an error.

If devices from a named VG are not imported (e.g. the
VG is missing devices), then remove the devices file if
it has been newly created by the command, and exit with
an error.

If --all VGs are being imported, and no devices are found
to include in the devices file, then remove the devices
file if it has been newly created by the command, and
exit with an error.
2022-08-30 14:52:00 -05:00
David Teigland
8c3cfc75c7 devices file: fix pvcreate --uuid matching pvid entry with no device id
pvcreate with --uuid would segfault if a devices file entry matched
the specified pvid, but the devices file entry had no device_id, which
could happen if the entry has a devname idtype.
2022-08-19 13:34:36 -05:00
Peter Rajnoha
af2b51d25f test: add report-format test 2022-08-11 11:10:11 +02:00
David Teigland
99ce09ae77 apply multipath_component_detection=0 to duplicate PV handling
multipath_component_detection=0 has always applied to the filter-based
component detection.  Also apply this setting to the duplicate-PV
handling which also eliminates multipath components (based on duplicate
PVs having the same wwid.)
2022-07-25 13:50:43 -05:00
Zdenek Kabelac
1c18ed3b4a vdo: support v4 kernel target line
Check and use new available table line v4, if kernel supports it.
2022-07-11 01:18:24 +02:00
David Teigland
92b4fcf57f exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
Tony Asleson
d0f94e763d lvmdbustest: Add test for property "Get"
We typically use "GetAll", so add test for "Get" and check values.
2022-06-30 10:55:16 -05:00
Tony Asleson
73121e3f07 lvmdbustest: Increase number of LVs
As storage is getting faster, we need to create more LVs to pass this test.
2022-06-30 10:55:16 -05:00
Tony Asleson
8fa8dfdb8c lvmdbustest: Correct comment spelling/grammar 2022-06-30 10:55:16 -05:00
Tony Asleson
55059e002a lvmdbustest: Test job remove path when job not complete 2022-06-30 10:55:16 -05:00
Tony Asleson
b3d7aff6a3 lvmdbusd: Fix env variable LVM_DBUSD_TEST_MODE
Make it more logical.
2022-06-30 10:55:16 -05:00