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

7057 Commits

Author SHA1 Message Date
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 6ff65e6755)
2023-07-13 15:02:26 +02:00
Zdenek Kabelac
5e6aa69ec0 vdo: document feature option
(cherry picked from commit 534269d0fb)
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 e8e6347ba3)
2023-06-22 17:43:03 +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 c20f01a0cb)
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 2451bc568f)
2023-06-21 09:49:50 +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
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
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
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
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
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
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
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
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
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
David Teigland
090dc0c320 change messages about filtered devices
Change messages that refer to devices being "excluded by filters"
to say just "excluded".  This will avoid mistaking the word
"filters" with the lvm.conf filter setting.
2022-06-09 14:33:29 -05:00
David Teigland
932b9720bb devices: use dev-cache aliases handling from label scan functions
The label scan functions where doing some device alias validation
which is now better handled by the dev-cache layer, so just use
that.
2022-06-09 14:33:28 -05:00
David Teigland
591b5f006f devices: fix dev_name assumptions
dev_name(dev) returns "[unknown]" if there are no names
on dev->aliases.  It's meant mainly for log messages.

Many places assume a valid path name is returned, and
use it directly.  A caller that wants to use the path
from dev_name() must first check if the dev has any
paths with dm_list_empty(&dev->aliases).
2022-06-09 14:33:28 -05:00
David Teigland
7dc7ab8e99 devices: initial use of existing option
Use dev_cache_get_existing() in a few common, high level
locations where it's obvious that only existing dev-cache
entries are wanted.  This can be expanded and used in more
locations (or dev_cache_get can stop creating new entries.)
2022-06-09 14:33:28 -05:00
David Teigland
8ba6259b24 devices: drop incorrect paths from aliases list
along with some basic checks for cases when a device
has no aliases.

lvm itself creates many situations where a struct device
has no valid paths, when it activates and opens an LV,
does something with it, e.g. zeroing, and then closes
and deactivates it.  (dev-cache is intended for PVs, and
the use of LVs should be moved out of dev-cache in a
future patch.)
2022-06-09 14:33:28 -05:00
David Teigland
8552290efa devices: simplify dev_cache_get_by_devt
remove unused args, and no callers need or want a
repeated dev_cache_scan if there is no dev from the
lookup.
2022-06-09 14:33:23 -05:00
David Teigland
c047ff61f6 writecache: display block size from lvs
lvs was missing the ability to display writecache block size.
now possible with lvs -o writecache_block_size
2022-06-09 11:33:14 -05:00
David Teigland
08a5619a1d devices file: do not clear PVID of unread devices
In a certain disconnected state, a block device is present on
the system, can be opened, reports a valid size, reports the
correct device id (wwid), and matches a devices file entry.
But, reading the device can still fail.  In this case,
device_ids_validate() was misinterpreting the read error as
the device having no data/label on it (and no PVID).
The validate function would then clear the PVID from the
devices file entry for the device, thinking that it was
fixing the devices file (making it consistent with the on disk
state.)  Fix this by not attempting to check and correct a
devices file entry that cannot be read.  Also make this case
explicit in the hints validation code (which was doing the
right thing but indirectly.)
2022-06-09 11:32:40 -05:00
David Teigland
df2b1555af lvmdevices: make deldev work for missing device 2022-06-09 11:30:07 -05:00
David Teigland
4e72068216 lvmdevices: fix checks when adding entries
Removes some incorrect and unnecessary checks for other entries
when adding a new devices.  The removed checks and corrections were
mostly redundant with what is already done by device id matching.
Other checking is reworked so the warnings are a bit different.
2022-06-09 11:29:57 -05:00
David Teigland
7b79acc616 devices: exclude md components when duplicate pvs are seen
Improve handling of md components that get through the
filter, like the previous improvement for multipath.
If md components get through the filter and trigger
duplicate PV code, then eliminate any devs entirely
that are not an md device.
2022-05-25 12:07:52 -05:00
David Teigland
5403a6f059 devices: exclude multipath components based on matching wwid
If multipath component devices get through the filter and
cause lvm to see duplicate PVs, then check the wwid of the
devs and drop the component devices as if they had been
filtered.  If a dm mpath device was found among the duplicates
then use that as the PV, otherwise do not use any of the
components as the PV.

"duplicate PVs" associated with multipath configs will no
longer stop commands from working.
2022-05-25 12:07:35 -05:00
David Teigland
9375aebad1 Revert "pvcreate: overwrite partition header with -f"
This reverts commit a5c37afdca.

This commit did not properly recognize GPT cases.
2022-01-18 12:16:52 -06:00
David Teigland
bb477d63e3 lvmdevices check: error exit if update is needed
. error exit means that lvmdevices --update would make a change.

. remove check of PART field from --check because it isn't used.

. unlink searched_devnames file to ensure check|update will search
2022-01-14 15:53:13 -06:00
David Teigland
a5c37afdca pvcreate: overwrite partition header with -f
$ pvcreate /dev/sdc
  Cannot use /dev/sdc: device is partitioned
$ pvcreate -f /dev/sdc
  Physical volume "/dev/sdc" successfully created.
2022-01-14 14:35:35 -06:00
David Teigland
357a807e81 device_id: handle wwid with spaces or control characters
non-standard wwid can be reported from sysfs with spaces/etc.
replace with "_"
2021-12-20 14:22:18 -06:00
David Teigland
604fd528fb print warning about unrecognized journal option value 2021-12-20 14:22:18 -06:00
David Teigland
04770589b4 devices file: don't write in test mode 2021-12-20 14:22:18 -06:00
David Teigland
7ac0b3c119 fix spelling of pruning 2021-12-20 14:22:17 -06:00
David Teigland
39adf3e513 device_id: searched_devnames improvements
Remove the searched_devnames file in a couple more places:
. When hints need refreshing it's possible that a missing
  devices file entry could be found by searching devices
  again.
. When a devices file entry devname is first found to be
  incorrect, a new search for missing entries may be
  useful.
2021-12-20 14:22:17 -06:00
David Teigland
5533cd7bf4 device_id: fix search on filtered device
When devnames are used as device ids and devnames change,
then new devices need to be located for the PVs.  If the old
devname is now used by a filtered device, this was preventing
the code from searching for the new device, so the PV was
reported as missing.
2021-12-20 14:22:17 -06:00