1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

17270 Commits

Author SHA1 Message Date
Zdenek Kabelac
fa64c51428 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.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
9dd759c6b1 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.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
081e47912e cmdline: use binary search
Reduce strcmp() call count by using binary search to find
commands in cmd_names[] and command_names[] arrays.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
589c654562 cmdline: drop MAX and check NULL
Remove MAX_COMMAND_NAMES and check for the last element as NULL pointer.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
e946a5e690 cmdline: lvcreate adds vdopool as vg name provider
Add same logic as with thinpool or cachepool.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
f87d1a2abb 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.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
6846af6612 makefiles: retry faster deps again
From commit 29abba3785 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.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
39eee85fff makefiles: better logging
Show only filename instead of full path name when building
in builddir != srcdir
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
456b659b4e makefiles: integrate DESTDIR
Always use lvmdbusdir with DESTDIR.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
8bfa4439e1 makefiles: fix pofile generation
If there is any user of --enable-nls  and wants to get
usable .po language file  -  use 'make pofile'
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
4e976d9960 makefiles: cmirrord install through install_cluster
There is not much left for this target...
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
e080e35c83 makefiles: sed 2021-03-02 22:54:40 +01:00
Zdenek Kabelac
520bd9356e makefiles: simplify and cleanup
Print all installed man pages with INSTALL
Simplify distclean handling.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
da29afe028 makefiles: drop invalid dependency on all 2021-03-02 22:54:40 +01:00
Zdenek Kabelac
5509e764f1 makefiles: add alias for device-mapper
Support also 'make device_mapper' so user is less confused.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
8d93d8b7b7 makefiles: fix man-generate rule
Symlink and compiled man-generate binary has to go to builddir.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
824230e1e2 makefiles: avoid sorting by locales
Localized sort for building source file is not wanted.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
9d190d6b46 makefiles: support help target
Usable targets for top-level make.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
8d3ce32880 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.
2021-03-02 22:24:51 +01:00
Zdenek Kabelac
7528a33630 tests: update setting LVM_BINARY for testing
When testing is running on uninstealled system - prefer our own binary
in tests.
2021-03-02 22:24:51 +01:00
David Teigland
3bab1a1026 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."
2021-03-02 14:15:17 -06:00
David Teigland
db4af67b37 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.
2021-03-02 14:14:28 -06:00
David Teigland
aa34da6ecc Revert "tests: enable tests for lvmlockd"
This reverts commit 99b6173f10.

These tests are disabled with lvmlockd because they use
snapshots without an origin which is not permitted in a
shared vg.
2021-02-24 10:30:51 -06:00
David Teigland
6fad7f2eac tests: real_devs remove mistakenly added test
devicesfile-realdevs is the correct one
2021-02-24 10:21:18 -06:00
David Teigland
91d6822534 WHATS_NEW: devices file 2021-02-23 16:43:38 -06:00
David Teigland
b36b4b82d8 tests: for devices file 2021-02-23 16:43:38 -06:00
David Teigland
135c226e26 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.
2021-02-23 16:43:37 -06:00
David Teigland
83fe6e720f 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
2021-02-23 16:43:32 -06:00
Zdenek Kabelac
f7d9542aed WHATS_NEW: updates 2021-02-23 15:01:05 +01:00
Zdenek Kabelac
5d820b0201 cleanup: comment typo 2021-02-23 14:56:48 +01:00
Zdenek Kabelac
0c842ee8ad cleanup: improving message
lvconvert -Z can be used with snaps & pools.
2021-02-23 14:56:48 +01:00
Zdenek Kabelac
5237175cb6 cleanup: simplify initilization
Simplier code and also drop duplicate check for active LV.
2021-02-23 14:56:48 +01:00
Zdenek Kabelac
b5f906e984 cleanup: simply code 2021-02-23 14:56:48 +01:00
Zdenek Kabelac
5ecd65e6f2 lvconvert: change errors to internal ones
Since these errors should never happen, change them to  internal errors.
2021-02-23 14:56:47 +01:00
Zdenek Kabelac
b140bba9fe cache: fix warning test
The cache here is not 'writethough' - so print proper state
(writeback or passthrough)
2021-02-23 14:56:47 +01:00
Zdenek Kabelac
ac09fa08aa lvextend: enable resize of writecached LV 2021-02-23 14:56:47 +01:00
Zdenek Kabelac
e43b5f1e3c 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.
2021-02-23 14:56:47 +01:00
Zdenek Kabelac
646e3280dd fsadm: avoid access to unbound variable 2021-02-23 14:56:47 +01:00
David Teigland
9e836c77a0 command defs: add missing commas
even though the parser seems to work fine without them
2021-02-22 10:44:01 -06:00
David Teigland
12667e9897 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.
2021-02-18 11:42:32 -06:00
Marian Csontos
3cba071254 tests: Skip test killing kernel
Bug 1916891
2021-02-17 13:28:56 +01:00
Zdenek Kabelac
26a09c84c9 WHATS_NEW: updates 2021-02-17 11:53:19 +01:00
Zdenek Kabelac
2c5e034cd3 make: generate 2021-02-17 11:53:19 +01:00
Zdenek Kabelac
b9846bdc3e tests: readonly snapshot thick origin can't be merged
When user sets snapshot thick origin as read-only - lvconvert --merge refuses
to merge until user swiches origin to 'read-write'.
2021-02-17 11:53:19 +01:00
Zdenek Kabelac
868b733588 lvmlocdk: correct creation of dm path vg sanlock LV
Vgname may contain '-' and needs escaping '--' for /dev/mapper path.
2021-02-17 11:53:19 +01:00
Zdenek Kabelac
fbaf5a32bb tests: lvconvert vdo profile support 2021-02-17 11:53:19 +01:00
Zdenek Kabelac
9c0ce4daa2 man: vdo drop resize restriction comment
lvm2 supports resize of cached vdo pool volumes.
2021-02-17 11:53:19 +01:00
Zdenek Kabelac
19e1373580 tests: check resize of cached vdopool 2021-02-17 11:53:18 +01:00
Zdenek Kabelac
5bf1dba9eb vdo: just one probe is enough
target_present_version() can handle modprobing no need to try it
twice.
2021-02-17 11:21:35 +01:00
Zdenek Kabelac
a7cb25c877 lvconvert: VDO kernel support before converting
Early check for kernel support of VDO target before starting any
conversion work.
2021-02-17 11:21:35 +01:00