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

18547 Commits

Author SHA1 Message Date
Zdenek Kabelac
9105890d43 tests: updates
Add some more complicated conversion tests.
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
7f661a24c4 tests: vdo manager wrapper tool updates
Support size specification in KiB units.
Add some theoretical support for some new options from vdoprepareforlvm.
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
734d9791f8 tests: tmp dir inside test dir
Keep even temporary files within testing dir so generated files are
not left behind in system's /tmp directory.
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
4d64838048 cov: drop unneeded constness
If we want to have const structure - use a const pointer to avoid,
however making individual members const make it only assingle
in construct time and we already violate this logic since
we memcpy into the structure -  so drop these unnecessary consts...
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
17ee5df857 vdo: man updates for lvm_import_vdo 2023-06-09 18:01:16 +02:00
Zdenek Kabelac
be6c34212b vdo: enhance lvm_vdo_import
Add support for usage of 'dm-snapshot' for doing whole device conversion
in a snapshot which could be merged once the whole conversion has been
made.
This helps with cases where there would be any unexpected failure in the
middle of conversion process and user can continue using original
device until problem in conversion is fixed.

Import tool now uses 'truncate' tool to create a small backend file (20M) for loop device
to hold COW exception store.

Option  --vdo-config has been added to allow specifing location of vdo
configuration file.

Option --no-snapshot allows to use import tool without creation of
snapshot, however recovery after finished VDO conversion and unfinished
lvm2 conversion is then very difficult.

Option --uuid-prefix allow to specify DM UUID prefix for snapshot
device.

Use read with -r.
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
00633f8b66 vdo: fix and enhance vdo metadata reader
Improve metadata parser to handle volume_geometry bio_offset,
which needs to be substracted from 'region' start_block when present.

This bio_offset block is non-zero i.e. with converted VDO volumes.

Also fix some converted structure value (but they are not in use).
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
fcf2057b38 cmd_enum: correct inclusion
Ensure we use generated header file for this build from -Iinclude.

Reported-by: Anton Lundin <glance@ac2.se>
2023-06-09 18:01:16 +02:00
David Teigland
74feebdab7 device_id: fix handling of non-PV with duplicate serial number
Fix in the code that matches devices to system.devices entries when
the devices have the same serial number.  A non-PV device in
system.devices has no pvid value, and the code was segfaulting
when checking the null pvid value.
2023-06-08 12:24:05 -05:00
David Teigland
8e53b3bc14 man: lvmraid update limitations 2023-06-05 10:43:51 -05:00
Peter Rajnoha
e2ecc6c763
reporter: restore report type to initial value after processing report_for_selection
If we are executing 'report_for_selection' to do an internal report
just for the selection itself (not for display), we can call it more
than once. In that case, we are reusing the same selection handle
(e.g. inside 'process_each_lv_in_vg').

The selection handle has 'report_type' field which is a union of all
report types needed for the report based on selection fields we actually
use.

The 'report_type' is further clarified based on checks and rules inside
'_get_final_report_type' which 'report_for_selection' calls. Then, this
final report type unambiguously identifies proper branch to take in
'report_all_in_{pv,vg,lv}' that is called next.

If the 'report_for_selection' is called more than once with the same
selection handle, we need to make sure that we always restore the report
type to its initial value, so all the rules inside 'report_for_selection'
are applied correctly next time.

This patch fixes the missing restoration of the 'report_type' value in
'selection_handle' that is reused for recurring 'report_for_selection'
calls.

An example scenario where this failed was with selecting an LV for
removal with "lvremove --select" while using a field in the selection
that required extra DM info or DM status call for the LV (that is,
"Logical Volume Device Info Fields" and "Logical Volume Device Status Fields"
as visible in 'lvs -S help').
2023-05-31 09:38:11 +02:00
David Teigland
0591131a53 lvreduce: simplify _lvseg_get_stripes integrity check
Simplify unnecessary loop to avoid coverity complaint.
2023-05-25 12:09:41 -05:00
David Teigland
4cdb178968 device_id: ignore trailing underscores in t10 wwid from devices file
In previous lvm versions, trailing spaces at the end of a t10 wwid would
be replaced with underscores, so the IDNAME string in system.devices
would look something like "t10.123_".  Current versions of lvm ignore
trailing spaces in a t10 wwid, so the IDNAME string used would be
"t10.123".  The different values would cause lvm to not recognize a
device in system.devices with the trailing _.  Fix this by ignoring
trailing underscores in the IDNAME string from system.devices.
2023-05-19 14:05:10 -05:00
David Teigland
24e4b6df11 tests: integrity-caching: ensure raid redundancy
The recent fix 05c2b10c5d ensures that raid LV images are not
using the same devices.  This was happening in the lvextend commands
used by this test, so fix the test to use more devices to ensue
redundancy.
2023-05-17 14:15:25 -05:00
David Teigland
3a75704756 tests: integrity: snapshots now work on raid+integrity 2023-05-17 11:10:45 -05:00
Peter Rajnoha
3b4e7d1625
toollib: provide proper hint for referencing VG uuid in case of duplicate VG names
vgrename does not support -S|--select, so do not provide a hint about
using it. Instead, provide a hint about using VG uuid directly.

❯  vgs
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  VG     #PV #LV #SN Attr   VSize   VFree
  vg1      1   0   0 wz--n- 124.00m 124.00m
  vg1      1   0   0 wz--n- 124.00m 124.00m

(vgrename does not support -S|--select)
❯  vgrename vg1 vg2
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  Multiple VGs found with the same name: skipping vg1
  Use VG uuid in place of the VG name.

(vgchange does support -S|--select)
❯  vgchange --addtag a vg1
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  Multiple VGs found with the same name: skipping vg1
  Use --select vg_uuid=<uuid> in place of the VG name.
2023-05-16 17:17:55 +02:00
David Teigland
fd6e113bba raidintegrity: allow snapshots 2023-05-11 11:02:52 -05:00
heinzm
05c2b10c5d Fix "multisegment RAID1, allocator uses one disk for both legs"
In case of e.g. 3 PVs, creating or extending a RaidLV causes SubLV
collocation thus putting segments of diffent rimage (and potentially
larger rmeta) SubLVs onto the same PV.  For redundant RaidLVs this'll
compromise redundancy.  Fix by detecting such bogus allocation on
lvcreate/lvextend and reject the request.
2023-05-10 18:35:21 +02:00
Zdenek Kabelac
bf794b66f4 tests: more updates for 300M xfs
Fix some sizing for larger xfs testing.
Also fix resize of reiserfs which requires resize_fsadm.
2023-05-10 16:19:46 +02:00
Zdenek Kabelac
bc28082b99 tests: skip this testing without newer blkid
Testing xfs --fs functionality needs new blkid.
2023-05-10 16:19:46 +02:00
Zdenek Kabelac
d418fc14f4 cov: hide some false positives
Hide some false positives.

Note: there must not a be blank line after coverity hiding comment.
2023-05-10 16:19:46 +02:00
Zdenek Kabelac
cc7c41abbd cov: remove unneeded header file inclusion 2023-05-10 15:27:48 +02:00
Zdenek Kabelac
7b52a663a6 cov: validate dev_get_primary_dev result
Make sure primary_dev is defined when using it.
2023-05-10 15:27:48 +02:00
Zdenek Kabelac
0cc5c2203b tests: needs to be exported for tracing 2023-05-06 22:43:22 +02:00
Zdenek Kabelac
7267322fc1 tests: adapt for xfs 300M min size
Some test still were missed to be converted for XFS 300M min size.
2023-05-06 22:43:22 +02:00
Zdenek Kabelac
4af8063c96 tests: different check for mounted volume
It appears newer mount allows repeated mounting ??
Anyway - do the check with grep.
2023-05-06 22:43:22 +02:00
Zdenek Kabelac
2fde4b6baa tests: check for lvmdbusd running in the system
Check for running (possibly leftover) lvmdbusd running in the
system - as this daemon may interfere with this test as in this
case both be operating on same  'live' data in /run/lvm.
2023-05-06 22:43:22 +02:00
Zdenek Kabelac
aa19f2aa3d tests: update lvextend tests
Make test faster by agregating sets of operation to work on a single
created filesystem yet checking all the variants of extension and reduction.

Split 'xfs' part into separate test and convert it for use of the
minimal size 300M nowdays required by mkfs.xfs.
2023-05-06 22:43:22 +02:00
Zdenek Kabelac
6e8ede833b aux: retry brd removal
Try to remove brd twice if there is some collision with udevd.
Instanciate only 1 ramdisk.
Use just 'eval' for '--nameprefixes' results.
2023-05-06 22:41:23 +02:00
Zdenek Kabelac
87eae82195 aux: wipefs_a takes list of devices
Enhance function to take list of device so set of devices
can be wiped with a single call:

aux wipefs_a  "$dev1" "$dev2"
2023-05-06 22:40:23 +02:00
Zdenek Kabelac
534269d0fb vdo: document feature option 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
58293173cf cov: check syscall result 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
f038fc3b17 cov: remove unused but set variables 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
c451d7925d cleanup: correcting some log_print
Correcting to log_print_unless_silent(),
so -qq can do some work.
2023-05-06 20:38:49 +02:00
Zdenek Kabelac
39b2bd06b8 cov: some initializers 2023-05-06 19:22:05 +02:00
Zdenek Kabelac
4fd2f433ad cov: hide problem with 64bit time_t 2023-05-06 19:22:05 +02:00
Zdenek Kabelac
242bf56413 cov: validata top_lv
Add explicit pointer check is never NULL.
2023-05-06 19:22:05 +02:00
Zdenek Kabelac
fae0ed8f10 cov: ensure there is either vg or error_vg
Make it explicitely visible to coverity that
_process_pvs_in_vg() is not passing  NULL vg.
2023-05-06 19:22:05 +02:00
Zdenek Kabelac
871d9f379f cov: ensure NULL baton is not dereferenced 2023-05-06 19:22:05 +02:00
Zdenek Kabelac
662020c221 cov: simplier code
Avoid coverity to contruct some abstract scenarions of 'cft'
modification and simplify the code at the same time.
2023-05-06 19:22:05 +02:00
heinzm
d7e922480e Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync"
Bail out in case first rimage is out-of-sync.
Refresh first, i.e. "lvchange --resync $RaidLV",
then retry downgrade to linear after resynchronization.
2023-05-05 20:51:58 +02:00
David Teigland
368381fd40 lvreduce: make _lvseg_get_stripes handle integrity layer
lvreduce uses _lvseg_get_stripes() which was unable to get raid stripe
info with an integrity layer present.  This caused lvreduce on a
raid+integrity LV to fail prematurely when checking stripe parameters.
An unhelpful error message about stripe size would be printed.
2023-05-03 11:34:59 -05:00
David Teigland
c4440b5b49 pvck: improve error for write to existing file 2023-04-28 13:31:39 -05:00
David Teigland
6d262eaf64 lvmcache: fix valgrind error when dropping md duplicate
When lvmcache info is dropped because it's an md component,
then the lvmcache vginfo can also be dropped, but the list
iterator was still using the list head in vginfo, so break
from the loop earlier to avoid it.
2023-04-25 14:46:36 -05:00
Zdenek Kabelac
ffead4f333 tests: adapt waiting for pvmove start
Previous commit cause the pvmove could actually be started in unexpected
order - so make sure, we are not starting new pvmove in same VG until
the previous one is started.
2023-04-25 19:51:52 +02:00
Zdenek Kabelac
7f2939d328 tests: utils now print also df_h
Add info about space usage on devices after the test.

Add some more skipped dirs.
2023-04-25 19:02:39 +02:00
Zdenek Kabelac
7b88c9f619 tests: some aux corrections
Keep backups within test_dir instead of dev_dir (so it doesn't
leak large files there if the tests are run over real /dev dir).

Move restoring of dm_mirror throttling before test_dir is removed.
2023-04-25 18:59:04 +02:00
Zdenek Kabelac
4a003ba671 tests: fix pattern for raid4
Since the strip in raid4 might be XOR - we might eventually end
with 2 blocks of 'B' on 2 disks - so will rest of stripe with 'b'.
2023-04-25 00:12:31 +02:00
Zdenek Kabelac
7c8901dabd tests: use 300M lv size for xfs 2023-04-25 00:12:31 +02:00
Zdenek Kabelac
e42b56c31b tests: try to retry remove of scsi_debug
Not quite sure if this helps anything, some of testing
machines can't reliably remove scsi_debug, reporting
they are in use - but it's not easily reproducible...
2023-04-25 00:12:31 +02:00