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

19495 Commits

Author SHA1 Message Date
Zdenek Kabelac
1712845ab5 device_mapper: use const for this API
Allow using constified version of devs_list.
Internal loop does not need to modify anythin in this stucture.
2024-05-27 15:35:17 +02:00
Zdenek Kabelac
36691b9844 device_mapper: add dm_device_list_find_by_dev
Introduce function to find device's name and uuid for
a given major:minor.

This information is cached with dm_device_list which reads all the
info from single ioctl(DM_DEVICE_LIST).
Lvm keeps major:minor name & uuid for active devices in the system.
2024-05-27 15:34:16 +02:00
Zdenek Kabelac
5c24d6d4db dev-type: use if..else if...
Compare strings till the first match.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
aad1add77f command: reorder vals order
Keep most frequently used val names in front.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
314c759a09 command: store val_name with its size
Compile length of val_name during compilation.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
a198224666 dev-cache: skip scanning known blockless dirs
Skip scan and stat() for dirs and nodes within known /dev/ paths,
where no block devices are located.

Also strlen(_cache.dev_dir) just once.

TODO: add more dirs to _no_scan (configurable via lvm.conf ?)
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
d8e639ecba dev-cache: collapsing slashes counts string size
_collapse_slashes() already goes through the whole string,
so just return now already known string length.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
caa0e08738 cleanup: use single array for idtype string
Share string array for de/coding idtype.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
2e0ac97903 error: try with modprobe
If the error target would be built as module,
ask modprobe to load it if the target is not present.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
9a371639fc cleanup: relocate section
Move _features[] structure from .data.rel.ro to .rodata.
2024-05-27 15:16:26 +02:00
Zdenek Kabelac
83c0b19f61 cleanup: use ALTERNATIVE_EXTENTS
Instead of comparing string of command names,
introduce ALTERNATIVE_EXTENTS command flags.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
93918a1990 cleanup: use ARG_LONG_OPT
Just like with _VAL strings, also _ARG strings do not need to
be present - as we can easily check for LONG opt version just
by adding attribute.

With attribute ARG_LONG_OPT string arg name[] becomes unused
and can be safely removed.

Also within _find_command_id_function() we do not need to handle
'command_enum == CMD_NONE' as separate case and just use single loop.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
59345da03f cleanup: do not store _VAL name string
String enum_name[] is unused so remove is with
all generated strings.

Reoder struct members, so there are no holes.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
dd78573073 libdm: parse only block section for proc_devices
Check for begining of 'B'lock section in /proc/devices file
before starting to sscanf() for major.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
38d34dbe75 lvmcmdline: use known lvm_command_enum
lvm command is already decoded (when found),
so use lvm_command_enum directly and avoid
comparing all strings again...
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
5173b0c222 command: return proper unsigned value
Use better 'unsigned' value, so we don't have any 'casting' troubles.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
73298635b9 lvm: fix shell completion
Previous commit 82617852a4
introduce bug in complession - as the rl_completion_matches()
needs to always advance to next element where the index
is held in static variable.

Add comment about this usage.
2024-05-27 15:16:25 +02:00
David Teigland
47f8bda051 lvremove: remove device_id for PVs on LVs
When PVs are created on LVs, remove the devices file entries
for the PVs when the LVs are removed.  In general, the devices
file entries should be removed with lvmdevices --deldev when
the LVs are removed (lvremove is the equivalent of detaching
a device from the system when layering PVs on LVs.)
This change is effectively an automatic lvmdevices --deldev
command that is built into lvremove when the LV has a PV on it.
2024-05-22 15:32:17 -05:00
David Teigland
c609dedc2f Allow system.devices to be automatically created on first boot
An OS installer can create system.devices for the system and
disks, but an OS image cannot create the system-specific
system.devices.  The OS image can instead configure the
image so that lvm will create system.devices on first boot.

Image preparation steps to enable auto creation of system.devices:
- create empty file /etc/lvm/devices/auto-import-rootvg
- remove any existing /etc/lvm/devices/system.devices
- enable lvm-devices-import.path
- enable lvm-devices-import.service

On first boot of the prepared image:
- udev triggers vgchange -aay --autoactivation event <rootvg>
- vgchange activates LVs in the root VG
- vgchange finds the file /etc/lvm/devices/auto-import-rootvg,
  and no /etc/lvm/devices/system.devices, so it creates
  /run/lvm/lvm-devices-import
- lvm-devices-import.path is run when /run/lvm/lvm-devices-import
  appears, and triggers lvm-devices-import.service
- lvm-devices-import.service runs vgimportdevices --rootvg --auto
- vgimportdevices finds /etc/lvm/devices/auto-import-rootvg,
  and no system.devices, so it creates system.devices containing
  PVs in the root VG, and removes /etc/lvm/devices/auto-import-rootvg
  and /run/lvm/lvm-devices-import

Run directly, vgimportdevices --rootvg (without --auto), will create
a new system.devices for the root VG, or will add devices for the
root VG to an existing system.devices.
2024-05-21 16:29:12 -05:00
Marian Csontos
6fdc8787eb post-release 2024-05-16 12:17:02 +02:00
Marian Csontos
90ec2cd92f pre-release 2024-05-16 12:12:06 +02:00
Marian Csontos
15413226a8 pages: Use gitlab pages and ikiwiki for doc 2024-05-16 12:00:26 +02:00
Marian Csontos
5906f44bee doc: Update TESTING file 2024-05-16 11:32:43 +02:00
Zdenek Kabelac
32b2776afc makefiles: use properly defined varitable
Variable used for tracking dependencies is USE_TRACKING.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
a0c5b2c9fd tests: add basics for dm_hash unit testing
Better code coverage.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
e59c84ca3a gcc: clean cast with -Wbad-function-cast
Makes gcc happier.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
e3dff2cba2 gcc: same signess 2024-05-14 17:59:26 +02:00
Zdenek Kabelac
7d22be22d9 gcc: use proper commnent 2024-05-14 17:59:26 +02:00
Zdenek Kabelac
e08e5a5a07 gcc: better initilizer for older gcc compilers
So use  { { } }.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
915267c900 activation: log_debug_activation
Correcting debug class.
2024-05-14 17:59:16 +02:00
Zdenek Kabelac
c2c028c680 tests: reduce number of created LVs
lvm2 for a while already optimizes 'vgremove' operation to
a single commit when possible if all LVs can be
easily deactivated.

So the number of LVs doesn't matter much - but the tested
case 'test_delete_non_complete_job' seems to be taking
some time anyway to capture the exception.

So just reducing the running time of the test significatanly
as we don't need to create 64LVs for 4 'execution mode' runs.
2024-05-13 18:04:34 +02:00
Zdenek Kabelac
a86fb27607 cov: ensure pointer has defined value
Add initialization of 'fin' pointer.
2024-05-13 17:32:46 +02:00
Zdenek Kabelac
c6b5eb5b50 dmfilemapd: assign 0 to integer
Avoid mixing enumeration assign with 0, so just pick some integer
from filemap_monitor,  stucture will be fully zeroed anyway....
2024-05-13 17:32:46 +02:00
Zdenek Kabelac
d58a2644e6 libdevmapper-event: correct switch break
Replace 'continue' within 'switch' statement with correct break.
2024-05-13 17:32:46 +02:00
David Teigland
aafa22e643 man: lvmlockd: remove dash in option name
for consistency with other man pages
2024-05-13 09:16:20 -05:00
Zdenek Kabelac
af983ad3d3 lvmcmdline: check for NULL
Althought this code likely never is hit with NULL, just add
check to be sure.
2024-05-13 14:49:54 +02:00
Zdenek Kabelac
c0e7cdff9d cov: enusure _table doesn't leak
If someone would enter _table multiple times by mistatek,
there is 'teroretical' leak - although doesn't matter much
in this case...
2024-05-13 14:48:46 +02:00
Zdenek Kabelac
a1a1e13dbe make: generate 2024-05-13 12:58:37 +02:00
Zdenek Kabelac
60bad2f22d lv_types: sort order of types
Order is used for man page generation (although not completely).
So place  'zero & error' to the end of list.
Keep  linear,striped,snapshot in front.
For the rest use alphabetic order.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
026344e8cc cleanup: local const arrays
No need for relocation entries for locally used arrays.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
ee3be2807f cleanup: static missed _ 2024-05-13 12:58:37 +02:00
Zdenek Kabelac
d25c43c8cd cleanup: remove unuable code path
Eliminate some ancient unreachable code
for historical version of libdm.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
ffdceeb982 cleanup: some missed public symbols static 2024-05-13 12:58:19 +02:00
Zdenek Kabelac
74e487f3a9 label: make scan_bcache local
Seems there are no users of scan_bcache, so make it local.
TODO: such variable should be ideally in cmd_context.
2024-05-13 02:21:37 +02:00
Zdenek Kabelac
8da0ab6fc1 cleanup: drop unused declared struct 2024-05-13 02:21:37 +02:00
Zdenek Kabelac
c7a9a1fb6c cleanup: use static vars
Drop global visibility.
2024-05-13 02:21:37 +02:00
Zdenek Kabelac
46669fe9e8 cleanup: add static _ 2024-05-13 02:21:37 +02:00
Zdenek Kabelac
5b7e30da76 lv_type: simplier macro usage
Use more simple macros - as there is likely not going to happen
any macro replacement - so use more effient structure layout.
2024-05-13 02:21:28 +02:00
Zdenek Kabelac
429ab45a1c lv_prop: simplier macro usage
Use more simple macros - as there is likely not going to happen
any macro replacement - so use more effient structure layout.
2024-05-13 02:20:29 +02:00
Zdenek Kabelac
f86bdcb6e9 command: validation code only for man-generator
Don't waste time with string order validation within command,
check within  'man-generator -c' is enough.
2024-05-13 02:18:19 +02:00