1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-09 01:18:39 +03:00
Commit Graph

18005 Commits

Author SHA1 Message Date
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 b9f35e07db)
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 1bed2cafe8)
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 773b88e028)
2023-06-21 09:19:19 +02:00
Zdenek Kabelac
05b4d98a51 vdo: fix reader error path
Nothing to be closed on this error path.

(cherry picked from commit b6b1c19365)
2023-06-21 09:19:14 +02:00
Zdenek Kabelac
57eb6c1b9c vdo: improve validation message
Rephrase.

(cherry picked from commit 403779333b)
2023-06-21 09:18:49 +02:00
Zdenek Kabelac
c66a3010e0 vdo: enhance detection of virtual size
Improve detection of VDO virtual size - so it's not reading VDO
metadata when VDO device is already active and instead we reuse
existing table line for knowing existing metadata size.

NOTE: if there is ever going to be added support for reduction
of VDO virtual size - this method will need to be reworked to
allow size difference only within 'extent_size' alignment.

(cherry picked from commit 8e9410594b)
2023-06-21 09:18:44 +02:00
Zdenek Kabelac
f67de990a6 vdo: replace errors with debug
As we actully use reading of VDO metadata only as extra 'information' source,
and not error command - switch to 'log_debug()' severity with messages
out of parser code.

(cherry picked from commit 218c7d44b5)
2023-06-21 09:18:42 +02:00
Zdenek Kabelac
9399376608 device_mapper: vdo V4 avoid messaging
With V4 format build table line with compression and
deduplication and skip sending any messages to set up
these parameters.

(cherry picked from commit 36a923926c)
2023-06-21 09:18:38 +02:00
Zdenek Kabelac
13ce88a2b2 dev_manager: accept misalined vdo pools.
Since lvm2 may create VDO pool virtual size aligned only on extent size
while VDO itself is just 4K aligned - we need to support such misalign.

(cherry picked from commit 2e79b005c2)
2023-06-21 09:18:34 +02:00
Zdenek Kabelac
fd16a667a9 device_mapper: add parser for vdo metadata
Add very simplistic parser of vdo metadata to be able to obtain
logical_blocks stored within vdo metadata - as lvm2 may
submit smaller value due to internal aligment rules.

To avoid creation of mismatching table line - use this number
instead the one provided by lvm2.

(cherry picked from commit 829ab01708)
2023-06-21 09:18:31 +02:00
Zdenek Kabelac
fc1c105c75 tests: vdo emulation without vdo binary
Avoid inserting 'vdo' binary into path - and use
alias and VDO_BINARY shell vars for emulation.

(cherry picked from commit 15ad2b8e55)
2023-06-21 09:18:19 +02:00
Zdenek Kabelac
c3d533a0ea vdo: extend volume and pool without flush
When the volume size is extended, there is no need to flush
IO operations (nothing can be targeting new space yet).
VDO target is supported as target that can safely work with
this condition.

Such support is also needed, when extending VDOPOOL size
while the pool is reaching its capacity - since this allows
to continue working without reaching 'out-of-space' condition
due to flushing of all in flight IO.

(cherry picked from commit e26c21cb8d)
2023-06-21 09:15:17 +02:00
Zdenek Kabelac
a4f39c5bbf vdo: reset errno before strtoull
Missed errno reset in commit ebad057579.

(cherry picked from commit 309df239e3)
2023-06-20 15:38:57 +02:00
Zdenek Kabelac
fee817aff4 vdo: use only verbose log level for reformating
When lvcreate is makeing VDO pool and user has not specified -V size,
ATM we actually run  'vdoformat' twice to get properly 'extent' aligned
size matching lvm2 properties - so the 2nd. run of vdoformat actually
can stay with 'log_verbose()' so the standard printed result
is not showing confusing info (which is now also correctly using
print_unless_silent)

(cherry picked from commit fc5bc5985d)
2023-06-20 15:36:50 +02:00
Zdenek Kabelac
f5c194afc5 vdo: suffle code for better error path handling
For failing dm_ no need to report 2nd. error,
but we missed to report error with 'updated==NULL'.

(cherry picked from commit 493acb9195)
2023-06-20 15:36:35 +02:00
Zdenek Kabelac
aa75359c7c vdo: enhance lvcreate validation
When creating VDO pool based of  % values, lvm2 is now more clever
and avoids to create 'unsupportable' sizes of physical backend
volumes as 16TiB is maximum size supported by VDO target
(and also limited by maximum supportable slabs (8192) based on slab
size.

If the requested virtual size is approaching max supported size 4PiB,
switch header size to 0.

(cherry picked from commit e2e31d9acf)
2023-06-20 15:36:32 +02:00
Zdenek Kabelac
c160f54ec5 vdo: support v4 kernel target line
Check and use new available table line v4, if kernel supports it.

(cherry picked from commit 1c18ed3b4a)
2023-06-20 15:36:30 +02:00
Zdenek Kabelac
d2a2720ccb vdo: add reformating to extent size aligned virtual size
Newer VDO kernel target require to have matching virtual size - this
however cause incompatiblity when lvcreate is let to format VDO data
device and read the usable size from vdoformat.
Altough this is a kernel regression and will likely get fixed,
lvm2 can actually reformat VDO device to use properly aligned VDO LV
size to make this problem disappear.

(cherry picked from commit a477490e81)
2023-06-20 15:36:25 +02:00
Zdenek Kabelac
783213e4da vdo: check vdo memory constrains
Add function to check for avaialble memory for particular VDO
configuration - to avoid unnecessary machine swapping for configs
that will not fit into memory (possibly in locked section).

Formula tries to estimate RAM size machine can use also with
swapping for kernel target - but still leaving some amount of
usable RAM.

Estimation is based on documented RAM usage of VDO target.

If the /proc/meminfo would be theoretically unavailable, try to use
'sysinfo()' function, however this is giving only free RAM without
the knowledge about how much RAM could be eventually swapped.

TODO: move _get_memory_info() into generic lvm2 API function used
by other targets with non-trivial memory requirements.

(cherry picked from commit ebad057579)
2023-06-20 15:36:19 +02:00
Zdenek Kabelac
1a39e0c2c2 vdo: update info about memory
Add more info about kernel target memory allocation associated with
VDO pool usage.

(cherry picked from commit f445624c33)
2023-06-20 15:36:00 +02:00
Zdenek Kabelac
e82e23447f vdo: fix conversion of vdo_slab_size_mb 2nd
Patch 1b070f366b should have
been already fixing this issue but since it the incorrect
patch rebasing the change to vdo_slabSize got lost.
So again now with explicit one-line patch.

(cherry picked from commit d2667bc25b)
2023-06-20 15:33:42 +02:00
Tony Asleson
8702e97022 lvmdbusd: Change unit test vdo minimum size
(cherry picked from commit 47c61907b4)
2023-06-20 15:33:36 +02:00
Zdenek Kabelac
64a78a2904 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'

(cherry picked from commit 4a49851207)
2023-06-20 15:33:24 +02:00
Zdenek Kabelac
2456b39b34 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

(cherry picked from commit 2ecfd503ed)
2023-06-20 15:33:14 +02:00
Zdenek Kabelac
a147a14813 vdo: fix conversion of vdo_slab_size_mb
When converting VDO volume, the parameter vdo_slabSize was
incorrectly copied as vdo_blockMapCacheSize, however this parameter
is then no longer used for any table line creation so the wrong
value was only stored in metadata.

Also use just single get_kb_size_with_unit_ and remove it's duplicate
functionality with get_mb_size_with_unit_.

Use $VERB for vdo remove call.

(cherry picked from commit 1b070f366b)
2023-06-20 15:30:59 +02:00
Andrew Walsh
c41468a8ac vdo: ensure VDO config is removed
Make sure to remove the VDO config after conversion
of LVM-backed VDO.

Addresses point 3 in rhbz#1987024#c5

(cherry picked from commit 522561e64b)
2023-06-20 14:54:13 +02:00
Zdenek Kabelac
cce56ebaa6 vdo: report supported range in error path
(cherry picked from commit 9f3eff002c)
2022-12-08 15:25:33 +01:00
Zdenek Kabelac
b16082b056 vdo: use defines also for configuration defines
Keep single source for most of values printed in lvm.conf
(still needs some conversion)

Correct max for logical threads to 60
(we may refuse some older configuration which might eventually
user higher numbers - but so far let's assume no user have ever set this
as it's been non-trivial and if would complicate code unnecessarily.)

Accept maximum of 4PiB for virtual size of VDO LV
(lvm2 will drop 'header borders to 0 for this case').

(cherry picked from commit b5c8e591ed)
2022-12-08 15:25:22 +01:00
Zdenek Kabelac
d0b5614d43 vdo: use single validator
Add era lenght validation into dm_vdo_validate_target_params()
and reuse this validator also for _check_lv_segment().

(cherry picked from commit 8ca2b1bc21)
2022-12-08 15:25:12 +01:00
Marian Csontos
71354c3935 make: generate 2022-12-08 14:32:23 +01:00
Zdenek Kabelac
b56e8fc94d vdo: fix --vdosettings parser
Parser was incorrectly parsing vdo_use_features - move the skip
of 'use_' prefix into internal loop which handles skipping of '_'.

(cherry picked from commit bba96e8680)
2022-12-08 12:34:22 +01:00
Zdenek Kabelac
7db3a53d8a 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.

(cherry picked from commit 0937113146)
2022-11-29 14:09:25 +01:00
David Teigland
0b9d9963b8 vgimportdevices: fix locking when creating devices file
Take the devices file lock before creating a new devices file.
(Was missed by the change to preemptively create the devices
file prior to setup_devices(), which was done to improve the
error path.)
2022-11-28 17:11:21 +01:00
David Teigland
f1d8c01dff 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-11-28 17:11:21 +01:00
Tony Asleson
0aa45120e9 lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
We need this to prevent lvm from interleaving the JSON output with errors
written to stderr.

(cherry picked from commit a5e6947d74)
2022-11-28 17:11:21 +01:00
Zdenek Kabelac
7394382550 lvconvert: correct test support for vdo-pool
(cherry picked from commit d0697be500)
2022-11-28 17:11:21 +01:00
David Teigland
87904fbbb8 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-11-02 13:23:52 -05:00
David Teigland
377ed7d9ba 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-11-02 12:20:07 -05:00
David Teigland
73b9a2805c exit with error when --devicesfile name doesn't exist 2022-07-06 10:22:28 -05:00
Marian Csontos
e60d7ce8e7 build: Fix make rpm with VERSION_DM without dash
When building RPM from a branch based on a release tag the expected -git
suffix is missing breaking the script producing error like following one:

    error: line 215: Unterminated rich dependency: (2021-53.ge36b180a6.el9: Requires: device-mapper-devel >= 1.02.181 (2021-53.ge36b180a6.el9
2022-06-15 11:53:51 +02:00
David Teigland
e36b180a69 filter-mpath: get wwids from sysfs vpd_pg83
to compare with wwids in /etc/multipath/wwids when
excluding multipath components.  The wwid printed
from the sysfs wwid file may not be the wwid used
in multipath wwids.  Save the wwids found for each
device on dev->wwids to avoid repeating reading
and parsing the sysfs files.
2022-06-09 14:33:30 -05:00
Zdenek Kabelac
7cb63b05da vdo: fix conversion of vdo_slab_size_mb
When converting VDO volume, the parameter vdo_slabSize was
incorrectly copied as vdo_blockMapCacheSize, however this parameter
is then no longer used for any table line creation so the wrong
value was only stored in metadata.

Also use just single get_kb_size_with_unit_ and remove it's duplicate
functionality with get_mb_size_with_unit_.

Use $VERB for vdo remove call.
2022-06-09 14:33:30 -05:00
David Teigland
25abb5730f filter-mpath: handle other wwid types in blacklist
Fixes commit 494372b4ee
  "filter-mpath: use multipath blacklist"
to handle wwids with initial type digits 1 and 2 used
for t10 and eui ids.  Originally recognized type 3 naa.
2022-06-09 14:33:30 -05:00
David Teigland
bf0b396208 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-06-09 14:33:30 -05:00
David Teigland
eda98e4b94 devices file: move clean up after command is run
devices_file_exit wasn't being called between lvm_shell
commands, so the file lock wouldn't be released.
2022-06-09 14:33:30 -05:00
Peter Rajnoha
45a2ccfa3b toollib: fix segfault when handling selection with historical LVs
When processing historical LVs inside process_each_lv_in_vg for
selection, we need to use dummy "_historical_lv" for select_match_lv.

This is because a historical LV is not an actual LV, but only a tiny
representation with subset of original properties that we recorded
(name, uuid...).

To use the same processing functions we use for full-fledged non-historical
LVs, we need to use the prefilled "_historical_lv" structure which has all
the other missing properties hard-coded.
2022-06-09 14:33:30 -05:00
Zdenek Kabelac
9c6954bc61 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-06-09 14:33:29 -05:00
David Teigland
e027f4da9b improve description of devices option 2022-06-09 14:33:29 -05:00
David Teigland
5d40b91bd4 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-06-09 14:33:29 -05:00
David Teigland
d964328355 devices file: remove extraneous unlock in vgchange -u
vgchange -u exit path was unlocking the devices file in cases
when it wasn't needed, which produced an warning.
2022-06-09 14:33:29 -05:00