lvm2.git
5 months agoWHATS_NEW: update 1866159748
Peter Rajnoha [Wed, 11 Jun 2025 12:08:30 +0000 (14:08 +0200)]
WHATS_NEW: update

5 months agotools: reporter: cleanup: setting of cmd->report_strict_type_mode
Peter Rajnoha [Wed, 11 Jun 2025 11:06:07 +0000 (13:06 +0200)]
tools: reporter: cleanup: setting of cmd->report_strict_type_mode

Make setting of cmd->report_string_type_mode easier to follow.

5 months agotools: reporter: override LC_NUMERIC if needed for json_std format
Peter Rajnoha [Wed, 11 Jun 2025 09:55:30 +0000 (11:55 +0200)]
tools: reporter: override LC_NUMERIC if needed for json_std format

Override LC_NUMERIC part of the locale to "C" if we detect that the
radix character interferes with JSON_STD format. If that's the case,
override LC_NUMERIC locale to "C" in report_format_init, that is,
before any reporting is executed (including log reporting). Restore
it back in report_format_destroy, that is, once we're sure that all
reporting is finished.

Related: https://gitlab.com/lvmteam/lvm2/-/issues/33

5 months agotools: reporter: cleanup: factor out code to new report_format_destroy
Peter Rajnoha [Wed, 11 Jun 2025 11:08:42 +0000 (13:08 +0200)]
tools: reporter: cleanup: factor out code to new report_format_destroy

We already have report_format_init. Having report_format_destroy makes
it easier to read and follow the code using these functions.

5 months agolibdm: report: require '.' radix char for DM_REPORT_GROUP_JSON_STD
Peter Rajnoha [Wed, 11 Jun 2025 09:21:29 +0000 (11:21 +0200)]
libdm: report: require '.' radix char for DM_REPORT_GROUP_JSON_STD

When a report is under DM_REPORT_GROUP_JSON_STD, the formatting of the
report follows more standard form of the JSON output. This includes
unquoted numbers (as opposed to the DM_REPORT_GROUP_JSON).

The JSON standard dictates the radix character (decimal point) must
be '.' only (https://www.rfc-editor.org/rfc/rfc7158#section-6).

However, some locales may use other character for the radix delimiter,
like ','. This character also interferes with ',' used as delimiter for
json items.

Therefore, we need to check whether current locale is not posing an
issue when using DM_REPORT_GROUP_JSON_STD. If that's the case, simply
error out from dm_report_group_create as we don't want to override
current locale in libdm or do anything else at this level. The libdm
caller is responsible here for setting the proper locale.

Related: https://gitlab.com/lvmteam/lvm2/-/issues/33

6 months agolvmlockctl: fix leading spaces in scanf alternative commit 0217887fcdd901ccaa4ed06165... 1817158097
Heinz Mauelshagen [Wed, 14 May 2025 12:36:27 +0000 (14:36 +0200)]
lvmlockctl: fix leading spaces in scanf alternative commit 0217887fcdd901ccaa4ed06165cd2c223fb376c1

6 months agotests: aux use 8EiB sized devices 1816967841
Zdenek Kabelac [Wed, 14 May 2025 10:49:37 +0000 (12:49 +0200)]
tests: aux use 8EiB sized devices

From kernel 6.15 DM block devices with size >= 8EiB can't be created.

6 months agotest: addm shell/lvresize-btrfs.sh 1815646373
Su Yue [Tue, 13 May 2025 06:14:27 +0000 (14:14 +0800)]
test: addm shell/lvresize-btrfs.sh

refer legacy patche:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00055.html

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
[Adjust to lvresize]
Signed-off-by: Su Yue <glass.su@suse.com>
6 months agolvresize: add btrfs support
Su Yue [Tue, 13 May 2025 06:14:26 +0000 (14:14 +0800)]
lvresize: add btrfs support

This commit adds lvresize/lvextend/lvreduce support for btrfs.
'btrfs filesystem resize [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path>'
is used to resize one device only when it's mounted.
The code pattern is like xfs but it supports shrink.

For multi-devices btrfs, There is one difficulty to be handled:

If `lvreduce --fs resize` is given, lvm2 will check newsize vs current fs size
to judge if it's need to shrink fs or not.
For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like
ext* and xfs. But for multi-devices btrfs, the two values are whole fs size.
There is no other way without relying btrfs superblock parse. It's too
complicated and inproper to implemnt the logic in lvm2.
So here just sets fs_last_byte to 0 for btrfs and skips boundary check in
_fs_reduce_allow(). It's safe as btrfs will handle it well.

The another complicated part is how to get mount point info if multi-devices.
There is only one mnt entry per mounted fs in /etc/mtab even it's a
multi-devices btrfs. So we first get uuid from lv device then traverse devices
under /sys/fs/btrfs/$uuid/devices and compare them to the mnt entry to get the
mount point.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agofilesystem: factor out get mount point logic from fs_get_info() into _fs_get_mnt()
Su Yue [Tue, 13 May 2025 06:14:25 +0000 (14:14 +0800)]
filesystem: factor out get mount point logic from fs_get_info() into _fs_get_mnt()

The new _fs_get_mnt() is used to get mount point info for fses.
No functional change.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agofilesystem: get device uuid in fs_get_blkid
Su Yue [Tue, 13 May 2025 06:14:24 +0000 (14:14 +0800)]
filesystem: get device uuid in fs_get_blkid

Add new field fs_info::uuid to record device uuid when calling
fs_get_blkid() for further use.

No functional change.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agoraid: use byte order conversion macros 1813095425
Zdenek Kabelac [Mon, 12 May 2025 13:48:35 +0000 (15:48 +0200)]
raid: use byte order conversion macros

As we already use  le_to_cpu() and cpu_to_be() elsewhere
and have a macros usable across wide variety of distros,
switch to use these.

6 months agotests: fix typo in PAGE_SIZE check 1813001121
Zdenek Kabelac [Mon, 12 May 2025 09:19:55 +0000 (11:19 +0200)]
tests: fix typo in PAGE_SIZE check

Here 1 meant to by shifted by 20 bits...
Otherwise it always falback to just 4K.

6 months agoWHATS_NEW: update
Zdenek Kabelac [Mon, 12 May 2025 13:07:15 +0000 (15:07 +0200)]
WHATS_NEW: update

6 months agoman: update raid man
Zdenek Kabelac [Mon, 12 May 2025 13:05:46 +0000 (15:05 +0200)]
man: update raid man

Mention repair of transiently lost devices.

6 months agolvmlockd: fix sanlock_release for vgremove 1807814397
David Teigland [Thu, 8 May 2025 15:54:50 +0000 (10:54 -0500)]
lvmlockd: fix sanlock_release for vgremove

incorrect data was being copied to lease structs passed
to sanlock_release(), making the lease removal fail.

6 months agolvmlockd: fix hosts check for vgremove
David Teigland [Wed, 7 May 2025 22:51:01 +0000 (17:51 -0500)]
lvmlockd: fix hosts check for vgremove

errors from lock manager were not being considered.
EAGAIN from sanlock should be considered EBUSY.

6 months agolvmlockd: keep using ifdef 1805630267
Zdenek Kabelac [Wed, 7 May 2025 14:58:46 +0000 (16:58 +0200)]
lvmlockd: keep using ifdef

We are not defining LOCKDSANLOCK_SUPPORT when there is no support
for sanlock enabled.

6 months agoconfigure: autoreconf
Zdenek Kabelac [Wed, 7 May 2025 14:56:20 +0000 (16:56 +0200)]
configure: autoreconf

6 months agoconfigure.ac: set lowest version
Zdenek Kabelac [Wed, 7 May 2025 15:00:41 +0000 (17:00 +0200)]
configure.ac: set lowest version

As we always require and check for version 3.7,
avoid extra CHECK_EXIST and go for CHECK_MODULE.

LOCKDSANLOCK_SUPPORT is not defined is the build
is not enabled.

When build for sanlock is enabled, and
CHEKC_MODULE does not detect at least version 3.7
then whole configure process errors out.

6 months agotest: check raid superblock clearing
Zdenek Kabelac [Sun, 2 Feb 2025 18:21:05 +0000 (19:21 +0100)]
test: check raid superblock clearing

6 months agolvconvert: allow clearing superblocks
Zdenek Kabelac [Fri, 31 Jan 2025 20:45:57 +0000 (21:45 +0100)]
lvconvert: allow clearing superblocks

6 months agoraid: count or clear transiently failed devices
Heinz Mauelshagen [Tue, 5 Nov 2024 17:33:19 +0000 (18:33 +0100)]
raid: count or clear transiently failed devices

Count or clear transiently failed devices as of dm-raid superblocks.
Updated debuging.
Use lvconvert --repair to repair transiently failed legs.
Activating all 'meta' LVs with single sync_local_dev_names().
Using proper DM path for meta LV.

Modified-by: zkabelac@redhat.com
6 months agolvmlockd: detect sanlock version in configure to enable new code 1803796799
David Teigland [Tue, 6 May 2025 21:06:24 +0000 (16:06 -0500)]
lvmlockd: detect sanlock version in configure to enable new code

6 months agolvmlockd: disable use of new sanlock apis 1803307864
David Teigland [Tue, 6 May 2025 17:07:54 +0000 (12:07 -0500)]
lvmlockd: disable use of new sanlock apis

6 months agolvmlockd: use error for corrupted sanlock lease in start
David Teigland [Thu, 17 Apr 2025 16:25:00 +0000 (11:25 -0500)]
lvmlockd: use error for corrupted sanlock lease in start

if sanlock delta lease for host_id is corrupt, then
return ELOCKREPAIR.

6 months agolvmlockd: add error for corrupted sanlock lease
David Teigland [Fri, 21 Mar 2025 20:26:51 +0000 (15:26 -0500)]
lvmlockd: add error for corrupted sanlock lease

A specific error message can be printed for this case:
"sanlock lease needs repair"

6 months agolvmlockd: add vg_status operation and fix sanlock read_lockspace_info
David Teigland [Tue, 22 Apr 2025 20:26:24 +0000 (15:26 -0500)]
lvmlockd: add vg_status operation and fix sanlock read_lockspace_info

6 months agolvmlockd: use new sanlock_read_lockspace_host for prev generation
David Teigland [Thu, 17 Apr 2025 16:12:40 +0000 (11:12 -0500)]
lvmlockd: use new sanlock_read_lockspace_host for prev generation

return previous sanlock generation number in the start_vg response.

6 months agolvmlockd: use new sanlock_acquire2 to return owner info
David Teigland [Fri, 21 Mar 2025 16:36:49 +0000 (11:36 -0500)]
lvmlockd: use new sanlock_acquire2 to return owner info

Use the new sanlock_acquire2() which returns info about the owner
of a lease.  Pass this info back to the lvm command, where it's
initially used to print the host_id of a host holding a lock
when it cannot be acquired.

6 months agolvmlockctl: sscanf alternative 1801476200
David Teigland [Mon, 5 May 2025 20:44:47 +0000 (15:44 -0500)]
lvmlockctl: sscanf alternative

Add szscanf() to use in place of sscanf. It takes a buffer size for
strings, so avoids needing to use max field width, which is hard to
read when implemented with stringify macros.

6 months agopost-release 1801459039
Marian Csontos [Mon, 5 May 2025 15:02:06 +0000 (17:02 +0200)]
post-release

6 months agopre-release 2.03.32 1801459141 v2_03_32
Marian Csontos [Mon, 5 May 2025 15:02:06 +0000 (17:02 +0200)]
pre-release 2.03.32

7 months agoWHATS_NEW: update
Marian Csontos [Tue, 29 Apr 2025 13:00:23 +0000 (15:00 +0200)]
WHATS_NEW: update

7 months agotests: check for resulting size 1790016575
Zdenek Kabelac [Mon, 7 Apr 2025 12:14:58 +0000 (14:14 +0200)]
tests: check for resulting size

Add some extra validation check for size and slabsize.

7 months agomake: generate
Zdenek Kabelac [Tue, 1 Apr 2025 13:39:28 +0000 (15:39 +0200)]
make: generate

7 months agoman: updates and typography
Zdenek Kabelac [Mon, 3 Mar 2025 14:21:34 +0000 (15:21 +0100)]
man: updates and typography

Manually enhance pages for thin, cache, raid, vdo.

Replace usage of .HP with .TP when it makes sense (but keep .HP
where so far we don't have replacement giving same visual results).

Use .CMS, .CME  macros in dmsetup/dmstats so it easy to switch
But keep using .HP when the rendering looks simply better in terminal
although HTML output does not looks that well - so we may eventually
switch here to .TP.

For basic command synopsis use .NSY macro that will
use .SY for graphical rendering (postscript/pdf) but keep
using .TP for ASCII terminal output, as here many HTML renderers
are emitting unreadable pages.

For options use '\ ' (non-breakable space) between option and
its argument and option are not across line.

Reformat lines to fit in 80 columns.

Use  .EX .. .EE  for example output - this improves
character alignment for poststrict/pdf rendering as
it use monospace fonts (unlike .nf .. .fi).
Also with Example section never let the line being with space
and use '\' for such line.
If the Example line should being with '.' it needs to be
prefix with \&.
Add .nf/.fi macros for cases where .EX & .EE are undefined
(this happens i.e. with man2html)

Avoid use of tables (.TS .. .TE) as HTML renderers often use
images (.png) files for such tables and this does not scale well
when user changes font size in browser.
(and the large/long table were split into 2 pieces
so it does fit to 80 columns).

Use .MT .ME for emails.

Use .UR .UE. for URL.

Use  .\|.\|.\& as sequence of 3 dots and add \& to not create end of
sentence and possibly wrong alignment.

On lines starting with .BR & .IR avoid using \fB \fI as this
can cause problem when i.e. html rendered may keep use
italic bold when just italic was really wanted.

When using series of .TP/.IP - set the size only with the
first tag - and let renderer align others to match the column.

Correct some small typographical rendering issues.

Rendering was evaluated for readable results with:
- mandoc -T html  (-O style=mandoc.css)
- groff  -Thtml -mman
- man2html
- man -Thtml
- man -Tps
- man

Unfortunatelly various g/troff troubles are with each of them,
so we need to select usage of macros in a way, that is not mangling
results for above engines.

7 months agoman: generator update
Zdenek Kabelac [Wed, 5 Mar 2025 10:55:22 +0000 (11:55 +0100)]
man: generator update

Improve generated output for better compliance with '-T lint' checker
(mandoc -T lint and groff --mandoc).

Try to properly place .P sections and also correctly use .TP rendering
where we need to place '.na .ad'  after the first rendered keyword,
otherwise it has not the desired impact.

Also use  .nh .na ..  .ad .hy around whole command USAGE description
so we avoid unwanted alignment,spacing,hyphenation there.

Make sure we are emitting properly order paragraphs and avoid
i.e. submit of .br after .RS/.in  that has this implicit

Also more frequently emit '\n' so there are not too long lines as
rendering engine will format line breaking according to its rules.

To keep generated page better controllable emit more empty line
and use such lines for every .SH, .TP.

Use 'short_ops' loop to avoid duplicating code.

Emit .\|.\|. for 3dot sequence for proper graphical rendering

Emit \\0\\0\\0 (3 white space of width of letter '0')
for better alignment of options with graphical rendering.

There is ATM prepare '#define TABBED' - enabling this make
initial option list nicely aligned in graphical rendering
and doesn't seem to have bad side effect on text rendering.

man: generator use macros for options

Predefine all options used by the command into list of '.de O_name'
macros that are pregenerated in the front of man page.
(interestingly usage of groff strings (.ds) seems to have some
non-trivial issues across rendering engines)

This allows to use '\t' without producing warnings with
'mandoc -T lint' - as normally tabs are allowed only within
'.nf ... .fi' section, but than there is not working line-breaking.

While we could use purely 'tab' base version, for some 'html' (ascii)
redering its producing not so well indented option list.
For this reason use tabs only with graphical renderers .ie  t / .el
and use only spaces for ascii rendering.

Ensure the ...   (3dots continuation is properly renderer with
a single space after repeatable option/argument and not adding extra
space before i.e. closing bracket.

Using .ta for graphical rendering - allows to keep option aligned
with proportional font.

7 months agoman: minor refactor
Zdenek Kabelac [Wed, 5 Mar 2025 10:54:46 +0000 (11:54 +0100)]
man: minor refactor

Minor updates to generator code.

7 months agolibdaemon: change connect error to log_debug 1780624071
David Teigland [Tue, 22 Apr 2025 21:18:51 +0000 (16:18 -0500)]
libdaemon: change connect error to log_debug

The message is unnecessary noise since callers print a
more user friendly message.

7 months agolvmdevices: skip lvmlockd connection 1780614643
David Teigland [Tue, 22 Apr 2025 21:10:26 +0000 (16:10 -0500)]
lvmdevices: skip lvmlockd connection

the command doesn't use locks from lvmlockd

7 months agolvmcmdline: still support use of profile 1752567800
Zdenek Kabelac [Wed, 2 Apr 2025 08:58:16 +0000 (10:58 +0200)]
lvmcmdline: still support use of profile

Couple commands (lvcreate,lvconvert,vgcreate,lvchange,vgchange)
has the 'specific' property that within them the option --profile
behaves like --metadataprofile, while for all other commands this
option should be simply an alias for --commandprofile.

We may eventually drop this rather confusing behavior in the future
version and there will be only one use as --[command]profile

It should be noted this --commandprofile can be often used
instead of --config option for preconfiguring setting
for some group of commands - we should possibly more propagate
this usage.

7 months agolibdm: fix missed init of regex pointer
Zdenek Kabelac [Wed, 2 Apr 2025 23:31:48 +0000 (01:31 +0200)]
libdm: fix missed init of regex pointer

Recent patch set for select enhancement missed to initialize
ssl struct element regex to NULL and this code might have
crashed on this code path evaluation.

8 months agoWHATS_NEW: update 28/head 1746699576
Zdenek Kabelac [Tue, 1 Apr 2025 11:32:36 +0000 (13:32 +0200)]
WHATS_NEW: update

8 months agomake: generate
Zdenek Kabelac [Tue, 1 Apr 2025 11:24:11 +0000 (13:24 +0200)]
make: generate

8 months agocov: remove unused header
Zdenek Kabelac [Sun, 30 Mar 2025 19:59:42 +0000 (21:59 +0200)]
cov: remove unused header

8 months agotests: check resize of snapshot with mounted origin
Zdenek Kabelac [Tue, 1 Apr 2025 11:49:10 +0000 (13:49 +0200)]
tests: check resize of snapshot with mounted origin

8 months agotests: resize of mounted fs missed workaround
Zdenek Kabelac [Tue, 1 Apr 2025 11:40:49 +0000 (13:40 +0200)]
tests: resize of mounted fs missed workaround

For older kernel, we need to suspend/resume.

8 months agotests: preserve signess
Zdenek Kabelac [Sun, 30 Mar 2025 19:27:25 +0000 (21:27 +0200)]
tests: preserve signess

8 months agotests: check unsupported vdo conversions
Zdenek Kabelac [Mon, 31 Mar 2025 00:07:03 +0000 (02:07 +0200)]
tests: check unsupported vdo conversions

Validate unsupported vdo conversions are rejected.

8 months agotests: remove testing of old mirror with vdo
Zdenek Kabelac [Mon, 31 Mar 2025 00:14:20 +0000 (02:14 +0200)]
tests: remove testing of old mirror with vdo

Actually mirror were never supposed to be usable with any newer
target as they are very problematic with any stacked usage.
So now it's going to be properly checked and prohibited.

Users are always supposed to use 'raid1' --type instead.

8 months agocommand: use loop for short_opts pass
Zdenek Kabelac [Sun, 16 Mar 2025 15:09:37 +0000 (16:09 +0100)]
command: use loop for short_opts pass

Slight refactoring of the code to take less size
as the code is used rather occasionally.

Correct some minor typographical issue.

8 months agoman-generator: print LV1 also for options
Zdenek Kabelac [Wed, 26 Mar 2025 10:28:54 +0000 (11:28 +0100)]
man-generator: print LV1 also for options

We can print list of supported LV types for
options like --cachepool,--thinpool,--vdopool when
they are specifying particular LV.

TODO: while we nicely document them, the parser engine ATM
is not capable to validate and enforce these properties,
so the code needs to match them on its own.

8 months agoman-generator: add check for option overlap
Zdenek Kabelac [Fri, 21 Mar 2025 23:50:01 +0000 (00:50 +0100)]
man-generator: add check for option overlap

Report --check error, when the option is required and optional
for the command.

8 months agolvconvert: fix _lvconvert_visible_check ret code
Zdenek Kabelac [Thu, 27 Mar 2025 10:40:37 +0000 (11:40 +0100)]
lvconvert: fix _lvconvert_visible_check ret code

_lvconvert_visible_check() used to validate visibility
of converted LV for changing mirrorlog, regionsize
and merging images.

8 months agolvconvert: validate converted LV to vdopool
Zdenek Kabelac [Thu, 27 Mar 2025 10:37:45 +0000 (11:37 +0100)]
lvconvert: validate converted LV to vdopool

Although our command-line description file describes
supported types for conversion with some rules,
these are technically not yet fully implemented in
the code, thus we need explicit functionality to
validate passed LVs for conversion.

8 months agolvconvert: fix move is positional args
Zdenek Kabelac [Wed, 26 Mar 2025 20:48:39 +0000 (21:48 +0100)]
lvconvert: fix move is positional args

Properly shift args by 1 - hopefully 'argv[]' has the right size
to fit this single shift (as some option must have been there...)

8 months agolvconvert: simplify passing LV for conversion
Zdenek Kabelac [Wed, 26 Mar 2025 18:34:47 +0000 (19:34 +0100)]
lvconvert: simplify passing LV for conversion

Since command is defined to not taky any'free args',
we can actully avoid playing with positional args here
and just pass argv with a single arg.

8 months agoargs: update name of kernel module
Zdenek Kabelac [Tue, 25 Mar 2025 20:52:02 +0000 (21:52 +0100)]
args: update name of kernel module

Use  '_' for kernel module name.

8 months agocommand-lines.in: matching vdopool conversion
Zdenek Kabelac [Wed, 26 Mar 2025 13:47:05 +0000 (14:47 +0100)]
command-lines.in: matching vdopool conversion

Just use options in the same order as with --type vdo-pool
conversion.

8 months agocommand-lines.in update some description
Zdenek Kabelac [Wed, 26 Mar 2025 10:26:01 +0000 (11:26 +0100)]
command-lines.in update some description

Add some explicit warning for commands that are destroying content
of converted volume.

Add thinpooldata to the list of allow LVs for caching
(as the code already support this).

8 months agocommand-lines.in: add info about implicity type
Zdenek Kabelac [Wed, 26 Mar 2025 08:42:28 +0000 (09:42 +0100)]
command-lines.in: add info about implicity type

Short description about how the default implied type
is selected for this lvcreate command.

8 months agocommand: update parameter from description
Zdenek Kabelac [Fri, 21 Mar 2025 23:42:43 +0000 (00:42 +0100)]
command: update parameter from description

Parameter --profile is already 'generic' parameter,
so it's been listed twice in lvchange & vgchange.

Parameter --uuid was listed 2x in pvchange.

8 months agotools: add suppport to recognize thinpooldata
Zdenek Kabelac [Wed, 26 Mar 2025 10:25:30 +0000 (11:25 +0100)]
tools: add suppport to recognize thinpooldata

8 months agovalidation: add check for single vdo segments
Zdenek Kabelac [Sun, 23 Mar 2025 10:54:49 +0000 (11:54 +0100)]
validation: add check for single vdo segments

Add check for VDO LV and VDOPOOL LV having just
a single segment in LV.
Also add couple missing '.'  in error messages.

8 months agodevice-types: support zram
David Disseldorp [Fri, 14 Mar 2025 01:30:24 +0000 (02:30 +0100)]
device-types: support zram

See Linux source Documentation/admin-guide/blockdev/zram.rst .
zram devices offer a good performance and efficient resource utilization
through the use of compression.

Signed-off-by: David Disseldorp <ddiss@suse.de>
8 months agosnapshot: fix lvresize when greater than max COW size
Bryn M. Reeves [Thu, 27 Mar 2025 18:11:05 +0000 (18:11 +0000)]
snapshot: fix lvresize when greater than max COW size

If lvresize is given a size > the maximum COW size for a given origin
the command will fail with an internal error and no error message:

  # lvresize --size 1.6g fedora/snaptest-snap
    Rounding size to boundary between physical extents: <1.59 GiB.
    Reached maximum COW size <1.01 GiB (258 extents).
    Command failed with status code 5.

  With -vvv:

  Found snapshot target v1.16.0.
  Getting target version for snapshot-origin
  dm versions   [ opencount flush ]   [2048] (*1)
  Found snapshot-origin target v1.9.0.
  Reached maximum COW size <1.01 GiB (258 extents). <<<
  Unlock: Memlock counters: prioritized:0 locked:0 critical:0 daemon:0 suspended:0
  Syncing device names
  Unlocking /run/lock/lvm/V_fedora
  _undo_flock /run/lock/lvm/V_fedora
  Freeing VG fedora at 0x55781b142890.
  Freeing VG fedora at 0x55781b136860.
  global/notify_dbus not found in config: defaulting to 1
  Destroy lvmcache content
  Completed: lvresize -vvv --debug --size 1706243072b fedora/snaptest-snap
  Internal error: Failed command did not use log_error

This happens because in this case _lvresize_adjust_extents() returns
early without setting lp->resize to either LV_EXTEND or LV_REDUCE after
capping lp->extents to the maximum COW size.

Fix this by just capping lp->extents and relying on the existing code in
_lvresize_adjust_extents() to fixup lp->resize in the case that
lp->extents == existing_logical_extents. This is consistent with the
no-op case where -l is given as the existing size:

root@localhost:~/src/git/lvm2# LD_LIBRARY_PATH="$PWD/tools" ./tools/lvm lvresize -L 1.6g fedora/snaptest-snap
  Rounding size to boundary between physical extents: 1.60 GiB.
  Reached maximum COW size <1.01 GiB (258 extents).
  New size (258 extents) matches existing size (258 extents).
  No size change.

8 months agolibdm: report: select: remove fixme note from _create_field_selection 1739855747
Peter Rajnoha [Fri, 28 Mar 2025 09:12:11 +0000 (10:12 +0100)]
libdm: report: select: remove fixme note from _create_field_selection

Let's keep the fail-safe check in for the case some combination (e.g.
after adding a new type) is not caught earlier in the _parse_selection.

8 months agolibdm: report: select: add support for string list regex selection 1734083124
Peter Rajnoha [Tue, 25 Mar 2025 10:41:40 +0000 (11:41 +0100)]
libdm: report: select: add support for string list regex selection

The c065b407cb77a7a14d7c7c3c94e09fcca2fcff09..872e085030ae8039f18908f6e45bad7ba99250a7
was for device_mapper/libdm-report.c. Do the same for libdm/libdm-report.c

8 months agoWHATS_NEW: update 1733869741
Peter Rajnoha [Tue, 25 Mar 2025 09:23:51 +0000 (10:23 +0100)]
WHATS_NEW: update

8 months agotests: select-report: cover string list regex selection
Peter Rajnoha [Mon, 24 Mar 2025 13:38:06 +0000 (14:38 +0100)]
tests: select-report: cover string list regex selection

8 months agoman: lvmreport: update parts about string list selection
Peter Rajnoha [Mon, 24 Mar 2025 09:34:12 +0000 (10:34 +0100)]
man: lvmreport: update parts about string list selection

8 months agolibdm: report: select: support string list selection based on a regex
Peter Rajnoha [Wed, 19 Mar 2025 14:19:45 +0000 (15:19 +0100)]
libdm: report: select: support string list selection based on a regex

Wire the field<-->selection comparison logic for regexes used for
string lists.

8 months agolibdm: report: select: support parsing regex for a string list
Peter Rajnoha [Tue, 18 Mar 2025 07:24:40 +0000 (08:24 +0100)]
libdm: report: select: support parsing regex for a string list

Recognize regex in string list selection criterion, including grouping
items by using {} and [] together with && (or ",") and || (or "#")
logical operators:
  - [ <regex> && <regex> ... ]
  - [ <regex> || <regex> ... ]
  - { <regex> && <regex> ... ]
  - { <regex> || <regex> ... ]

Also recognize simple "<regex>" (without any grouping operators)
as a shortcut for "{ <regex> }".

8 months agolibdm: report: select: lower initial size for selection mempool
Peter Rajnoha [Thu, 20 Mar 2025 09:25:13 +0000 (10:25 +0100)]
libdm: report: select: lower initial size for selection mempool

The selection doesn't use that much memory, adjust the size accordingly.

8 months agolibdm: report: selection: use separate regex mempool
Peter Rajnoha [Thu, 20 Mar 2025 07:57:48 +0000 (08:57 +0100)]
libdm: report: selection: use separate regex mempool

Regex remembers the mempool it was given during dm_regex_create and
then it uses it for further allocation during dm_regex_match. This
could be dangerous in case we used the same mempool for any other
allocations/frees in between dm_regex_create and dm_regex_match calls
in the outer code. This patch adds separate regex mempool for the
report/select to avoid the possible issues.

8 months agolibdm: report: select: default to subset if no grouping operator used
Peter Rajnoha [Mon, 24 Mar 2025 09:56:45 +0000 (10:56 +0100)]
libdm: report: select: default to subset if no grouping operator used

Previous patch made a proper difference between [...||...] and
[...&&...]. If the criterion for a string list does not use any [] or
{}, we need to make sure that proper matching function is called -
in this case not using {} or [] is the same as if {} was used
(matching subset).

8 months agotests: select-report: adjust test for matching [...||...] in string lists
Peter Rajnoha [Mon, 24 Mar 2025 12:53:23 +0000 (13:53 +0100)]
tests: select-report: adjust test for matching [...||...] in string lists

8 months agolibdm: report: select: fix string list match for [...||...] selection
Peter Rajnoha [Wed, 19 Mar 2025 12:20:03 +0000 (13:20 +0100)]
libdm: report: select: fix string list match for [...||...] selection

Matching a string list criterion which had [... || ... ] was not
correctly implemented - it was the same as [ ... && ... ]. This patch
makes a difference between the two:
  - [ ... || ... ] matches if all items from string list value are
    matched by ANY item from selection string list (that is, not
    all the selection string list items need to match)

  - [ ... && ... ] matches if all items from string list value are
    matched by an item from selection string list 1:1 (that is,
    all the selection string list items need to match)

8 months agolibdm: report: select: remove superfluous struct reserved_value_wrapper param
Peter Rajnoha [Tue, 18 Mar 2025 08:27:57 +0000 (09:27 +0100)]
libdm: report: select: remove superfluous struct reserved_value_wrapper param

Remove superfluous struct reserved_value_wrapper param for
_tok_value_regex function. The only thing that _tok_value did was
zeroing the reserve field within the struct. But this one is already
zero-initialied in outer _parse_selection function.

8 months agolibdm: report: select: make internal errors related to incorrect field types clearer
Peter Rajnoha [Wed, 19 Mar 2025 11:23:27 +0000 (12:23 +0100)]
libdm: report: select: make internal errors related to incorrect field types clearer

8 months agolibdm: report: select: also log function name for internal errors
Peter Rajnoha [Wed, 19 Mar 2025 10:46:05 +0000 (11:46 +0100)]
libdm: report: select: also log function name for internal errors

8 months agolibdm: report: select: add/edit comments for parser
Peter Rajnoha [Mon, 17 Mar 2025 12:30:41 +0000 (13:30 +0100)]
libdm: report: select: add/edit comments for parser

8 months agolibdm: report: select: move regex handling under common value token parsing
Peter Rajnoha [Mon, 17 Mar 2025 11:53:07 +0000 (12:53 +0100)]
libdm: report: select: move regex handling under common value token parsing

This is a cleanup and a preparation for adding support for regex matching
in string lists in subsequent patches.

8 months agotests: fix metadata-old with lvmlockd_test 1720635686
David Teigland [Mon, 17 Mar 2025 16:49:54 +0000 (11:49 -0500)]
tests: fix metadata-old with lvmlockd_test

8 months agomake: generate 1720129941
Zdenek Kabelac [Mon, 17 Mar 2025 12:52:03 +0000 (13:52 +0100)]
make: generate

8 months agoWHATS_NEW: updates
Zdenek Kabelac [Sun, 16 Mar 2025 12:21:58 +0000 (13:21 +0100)]
WHATS_NEW: updates

8 months agoman: indent with command
Zdenek Kabelac [Mon, 3 Mar 2025 17:59:32 +0000 (18:59 +0100)]
man: indent with command

Avoid spaces showing as the 1st. character on the man page line.
Also start with actual text and move .IP sequence to the line end.

8 months agomakefile: rebuild man when see_also changes
Zdenek Kabelac [Tue, 4 Mar 2025 23:14:44 +0000 (00:14 +0100)]
makefile: rebuild man when see_also changes

Missed rebuild dependency, when see_also file changes.

8 months agomakefile: cleanup tab
Zdenek Kabelac [Sun, 16 Mar 2025 10:31:57 +0000 (11:31 +0100)]
makefile: cleanup tab

8 months agotests: don't restart lvmdbusd
Zdenek Kabelac [Sun, 16 Mar 2025 12:17:13 +0000 (13:17 +0100)]
tests: don't restart lvmdbusd

Since lvmdbusd execution of lvm2 command was fixed
stop retrying to restart lvmdbuds and abort testig
when it fails.

8 months agolvm: option description only for man generator
Zdenek Kabelac [Sat, 15 Mar 2025 21:08:02 +0000 (22:08 +0100)]
lvm: option description only for man generator

There is no need to include option description text
within command binary itself.

It's only used only for man generating.

8 months agoman: fixes in argument description
Zdenek Kabelac [Tue, 4 Mar 2025 23:36:26 +0000 (00:36 +0100)]
man: fixes in argument description

Describe missed --segments opt for lvdisplay (matches lvs).

Describe lvm-fullreport --all option - show text for lvs,vgs,pvs.

Missed '.' for --separator.

8 months agolvmdbusd: ensure readout on exit
Zdenek Kabelac [Sun, 16 Mar 2025 12:11:54 +0000 (13:11 +0100)]
lvmdbusd: ensure readout on exit

8 months agocache: ensure UUID ends with \0
Zdenek Kabelac [Tue, 11 Mar 2025 10:20:37 +0000 (11:20 +0100)]
cache: ensure UUID ends with \0

Initialization of union is somewhat tricky as it initialize only
the first member + padding, but in our case this does not clear
the whole size of union so explicitly set \0 after 2 'struct id'
and make sure DM uuid is not using random characters from stack.

Also add explicit .id designators (c99).

8 months agometadata: replace pv status WRONG_VG with pv bit field 1703463207
David Teigland [Thu, 6 Mar 2025 16:51:52 +0000 (10:51 -0600)]
metadata: replace pv status WRONG_VG with pv bit field

Avoid any special meaning associated with the status field.

8 months agolvmcache: unpair wrong PV devs and improve duplicate name warnings
David Teigland [Thu, 6 Mar 2025 16:02:29 +0000 (10:02 -0600)]
lvmcache: unpair wrong PV devs and improve duplicate name warnings

After detecting that a VG has wrongly claimed a PV, unpair
the pv->dev setting.  This will cause the usual "missing PV"
message to appear for that VG.  Make this message, and some
others, clearer by using the VGID rather than the VG name
when there are multiple VGs with the same name.

8 months agolvmcache: fix check for no pvid 1701925449
David Teigland [Wed, 5 Mar 2025 22:03:42 +0000 (16:03 -0600)]
lvmcache: fix check for no pvid

8 months agolvmcache: add WRONG_VG PV status flag 1701793897
David Teigland [Wed, 5 Mar 2025 18:08:38 +0000 (12:08 -0600)]
lvmcache: add WRONG_VG PV status flag

_vg_read() calls lvmcache_update_vg_from_read() which detects
that the VG metadata is incorrectly claiming the PV.  Flag this
condition in the PV status as WRONG_VG.  Later, vg_read() can
simply check the WRONG_VG flag rather than repeating the same
PV/VG checks that were already done in lvmcache_update_vg_from_read.

8 months agolvmcache: ignore incorrect PV claim from old metadata
David Teigland [Tue, 4 Mar 2025 20:11:54 +0000 (14:11 -0600)]
lvmcache: ignore incorrect PV claim from old metadata

Outdated VG metadata that appears when an old device is attached
to the system can result in PVs appearing to belong to the
old/wrong VG, and commands are allowed to use (corrupt) the PVs.

- vgcreate old /dev/sda /dev/sdb /dev/sdc
- offline /dev/sda
- vgreduce --removemissing old
- vgremove old
- vgcreate new /dev/sdb /dev/sdc
- online /dev/sda

When sda is reattached, sdb and sdc will appear to be
in VG old again.  An attempt to correct the problem,
e.g. with vgremove old or vgreduce old, would modify
sdb and sdc, removing them from the new VG.

To fix this, check that sdb and sdc contain metadata for
VG old before allowing VG old to claim ownership of them.
With the fix, sdb and sdc are not displayed as part of
VG old, and commands to change VG old will fail as long
as it references incorrect PVs.

To fix VG old (sda), remove the incorrect PVs from VG old
while limiting the command to see only the correct PVs:
vgreduce --removemissing --devices /dev/sda old

This page took 0.104673 seconds and 5 git commands to generate.