]> sourceware.org Git - lvm2.git/log
lvm2.git
3 years agocov: variable initialization
Zdenek Kabelac [Tue, 9 Mar 2021 15:05:46 +0000 (16:05 +0100)]
cov: variable initialization

3 years agocov: mask uninitialized value
Zdenek Kabelac [Tue, 9 Mar 2021 14:58:48 +0000 (15:58 +0100)]
cov: mask uninitialized value

Coverity doesn't track ioctl() too well, so let's just make it quiet.

3 years agocov: unused value
Zdenek Kabelac [Tue, 9 Mar 2021 14:51:11 +0000 (15:51 +0100)]
cov: unused value

3 years agocov: remove unnecessary headers
Zdenek Kabelac [Tue, 9 Mar 2021 14:04:22 +0000 (15:04 +0100)]
cov: remove unnecessary headers

3 years agocov: memleak on error path
Zdenek Kabelac [Tue, 9 Mar 2021 14:38:54 +0000 (15:38 +0100)]
cov: memleak on error path

3 years agocov: fix iter memleak in vgimportclose
Zdenek Kabelac [Wed, 10 Mar 2021 00:25:37 +0000 (01:25 +0100)]
cov: fix iter memleak in vgimportclose

Add missing release of iterator on error path.

3 years agoactivation: use existing LV as best effort
Zdenek Kabelac [Tue, 9 Mar 2021 17:23:42 +0000 (18:23 +0100)]
activation: use existing LV as best effort

Returning NULL for lv_committed is basically instant crash,
so instead try with passed LV instead.
It shouldn't matter as this is internall error path anyway,
but coverity should be happier.

3 years agogcc: match size of holder name to direcnt d_name
Zdenek Kabelac [Tue, 9 Mar 2021 12:58:50 +0000 (13:58 +0100)]
gcc: match size of holder name to direcnt d_name

As d_name is defined as 256 avoid gcc warning - although
in our case the used size will be much smaller.

3 years agodebug: more tracing
Zdenek Kabelac [Wed, 10 Mar 2021 00:26:30 +0000 (01:26 +0100)]
debug: more tracing

Check result of device_ids_write() and at least provide stack;

3 years agodebug: more use of display_lvname
Zdenek Kabelac [Tue, 9 Mar 2021 12:13:42 +0000 (13:13 +0100)]
debug: more use of display_lvname

3 years agodebug: change sys_error to sys_debug
Zdenek Kabelac [Tue, 9 Mar 2021 10:08:47 +0000 (11:08 +0100)]
debug: change sys_error to sys_debug

These messages do not cause command error - so changing logging level
to just 'sys_debug' (so visible only with -vvvv)

3 years agocleanup: no backtraces needed after log_error
Zdenek Kabelac [Tue, 9 Mar 2021 10:42:29 +0000 (11:42 +0100)]
cleanup: no backtraces needed after log_error

Reduce double backtracing.

3 years agocleanup: easier print of historical lv
Zdenek Kabelac [Tue, 9 Mar 2021 11:30:25 +0000 (12:30 +0100)]
cleanup: easier print of historical lv

Drop unneeded macros.

3 years agobackup: set in vg_commit
Zdenek Kabelac [Tue, 9 Mar 2021 10:30:28 +0000 (11:30 +0100)]
backup: set in vg_commit

Another step towards better automatic handling of backup,
and automatically setup needs_backup after commit.

In some next step we should reduce number of backups and takem
then only at the command finish with  vg_committed content.

3 years agolvm-file: remove duplication of dm_is_empty_dir
Zdenek Kabelac [Tue, 9 Mar 2021 10:10:47 +0000 (11:10 +0100)]
lvm-file: remove duplication of dm_is_empty_dir

3 years agothin: correct ptr test for thin snapshot merging
Zdenek Kabelac [Tue, 9 Mar 2021 15:23:08 +0000 (16:23 +0100)]
thin: correct ptr test for thin snapshot merging

The correct test needs to actually check  'lv->snapshot' is not NULL,
so the 'find_snapshot()' can work.

Test lv_is_snapshot was actually irrelavant for this case.

Also initialize device_id.

3 years agodevice_mapper: keep bigger size for most ioctls
Zdenek Kabelac [Tue, 9 Mar 2021 13:58:09 +0000 (14:58 +0100)]
device_mapper: keep bigger size for most ioctls

Actually the idea was to keep 2K ioctl only for certain command,
so keep 16 for them.

3 years agovg_write: shift check for exported metadata
Zdenek Kabelac [Tue, 9 Mar 2021 16:45:42 +0000 (17:45 +0100)]
vg_write: shift check for exported metadata

Since we now immediatelly use created buffer for CFT creation,
the result needs to be validate before such use.

3 years agobcache: fix incorrect pointer check
Zdenek Kabelac [Tue, 9 Mar 2021 18:35:53 +0000 (19:35 +0100)]
bcache: fix incorrect pointer check

With commit b44db5d1a7ecc2e8e3cef0852c4397b64ddf0a09
needs to check allocated pointer for failed malloc().

Existing check was actually no checking anything so failing
malloc here would result in segfault (although with very
low chance to ever happen).

3 years agotests: check_devicesfile
David Teigland [Mon, 8 Mar 2021 23:19:26 +0000 (17:19 -0600)]
tests: check_devicesfile

make check_devicesfile T=...

(A number of tests should probably get a new
SKIP_WITH_DEVICES_FILE.)

3 years agolvremove: correct return code
Zdenek Kabelac [Mon, 8 Mar 2021 19:24:04 +0000 (20:24 +0100)]
lvremove: correct return code

Need to return ECMD_FAILED from toollib code.
Add missing stack traces.

3 years agoWHATS_NEW: updates
Zdenek Kabelac [Mon, 8 Mar 2021 14:41:19 +0000 (15:41 +0100)]
WHATS_NEW: updates

3 years agocleanup: compare only LV uuid part
Zdenek Kabelac [Mon, 8 Mar 2021 07:07:47 +0000 (08:07 +0100)]
cleanup: compare only LV uuid part

Match VG uuid just once per list of all LVs in VG.

TODO: maybe some more efficeint tree or hash could be better here,
but since it's used not so often, the total benefit is not so great,
so ATM just reducing amount of checked bytes.

3 years agocleanup: move code
Zdenek Kabelac [Sun, 7 Mar 2021 17:10:48 +0000 (18:10 +0100)]
cleanup: move code

just evaluate later in code path.

3 years agocleanup: simpler checks first
Zdenek Kabelac [Thu, 4 Mar 2021 16:05:10 +0000 (17:05 +0100)]
cleanup: simpler checks first

Minor optimizatoins...

3 years agocleanup: on stack structure instead of allocation
Zdenek Kabelac [Thu, 4 Mar 2021 17:09:58 +0000 (18:09 +0100)]
cleanup: on stack structure instead of allocation

3 years agocleanup: avoid allocating memory for hash key
Zdenek Kabelac [Thu, 4 Mar 2021 17:17:03 +0000 (18:17 +0100)]
cleanup: avoid allocating memory for hash key

Hash always allocates its own copy of the key so avoid
this extra uuid copy.

3 years agolibdm-config: replace check for 0
Zdenek Kabelac [Sun, 7 Mar 2021 20:52:10 +0000 (21:52 +0100)]
libdm-config: replace check for 0

No need to call strlen() when checking for zero length string.

3 years agohints: keep strings aligned in structure
Zdenek Kabelac [Sun, 7 Mar 2021 15:28:59 +0000 (16:28 +0100)]
hints: keep strings aligned in structure

Preffer aligned string access.

3 years agohash: replace hash with better function
Zdenek Kabelac [Mon, 8 Mar 2021 14:18:04 +0000 (15:18 +0100)]
hash: replace hash with better function

Add Bob Jenkins hash function to get better working hash function,
which does genarate way less colisions (especially with similar
strings).

For a comparision also a kernel function used in DM kernel is include.
While it's better then our existing one, it's still far worse,
then Bob Jenkins hash.

3 years agohash: speed up hash tables
Zdenek Kabelac [Sun, 7 Mar 2021 14:33:04 +0000 (15:33 +0100)]
hash: speed up hash tables

Enhance hash perfomance by remembering the computed
hash value for the hashed node - this allows to speedup
lookup of nodes with the hash collision when
different keys map to the same masked hash value.

For the easier use 'num_slots' become 'mask_slots',
so we only add '1' in rare case of need of the original
num_slots value.

Also add statistic counters for hashes and print stats in
debug build (-DDEBUG) on hash wiping.
(so badly performing hash can be optimized.)

3 years agohash: use unsigned size
Zdenek Kabelac [Sun, 7 Mar 2021 01:13:02 +0000 (02:13 +0100)]
hash: use unsigned size

There is not much point in using 64bit hash size, since we hash
with way less bits anyway. So keep size 32bit.

3 years agohash: use individual hint sizes
Zdenek Kabelac [Sun, 7 Mar 2021 14:33:50 +0000 (15:33 +0100)]
hash: use individual hint sizes

Use different 'hint' size for dm_hash_create() call - so
when debug info about hash is printed we can recognize which
hash was in use.

This patch doesn't change actual used size since that is always
rounded to be power of 2 and >=16 - so as such is only a
help to developer.

We could eventually use 'name' arg, but since this would have changed
API and this patchset will be routed to libdm & stable - we will
just use this small trick.

3 years agolvremove: reduce ioctl count
Zdenek Kabelac [Mon, 8 Mar 2021 13:22:43 +0000 (14:22 +0100)]
lvremove: reduce ioctl count

Just like with deactivation, call of 'lv_is_not_in_use()'
now has embeded report for inactivate LV.

Note: this patch cannot be backported to stable-2.02 - as
there lv_is_active() has 'cluster' meaning and differs from lvinfo().

3 years agodeactivation: reduce ioctl count
Zdenek Kabelac [Sun, 7 Mar 2021 00:54:50 +0000 (01:54 +0100)]
deactivation: reduce ioctl count

When LV is deactivativate, we check for presence, and later
for some LV types also for being in use.

We can however do this check in 1 step for them a remove extra ioctl.

Add return value '2' to lv_check_not_in_use() to recognize LV is not
present.

Existing users were just testing for 0, so no change for them.

3 years agovg_read: reuse already parsed config tree
Zdenek Kabelac [Fri, 5 Mar 2021 22:04:44 +0000 (23:04 +0100)]
vg_read: reuse already parsed config tree

When parsing VG metadata we can create from a single config tree
also 'vg_committed' that is always created for writable VG.

This avoids extra uncessary step of serializing and deserilizing
just parsed VG.

3 years agovg_write: optimize caching of precommitted VG
Zdenek Kabelac [Fri, 5 Mar 2021 21:12:58 +0000 (22:12 +0100)]
vg_write: optimize caching of precommitted VG

Every vg_write stores new 'metadata' into precommitted slot.
For this step we use 'serialized buffer' to ascii metadata.

Instead of recreating this buffer after whole 'vg_write()' we
use this buffer instantly for creating of precommitted VG.

This has also the advantage of catching any problems with
reparsing of ascii metadata back to VG early before any write.

3 years agolv_remove: reduce commits for removed LVs
Zdenek Kabelac [Fri, 5 Mar 2021 15:21:50 +0000 (16:21 +0100)]
lv_remove: reduce commits for removed LVs

This patch postpones update of lvm metadata for each removed
LV for later moment depending on LV type.

It also queues messages to be printed after such write & commit.

As such there is some change in the behavior - although before
prompt we do make  write&commit happens automatically in some
other error case we rather keep 'existing' state - so there
could be difference in amount of removed & commited LVs.

IMHO introduce logic is slightly better and more save.

But some cases still need the early commit - i.e. thin-removal
and fixing this needs some more thinking.

TODO: improve removal at least with the case of the whole thin-pool.
i.e. we can simply recognize removal of 'all LVs/whole VG'.

3 years agomakefiles: fix location of basedir
Zdenek Kabelac [Wed, 3 Mar 2021 13:45:25 +0000 (14:45 +0100)]
makefiles: fix location of basedir

3 years agomakefiles: make rpm respect --disable-silent-rules
Marian Csontos [Mon, 8 Mar 2021 13:10:17 +0000 (14:10 +0100)]
makefiles: make rpm respect --disable-silent-rules

3 years agomakefiles: Revert most of 456b659
Marian Csontos [Mon, 8 Mar 2021 12:59:26 +0000 (13:59 +0100)]
makefiles: Revert most of 456b659

Must not use DESTDIR with --basedir.

Reverts: 456b659b4edfc758b5aa0b72af25677a4f5042ea

3 years agomake: generate
Marian Csontos [Fri, 5 Mar 2021 11:53:35 +0000 (12:53 +0100)]
make: generate

3 years agoman: Fix wording in lvmthin(7)
Marian Csontos [Fri, 5 Mar 2021 11:49:54 +0000 (12:49 +0100)]
man: Fix wording in lvmthin(7)

3 years agolvmlockctl: replace popen and system
David Teigland [Wed, 3 Mar 2021 23:36:42 +0000 (17:36 -0600)]
lvmlockctl: replace popen and system

with fork and exec to avoid use of shell.
largely copied from lib/misc/lvm-exec.c

require lvmlockctl_kill_command to be full path

use lvm config instead of lvmconfig to avoid need for LVM_DIR

3 years agolvmlockctl: use lvm.conf lvmlockctl_kill_command
David Teigland [Mon, 1 Mar 2021 21:22:54 +0000 (15:22 -0600)]
lvmlockctl: use lvm.conf lvmlockctl_kill_command

which specifies a command to run by lvmlockctl --kill.

3 years agofilters: better message for excluding LV
David Teigland [Wed, 3 Mar 2021 18:07:57 +0000 (12:07 -0600)]
filters: better message for excluding LV

Make the generic "device is not usable" message from filter-usable
more specific in case the device is not usable because it's an LV.
(i.e. when scan_lvs=0)

3 years agoWHATS_NEW: updates
Zdenek Kabelac [Fri, 26 Feb 2021 23:15:25 +0000 (00:15 +0100)]
WHATS_NEW: updates

3 years agomake: generate
Zdenek Kabelac [Wed, 24 Feb 2021 11:40:15 +0000 (12:40 +0100)]
make: generate

3 years agodebug: use enclusing "" for debug
Zdenek Kabelac [Sat, 27 Feb 2021 16:08:52 +0000 (17:08 +0100)]
debug: use enclusing "" for debug

3 years agocleanup: simplify condition
Zdenek Kabelac [Sat, 27 Feb 2021 20:18:48 +0000 (21:18 +0100)]
cleanup: simplify condition

3 years agocleanup: free already checks for NULL
Zdenek Kabelac [Sat, 27 Feb 2021 13:14:25 +0000 (14:14 +0100)]
cleanup: free already checks for NULL

3 years agointegrity: mark as user of secure_data
Zdenek Kabelac [Sat, 27 Feb 2021 21:12:33 +0000 (22:12 +0100)]
integrity: mark as user of secure_data

Use the secure_data with integrity target. Not so big difference,
as the secure feature of the integrity target is not used by lvm2.

3 years agodevice_mapper: reduce min_size for flatten
Zdenek Kabelac [Sat, 27 Feb 2021 20:22:41 +0000 (21:22 +0100)]
device_mapper: reduce min_size for flatten

For most ioctl() we do not need to pass so big buffers
and we can reduce amount of zeroed memory blocks.

3 years agodevice_mapper: zero only secure buffers
Zdenek Kabelac [Sat, 27 Feb 2021 16:08:26 +0000 (17:08 +0100)]
device_mapper: zero only secure buffers

Securely erase before free() only dm_tasks marked as secure_data.
TODO: think about also using this for libdm/.

3 years agolabel: check only with active device for rescan
Zdenek Kabelac [Sat, 27 Feb 2021 20:20:37 +0000 (21:20 +0100)]
label: check only with active device for rescan

When 'lv_info()' is called with &info structure,
the presence of node has to be checked from this structure.
Without this we were needlesly trying to look out 0:0 device.

3 years agotoolib: move sigint_caught
Zdenek Kabelac [Sat, 27 Feb 2021 18:22:11 +0000 (19:22 +0100)]
toolib: move sigint_caught

Move the check for catched signal to the loop front.
Currently not much usable - but we can improve it later.

3 years agoarchive: support interruption
Zdenek Kabelac [Fri, 26 Feb 2021 00:23:50 +0000 (01:23 +0100)]
archive: support interruption

When lvm2 calls archive() or backup() it can be useful to allow handling
break signal so the command can be interrupted at some consistent point.

Signal is accepted during processing these calls - and can be evaluated
later during even lengthy processing loops.

So now user can interrupt lengthy lvremove().

3 years agolvremove: backup at the end of loop
Zdenek Kabelac [Fri, 26 Feb 2021 00:01:29 +0000 (01:01 +0100)]
lvremove: backup at the end of loop

Taking backup with each removed LV is slowing down the process
considerable and is largerly uneeded. We are supposed to take
backup only on significant points and making sure the backup
is correct when the command is finished.

TODO: check how many other commands can be improved.

3 years agodev-cache: optimize dir scanning
Zdenek Kabelac [Sat, 27 Feb 2021 16:09:38 +0000 (17:09 +0100)]
dev-cache: optimize dir scanning

Use 'C' for alphasort - there is no need to use localized and slower
sorting for internal directory scanning.

Ensure on all code paths allocated dirent entries are released.

Optimize full path construction.

3 years agodev-cache: replace inefficient looking for dev
Zdenek Kabelac [Thu, 25 Feb 2021 23:21:41 +0000 (00:21 +0100)]
dev-cache: replace inefficient looking for dev

Use btree loopkup to find dev structure by major:minor.
This could have slow down lvm2 commands significantly with
higher amount of LVs.

3 years agocmdline: use binary search
Zdenek Kabelac [Thu, 25 Feb 2021 17:09:52 +0000 (18:09 +0100)]
cmdline: use binary search

Reduce strcmp() call count by using binary search to find
commands in cmd_names[] and command_names[] arrays.

3 years agocmdline: drop MAX and check NULL
Zdenek Kabelac [Thu, 25 Feb 2021 17:09:33 +0000 (18:09 +0100)]
cmdline: drop MAX and check NULL

Remove MAX_COMMAND_NAMES and check for the last element as NULL pointer.

3 years agocmdline: lvcreate adds vdopool as vg name provider
Zdenek Kabelac [Thu, 25 Feb 2021 16:41:39 +0000 (17:41 +0100)]
cmdline: lvcreate adds vdopool as vg name provider

Add same logic as with thinpool or cachepool.

3 years agocommands.h: keep entries alphabetically sorted
Zdenek Kabelac [Thu, 25 Feb 2021 21:24:32 +0000 (22:24 +0100)]
commands.h: keep entries alphabetically sorted

For binary search usage commands need to be sorted.
Later patch also adds check if the order would be broken.

3 years agomakefiles: retry faster deps again
Zdenek Kabelac [Tue, 2 Mar 2021 20:20:42 +0000 (21:20 +0100)]
makefiles: retry faster deps again

From commit 29abba378520a270c3a9385724c8ef5df66497b1 we have hopefully
fixed most of troubles for deps tracking we had in past - so retry
again.

Drop explicit configure.h from DEPS - as it's automatically gathered
by gcc dependency tracking anyway.

3 years agomakefiles: better logging
Zdenek Kabelac [Sun, 28 Feb 2021 20:20:54 +0000 (21:20 +0100)]
makefiles: better logging

Show only filename instead of full path name when building
in builddir != srcdir

3 years agomakefiles: integrate DESTDIR
Zdenek Kabelac [Tue, 2 Mar 2021 15:29:07 +0000 (16:29 +0100)]
makefiles: integrate  DESTDIR

Always use lvmdbusdir with DESTDIR.

3 years agomakefiles: fix pofile generation
Zdenek Kabelac [Tue, 2 Mar 2021 00:10:25 +0000 (01:10 +0100)]
makefiles: fix pofile generation

If there is any user of --enable-nls  and wants to get
usable .po language file  -  use 'make pofile'

3 years agomakefiles: cmirrord install through install_cluster
Zdenek Kabelac [Mon, 1 Mar 2021 23:23:45 +0000 (00:23 +0100)]
makefiles: cmirrord install through install_cluster

There is not much left for this target...

3 years agomakefiles: sed
Zdenek Kabelac [Tue, 2 Mar 2021 20:21:38 +0000 (21:21 +0100)]
makefiles: sed

3 years agomakefiles: simplify and cleanup
Zdenek Kabelac [Sun, 28 Feb 2021 00:21:12 +0000 (01:21 +0100)]
makefiles: simplify and cleanup

Print all installed man pages with INSTALL
Simplify distclean handling.

3 years agomakefiles: drop invalid dependency on all
Zdenek Kabelac [Sun, 28 Feb 2021 00:20:28 +0000 (01:20 +0100)]
makefiles: drop invalid dependency on all

3 years agomakefiles: add alias for device-mapper
Zdenek Kabelac [Sun, 28 Feb 2021 00:19:23 +0000 (01:19 +0100)]
makefiles: add alias for device-mapper

Support also 'make device_mapper' so user is less confused.

3 years agomakefiles: fix man-generate rule
Zdenek Kabelac [Sun, 28 Feb 2021 00:17:31 +0000 (01:17 +0100)]
makefiles: fix man-generate rule

Symlink and compiled man-generate binary has to go to builddir.

3 years agomakefiles: avoid sorting by locales
Zdenek Kabelac [Thu, 25 Feb 2021 20:18:05 +0000 (21:18 +0100)]
makefiles: avoid sorting by locales

Localized sort for building source file is not wanted.

3 years agomakefiles: support help target
Zdenek Kabelac [Thu, 25 Feb 2021 16:40:53 +0000 (17:40 +0100)]
makefiles: support help target

Usable targets for top-level make.

3 years agotests: make test complaint to local dev dir
Zdenek Kabelac [Wed, 24 Feb 2021 10:54:24 +0000 (11:54 +0100)]
tests: make test complaint to local dev dir

For test running in 'local' dev dir we want to see loop devices there.
Also add missing notification to lvmetad after wipefs.

3 years agotests: update setting LVM_BINARY for testing
Zdenek Kabelac [Tue, 23 Feb 2021 15:27:44 +0000 (16:27 +0100)]
tests: update setting LVM_BINARY for testing

When testing is running on uninstealled system - prefer our own binary
in tests.

3 years agoconfig: remove redundant comment for deprecated settings
David Teigland [Tue, 2 Mar 2021 20:11:38 +0000 (14:11 -0600)]
config: remove redundant comment for deprecated settings

Drop the comment "This setting is no longer used." which
was printed just before the standard deprecation comment:
"This configuration option is deprecated."

3 years agolvmconfig: fix deprecation message
David Teigland [Tue, 2 Mar 2021 19:49:41 +0000 (13:49 -0600)]
lvmconfig: fix deprecation message

When lvmconfig --typeconfig full printed a deprecated
entry it would attempt to print a non-existing
deprecation comment resulting in output like:
  # (null)        # This setting is no longer used.

3 years agoRevert "tests: enable tests for lvmlockd"
David Teigland [Wed, 24 Feb 2021 16:30:51 +0000 (10:30 -0600)]
Revert "tests: enable tests for lvmlockd"

This reverts commit 99b6173f10fe7e2dbd54bb8734667ca8df69905e.

These tests are disabled with lvmlockd because they use
snapshots without an origin which is not permitted in a
shared vg.

3 years agotests: real_devs remove mistakenly added test
David Teigland [Wed, 24 Feb 2021 16:19:00 +0000 (10:19 -0600)]
tests: real_devs remove mistakenly added test

devicesfile-realdevs is the correct one

3 years agoWHATS_NEW: devices file
David Teigland [Tue, 23 Feb 2021 21:29:23 +0000 (15:29 -0600)]
WHATS_NEW: devices file

3 years agotests: for devices file
David Teigland [Mon, 23 Nov 2020 23:15:25 +0000 (17:15 -0600)]
tests: for devices file

3 years agotests: allow tests to use real devices
David Teigland [Mon, 16 Nov 2020 22:05:39 +0000 (16:05 -0600)]
tests: allow tests to use real devices

user creates a file listing real devices they want
lvm tests to use, and sets LVM_TEST_DEVICE_LIST.
lvm tests can use these with prepare_real_devs
and get_real_devs.
Other aux functions do not work with these devs.

3 years agodevice usage based on devices file
David Teigland [Tue, 23 Jun 2020 18:25:41 +0000 (13:25 -0500)]
device usage based on devices file

The LVM devices file lists devices that lvm can use.  The default
file is /etc/lvm/devices/system.devices, and the lvmdevices(8)
command is used to add or remove device entries.  If the file
does not exist, or if lvm.conf includes use_devicesfile=0, then
lvm will not use a devices file.  When the devices file is in use,
the regex filter is not used, and the filter settings in lvm.conf
or on the command line are ignored.

LVM records devices in the devices file using hardware-specific
IDs, such as the WWID, and attempts to use subsystem-specific
IDs for virtual device types.  These device IDs are also written
in the VG metadata.  When no hardware or virtual ID is available,
lvm falls back using the unstable device name as the device ID.
When devnames are used, lvm performs extra scanning to find
devices if their devname changes, e.g. after reboot.

When proper device IDs are used, an lvm command will not look
at devices outside the devices file, but when devnames are used
as a fallback, lvm will scan devices outside the devices file
to locate PVs on renamed devices.  A config setting
search_for_devnames can be used to control the scanning for
renamed devname entries.

Related to the devices file, the new command option
--devices <devnames> allows a list of devices to be specified for
the command to use, overriding the devices file.  The listed
devices act as a sort of devices file in terms of limiting which
devices lvm will see and use.  Devices that are not listed will
appear to be missing to the lvm command.

Multiple devices files can be kept in /etc/lvm/devices, which
allows lvm to be used with different sets of devices, e.g.
system devices do not need to be exposed to a specific application,
and the application can use lvm on its own set of devices that are
not exposed to the system.  The option --devicesfile <filename> is
used to select the devices file to use with the command.  Without
the option set, the default system devices file is used.

Setting --devicesfile "" causes lvm to not use a devices file.

An existing, empty devices file means lvm will see no devices.

The new command vgimportdevices adds PVs from a VG to the devices
file and updates the VG metadata to include the device IDs.
vgimportdevices -a will import all VGs into the system devices file.

LVM commands run by dmeventd not use a devices file by default,
and will look at all devices on the system.  A devices file can
be created for dmeventd (/etc/lvm/devices/dmeventd.devices)  If
this file exists, lvm commands run by dmeventd will use it.

Internal implementaion:

- device_ids_read - read the devices file
  . add struct dev_use (du) to cmd->use_devices for each devices file entry
- dev_cache_scan - get /dev entries
  . add struct device (dev) to dev_cache for each device on the system
- device_ids_match - match devices file entries to /dev entries
  . match each du on cmd->use_devices to a dev in dev_cache, using device ID
  . on match, set du->dev, dev->id, dev->flags MATCHED_USE_ID
- label_scan - read lvm headers and metadata from devices
  . filters are applied, those that do not need data from the device
  . filter-deviceid skips devs without MATCHED_USE_ID, i.e.
    skips /dev entries that are not listed in the devices file
  . read lvm label from dev
  . filters are applied, those that use data from the device
  . read lvm metadata from dev
  . add info/vginfo structs for PVs/VGs (info is "lvmcache")
- device_ids_find_renamed_devs - handle devices with unstable devname ID
  where devname changed
  . this step only needed when devs do not have proper device IDs,
    and their dev names change, e.g. after reboot sdb becomes sdc.
  . detect incorrect match because PVID in the devices file entry
    does not match the PVID found when the device was read above
  . undo incorrect match between du and dev above
  . search system devices for new location of PVID
  . update devices file with new devnames for PVIDs on renamed devices
  . label_scan the renamed devs
- continue with command processing

3 years agoWHATS_NEW: updates
Zdenek Kabelac [Tue, 23 Feb 2021 14:00:17 +0000 (15:00 +0100)]
WHATS_NEW: updates

3 years agocleanup: comment typo
Zdenek Kabelac [Sat, 20 Feb 2021 22:50:25 +0000 (23:50 +0100)]
cleanup: comment typo

3 years agocleanup: improving message
Zdenek Kabelac [Sat, 20 Feb 2021 22:23:00 +0000 (23:23 +0100)]
cleanup: improving message

lvconvert -Z can be used with snaps & pools.

3 years agocleanup: simplify initilization
Zdenek Kabelac [Sat, 20 Feb 2021 21:44:06 +0000 (22:44 +0100)]
cleanup: simplify initilization

Simplier code and also drop duplicate check for active LV.

3 years agocleanup: simply code
Zdenek Kabelac [Sat, 20 Feb 2021 21:11:30 +0000 (22:11 +0100)]
cleanup: simply code

3 years agolvconvert: change errors to internal ones
Zdenek Kabelac [Sat, 20 Feb 2021 22:01:25 +0000 (23:01 +0100)]
lvconvert: change errors to internal ones

Since these errors should never happen, change them to  internal errors.

3 years agocache: fix warning test
Zdenek Kabelac [Sat, 20 Feb 2021 21:45:13 +0000 (22:45 +0100)]
cache: fix warning test

The cache here is not 'writethough' - so print proper state
(writeback or passthrough)

3 years agolvextend: enable resize of writecached LV
Zdenek Kabelac [Sat, 20 Feb 2021 21:22:51 +0000 (22:22 +0100)]
lvextend: enable resize of writecached LV

3 years agotests: remove local setting of LVM_BINARY
Zdenek Kabelac [Tue, 23 Feb 2021 13:42:47 +0000 (14:42 +0100)]
tests: remove local setting of LVM_BINARY

To better test actually fsadm in test suite - avoid setting
LVM_BINARY locally - since test setup already modifies
PATH to find test's lvm binary as the 1st. in path.

3 years agofsadm: avoid access to unbound variable
Zdenek Kabelac [Tue, 23 Feb 2021 13:14:16 +0000 (14:14 +0100)]
fsadm: avoid access to unbound variable

3 years agocommand defs: add missing commas
David Teigland [Mon, 22 Feb 2021 16:44:01 +0000 (10:44 -0600)]
command defs: add missing commas

even though the parser seems to work fine without them

3 years agofix check for md raid imsm signature on 4k devices
David Teigland [Thu, 18 Feb 2021 17:42:32 +0000 (11:42 -0600)]
fix check for md raid imsm signature on 4k devices

On devices with 4k logical block size, the imsm signature
is located 8k from the end of the device, not 1k as is
the case for devices with 512 LBS.

3 years agotests: Skip test killing kernel
Marian Csontos [Wed, 17 Feb 2021 12:26:06 +0000 (13:26 +0100)]
tests: Skip test killing kernel

Bug 1916891

3 years agoWHATS_NEW: updates
Zdenek Kabelac [Wed, 17 Feb 2021 10:27:57 +0000 (11:27 +0100)]
WHATS_NEW: updates

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