]> sourceware.org Git - lvm2.git/log
lvm2.git
2 years agopvscan: match device arg to filter symlink
David Teigland [Mon, 29 Nov 2021 23:13:44 +0000 (17:13 -0600)]
pvscan: match device arg to filter symlink

This fixes an issue related to the optimization in
  "pvscan: only add device args to dev cache"

If the devices file is not used, and the lvm.conf filter
accepts devices via symlink names, then those devices won't
be accepted by pvscan for autoactivation.  To resolve this,
recognize when the filter contains symlinks and disable the
optimization.  When the optimization is disabled, a full
dev_cache_scan is performed, and symlinks are associated
with the device names passed to pvscan.  filter-regex
will accept a device if symlinks to that device are accepted.

2 years agoman: lvmautoactivation
David Teigland [Wed, 24 Nov 2021 22:03:39 +0000 (16:03 -0600)]
man: lvmautoactivation

new topical man page describing autoactivation

2 years agodevices: exclude md components when duplicate pvs are seen
David Teigland [Mon, 22 Nov 2021 21:10:43 +0000 (15:10 -0600)]
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.

2 years agofix spelling of pruning
David Teigland [Fri, 19 Nov 2021 18:02:35 +0000 (12:02 -0600)]
fix spelling of pruning

2 years agodevices: exclude multipath components based on matching wwid
David Teigland [Wed, 17 Nov 2021 23:10:45 +0000 (17:10 -0600)]
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.

2 years agodisplay: ignore --reportformat
David Teigland [Wed, 17 Nov 2021 16:40:27 +0000 (10:40 -0600)]
display: ignore --reportformat

Using the option would do nothing useful but would
print extraneous braces.

2 years agoRevert "tests devicesfile-devname: remove searched_devnames"
David Teigland [Tue, 16 Nov 2021 20:30:09 +0000 (14:30 -0600)]
Revert "tests devicesfile-devname: remove searched_devnames"

This reverts commit 8e61c0ad6ecad5e0bcee09e44029e39396c1b59a.

The changes from "device_id: searched_devnames improvements"
allow this to work without the external removal.

2 years agotests pv-ext-flags: work with devices file
David Teigland [Tue, 16 Nov 2021 20:21:07 +0000 (14:21 -0600)]
tests pv-ext-flags: work with devices file

2 years agodevice_id: searched_devnames improvements
David Teigland [Tue, 16 Nov 2021 17:26:41 +0000 (11:26 -0600)]
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.

2 years agodevice_id: fix search on filtered device
David Teigland [Tue, 16 Nov 2021 15:29:24 +0000 (09:29 -0600)]
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.

2 years agotests devicesfile-devname: remove searched_devnames
David Teigland [Tue, 16 Nov 2021 00:04:10 +0000 (18:04 -0600)]
tests devicesfile-devname: remove searched_devnames

remove /run/lvm/searched_devnames when preparing each test
in case it has appeared on the system

2 years agovgchange autoactivation: error path cleanup
David Teigland [Fri, 12 Nov 2021 22:46:39 +0000 (16:46 -0600)]
vgchange autoactivation: error path cleanup

If the optimized label scan fails (using online files),
then clear the device state prior to falling back to the
standard label_scan.  This avoids printing output about
unexpected state.

2 years agodevice_id: match different dm device names
David Teigland [Fri, 12 Nov 2021 22:42:51 +0000 (16:42 -0600)]
device_id: match different dm device names

If a devices file entry for a dm device is using the devname
for the device id, then recognize different dm names as matching.

2 years agotests: udev-pvscan-vgchange clear services
David Teigland [Fri, 12 Nov 2021 18:10:26 +0000 (12:10 -0600)]
tests: udev-pvscan-vgchange clear services

2 years agoonline files: fix vgname check
David Teigland [Fri, 12 Nov 2021 17:52:36 +0000 (11:52 -0600)]
online files: fix vgname check

The pvs_online file for a PV will not contain a vgname
if the PV has no metadata, so don't require matching
vgname with the pvs_lookup file.

2 years agopvscan: consistent creation of pvs_lookup file
David Teigland [Fri, 12 Nov 2021 16:06:54 +0000 (10:06 -0600)]
pvscan: consistent creation of pvs_lookup file

Consistently create the pvs_lookup file for VGs with
more than one PV.  Previously the file create would be
skipped if all the PVs happened to already be online.
That led to unpredicatable results in an uncommon case
(when the last PV to come online is the only PV with
metadata.)

2 years agotests vgchange-pvs-online: clean up with devices file
David Teigland [Thu, 11 Nov 2021 22:38:10 +0000 (16:38 -0600)]
tests vgchange-pvs-online: clean up with devices file

changing the dev names resulted in stale devices file
entries that created noise in the output.

2 years agotests: udev-pvscan-vgchange fix wait
David Teigland [Thu, 11 Nov 2021 22:04:24 +0000 (16:04 -0600)]
tests: udev-pvscan-vgchange fix wait

the service now remains after completion

2 years agovgchange autoactivation: lock vg early to avoid second label scan
David Teigland [Wed, 10 Nov 2021 22:43:21 +0000 (16:43 -0600)]
vgchange autoactivation: lock vg early to avoid second label scan

Copy another optimization from pvscan -aay to vgchange -aay.
When using the optimized label scan for only one VG, acquire the
VG lock prior to the scan.  This allows vg_read to then skip the
repeated label scan that normally happens after locking the vg.

2 years agovgchange: move autoactivation setup code
David Teigland [Wed, 10 Nov 2021 20:44:11 +0000 (14:44 -0600)]
vgchange: move autoactivation setup code

into its own function, no functional change.

2 years agofilter-sysfs: support old kernels without sys/dev/block
David Teigland [Tue, 9 Nov 2021 17:54:48 +0000 (11:54 -0600)]
filter-sysfs: support old kernels without sys/dev/block

rhel5 for example doesn't have /sys/dev/block

2 years agopvs_online: include devname in pvid files
David Teigland [Mon, 8 Nov 2021 22:02:48 +0000 (16:02 -0600)]
pvs_online: include devname in pvid files

Include the device name in the /run/lvm/pvs_online/pvid files.
Commands using the pvid file can use the devname to more quickly
find the correct device, vs finding the device using the
major:minor number.  If the devname in the pvid file is missing
or incorrect, fall back to using the devno.

2 years agovgchange -aay: improve unexpected command variations
David Teigland [Mon, 8 Nov 2021 17:30:25 +0000 (11:30 -0600)]
vgchange -aay: improve unexpected command variations

For completeness and consistency, adjust the behavior
for some variations of:

  vgchange -aay --autoactivation event [vgname]

The current standard use is with a VG name arg, and the
command is only called when all pvs_online files exist.
This is the optimal case, in which only pvs_online devs
are read.  This remains the same.

Clean up behaviors for some other unexpected uses of the
command:

. With no VG name arg, the command activates any VGs
  that are complete according to pvs_online.  If no
  pvs_online files exist, it does nothing.

. If a VG name is used but no PVs online files exist for
  the VG, or the PVs online files are incomplete, then
  consider there could be a problem with the pvs_online
  files, and fall back to a full label scan prior to
  attempting the activation.

2 years agovgchange -aay: fall back to dev_cache_scan if optimization fails
David Teigland [Fri, 5 Nov 2021 22:01:34 +0000 (17:01 -0500)]
vgchange -aay: fall back to dev_cache_scan if optimization fails

Part of the optimization to avoid a full dev_cache_scan requires
translating major:minor numbers to a device name.  If this devno
translation fails, then fall back to doing a full dev_cache_scan
which is slower but certain to provide the info.  This preserves
the most important part of the label scanning optimization in the
vgchange aay (avoiding dev_cache_scan is a relatively small part
of the optimized activation compared to label scanning.)

2 years agofix device name from devno for partitions
David Teigland [Fri, 5 Nov 2021 21:21:23 +0000 (16:21 -0500)]
fix device name from devno for partitions

sysfs files for partitions are different from
whole devices and will require more work to translate
to device names.

2 years agovgchange -aay: optimize device list using pvs_online files
David Teigland [Fri, 5 Nov 2021 17:19:35 +0000 (12:19 -0500)]
vgchange -aay: optimize device list using pvs_online files

Port another optimization from pvscan -aay to vgchange -aay:
  "pvscan: only add device args to dev cache"

This optimization avoids doing a full dev_cache_scan, and
instead populates dev-cache with only the devices in the
VG being activated.

This involves shifting the use of pvs_online files from
the hints interface up to the higher level label_scan
interface.  This specialized label_scan is structured
around creating a list of devices from the pvs_online
files.  Previously, a list of all devices was created
first, and then reduced based on the pvs_online files.
The initial step of listing all devices was slow when
thousands of devices are present on the system.

This optimization extends the previous optimization that
used pvs_online files to limit the devices that were
actually scanned (i.e. reading to identify the device):
  "vgchange -aay: optimize device scan using pvs_online files"

2 years agolvm2-pvscan: include --autoactivation event
David Teigland [Thu, 4 Nov 2021 19:14:37 +0000 (14:14 -0500)]
lvm2-pvscan: include --autoactivation event

in the pvscan --cache -aay command so that the use
of the command for event activation is explicit.

2 years agomove code from pvscan.c to online.c
David Teigland [Wed, 3 Nov 2021 21:02:38 +0000 (16:02 -0500)]
move code from pvscan.c to online.c

related to managing files in /run/lvm/pvs_online
and /run/lvm/vgs_online

2 years agovgchange -aay: optimize device scan using pvs_online files
David Teigland [Wed, 3 Nov 2021 17:03:29 +0000 (12:03 -0500)]
vgchange -aay: optimize device scan using pvs_online files

Port the old pvscan -aay scanning optimization to vgchange -aay.
The optimization uses pvs_online files created by pvscan --cache
to derive a list of devices to use when activating a VG.  This
allows autoactivation of a VG to avoid scanning all devices, and
only scan the devices used by the VG itself.  The optimization is
applied internally using the device hints interface.

The new option "--autoactivation event" is given to pvscan and
vgchange commands that are called by event activation.  This
informs the command that it is being used for event activation,
so that it can apply checks and optimizations that are specific
to event activation.  Those include:

- skipping the command if lvm.conf event_activation=0
- checking that a VG is complete before activating it
- using pvs_online files to limit device scanning

2 years agorename pvscan_cache_single to expect_missing_vg_device in cmd
David Teigland [Wed, 3 Nov 2021 14:50:11 +0000 (09:50 -0500)]
rename pvscan_cache_single to expect_missing_vg_device in cmd

2 years agoadd hints interface to the pvs_online file information
David Teigland [Thu, 15 Jul 2021 21:33:50 +0000 (16:33 -0500)]
add hints interface to the pvs_online file information

The information in /run/lvm/pvs_online/<pvid> files can
be used to build a list of devices for a given VG.

The pvscan -aay command has long used this information to
activate a VG while scanning only devices in that VG, which
is an important optimization for autoactivation.

This patch implements the same thing through the existing
device hints interface, so that the optimization can be
applied elsewhere.  A future patch will take advantage of
this optimization in vgchange -aay, which is now used in
place of pvscan -aay for event activation.

2 years agolvmdevices: increase open file limit
David Teigland [Fri, 29 Oct 2021 19:49:36 +0000 (14:49 -0500)]
lvmdevices: increase open file limit

2 years agofilter-sysfs: skip when device id is set
David Teigland [Tue, 2 Nov 2021 20:42:26 +0000 (15:42 -0500)]
filter-sysfs: skip when device id is set

When a device id is set for a device, using an idtype other
than devname, it means that sysfs has been used with the device
to match the device id.  So, checking for a sysfs entry for the
device in filter-sysfs is redundant.  For any other cases not
covered by this (e.g. devname ids), have filter-sysfs simply
stat /sys/dev/block/major:minor to test if the device exists
in sysfs.

The extensive processing done by filter-sysfs init is removed.
It was taking an immense amount of time with many devices, e.g.
. 1024 PVs in 520 VGs
. 520 concurrent vgchange -ay <vgname> commands
. vgchange scans only PVs in the named VG (based on pvs_online
  files from a pending patch)

A large number of the vgchange commands were taking over 1 min,
and nearly half of that time was used by filter-sysfs init.
With this patch, the vgchange commands take about half the time.

2 years agohints: remove the cmd hints list
David Teigland [Mon, 1 Nov 2021 21:01:09 +0000 (16:01 -0500)]
hints: remove the cmd hints list

which is no longer used after commit
"toollib: remove all devices list from process_each_pv"

2 years agovgimportdevices: skip lvmlockd locking
David Teigland [Mon, 25 Oct 2021 17:11:17 +0000 (12:11 -0500)]
vgimportdevices: skip lvmlockd locking

Help bootstrapping existing shared vgs into the devices file.
Reading the vg in vgimportdevices would require locking to be
started, but vgchange lockstart won't see the vg if it's not
in the devices file.  The lvmlockd locks are not protecting
vg modifications so skipping them here won't be a problem.

2 years agoThe path is known anyway and should be the bullet proof option.
Christian Hesse [Thu, 21 Oct 2021 21:33:23 +0000 (16:33 -0500)]
The path is known anyway and should be the bullet proof option.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 years agopvscan: fix messages from coverity changes
David Teigland [Wed, 20 Oct 2021 21:12:41 +0000 (16:12 -0500)]
pvscan: fix messages from coverity changes

2 years agopost-release
Marian Csontos [Wed, 20 Oct 2021 09:13:28 +0000 (11:13 +0200)]
post-release

2 years agopre-release v2_03_14
Marian Csontos [Wed, 20 Oct 2021 09:11:41 +0000 (11:11 +0200)]
pre-release

2 years agoWHATS_NEW: update
Marian Csontos [Wed, 20 Oct 2021 09:08:36 +0000 (11:08 +0200)]
WHATS_NEW: update

2 years agopvscan: only add device args to dev cache
David Teigland [Mon, 18 Oct 2021 21:24:24 +0000 (16:24 -0500)]
pvscan: only add device args to dev cache

Optimize the common pvscan --cache command by only adding
the necessary devs to dev-cache.

2 years agodev-cache: enhance dir scan also for non-udev build
Zdenek Kabelac [Mon, 18 Oct 2021 19:50:56 +0000 (21:50 +0200)]
dev-cache: enhance dir scan also for non-udev build

2 years agodev-cache: better detection of filesystem
Zdenek Kabelac [Mon, 18 Oct 2021 19:08:19 +0000 (21:08 +0200)]
dev-cache: better detection of filesystem

It appear on some systems the first found dev might not be actually for
the filesytem - so use a better way through _cache.st_dev.

2 years agoconfigure: update
Zdenek Kabelac [Mon, 18 Oct 2021 17:13:58 +0000 (19:13 +0200)]
configure: update

2 years agoconfigure.ac: remove unused part
Zdenek Kabelac [Sat, 16 Oct 2021 20:08:50 +0000 (22:08 +0200)]
configure.ac: remove unused part

As we are not using 'enable-compat' for anything, remove this section.
Also remove duplicated check for blkid.
Move setting of some AC_ARG_ENABLE defaults into the macro so it's always
defined.

2 years agocleanup: use const char buffer
Zdenek Kabelac [Sat, 16 Oct 2021 08:09:02 +0000 (10:09 +0200)]
cleanup: use const char buffer

2 years agodev-cache: skip different filesystems on dir scan
Zdenek Kabelac [Mon, 18 Oct 2021 17:04:44 +0000 (19:04 +0200)]
dev-cache: skip different filesystems on dir scan

When scanning configured  /dev dir, avoid entring
directories with different filesystem.

This minimizes risk we will block on i.e. entring
directory with mount point.

2 years agocov: check device_ids_write return code
Zdenek Kabelac [Fri, 15 Oct 2021 13:04:43 +0000 (15:04 +0200)]
cov: check device_ids_write return code

At least 'stack' failure code path as the
function device_id_update_vg_uuid() is void.

2 years agocov: ensure id is always initialize
Zdenek Kabelac [Fri, 15 Oct 2021 13:00:03 +0000 (15:00 +0200)]
cov: ensure id is always initialize

Always resed sd_id128_t id and report warning in case
sd_id128_get_machine_app_specific() does not exit with 0.

2 years agocov: check pointer before dereferencing
Zdenek Kabelac [Fri, 15 Oct 2021 12:48:48 +0000 (14:48 +0200)]
cov: check pointer before dereferencing

Check pv2 is non-null before trying to deref its tags.

2 years agocov: do not drop already known error state
Zdenek Kabelac [Fri, 15 Oct 2021 12:46:23 +0000 (14:46 +0200)]
cov: do not drop already known error state

Do not try to 'discover' another error state, when ENOMEM
is already detected.

2 years agocov: ignore close result
Zdenek Kabelac [Fri, 15 Oct 2021 12:42:34 +0000 (14:42 +0200)]
cov: ignore close result

2 years agocov: validate subcommand existance
Zdenek Kabelac [Fri, 15 Oct 2021 12:42:20 +0000 (14:42 +0200)]
cov: validate subcommand existance

Before dereference of subcommand pointer, check it's not NULL
as  coverity believes there exists theoretical path for this...

2 years agocov: avoid using NULL info
Zdenek Kabelac [Fri, 15 Oct 2021 12:42:10 +0000 (14:42 +0200)]
cov: avoid using NULL info

Check lvmcache info exists before calling lvmcache_del_save_bad_mda().

2 years agoconfigure: fix use of withval
Zdenek Kabelac [Fri, 15 Oct 2021 21:33:59 +0000 (23:33 +0200)]
configure: fix use of withval

Newly added option --with-default-use-devices-file needs to use withval.

2 years agoconfigure: update
Zdenek Kabelac [Fri, 15 Oct 2021 08:08:26 +0000 (10:08 +0200)]
configure: update

2 years agoconfigure.ac: enhance systemd testing
Zdenek Kabelac [Fri, 15 Oct 2021 07:55:08 +0000 (09:55 +0200)]
configure.ac: enhance systemd testing

Enhance logic for checking supported systemd version,
while doing only a single check for systemd package.
For version checking use  PKG_CHECK_EXISTS() macro.

Also use one pkg check for blkid.

Avoid checking version for thin/cache_check when tools are not present
on system.

2 years agomakefile: enhance run-unit-test target
Zdenek Kabelac [Fri, 15 Oct 2021 07:45:26 +0000 (09:45 +0200)]
makefile: enhance run-unit-test target

Use TMPDIR for executing test and also ensure
all libraries linked to the test are from builddir.

2 years agounit-test: better check for O_DIRECT
Zdenek Kabelac [Fri, 15 Oct 2021 07:44:15 +0000 (09:44 +0200)]
unit-test: better check for O_DIRECT

Instead of guessing tmpfs usage, just directly try if we could
reopen file with O_DIRECT on the used filesystem.

2 years agoconfigure: bash var typo
Zdenek Kabelac [Thu, 14 Oct 2021 22:32:36 +0000 (00:32 +0200)]
configure: bash var typo

2 years agogcc: always initialize vg_complete
Zdenek Kabelac [Thu, 14 Oct 2021 21:43:12 +0000 (23:43 +0200)]
gcc: always initialize vg_complete

2 years agogcc: archive reoder struct vars
Zdenek Kabelac [Thu, 14 Oct 2021 21:41:47 +0000 (23:41 +0200)]
gcc: archive reoder struct vars

Easier for automatic struct initialization = { 0 } without warns
from older gcc.

2 years agoconfigure: missed braces
Zdenek Kabelac [Thu, 14 Oct 2021 22:02:11 +0000 (00:02 +0200)]
configure: missed braces

Missed [] around AS_IF internals,
Also missed to call pkg_config_init prior PKG_CHECK_MODULES().

2 years agodebug: reduce some debugging noise
Zdenek Kabelac [Thu, 14 Oct 2021 16:16:49 +0000 (18:16 +0200)]
debug: reduce some debugging noise

Resolve event_activation configure option just once.

Do not print debug_devs about 'bad' filtering, when
actually filter already printed reason for skipping

Do not trace more then once about backup being disabled.

No debug when unlinked file does not exists in pvscan.

2 years agomake: generate
Zdenek Kabelac [Thu, 14 Oct 2021 20:41:48 +0000 (22:41 +0200)]
make: generate

2 years agolog: also build without systemd_journal_support
Zdenek Kabelac [Thu, 14 Oct 2021 18:50:01 +0000 (20:50 +0200)]
log: also build without systemd_journal_support

2 years agoconfigure: updates
Zdenek Kabelac [Thu, 14 Oct 2021 20:41:09 +0000 (22:41 +0200)]
configure: updates

2 years agoconfigure.ac: improvement
Zdenek Kabelac [Thu, 14 Oct 2021 20:36:33 +0000 (22:36 +0200)]
configure.ac: improvement

Handle automatically new setttings

--disable-systemd-journal
--disable-appmachineid

Both setting will check presence of apropriate header files.
In case they are present, build will try to automatically build with
them (adding systemd dependency)

User can anytime disabled them and drop systemd dependency.

Also add --with-default-use-devices-file  configure option to
select automatically default value for this option.
For this moment keep default upstream as 0

2 years agomakefiles: use proper install prefix for python dbus
Zdenek Kabelac [Thu, 14 Oct 2021 19:39:14 +0000 (21:39 +0200)]
makefiles: use proper install prefix for python dbus

For non-standard prefix dir use correct installation path
(so the python files are not installed into user's system).

2 years agodebug: better error message
Zdenek Kabelac [Thu, 14 Oct 2021 16:44:55 +0000 (18:44 +0200)]
debug: better error message

Add more details about size difference.

2 years agoarchiving: update refactoring
Zdenek Kabelac [Thu, 14 Oct 2021 21:31:21 +0000 (23:31 +0200)]
archiving: update refactoring

Commit 5ea426e65628218569ede461312d80ba5d1c50fb handled case with
file path without '/' incorrectly - there is valid use-case so
switch 'log_error()' to valid code branch.

2 years agofix segfault handling duplicate PVs
David Teigland [Thu, 14 Oct 2021 19:02:59 +0000 (14:02 -0500)]
fix segfault handling duplicate PVs

cmd arg was missing when switching to use an alternative
duplicate dev.

2 years agofix lvmcache_add log_debug pvid
David Teigland [Wed, 13 Oct 2021 21:26:00 +0000 (16:26 -0500)]
fix lvmcache_add log_debug pvid

from previous cleanup

2 years agotoollib: remove all devices list from process_each_pv
David Teigland [Wed, 13 Oct 2021 19:13:54 +0000 (14:13 -0500)]
toollib: remove all devices list from process_each_pv

Reporting non-PVs / "all devices" is only done by
pvs -a or pvdisplay -a, so avoid the work managing
a list of all devices in process_each_pv.
In the case when it's needed, use the results of
label_scan which already determines which devs
are not PVs.

2 years agodevices file: unmatching system id should just be warning
David Teigland [Wed, 13 Oct 2021 18:34:46 +0000 (13:34 -0500)]
devices file: unmatching system id should just be warning

there are likely more cases than not where the systemid
does not match and the command should still run.

2 years agofix syslog setting
David Teigland [Mon, 11 Oct 2021 22:08:05 +0000 (17:08 -0500)]
fix syslog setting

Just setting lvm.conf level=N should not send messages to
syslog (now the journal by default.)

Sending messages to syslog should require setting lvm.conf
log { syslog=1 level=N }.

2 years agomake: generate
Marian Csontos [Fri, 6 Aug 2021 11:23:11 +0000 (13:23 +0200)]
make: generate

2 years agolvmdbusd: Use ID_FS_TYPE UDev property in udevwatch
Vojtech Trefny [Wed, 2 Jun 2021 15:17:40 +0000 (17:17 +0200)]
lvmdbusd: Use ID_FS_TYPE UDev property in udevwatch

'.ID_FS_TYPE_NEW' is a custom property added by an LVM UDev rule
which is now being removed and 'ID_FS_TYPE' has the same value.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
2 years agoconfigure: update
Marian Csontos [Mon, 26 Apr 2021 12:27:05 +0000 (14:27 +0200)]
configure: update

2 years agonew udev autoactivation
David Teigland [Fri, 26 Mar 2021 16:39:05 +0000 (11:39 -0500)]
new udev autoactivation

new udev rule 69-dm-lvm.rules replaces
69-dm-lvm-meta.rules and lvm2-pvscan.service

udev rule calls pvscan directly on the added device

pvscan output indicates if a complete VG can be activated

udev env var LVM_VG_NAME_COMPLETE is used to pass complete
VG name from pvscan to the udev rule

udev rule uses systemd-run to run vgchange -aay <vgname>

2 years agologging: to the systemd journal
David Teigland [Wed, 24 Mar 2021 19:19:54 +0000 (14:19 -0500)]
logging: to the systemd journal

Configure via lvm.conf log/journal or command line --journal.

Possible values:
"command" records command information.
"output" records default command output.
"debug" records full command debugging.

Multiple values can be set in lvm.conf as an array.
One value can be set in --journal which is added to
values set in lvm.conf

2 years agopvscan: add options listlvs listvg checkcomplete
David Teigland [Wed, 9 Dec 2020 16:59:40 +0000 (10:59 -0600)]
pvscan: add options listlvs listvg checkcomplete

pvscan --cache <dev>
    . read only dev
    . create online file for dev

pvscan --listvg <dev>
    . read only dev
    . list VG using dev

pvscan --listlvs <dev>
    . read only dev
    . list VG using dev
    . list LVs using dev

pvscan --cache --listvg [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . [check online files and report if VG is complete]

pvscan --cache --listlvs [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . list LVs using dev
    . [check online files and report if VG is complete]
    . [check online files and report if LVs are complete]

[--vgonline]
can be used with --checkcomplete, to enable use of a vg online
file.  This results in only the first pvscan command to see
the complete VG to report 'VG complete', and others will report
'VG finished'.  This allows the caller to easily run a single
activation of the VG.

[--udevoutput]
can be used with --cache --listvg --checkcomplete, to enable
an output mode that prints LVM_VG_NAME_COMPLETE='vgname' that
a udev rule can import, and prevents other output from the
command (other output causes udev to ignore the command.)

The list of complete LVs is meant to be passed to lvchange -aay,
or the complete VG used with vgchange -aay.

When --checkcomplete is used, lvm assumes that that the output
will be used to trigger event-based autoactivation, so the pvscan
does nothing if event_activation=0 and --checkcomplete is used.

Example of listlvs
------------------

$ lvs -a vg -olvname,devices
  LV     Devices
  lv_a   /dev/loop0(0)
  lv_ab  /dev/loop0(1),/dev/loop1(1)
  lv_abc /dev/loop0(3),/dev/loop1(3),/dev/loop2(1)
  lv_b   /dev/loop1(0)
  lv_c   /dev/loop2(0)

$ pvscan --cache --listlvs --checkcomplete /dev/loop0
  pvscan[35680] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete
  LV vg/lv_a complete
  LV vg/lv_ab incomplete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop1
  pvscan[35681] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete
  LV vg/lv_b complete
  LV vg/lv_ab complete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop2
  pvscan[35682] PV /dev/loop2 online, VG vg is complete.
  VG vg complete
  LV vg/lv_c complete
  LV vg/lv_abc complete

Example of listvg
-----------------

$ pvscan --cache --listvg --checkcomplete /dev/loop0
  pvscan[35684] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop1
  pvscan[35685] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop2
  pvscan[35686] PV /dev/loop2 online, VG vg is complete.
  VG vg complete

2 years agosystem_id: new appmachineid option
David Teigland [Wed, 20 May 2020 15:59:38 +0000 (10:59 -0500)]
system_id: new appmachineid option

The new system_id_source="appmachineid" will cause
lvm to use an lvm-specific derivation of the machine-id,
instead of the machine-id directly.  This is now
recommended in place of using machineid.

2 years agoconfig: change default use_devicesfile to 1
David Teigland [Tue, 16 Mar 2021 14:52:13 +0000 (09:52 -0500)]
config: change default use_devicesfile to 1

2 years agoconfig: comment all default settings
David Teigland [Tue, 16 Mar 2021 14:51:41 +0000 (09:51 -0500)]
config: comment all default settings

2 years agocleanup: use dm_list_empty
Zdenek Kabelac [Fri, 1 Oct 2021 12:30:49 +0000 (14:30 +0200)]
cleanup: use dm_list_empty

Instant check for 'dm_list_size() == 0' without any size calc.

2 years agocleanup: skip zeroing buffer overwritten by memcpy
Zdenek Kabelac [Fri, 1 Oct 2021 12:25:59 +0000 (14:25 +0200)]
cleanup: skip zeroing buffer overwritten by memcpy

Since the buffer is going to be overwritten by memcpy, reset only last
char to 0.

Also more use of DM_LIST_INIT list.h macro.

2 years agocleanup: all lvmcache_add users pass char with 0
Zdenek Kabelac [Fri, 1 Oct 2021 12:10:39 +0000 (14:10 +0200)]
cleanup: all lvmcache_add users pass char with 0

No local copy needed, both users submit zero-end string as pv/vgid.

2 years agocleanup: always initialize historical ptr
Zdenek Kabelac [Fri, 1 Oct 2021 11:53:28 +0000 (13:53 +0200)]
cleanup: always initialize historical ptr

Set ptr for all paths.

2 years agocleanup: remove unused code
Zdenek Kabelac [Fri, 1 Oct 2021 11:47:43 +0000 (13:47 +0200)]
cleanup: remove unused code

2 years agoarchiving: refactor code to allocate less memory
Zdenek Kabelac [Fri, 1 Oct 2021 14:19:53 +0000 (16:19 +0200)]
archiving: refactor code to allocate less memory

Do not store full path with each archived name reduces memory usage if
the directory has thousands of entries and just add 'dir' path when
needed.

Also emit info print message to a user if the total size of archived
files for a VG is more then 128MiB or 8192 files.

TODO: Consider wheather adding a new 'lvm.conf  archive{option}' to support
trimming these wild archive sizes can make situation better.
We already support retain_min && retain_days  - but if user is
generating too many and too large archives with minutes - maybe archiving
should be disabled by a user - as it's not producing anything largely usable
and just slows-down command ??
If we add 'retain_max & retain_max_size' the condition will go against
each other and we need to chose priorities.

mm

2 years agometadata: enhance internal error
Zdenek Kabelac [Fri, 1 Oct 2021 11:45:34 +0000 (13:45 +0200)]
metadata: enhance internal error

Consider missing config tree from vg read to be an internal error
since we do not want to 'regenerate' this one in expesive parsing way.

Also if there is any failure on recreating committed VG, make it also
a 'vg_write' error.

2 years agodebug: fix stack tracing
Zdenek Kabelac [Fri, 1 Oct 2021 11:44:17 +0000 (13:44 +0200)]
debug: fix stack tracing

Emit stack trace only on log_error path, and avoid on 'expected'
not-found path.

2 years agometadata: simplify code
Zdenek Kabelac [Fri, 1 Oct 2021 11:43:46 +0000 (13:43 +0200)]
metadata: simplify code

2 years agodevice_id: update stacked PVs for vgchange uuid
David Teigland [Mon, 4 Oct 2021 20:47:25 +0000 (15:47 -0500)]
device_id: update stacked PVs for vgchange uuid

If a VG uuid is changed, update the device_id of any
PVs stacked on LVs in the changed VG.

2 years agohandle bad metadata text in vg_read path
David Teigland [Tue, 28 Sep 2021 19:58:03 +0000 (14:58 -0500)]
handle bad metadata text in vg_read path

Corrupt metadata text (with good mda header) was being handled
in the label_scan phase, but not in the vg_read phase.  This
was sufficient because metadata areas would always be read and
checksummed during label_scan (metadata parsing was skipped
previously as an optimization.)

This changed with the optimization in
commit 61a6f9905e87e650f0bddae83fec6923bb100a57
"metadata: optimize reading metadata copies in scan"

Now, some metadata areas will not be read and checksummed
at all during the label_scan phase, only during the vg_read
phase.  This means that bad metadata text may first be detected
in the vg_read phase.  So, add equivalent bad metadata handling
to the vg_read path to match the label_scan path.

2 years agodebug: shorter code
Zdenek Kabelac [Mon, 27 Sep 2021 09:52:16 +0000 (11:52 +0200)]
debug: shorter code

2 years agocleanup: use already known lv size
Zdenek Kabelac [Mon, 27 Sep 2021 09:00:53 +0000 (11:00 +0200)]
cleanup: use already known lv size

2 years agocleanup: reuse existing code for free path
Zdenek Kabelac [Mon, 27 Sep 2021 09:42:45 +0000 (11:42 +0200)]
cleanup: reuse existing code for free path

2 years agocleanup: use first parameter uint
Zdenek Kabelac [Fri, 24 Sep 2021 20:16:07 +0000 (22:16 +0200)]
cleanup: use first parameter uint

Easier with struct zeroing and matching assing of type uint.

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