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

4268 Commits

Author SHA1 Message Date
David Teigland
7cc414135a lvmdevices: add --delnotfound to delete entries for missing devices
Used with update: lvmdevices --update --delnotfound.
Removes all devices file entries for which no matching device is found.
2023-07-24 14:56:32 -05:00
Zdenek Kabelac
09e17f99c5 cleanup: remove double //
dev_dir ends with /.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
d6771e513e lvconvert: code shuffle
Use cachepool name for create name for metadata backup LV.
(so we do not generate 2 'sequences' of metadata filenames.)
Move path preparion before handling _pmspare.
Also drop extra call to sync_local_dev_names() as it's
already got in sync with call of exec_cmd().
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
f078ffc5e6 lvconvert: add support --setactivationskip
When repair thinpool or cachepool, lvm2 leaves original metadata
volume backup. To avoid potential damage of those data, mark such
volume as 'read-only' and also allow user to use --setactivationskip
option for this volume.

TODO: likely better default would be to automatically skip, but
that might need some more thinking about recovery reporting doc.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
d040b68aee lvconvert: use public LVs for recovery
Replace the use of internal /dev/mapper names with the use of
public LV names /dev/vg/lv for use with repair tools.
For this make the activation of _pmspare LV to be handled as
a component activation with public name.
Metadata is already atomatically activated this way (as readonly).

So if there is any 'error' happening, we leave public LVs in
system.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
4d2311655b lvm-exec: refactor code
Add prepare_exec_args() for reading option list for
thin/cache_repair, thin/cache_check.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
81ef1fd0cc debug: print WARNING:
Add WARNING: in front of log_warn() messages.
2023-07-15 11:05:35 +02:00
Zdenek Kabelac
b3e45219c2 lvconvert: hanle metadataswap with lvmlockd 2023-07-15 11:05:35 +02:00
Zdenek Kabelac
b89fc0564b cleanup: indent 2023-07-14 16:52:51 +02:00
Zdenek Kabelac
a2b2ae35b2 lvresize: improve usepolices
lvresize --usepolicy requires resized LVs to be active.
(So it's not only required for shared VG).

The test for active pool needs to use lv_info to query 'layer'
otherwise the pool is considered inactive if it was not activated
explicitely - thun 'implicit' activation with VDO or ThinLV was
not managed by --usepolicy option.
2023-07-14 16:52:51 +02:00
Zdenek Kabelac
8cbba1d164 lvmlockd: enable vdo conversion
As we turn 'already' active/locked LV into a data LV of vdopool,
we just keep active lock for such volume (uuid is preserved).
2023-07-14 16:52:51 +02:00
Zdenek Kabelac
8eb3a5b557 lvconvert: thin convert locking
Fix locking when converting thick to thin LV, ensure
we take pool lock for shared VG.
2023-07-14 16:51:46 +02:00
Zdenek Kabelac
93484c2a62 man-generator: ensure p is defined
In error path, p pointer could have been undefined.
2023-07-13 21:56:47 +02:00
Zdenek Kabelac
5ce236a691 gcc: correct signess comparation
Compare int to int and unsigned to unsigned...
2023-07-13 21:31:18 +02:00
Zdenek Kabelac
64b28e0839 lvchange: add log_error for failure path
When change of monitoring fails, ensure there is log_error() printed.
2023-07-13 21:31:18 +02:00
Zdenek Kabelac
7ec97ed5f2 cov: fix memleak in vgchange
Release allocated  vgname from get_single_vgname_cmd_arg()
when it is not returned via *vgname_ret.
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
857f5d6e65 lvconvert: correction for thin conversion
Updates for 39457234db.
Off-by-one for option array - need 20 fields.
Missed to clear lock_args for cachepool.
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
70c911b63f pool: improve message for data persistance
Inform a user that pools using either error or zero LVs are
not able to keep any data persistant.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
39457234db lvconvert: support conversion to thin volume
Update pool conversion function to handle also conversion of
thick LV to thin LV by moving thick LV into thin pool data LV
and creating fully provissioned thin LV on top of this volume.

Reworking existing conversion to use insert_layer_for_lv co
the uuid is now kept with thin-pool - this should however not
really matter as we are doing full deactivation & activation cycle.

With conversion to thin LV user can use same set of arguments
to set chunk-size.

TODO: add some smart code to decide best values for chunks sizes.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
96123b9059 cleanup: use spelling synchronize
Use single spelling form for synchronize.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
077b46e014 lv_manip: fix move_lv_segments moved bits
For proper functionality of insert_layer_for_lv we need to
move more bits to layerd LV.

Add some missing new types and correct usage of caller,
so the new LV type is set after the movement.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
e36028b7d2 cache: update validation rules
Validate cache origin in front of the prompt.
Also add some rules to command description file.

TODO:
more validation needed also for lvcreate,
more complex rules with "OR" seems to be needed.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
88f1e7a9a7 cache: support more segtypes for caching
Enable support to cache thin/error/zero virtual targets.

Use can now select whether he want to cache whole thin-pool,
or an individual thin volume out of whole thin-pool.
Support using zero and error LVs as data volume for
cachepool is possibly useful for benchmarking, not much
can be expected from such setup.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
0dee6fc28c cache: handle error segtype
Allow to convert error LV.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
558890ad0e pool: support passing data_lv for recalculation
Support data_lv to be passed as parameter when it's not yet
attached to the pool.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
5175e87fda commands: error and zero segtype handling
Add function to work with error and zero LVs more easily.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
226429058c commands: enhance error checking for generator
No exit value 0, when the parser hits an error.
Increase some buffers since as some arg lists are getting longer.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
44b070415b commands: support query for lv_is_cow 2023-07-10 17:13:32 +02:00
Zdenek Kabelac
e84b00964f pool: avoid using artificial name internally 2023-06-29 13:55:27 +02:00
Zdenek Kabelac
6ff65e6755 vdo: check_point_frequence is unused option
This vdo parameter existed in the early stage of integration of vdo into lvm2,
but later it's been removed from vdoformat tool - so actually if
there would be any non-zero value it would cause error on lvcreate.
Option was not stored on disk in lvm2 metadata.

Remove this vdo parameter from lvm2 sources.

(Although this vdo parameter will be still accepted on cmdline through
 --vdosettings option, but it will be ignored.)
2023-06-29 13:10:42 +02:00
David Teigland
ea6b5b694b lvcreate: allow thin snapshot syntax that broke
The command "lvcreate --type thin --snapshot ..." to create a thin
snapshot would fail.

commit d651b340e6 removed the optional
"--type thin" from the command definition "lvcreate --snapshot LV_thin",
and added --type thin as AUTOTYPE.  This was correct and should not have
changed anything if all the command defs were correct, but it broke
the "lvcreate --type thin --snapshot" case.  It reveals a problem in a
different command definintion:  "lvcreate --type thin LV_thin" that was
missing --snapshot in its OO list.
2023-06-20 15:47:01 -05:00
Peter Rajnoha
e2ecc6c763
reporter: restore report type to initial value after processing report_for_selection
If we are executing 'report_for_selection' to do an internal report
just for the selection itself (not for display), we can call it more
than once. In that case, we are reusing the same selection handle
(e.g. inside 'process_each_lv_in_vg').

The selection handle has 'report_type' field which is a union of all
report types needed for the report based on selection fields we actually
use.

The 'report_type' is further clarified based on checks and rules inside
'_get_final_report_type' which 'report_for_selection' calls. Then, this
final report type unambiguously identifies proper branch to take in
'report_all_in_{pv,vg,lv}' that is called next.

If the 'report_for_selection' is called more than once with the same
selection handle, we need to make sure that we always restore the report
type to its initial value, so all the rules inside 'report_for_selection'
are applied correctly next time.

This patch fixes the missing restoration of the 'report_type' value in
'selection_handle' that is reused for recurring 'report_for_selection'
calls.

An example scenario where this failed was with selecting an LV for
removal with "lvremove --select" while using a field in the selection
that required extra DM info or DM status call for the LV (that is,
"Logical Volume Device Info Fields" and "Logical Volume Device Status Fields"
as visible in 'lvs -S help').
2023-05-31 09:38:11 +02:00
Peter Rajnoha
3b4e7d1625
toollib: provide proper hint for referencing VG uuid in case of duplicate VG names
vgrename does not support -S|--select, so do not provide a hint about
using it. Instead, provide a hint about using VG uuid directly.

❯  vgs
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  VG     #PV #LV #SN Attr   VSize   VFree
  vg1      1   0   0 wz--n- 124.00m 124.00m
  vg1      1   0   0 wz--n- 124.00m 124.00m

(vgrename does not support -S|--select)
❯  vgrename vg1 vg2
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  Multiple VGs found with the same name: skipping vg1
  Use VG uuid in place of the VG name.

(vgchange does support -S|--select)
❯  vgchange --addtag a vg1
  WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
  Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
  Multiple VGs found with the same name: skipping vg1
  Use --select vg_uuid=<uuid> in place of the VG name.
2023-05-16 17:17:55 +02:00
Zdenek Kabelac
d418fc14f4 cov: hide some false positives
Hide some false positives.

Note: there must not a be blank line after coverity hiding comment.
2023-05-10 16:19:46 +02:00
Zdenek Kabelac
cc7c41abbd cov: remove unneeded header file inclusion 2023-05-10 15:27:48 +02:00
Zdenek Kabelac
58293173cf cov: check syscall result 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
f038fc3b17 cov: remove unused but set variables 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
fae0ed8f10 cov: ensure there is either vg or error_vg
Make it explicitely visible to coverity that
_process_pvs_in_vg() is not passing  NULL vg.
2023-05-06 19:22:05 +02:00
Zdenek Kabelac
871d9f379f cov: ensure NULL baton is not dereferenced 2023-05-06 19:22:05 +02:00
David Teigland
c4440b5b49 pvck: improve error for write to existing file 2023-04-28 13:31:39 -05:00
David Teigland
b443eac6ef support 16KB page size 2023-04-07 14:26:09 -05:00
David Teigland
390ff5be2f raidintegrity: allow writecache and cache
Allow writecache|cache over raid+integrity LV.
2023-04-05 14:24:07 -05:00
David Teigland
aa85ed1784 vgchange: allow changing system ID with majority of PVs
when used with --majoritypvs.  This allows the fail-over
of a VG between systems by changing the VG system ID when
a PV is missing.
2023-03-08 16:30:54 -06:00
Peter Rajnoha
cd14d3fcc0
toollib: fix segfault if using -S|--select with log/report_command_log=1 setting
When we are using -S|--select for non-reporting tools while using command log
reporting (log/report_command_log=1 setting), we need to create an internal
processing handle to handle the selection itself. In this case, the internal
processing handle to execute the selection (to process the -S|--select) has
a parent handle (that is processing the actual non-reporting command).

When this parent handle exists, we can't destroy the command log report
in destroy_processing_handle as there's still the parent processing to
finish. The parent processing may still generate logs which need to be
reported in the command log report. If the command log report was
destroyed prematurely together with destroying the internal processing
handle for -S|--select, then any subsequent log request from processing
the actual command (and hence an attermpt to access the command log report)
ended up with a segfault.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=2175220
2023-03-07 15:29:54 +01:00
David Teigland
25cb6a042f vgimport: invalidate hints
There may be some unconventional methods of sharing disks with vgimport
where hints could cause confusion.  Hints should be disabled when
sharing disks, or pvscan --cache used to regenerate hints as needed,
but invalidating hints from vgimport might help reduce confusion.
2023-02-22 16:19:48 -06:00
Zdenek Kabelac
3ef26494f2 debug: missing backtraces 2023-02-17 00:00:12 +01:00
Zdenek Kabelac
fb930c2165 lvconvert: use log_print_unless_silent
For better -qq.
2023-02-16 13:15:03 +01:00
Zdenek Kabelac
501cc19034 lvconvert: fix return codes
Several inverted return code resulted the command returned
a success as exit code, while the function errored internally.
2023-02-16 13:15:03 +01:00
David Teigland
08265641f3 pvscan: remove warning about excluded root dev
This was trying to warn about a misconfig where the root PV
was excluded by the devices file, but it wasn't covering all
cases.  Also, it's not very useful because the root LV is
usually activated directly in the initrd.
2023-02-15 10:21:13 -06:00
David Teigland
bd05318ba2 pvscan: filter does not need to be checked for symlink names
With the recent use of DEVLINKS, there is no longer any real
point in checking the filter for symlink names.  Removing
this check should not change behavior with or without symlinks
in the filter.
2023-02-15 10:19:57 -06:00