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

7307 Commits

Author SHA1 Message Date
David Teigland
4f9215e70f devices file: rename unused system.devices
If lvm.conf has use_devicesfile=0 and /etc/lvm/device/system.devices
exists, then rename it to system.devices-unused.YYYYMMDD.HHMMSS.
This prevents an old, incorrect system.devices from being used in
the future if lvm.conf is changed to use_devicesfile=1.
2024-02-15 11:40:37 -06:00
David Teigland
e59027e4f7 devices file: back up each version
Create backup copies of system.devices in /etc/lvm/devices/backup
named system.devices-YYYYMMDD.HHMMSS.NNNN.  NNNN is the version
counter from the file.

Each time that an lvm command writes a new system.devices file,
it also writes the same file in the backup directory.

A new comment line is added to system.devices with HASH=<num>
where <num> is a crc calculated from the uncommented lines in
system.devices.  This lets lvm detect if the file has been
modified outside of lvm itself.

If system.devices is edited directly, the next time a command
reads the file, the crc will not match the HASH value.  The
command will then rewrite system.devices with the correct HASH
value, and create a backup reflecting the edits.

A default limit of 50 backup files is kept, configurable by
lvm.conf devicesfile_backup_limit (set to 0 to disable backups.)
2024-02-15 11:40:37 -06:00
Andre Klärner
fe822f7043 system_id: explain the reason for choosing appmachineid over machineid
Since understanding the reason for choosing the appmachineid over the
direct use of machineid is not easily found, I extended to help text to
clarify this a bit.
2024-02-05 14:01:22 -06:00
Ranjith ML
1c3ae2b678 archiving: Fix doubled filename in vgcfgrestore 2024-01-24 14:11:19 +01:00
Zdenek Kabelac
5533f034e2 thin_pool: correct refactoring chunk_size
Function to recalc chunk_size according to dev hints needs to be
used after chunk_size is being set to thin pool segment - correct
this ordering mistake introduced in previous refactoring commit.
2024-01-17 17:31:19 +01:00
Zdenek Kabelac
9d9e43b87f vdo: correct vdo header size
Previous patch that introduced support for thinpool with vdo
not correctly handled header size - as this part is not fully usable
yet.  We are going to try to use the 0, but current state of code is not
yet compliant to this logic so keep vdo_header_size during conversion
and alos correctly pass through virtual_extents to vdo formating.
2024-01-17 17:30:10 +01:00
Zdenek Kabelac
db0de73d6e vdo: support creation of compressed thin-pools
Add code to handle creation of  thin-pool with VDO data backend
which can be seen as compressed deduplicated thin-pool.

To avoid need of changing to many internal APIs, pass the conversion
parameters for create thin-pool data volume via cmd_context.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
6ec2f1f44b vdo: refactor conversion to vdo lv
Introduce struct vdo_convert_params {} to pass-in all the parameters
needed for the conversion of an LV to a vdopool + vdo LV.

Function convert_vdo_lv() is also able to create a new LV and swap
segments, so the passed in LV can be later on use for futher
conversion so this refactoring makes it ready for more enhanced
usage.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
7544b9fc10 vdo: refactor vdo_params passing
Introduce vdo_convert_params and use vdo_params from this structure
also with lvcreate_params.

Later we will use this for convertion of thin-pool data volume to VDO.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
4ccedceaa8 thin_pool: introduce --pooldatavdo
Introducing new arg --pooldatavdo y|n
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
c496f80379 pool: code refactoring
Move pool related manipulation code to pool_manip.c.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
a176184b7d thin_pool: code refactoring
Move common code into thin_pool_set_params()
(just like we use  cache_set_params).
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
18d3283157 cov: some stack tracing corrections
Checking some returned values and adding/correcting
some debug tracing.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
2135bbe558 vdo: flip return value to int
Change API to return just 0/1.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
73967233e4 dev_manager: reuse _setup_task_run 2024-01-10 14:02:22 +01:00
Zdenek Kabelac
b058498404 lv: remove unused declaration 2024-01-10 14:02:22 +01:00
Zdenek Kabelac
b1e8af1c0c activate: use lv_layer
Avoid code duplication.
2024-01-10 14:02:22 +01:00
David Teigland
921ceddebf lvmconfig: uncomment the report section
so settings can be changed without uncommenting the
start/end of the section.
2023-11-17 13:52:49 -06:00
David Teigland
0e4fd4485f lvs: set first attr flag for raid integrity images
The first lv_attr flag is 'i' or 'I' for a raid image.
(i: raid image, I: out of sync raid image)
For integrity raid images (_iorig), the flag was not being set.
2023-11-17 13:26:23 -06:00
David Teigland
622284740a pvs, pvscan: new option -A to show PVs outside the devices file
pvs -A|--allpvs
	Show PVs that would otherwise be excluded by the devices file.

pvscan -A|--allpvs
	Show PVs that would otherwise be excluded by the devices file.
	For those devices that are included by the devices file,
	their device ID is displayed in place of the usual "lvm2"
	format and size.

(pvs -a|--all is unchanged, and shows devices not formatted as PVs.)
2023-11-16 08:45:46 -06:00
David Teigland
db03270135 device: remove log_debug for nvme device 2023-11-09 13:31:01 -06:00
David Teigland
e71b663bf5 device_id: remove unused dev pointer from dev_id struct 2023-11-09 13:15:02 -06:00
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