1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-14 04:59:04 +03:00

18052 Commits

Author SHA1 Message Date
Zdenek Kabelac
bdd823b4b1 validation: support empty lv segments
Revert 373372c8ab3749bc76ced37cec04b00aae6e5979 and instead update
our validation code to handle LVs with empty segment - currently
we should need this only for pvmove operation, thus such LV should
have name  'pvmove%u'.

This fixes a problem where user tried i.e. pvmove on a VG with single
PV - as reported: https://github.com/lvmteam/lvm2/issues/148

Reported-by: bob@redhat.com
(cherry picked from commit 07b6174f7cb3ac70df2791d54f654d6d5ca36169)
2025-02-12 09:20:03 +01:00
Zdenek Kabelac
4f4a5c39ae tests: check exit_on works
(cherry picked from commit cb8486a9b2d6f3c73749f98287cad6adbc4f857f)
2025-01-22 20:13:39 +01:00
Zdenek Kabelac
490631e2cd debug: correct level
No error for just tracing message.

(cherry picked from commit e930ee93f7361a7b0b7a357acc4187bf630b7f14)
2025-01-22 20:13:39 +01:00
Zdenek Kabelac
b7dd2a9e59 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).

(cherry picked from commit a9d7a9d1289d7cafa1db5fd1e41417bf4f7709d1)
2025-01-22 20:13:39 +01:00
Zdenek Kabelac
c499428897 configure: autoreconf
(cherry picked from commit 3da18a06d8e0671374f9bf8b841017cfd5d1e5ea)
2025-01-22 20:13:35 +01:00
Zdenek Kabelac
ebe966020d configure.ac: add --with-dmeventd-exit-on-path
(cherry picked from commit 744cdc3ba885f9dc8e1444cb77a190d5ea0007ed)
2025-01-22 20:13:25 +01:00
Zdenek Kabelac
7dfa1f3d0d 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.

(cherry picked from commit 80d34abf4974e45471f947fb2b85146a30feb87d)
2025-01-22 19:45:21 +01:00
Zdenek Kabelac
bc94a75dc4 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.

(cherry picked from commit 637d812df56440d792ab403f63e50583d78cdfef)
2025-01-22 19:45:17 +01:00
Zdenek Kabelac
d7f61ce393 dmeventd: use return
Use 'return' instead of calling exit() when possible.

(cherry picked from commit c31dcf3632988ef4e8d1c62a685f4c436b5f115e)
2025-01-22 19:45:12 +01:00
Zdenek Kabelac
068897bbd1 dmeventd: move var set to locked section
It should not change the actual code flow, however make the
set of the current_event variable inside locked section.

(cherry picked from commit 29630b2d7fcb28827f0c928edd6cd638f6ea2591)
2025-01-22 19:45:07 +01:00
Marian Csontos
e85d3a5487 spec: Install and package /etc/lvm/devices
(cherry picked from commit ee31ba5023e6e1430c0d808f54015ccd3eb3931a)
2024-02-02 16:02:23 +01:00
David Teigland
c78f2e6ee2 remove unused variable
resulting from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a
  "lvmcache: remove lvmcache_update_vg_from_write"

(cherry picked from commit 0c80ea88477b3511562036748d3bf837bf7b3e8b)
2024-01-31 20:40:15 +01:00
David Teigland
05bb44d821 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.)

(cherry picked from commit 18f451e09e943eb3d51f8394f6fe8967e1e9f565)
2024-01-31 20:40:04 +01:00
David Teigland
2ae69ffd78 lvmcache: remove lvmcache_update_vg_from_write
After a vg_write, this function was used to attempt to
make lvmcache data match the new state written to disk.
It was not updated correctly in a many or most cases,
and the resulting lvmcache is not actually used after
vg_write, making the update unnecessary.

(cherry picked from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a)
2024-01-31 20:39:54 +01:00
David Teigland
b7334daa69 vgsplit: don't reread vg_to
The destination vg is first written with the EXPORTED flag,
then the source vg is written, then the destination vg is
written again without the EXPORTED flag.  Remove an unnecessary
vg_read of the destination vg just before the second write.

(cherry picked from commit 5e428d22d9647a294eba65852078947df5ade48f)
2024-01-31 20:39:43 +01:00
Heinz Mauelshagen
1c773b7696 raid: add messages to lvs command output in case RaidLVs require a refresh
If a RaidLV mapping is required to be refreshed as a result of temporarily failed
and recurred RAID leg device (pairs) caused by writes to the LV during failure,
the requirement is reported by volume health character r' in position 9 of the
LV's attribute field (see 'man lvs' about additional volume health characters).

As this character can be overlooked, this patch adds messages to the top
of the lvs command output informing the user explicitely about the fact.

(cherry picked from commit b69f73b13ee55ef3feb7427c6dc099dc3472d9fc)
2024-01-31 20:24:39 +01:00
heinzm
b9b28ee11a 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.

(cherry picked from commit 05c2b10c5d0a99993430ffbcef684a099ba810ad)
2024-01-31 19:56:48 +01:00
Heinz Mauelshagen
54576eb1e4 lvconvert: fix "lvconvert -m 0" for in-sync legs
With commit d7e922480e04ecfb7c4d8b2d42533699ddef5c34
lvconvert -m   may fail if we try to remove 1st. leg that
is out-of-sync while other leg is in-sync.

Hot fix allows to proceed with such down conversion.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
(cherry picked from commit e41da923a3bec2df603b54f0f466e9574b6544db)
2024-01-31 19:56:05 +01:00
heinzm
3b5e2537ae 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.

(cherry picked from commit d7e922480e04ecfb7c4d8b2d42533699ddef5c34)
2024-01-31 19:55:56 +01:00
Lukas Herbolt
4db199be5c man: add inte(g)rity to man lvs
(cherry picked from commit 7b64d9946d6a3be84338ad976383b6ab53e97484)
2024-01-31 19:07:12 +01:00
Ranjith ML
4d602fc32a archiving: Fix doubled filename in vgcfgrestore
(cherry picked from commit 1c3ae2b678ddae0c1916caca4dbe65049dcea3d7)
2024-01-31 19:07:01 +01:00
Samanta Navarro
3d6f6b58f6 doc: fix typos in documentation
Typos found with codespell.

(cherry picked from commit aec5e573afe610070eb2c6bed675d2a7c0efc7e8)
2024-01-31 18:53:07 +01:00
Marian Csontos
cf7e7e0041 man: Fix typo 2024-01-31 18:48:24 +01:00
Marian Csontos
34255cb85a vdo: Sync lvm_import_vdo.sh with main as of 970e4d295edd. 2023-09-14 17:14:37 +02:00
Marian Csontos
54cdf9bffd [WIP] Add .gitlab-ci.yml 2023-07-27 14:56:21 +02:00
Zdenek Kabelac
adaa703488 vdo: use long --verbose
vdo tools needs long option.

(cherry picked from commit 1c2782354c9ad49f1e2c9af58d7f5085f0632cb5)
2023-07-27 14:56:21 +02:00
Zdenek Kabelac
50b89ccac3 vdo: support version 4
Properly parse VDO volumes formatted with geometry block version 4.0.

(cherry picked from commit b90c5d60156c59c33ac440dd5ea7681457684f64)
2023-07-13 15:06:43 +02:00
Zdenek Kabelac
e6fc4b2d36 lvm_import_vdo: spelling fixes
(cherry picked from commit 8a07f57ba478c16ca5d5eacf778ee2708109aa65)
2023-07-13 15:02:33 +02:00
Zdenek Kabelac
d50c0cdcda vdo: lvm_import_vdo correct parsing output
Output from vdo manager may actually indent output with spaces,
so trim leading and ending space.

Also add support for verbosity flag for vdo conversion tool.

(cherry picked from commit 8b75bbe47d2a2961b0fb029ad7a01dc37ee6a8e5)
2023-07-13 15:02:31 +02:00
Zdenek Kabelac
eb32a7ca3e vdo: indent for lvdisplay
(cherry picked from commit e48c9826e3069b06a5aa31e1e59200dce4915983)
2023-07-13 15:02:29 +02:00
Zdenek Kabelac
e001f919e8 vdo: check_point_frequence is unused option
This vdo parameter existed in the early stage of integration of vdo into lvm2,
but later it's been removed from vdoformat tool - so actually if
there would be any non-zero value it would cause error on lvcreate.
Option was not stored on disk in lvm2 metadata.

Remove this vdo parameter from lvm2 sources.

(Although this vdo parameter will be still accepted on cmdline through
 --vdosettings option, but it will be ignored.)

(cherry picked from commit 6ff65e675582265a673136f1edd5358b26c9e481)
2023-07-13 15:02:26 +02:00
Zdenek Kabelac
36ef0612d9 tests: update test for automatic virtual size correction
lvm_import_vdo will adjust the virtual size within conversion
so the volume can be use without any futher tweaking.

(cherry picked from commit 8d09124c6204d49f6bda833229c96e8a76665127)
2023-07-13 15:02:02 +02:00
Zdenek Kabelac
3603348e50 lvm_import_vdo: correct the converted virtual size
Ensure the volume after conversion has the properly aligned size to the
volume group extent size. This would be visible when using virtual size,
that cannot be divided by extent size.

Before the user had to manually adjust the size after conversion to get
access to all data stored on VDO volume.

(cherry picked from commit 657dde6208ddc8172b7d0e1466751046c8ddaeaa)
2023-07-13 15:02:00 +02:00
Zdenek Kabelac
d698509aa8 WHATS_NEW: update
(cherry picked from commit 7ac5dbfd09e771f087a9467aca8a0d5905084459)
2023-07-13 15:01:34 +02:00
Zdenek Kabelac
a621c3a6dc tests: updates
Add some more complicated conversion tests.

(cherry picked from commit 9105890d43bd1b6fe514114f671af2e946e13083)
2023-07-13 14:58:40 +02:00
Zdenek Kabelac
0fe0f35cda 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.

(cherry picked from commit 0fed9b097120648301faa586970a47b8b4d629ff)
2023-07-13 14:58:13 +02:00
Zdenek Kabelac
f38f893139 tests: vdo manager wrapper tool updates
Support size specification in KiB units.
Add some theoretical support for some new options from vdoprepareforlvm.

(cherry picked from commit 7f661a24c4f7fa8f161f17da093e456f0d60e106)
2023-06-22 18:05:56 +02:00
Zdenek Kabelac
f8ef830ccc vdo: man updates for lvm_import_vdo
(cherry picked from commit 17ee5df8576acf628d88fd6840ce55aa1388d6d1)
2023-06-22 18:05:53 +02:00
Zdenek Kabelac
80a59e88c9 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.

(cherry picked from commit be6c34212b05d8c59c0ba68e26c56cddf61c9f04)
2023-06-22 18:05:45 +02:00
Marian Csontos
062b014c04 tests: cleanup some shellcheck warns
(manually backported some changes from commit 773bc013778df631f9ee14e7a79d5f02211b1e67)
2023-06-22 18:01:27 +02:00
Zdenek Kabelac
3b7c0786cc 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).

(cherry picked from commit 00633f8b668d94a58756d96f5927fd690b8f41d3)
2023-06-22 17:43:17 +02:00
Zdenek Kabelac
5e6aa69ec0 vdo: document feature option
(cherry picked from commit 534269d0fb834fb9a3b115bf859319fc1acb2275)
2023-06-22 17:43:10 +02:00
Zdenek Kabelac
51e90d49ba vdo: use fixed size vdopool wrapper
Instead of using size of 'empty header' in vdopool use fixed size 4K
for a 'wrappeing' vdo-pool device.

This fixes the issue when user tried to activate vdo-pool after
a conversion from vdo managed device with 'vgchange -ay' - where
this command activated all LVs with 'vdo-pool' wrapping device as well,
but this converted pool uses  0-length header.

This 4k size should usually prevent other tools like 'blkid' recognize
such device as anything - so it shouldn't cause any problems with
duplicate indentification of devices.

(cherry picked from commit e8e6347ba3f59cbd2f7e92aa707543b90fa607a3)
2023-06-22 17:43:03 +02:00
Zdenek Kabelac
31e71842d4 tests: check failing vdo conversion
When we detect not usable vdo on a machine, check lvconvert fails.

(cherry picked from commit 06c5c29443fdd48730a282a5db16e46c793db27b)
2023-06-22 17:42:54 +02:00
Zdenek Kabelac
686d6ecdcc tests: vdo resizing
(cherry picked from commit aa09232dc4fb825f4e643bbe87a95e2318dd5a93)
2023-06-22 17:42:41 +02:00
Marian Csontos
7274949166 vdo: resize requires active vdopool volume
ATM kernel VDO target does not handle resize of inactive VDO LVs
so prevent users corrupting such LVs and require active such LVs.

(manually backported from commit c20f01a0cbb24e8276734a00f26a510cf6daaf21)
2023-06-22 16:55:47 +02:00
Zdenek Kabelac
a22a9aa39b vdo: fix and enhance vdo constain checking
Enhance checking vdo constains so it also handles changes of active VDO LVs
where only added difference is considered now.

For this also the reported informational message about used memory
was improved to only list consuming RAM blocks.

(cherry picked from commit 2451bc568feb9b3d0cb4d7c15e3c723f4d0c8cc9)
2023-06-21 09:49:50 +02:00
Zdenek Kabelac
52e019c613 lvcreate: fix error path return values
Return failing error code for return path, as 'return 0' in this
case was returning success.

(cherry picked from commit b9f35e07db41f3dd6bea2c91a8bc1bff93a4d406)
2023-06-21 09:46:54 +02:00
Zdenek Kabelac
696036c20f vdo: read live vdo size configuration
Introduce struct vdo_pool_size_config usable to calculate necessary
memory size for active VDO volume.

Function lv_vdo_pool_size_config() is able to read out this
configuration out of runtime DM table line.

(cherry picked from commit 1bed2cafe83096cf01cfff5cd2cd64ecb32b7d78)
2023-06-21 09:19:21 +02:00
Zdenek Kabelac
71c8df45c7 vdo: check memory only in non critical section
When we are actually resizing VDO device - we need to check size only in
non-critical section - otherwise we are checking

(cherry picked from commit 773b88e028ab2965a8c185f5f2147334f8f2bbfd)
2023-06-21 09:19:19 +02:00