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

7285 Commits

Author SHA1 Message Date
David Teigland
631b8edefb device_id: ensure pvid buffers are ID_LEN+1
A pvid string read from system.devices could be less
then ID_LEN since system.devices fields can be edited.
Ensure the pvid buffer is ID_LEN+1 even if the string
read from the file is shorter.
2023-11-09 13:15:02 -06:00
David Teigland
de2b11f39a device_id: improve searched_devnames temp file
Include info in the temp file to confirm that it should be used.
The temp file is meant to suppress repeated, identical searches
for the same PVIDs on the same set of devices.  Write to the file
a count and hash of the missing PVIDs and a count and hash of the
devices to search.  A subsequent command will ignore and remove
the temp file if any of these values differ.  We don't want to
suppress a search if a change has occured, and a missing PV could
be found by scanning devices.
2023-11-09 13:14:55 -06:00
David Teigland
2b7c832847 lvmdevices: print changes for product_uuid or hostname
used by the recently added refresh feature
2023-11-07 14:30:48 -06:00
David Teigland
35cefa50fa device_id: change default search_for_devnames to all
Problematic scenario:
. the device for a PV has no wwid, so it's identified in system.devices
  with IDTYPE=devname IDNAME=/dev/foo
. user adds/enables a wwid for the device
. on reboot, the device name changes, e.g. now /dev/bar
. the code that searches for the new device name includes an
  optimization to skip looking on devs that have a wwid, on
  the basis that a device with a wwid won't have IDTYPE=devname
. this optimization causes lvm to not look for the PV on /dev/bar
  since that device now has a wwid, so the PV is not found
. the optimization is enabled by search_for_devnames="auto"
. change the default to search_for_devnames="all" which does not
  use the problematic optimization
2023-11-02 13:00:50 -05:00
David Teigland
37773c1055 lvmdevices: new output and options for check and update
- add new comparison between old and new entries, and use this
  as the basis for new dedicated output for check and update
- add new --refresh option to search for missing PVIDs on all
  devices, and possibly update the device ID
- internally, only use the term "refresh" for cases where a
  new device ID may be found and assigned for a missing PVID
2023-11-02 11:46:31 -05:00
David Teigland
a5628cf782 device_id: improve validate debug messages
Make the device_ids_validate messages consistent.

Consistently use "noupdate" and "update_needed" args.
2023-11-02 11:46:31 -05:00
David Teigland
ec47f0763d device_id: reduce messages
Don't print messages about devices file entries that are
missing or are being updated.
2023-11-02 11:46:31 -05:00
David Teigland
e291178633 device_id: simplify devname matching
Handle this case directly rather than going through the
process for reading other device ids.  Also simplify
matching alternate dm devnames.
2023-10-23 15:17:29 -05:00
David Teigland
46521a46d2 device_id: no idname should be NULL not empty string
One place was setting idname to "" instead of NULL when
there was no idname value.
2023-10-23 15:17:29 -05:00
David Teigland
9ff0615546 device_id: first match non-devname device ids
Incorrectly matching a dev to a devname id (due to changing devnames)
before matching the dev to a proper device id, can result in the
dev not being matched to the real id.
2023-10-23 15:17:29 -05:00
Zdenek Kabelac
d019c41f7a typo: update 2023-10-20 00:21:13 +02:00
Heinz Mauelshagen
e41da923a3 lvconvert: fix "lvconvert -m 0" for in-sync legs
With commit d7e922480e
lvconvert -m   may fail if we try to remove 1st. leg that
is out-of-sync while other leg is in-sync.

Hot fix allows to proceed with such down conversion.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
2023-10-20 00:20:15 +02:00
Zdenek Kabelac
2b01af3de9 filters: fix condition
During revork in commit cf46f4baee
condition was inverted, the check for non-null string is needed.
2023-10-18 02:19:15 +02:00
David Teigland
be9a64e654 device_id: make dmeventd use system.devices by default
When no dmeventd.devices exists, make it use system.devices
rather than no devices file at all.
2023-10-16 15:40:11 -05:00
David Teigland
a836872199 device_id: accept wwids containing QEMU HARDDISK
A wwid may be useful even when it contains the string
"QEMU HARDDISK", so allow these to be used.
2023-10-16 15:21:22 -05:00
David Teigland
d8d4260df8 device_id: improve handling of non-standard wwid prefixes 2023-10-16 15:12:12 -05:00
David Teigland
e6c6713a1b hints: correct fix for hints with device ids
Fixes commit 63b469c160
"device_id: fix hints with device ids"

It's not correct for internal filtering to be a factor
in validating the set of devs that are the basis for hints.

Instead, look for inconsistencies between a hint entry and
the corresponding devices file entry.
2023-10-16 14:13:27 -05:00
Zdenek Kabelac
6afaaca2e5 cov: enusure pointer to idname exists 2023-10-14 23:12:57 +02:00
Zdenek Kabelac
9668d40d5a resize: reduce without prompt for no-fs case
Apply the same logic for 'lvreduce' which exists for newer
systems (compiled with HAVE_BLKID_SUBLKS_FSINFO)
also for older systems for one very common practical case where
the active LV does not have any blkid known signature/filesystem.

New variant recognized this situation and allowed to proceed
without requesting a prompt, while the older variant always
requested confirmation prompt.

With this patch command now works equily for both variants
for 'active LV' without signature and allows to reduce LV
without prompting.
2023-10-14 23:10:21 +02:00
Zdenek Kabelac
46eeb62b04 pool: fix recalculate of pool chunk_size
Before checking seg_type of the first area, check there is
some existing area.
Since we now support error and zero segtypes, these do not have
any PV area present.
2023-10-14 01:04:10 +02:00
David Teigland
63b469c160 device_id: fix hints with device ids
Fix some interactions between device IDs and hints.  Hints
may limit the scanned devices which should not always trigger
a search for the PVs that were intentionally not scanned.
Hints should also be invalidated if they contain a device
that's become excluded by an internal filter such as the
device_id filter.
2023-10-10 11:47:29 -05:00
David Teigland
f20be398a1 device_id: refresh devname idnames if any are not found
Search for a PV on other devices if it's a devname entry
and the name doesn't exist on the system.  This restores
code that should not have been removed in commit 1901a47df
"device_id: fix conditions for device_ids_refresh"
2023-10-10 11:46:21 -05:00
David Teigland
25a87ea16a device_id: fix lvmdevices update segfault
From commit 1901a47df1
"device_id: fix conditions for device_ids_refresh"
2023-10-06 12:24:34 -05:00
Zdenek Kabelac
44f86d38f9 debug: fix message severity levels
Add some missing WARNS and correct some severity levels.
2023-10-06 10:50:26 +02:00
David Teigland
1901a47df1 device_id: fix conditions for device_ids_refresh
Fix commit 847f1dd99c
"device_id: rewrite validation of devname entries"

which began calling device_ids_refresh() in cases where it
was unnecessary, leading to extra PV searches and warnings.
Specifically, a command like "lvs <vg>" would use the hints
file to scan only devices for the named VG.  This means that
scanning other PVs would be skipped, and device IDs of those
PVs could not be validated because there are no PVID values
to verify.  This missing info would cause messages about
the missing info, and would cause device_ids_refresh to
search for the PVs that had been intentionally skipped.
2023-10-05 15:33:55 -05:00
Zdenek Kabelac
4edaa9fdf5 filters: leave device_id_sysfs_dir only for device_id
Do not use filters for sysfs with device_id.
2023-10-04 22:03:56 +02:00
Zdenek Kabelac
cf46f4baee filters: sysfs use device_id_sysfs_dir
This is mainly useful in internal testing - but keep sysfs dir also
passed to filter.
Also drop use of static variable within sysfs filter and base whole
config at creation time.
2023-10-03 21:30:22 +02:00
David Teigland
88aa285a79 devices: refresh device ids if the system changes
If the system changes, locate PVs that appear on different devices,
and update the device IDs in the devices file.  A system change is
detected by saving the DMI product_uuid or hostname in the devices
file, and comparing it to the current system value.  If a root PV
is restored or copied to a new system with different devices, then
the product_uuid or hostname should change, and trigger lvm to
locate PVIDs from system.devices on new devices.
2023-09-27 15:22:11 -05:00
Zdenek Kabelac
d54deae0ad debug: correcting check for error
Correct trace for erroring case of close.
2023-09-26 01:23:00 +02:00
Mikulas Patocka
ab73ad4e5f gcc: fix warnings for x32 architecture
Warning from x32 ABI compilation.
2023-09-12 14:41:22 +02:00
David Teigland
fa49651301 lvresize: fix 32 bit overflow in size calculation 2023-09-11 12:18:12 -05:00
Zdenek Kabelac
d34d1f0173 debug: trace result failure 2023-09-03 22:03:33 +02:00
Zdenek Kabelac
670d982568 debug: drop stack from regular path 2023-09-03 22:03:33 +02:00
Zdenek Kabelac
97770d5aeb debug: check for syscalls
Add some debug checks for possibly failing syscalls.
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
a48847269a clang: ensure all variables intialized
Just in case of some wierd kernel bug, which would forget
to report these values...
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
6a0e54f84f clang: ensure status is initilized
Initialize status before handling error path.
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
cb61d2294a filesystem: move stat after open check
To avoid time-of-check-time-of-use clash, take the stat()
after successful open with fstat().
Also add some debugs for failing sys calls.
2023-09-03 22:03:33 +02:00
Peter Rajnoha
14d0a9eef6
report: support printing full column names in report headings
Reuse existing report/headings config setting to make it possible to
change the type of headings to display:
  0 - no headings
  1 - column name abbreviations (default and original functionality)
  2 - full column names (column names are equal to exact names that
      -o|--options also accepts to set report output)

Also, add '--headings none|abbrev|full|0|1|2' command line option
so we are able to select the heading type for each LVM reporting
command directly.
2023-08-28 15:44:57 +02:00
Zdenek Kabelac
71ff21f57c gcc: initialize variables 2023-08-23 15:10:40 +02:00
Zdenek Kabelac
8698f9dce6 pool: use predefined name for metadata LV
While create new LV for pool volume, use name from 'pool_metadata%d' naming
sequence. This LV is later on renamed to  pool_t/cmeta, but if there
is any error in the middle, we may evenutally leave some 'volume',
With this name it can be slightly more obvious how it got there,
but also when we handle _pmspare name - we get slightly more predictible
name used there for it.

However for a standard usage this commit shall no visible impact as the
name is used temporarily just for cleaning LV.
2023-08-17 20:10:21 +02:00
David Teigland
696ee52ffd lvmlockd: let lockd_init_lv_args set lock_args
Set the lock_args string in addition to doing initialization.
lvconvert calls lockd_init_lv_args() directly, skipping
the normal lockd_init_lv() which usually sets lock_args.
2023-08-16 15:29:20 -05:00
David Teigland
096196281e lvmlockd: fix thick to thin lv conversion 2023-08-16 15:29:19 -05:00
Zdenek Kabelac
728617d25d gcc: cleanup warnings
Correcting signess comparation.
Also use standalone /* fall through */ comment as that's
the only one supported by gcc to quiet warning.
2023-08-16 15:13:25 +02:00
Zdenek Kabelac
b764665f4d debug: add missing log_error
Report error with failure.
2023-08-14 17:02:11 +02:00
Zdenek Kabelac
2f3d8659b1 commands: add lv_is_writable 2023-08-14 17:02:11 +02:00
David Teigland
847f1dd99c device_id: rewrite validation of devname entries
The old approach was too complicated and didn't work correctly
in some cases.
2023-08-04 11:45:40 -05:00
Peter Rajnoha
0e9fe272bc
report: fix pv_major and pv_minor report field type
We incorrectly marked pv_major and pv_minor fields as being of string
type, even though the values were already correctly handled as integers
internally. This confused -S|--select that tried to compare string
values instead of integers.

Reported here: https://github.com/lvmteam/lvm2/issues/122
2023-07-31 13:44:09 +02:00
Paul van Genderen-Tjie A Loi
e3cc3e55c8 vgmknodes: skipping thin pool is not an error 2023-07-24 12:03:06 -05:00
Zdenek Kabelac
96b2c20991 debug: add backtrace 2023-07-17 12:44:37 +02:00
Zdenek Kabelac
469bcc28ac cleanup: remove duplicated code
Commit cac4a9743a moved setting
if layer structed to the function front, but the old code
was still left in original place.
2023-07-17 12:44:23 +02:00