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

18801 Commits

Author SHA1 Message Date
Lennart Poettering
25ef7a7b1a _create_and_load_v4: propagate ioctl errors back to caller
When setting up dm-verity devices with signed root hashes it is very
useful to have a recognizable error code when a key is not present in
the kernel keyring. Turns out the kernel actually returns ENOKEY in that
case, but this gets lost in libdevmapper.

This fixes this: in _create_and_load_v4() it copies the error code from
the ioctl from the sub-tasks back to the main task field on failure.

This is not enough to make libcryptsetup actually propagate the ENOKEY
correctly, that also needs a patch to libcryptsetup, but this is part of
the puzzle.
2023-10-11 15:35:33 +02:00
David Teigland
63b469c160 device_id: fix hints with device ids
Fix some interactions between device IDs and hints.  Hints
may limit the scanned devices which should not always trigger
a search for the PVs that were intentionally not scanned.
Hints should also be invalidated if they contain a device
that's become excluded by an internal filter such as the
device_id filter.
2023-10-10 11:47:29 -05:00
David Teigland
f20be398a1 device_id: refresh devname idnames if any are not found
Search for a PV on other devices if it's a devname entry
and the name doesn't exist on the system.  This restores
code that should not have been removed in commit 1901a47df
"device_id: fix conditions for device_ids_refresh"
2023-10-10 11:46:21 -05:00
David Teigland
25a87ea16a device_id: fix lvmdevices update segfault
From commit 1901a47df1
"device_id: fix conditions for device_ids_refresh"
2023-10-06 12:24:34 -05:00
Zdenek Kabelac
f960fe0578 tests: delay_dev to slowdown pvmove
throtling mirror device is becoming useless with faster CPUS,
as way to many data can be transferred before throttling steps-in.
So prefer using  dm-delay for test and keep throttling as fallback.
2023-10-06 10:51:15 +02:00
Zdenek Kabelac
2c3742039c tests: skip test if the memory cannot be allocated in kernel 2023-10-06 10:51:15 +02:00
Zdenek Kabelac
f5512315d2 tests: ignore failure from stop 2023-10-06 10:51:15 +02:00
Zdenek Kabelac
37329e4184 tests: add delay to let dmevent initalize
There is short time period needed to fully initilize dmeventd and
handle 'kill' signal.
2023-10-06 10:51:15 +02:00
Zdenek Kabelac
44f86d38f9 debug: fix message severity levels
Add some missing WARNS and correct some severity levels.
2023-10-06 10:50:26 +02:00
David Teigland
1901a47df1 device_id: fix conditions for device_ids_refresh
Fix commit 847f1dd99c
"device_id: rewrite validation of devname entries"

which began calling device_ids_refresh() in cases where it
was unnecessary, leading to extra PV searches and warnings.
Specifically, a command like "lvs <vg>" would use the hints
file to scan only devices for the named VG.  This means that
scanning other PVs would be skipped, and device IDs of those
PVs could not be validated because there are no PVID values
to verify.  This missing info would cause messages about
the missing info, and would cause device_ids_refresh to
search for the PVs that had been intentionally skipped.
2023-10-05 15:33:55 -05:00
Zdenek Kabelac
bccfd92f4a tests: previous patch wrongly replaced tab
Tab overwrote first char instead of insert.
Actually it should be a single function.
2023-10-05 01:11:54 +02:00
Zdenek Kabelac
ede63b5029 tests: more complex check for resize of reiserfs
Detection of how the command is supposed to behave actually depends on
the configure.h compilation and whether binary is compiled with
HAVE_BLKID_SUBLKS_FSINFO.

This makes it somewhat complicated in a way how to recognize which
behavior is expected.

Currently we can eventually recognize by checking error output
of some 'random' lvresize command and see if the --fs checksize is
actually recognized and rejected.  If this changes - test needs
to be updated.
2023-10-05 00:03:30 +02:00
Zdenek Kabelac
b80404f2c6 tests: utils use read without slash mangling
Do not use backslash as escape character for path.
2023-10-04 23:58:54 +02:00
Zdenek Kabelac
470f1058a8 tests: better coredump lookup
Some bash version may have problem with contruct:
done < <(

Replace it with array reading.
2023-10-04 23:58:54 +02:00
Zdenek Kabelac
e3adccb528 tests: retry removal
After umout we may race with system udevd rule - so
just retry once again after 1s sleep - that should be
enough - otherwise we would need some loop here...
2023-10-04 22:05:22 +02:00
Zdenek Kabelac
e72e130e9d tests: convert to heredoc string
Multi-line echo command are problemat across variety of bash version
and may have produce shorter results.
Convert to stable heredoc string with 'tab' skipping <<- for better
formating.
2023-10-04 22:05:22 +02:00
Zdenek Kabelac
4edaa9fdf5 filters: leave device_id_sysfs_dir only for device_id
Do not use filters for sysfs with device_id.
2023-10-04 22:03:56 +02:00
Zdenek Kabelac
8f61a127b5 tests: fix reader for runner
Since we now push more data into journal, parser reading this file
for --continue mode need to be adapted.
Also properly align batch mode with '.' for max test length name.
2023-10-03 21:32:12 +02:00
Zdenek Kabelac
cf46f4baee filters: sysfs use device_id_sysfs_dir
This is mainly useful in internal testing - but keep sysfs dir also
passed to filter.
Also drop use of static variable within sysfs filter and base whole
config at creation time.
2023-10-03 21:30:22 +02:00
Zdenek Kabelac
0e8c631f5e tests: old g++ needs explicit cast 2023-10-03 12:59:38 +02:00
Zdenek Kabelac
c818f3dabc tests: give some more time to die
VMs are not top performers here...
2023-10-03 12:46:32 +02:00
Zdenek Kabelac
48fd6d6d40 tests: restore old fsync method
New code isn't portable across wider range of c++ compilers.
2023-10-03 12:46:32 +02:00
Zdenek Kabelac
6f52091668 tests: give dmeventd some time to restart
We need to wait for a new dmeventd as fork new daemon from bash.
2023-10-03 02:01:29 +02:00
Zdenek Kabelac
d01e9de8b8 tests: add RT_LIBS for older g++ 2023-10-03 02:01:29 +02:00
Zdenek Kabelac
13bf42b8b8 tests: restore fsync for runner
Restore fsync() call For more accurate tracking by buildbot.
Try different rather tricky way of static_cast to use
already opened FD instead of seperate open(),fsync(),close().

It's pretty strange there is no way to enforce fsync() for
C++ iostreams.  Flush() is actully not equal.
2023-10-03 01:58:23 +02:00
Zdenek Kabelac
a540b3f189 make: generate 2023-10-03 00:02:46 +02:00
Zdenek Kabelac
36bccbc4f3 tests: skip some tests on valgrind run
Skip some tests that takes too much time with valgrind pass.
2023-10-03 00:02:46 +02:00
Zdenek Kabelac
3c70c243c5 tests: aux use dmsetup concise
A bit faster creation of multiple devices with dmsetup --concise.
Also solves the 'cookies' handling.
2023-10-03 00:02:02 +02:00
Zdenek Kabelac
19df4510c2 tests: faster creation of 200 PVs
Use already existing optmized aux version
2023-10-03 00:01:34 +02:00
Zdenek Kabelac
80899f7010 tests: runner compatible with older g++
Avoid using some constructs available with newer C++ only.
Moving timing into to journal instead of list file.
2023-10-03 00:00:01 +02:00
Zdenek Kabelac
ffaff7afa6 tests: better handling of system dir
Use more consistenly location of etc dir in tests.
Read value of etc dir via lvm cmd.
2023-10-02 14:25:52 +02:00
Zdenek Kabelac
e3cee67d77 tests: reiserfs needs fsadm
With plain -r we currenly issue an error message.
2023-10-02 14:25:52 +02:00
Zdenek Kabelac
368ab3051f tests: reduce slowing down of device
Too high value currently may result in occasional race problem with
device deactivation.
2023-10-02 14:25:52 +02:00
Zdenek Kabelac
529fe9ef75 tests: aux reuse already pgrep of dmeventd
Test already checks if there is any dmeventd running in the system
in the inittest.
2023-10-02 14:25:52 +02:00
Zdenek Kabelac
e3dd3424fc tests: enhance runner
Add Timespec class to increase time resolution to miliseconds
(can switch to microseconds if ever needed).
Use more const and const_interators and pass by reference.
Output rusage also to list result file.
Reduce inlining of C++ constructors.
2023-10-02 14:24:04 +02:00
Zdenek Kabelac
d7b4a4ce01 debug: stacktracing failure 2023-10-02 14:13:12 +02:00
Zdenek Kabelac
df9e5f39a7 debug: correct check for failing close 2023-10-02 14:13:12 +02:00
David Teigland
88aa285a79 devices: refresh device ids if the system changes
If the system changes, locate PVs that appear on different devices,
and update the device IDs in the devices file.  A system change is
detected by saving the DMI product_uuid or hostname in the devices
file, and comparing it to the current system value.  If a root PV
is restored or copied to a new system with different devices, then
the product_uuid or hostname should change, and trigger lvm to
locate PVIDs from system.devices on new devices.
2023-09-27 15:22:11 -05:00
Zdenek Kabelac
d06378373e WHATS_NEW_DM: update 2023-09-26 01:32:48 +02:00
Zdenek Kabelac
cb8486a9b2 tests: check exit_on works 2023-09-26 01:24:38 +02:00
Zdenek Kabelac
d54deae0ad debug: correcting check for error
Correct trace for erroring case of close.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
e930ee93f7 debug: correct level
No error for just tracing message.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
a9d7a9d128 dmeventd: implement exit_on file check
When exit on file is present in a system and term/break signal is
catched, them dmeventd is no longger refusing to exit.

For the correct shutdown, there should be ideally unmonitoring call,
however in some case it's very hard to implement this correct procedure.

With this 'exit on' file dmeventd at least avoid 'blocking' shutdown,
before systemd kills use with -9 anyway possibly even in some unwanted
stated of internal dmeventd processing (i.e. in the middle of some lvm
command processing).
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
3da18a06d8 configure: autoreconf 2023-09-26 01:23:00 +02:00
Zdenek Kabelac
744cdc3ba8 configure.ac: add --with-dmeventd-exit-on-path 2023-09-26 01:23:00 +02:00
Zdenek Kabelac
80d34abf49 dmeventd: info status report
To quickly get info about some internal dmeventd status,
implment   'dmeventd -i' support.

Reported messages are some 'raw' internal informations mainly
useful to developers.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
637d812df5 dmeventd: unregister all devices on restart
Instead of just exiting in the middle of monitoring,
unregisted all monitored devices first and then exit.

To speedup this path, all send internal SIGINT when thread
unregiters itself, to wakup-up main sleeping loop.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
c31dcf3632 dmeventd: use return
Use 'return' instead of calling exit() when possible.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
396024713f dm-event: reset descriptors
Reset descriptors after closing them to -1.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
a203499ba3 dm-event: release buffer on dm_event_get_version
Avoid memory leak in this function.
2023-09-26 01:23:00 +02:00