1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

17638 Commits

Author SHA1 Message Date
Marian Csontos
a77339ae38 make: generate 2021-08-11 14:03:25 +02:00
Marian Csontos
461746cb1f configure: update 2021-08-11 13:34:22 +02:00
David Teigland
4317c2a18a udev vgchange: skip hints and keep transient service record
Using hints with vgchange in the udev rule is not helpful because
repeated pvscans during startup are constantly invalidating hints.

Use -r with systemd-run so that the transient service used to
run vgchange remains visible and can be inspected.

(cherry picked from commit 7b87ffce2a5d635fb10bde3477847339b0ebb776)
2021-08-11 13:26:24 +02:00
Vojtech Trefny
9c9a6575f0 lvmdbusd: Use ID_FS_TYPE UDev property in udevwatch
'.ID_FS_TYPE_NEW' is a custom property added by an LVM UDev rule
which is now being removed and 'ID_FS_TYPE' has the same value.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
(cherry picked from commit 9421c3f38293b0fcb871e6db8f723a77b585a6ee)
2021-08-11 13:26:09 +02:00
David Teigland
2388284314 new udev autoactivation
new udev rule 69-dm-lvm.rules replaces
69-dm-lvm-meta.rules and lvm2-pvscan.service

udev rule calls pvscan directly on the added device

pvscan output indicates if a complete VG can be activated

udev env var LVM_VG_NAME_COMPLETE is used to pass complete
VG name from pvscan to the udev rule

udev rule uses systemd-run to run vgchange -aay <vgname>

(cherry picked from commit 9ac24b6c66ad1074e1ed33c523a2d5ceb62e22a1)
2021-08-11 13:25:48 +02:00
David Teigland
db75b6cc41 logging: to the systemd journal
Configure via lvm.conf log/journal or command line --journal.

Possible values:
"command" records command information.
"output" records default command output.
"debug" records full command debugging.

Multiple values can be set in lvm.conf as an array.
One value can be set in --journal which is added to
values set in lvm.conf

(cherry picked from commit bebce91cb9d8dc6170b6432972f98f45c28714c5)
2021-08-11 13:25:37 +02:00
David Teigland
a7913e4e10 pvscan: add options listlvs listvg checkcomplete
pvscan --cache <dev>
    . read only dev
    . create online file for dev

pvscan --listvg <dev>
    . read only dev
    . list VG using dev

pvscan --listlvs <dev>
    . read only dev
    . list VG using dev
    . list LVs using dev

pvscan --cache --listvg [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . [check online files and report if VG is complete]

pvscan --cache --listlvs [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . list LVs using dev
    . [check online files and report if VG is complete]
    . [check online files and report if LVs are complete]

[--vgonline]
can be used with --checkcomplete, to enable use of a vg online
file.  This results in only the first pvscan command to see
the complete VG to report 'VG complete', and others will report
'VG finished'.  This allows the caller to easily run a single
activation of the VG.

[--udevoutput]
can be used with --cache --listvg --checkcomplete, to enable
an output mode that prints LVM_VG_NAME_COMPLETE='vgname' that
a udev rule can import, and prevents other output from the
command (other output causes udev to ignore the command.)

The list of complete LVs is meant to be passed to lvchange -aay,
or the complete VG used with vgchange -aay.

When --checkcomplete is used, lvm assumes that that the output
will be used to trigger event-based autoactivation, so the pvscan
does nothing if event_activation=0 and --checkcomplete is used.

Example of listlvs
------------------

$ lvs -a vg -olvname,devices
  LV     Devices
  lv_a   /dev/loop0(0)
  lv_ab  /dev/loop0(1),/dev/loop1(1)
  lv_abc /dev/loop0(3),/dev/loop1(3),/dev/loop2(1)
  lv_b   /dev/loop1(0)
  lv_c   /dev/loop2(0)

$ pvscan --cache --listlvs --checkcomplete /dev/loop0
  pvscan[35680] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete
  LV vg/lv_a complete
  LV vg/lv_ab incomplete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop1
  pvscan[35681] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete
  LV vg/lv_b complete
  LV vg/lv_ab complete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop2
  pvscan[35682] PV /dev/loop2 online, VG vg is complete.
  VG vg complete
  LV vg/lv_c complete
  LV vg/lv_abc complete

Example of listvg
-----------------

$ pvscan --cache --listvg --checkcomplete /dev/loop0
  pvscan[35684] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop1
  pvscan[35685] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop2
  pvscan[35686] PV /dev/loop2 online, VG vg is complete.
  VG vg complete

(cherry picked from commit d6495e9bfc7d6a3bed2a2a1d187e220d4f4bbed3)
2021-08-11 13:25:23 +02:00
David Teigland
3d5418c9c6 system_id: new appmachineid option
The new system_id_source="appmachineid" will cause
lvm to use an lvm-specific derivation of the machine-id,
instead of the machine-id directly.  This is now
recommended in place of using machineid.

(cherry picked from commit 9f73ead7d42597cc8eb57fd0b63af050eece0718)
2021-08-11 13:11:14 +02:00
David Teigland
e2ecc426ac config: change default use_devicesfile to 1
(cherry picked from commit b1ea0fdad5cbd4c44ce278c1f1f88c23ee11b559)
2021-08-11 13:11:03 +02:00
David Teigland
05542a8839 config: comment all default settings
(cherry picked from commit d6a75b516cddea809306234d41ace64bbb928aaa)

Conflicts:
	lib/config/config_settings.h
2021-08-11 13:10:38 +02:00
Zdenek Kabelac
6d3b3753d7 tests: extend vgmerge testing
(cherry picked from commit 8ebcbe9ace6e5c88a35cf62cd04b853ca7551a2b)
(cherry picked from commit 323257dfff9da36c77f22d7ef019f782c52591bf)
2021-08-11 13:05:05 +02:00
Zdenek Kabelac
c20978d76e vgmerge: support option --poolmetadataspare
(cherry picked from commit 4b856476e96777842ea6c9b42654c369a6b22db4)
(cherry picked from commit 84f8b4325c54636709734875601cc2070e3429e6)
2021-08-11 13:04:58 +02:00
Zdenek Kabelac
4d28b4791a vgmerge: remove one of merge pmspare LVs
When merging 2 VG, where both of them have pmspare volume,
select the bigger one and remove the other.

(cherry picked from commit 9cbc9e8296752df35626a9b50de1cb551ff5e99e)
(cherry picked from commit 5b388f30fd2b1b960b1caa8c05dee712176985da)
2021-08-11 13:04:52 +02:00
Zdenek Kabelac
dde6ca5246 test: vgsplit of cached thin pool
(cherry picked from commit b70c341c9e9526cc21f590af73ccce2369755736)
(cherry picked from commit a48e248e17fd7e7bb1b5c115b7e0a33a35d0e916)
2021-08-11 13:03:44 +02:00
Zdenek Kabelac
1961ca0ba5 vgsplit: add support for option --poolmetadataspare
When splitting VG with thin/cache pool volume, handle pmspare during
such split and allocate new pmspare in new VG or extend existing pmspare
there and eventually drop  pmspare in original VG if is no longer needed
there.

(cherry picked from commit 2132fdc11f7bc285638765e001bef6a3e595b286)

Conflicts:
	WHATS_NEW

(cherry picked from commit 03bbbd14f8433cfd2b8f7e3480e2fd4534241fcc)
2021-08-11 13:03:26 +02:00
Zdenek Kabelac
9ce7bfdf42 vgremove: remove forgotten pmspare
As pmspare is an invisible LV it's not getting automatically removed
since vgremove removes only visible LVs and it depending LVs.
If there was no other thin/cache pool volume, such pmspare stayed
undeleted and caused command failure.

So handle explicitelly such forgotten pmspare and remove it.

(cherry picked from commit 5042463c5083cc71546297344058bd0fa523aa5c)
(cherry picked from commit bec864948785d145bcd19603cb3781d514eb00e8)
2021-08-11 13:03:18 +02:00
Zdenek Kabelac
a44b10fd1c thin: fix component detection of external origin
When check active componet of thinLV with external origin,
we need to check if the external origin isn't already active.
For this however we need to use layered check for -real device.

(cherry picked from commit d38fdb25e4debc035f1e4585432c2627460d5e50)

Conflicts:
	WHATS_NEW

(cherry picked from commit f29ce593ec5c19296f50a1dbd1adbced1a1a53a7)
2021-08-11 13:03:11 +02:00
Zdenek Kabelac
948c9c288d man: vdoimport page
(cherry picked from commit 70c32d1e74b92f6055bcb688ed0e3bc8630f5489)
(cherry picked from commit 6643baa3cc744f35f1ff14989aa13e492cedb674)
2021-08-11 13:02:57 +02:00
Zdenek Kabelac
21b1cb2d5a vdo: add vdoimport support
Add tool 'vdoimport' to support easy conversion of an existing VDO manager managed
VDO volumes into lvm2 managed VDO LV.

When physical converted volume is already a logical volume, conversion
happens with the VG itself, just with validation for extent_size, so
the virtually sized logical VDO volume size can be expressed in extents.

Example of basic simple usage:

vdoimport --name vg/vdolv  /dev/mapper/vdophysicalvolume

(cherry picked from commit ed48cb26a31e8e5a12d82d96d8bec6bfc4d5b218)

Conflicts:
	WHATS_NEW

(cherry picked from commit 864babf4c7c73ad03ebac450257f3d7ef93e9654)
2021-08-11 13:02:48 +02:00
Zdenek Kabelac
9395a93a44 vdo: support vdo_pool_header_size
Add profilable configurable setting for vdo pool header size, that is
used as 'extra' empty space at the front and end of vdo-pool device
to avoid having a disk in the system the may have same data is real
vdo LV.

For some conversion cases however we may need to allow using '0' header size.

TODO: in this case we may eventually avoid adding 'linear' mapping layer
in future - but this requires further modification over lvm code base.

(cherry picked from commit 2c6a2b6e86b57aeb96e93618193426ee129b00a6)

Conflicts:
	tools/lvconvert.c

(cherry picked from commit 65e0829f34c8c7555dc94e5616700950646673fc)
2021-08-11 13:02:42 +02:00
Zdenek Kabelac
de09753cea vdo: rename variable vdo_pool_zero
Match rest of code.

(cherry picked from commit 5fcbc3bd7d3473f14e556508fff1b381431c59f0)

Conflicts:
	tools/lvconvert.c

(cherry picked from commit a021aba6ef328c89975583489de785f35d0490f4)
2021-08-11 13:02:37 +02:00
Zdenek Kabelac
e23d273163 lvconvert: fix vdo virtual size when specified
Correctly use virtual size specified by:
lvconvert --type vdo-pool --virtualsize

(cherry picked from commit 6e773bb196d7e45fbecf0619f8993e6cf4534fa2)
(cherry picked from commit 9281d69a74ac9291843081a7cb4dd80ef2ef57d8)
2021-08-11 13:02:30 +02:00
David Teigland
02eaf10114 device_id: handle scsi_debug wwid
Ignore the wwid value reported by scsi_debug devices
that begin "t10.Linux   scsi_debug".  The devname
will be used as the device id.

(cherry picked from commit 1139a05939f85bd86a756b451a8f194bc7a72a2c)
(cherry picked from commit 013303da9deb39c0518a9c8bdfb0237ef359747e)
2021-08-11 13:02:23 +02:00
David Teigland
8bfe69ee01 lvmdevices: add deviceidtype option
When adding a device to the devices file with --adddev, lvm
by default chooses the best device ID type for the new device.
The new --deviceidtype option allows the user to override the
built in preference.  This is useful if there's a problem with
the default type, or if a secondary type is preferrable.

If the specified deviceidtype does not produce a device ID,
then lvm falls back to the preference it would otherwise use.

(cherry picked from commit 440d6ae79fb4df92c7992d3c1689ba4f2d242d6a)
(cherry picked from commit de8d6238dfa4075ee0ed7f368dffff4b2cf648ad)
2021-08-11 13:02:16 +02:00
David Teigland
7da18132fd devices: don't use deleted loop backing file for device id
check for "(deleted)" in the backing_file string and
fall back to devname for id.

$ cat /sys/block/loop0/loop/backing_file
/root/looptmp (deleted)

(cherry picked from commit ca930bd936de2e7d4a83fa64add800baf6cfd116)
(cherry picked from commit e9227b4bcce72e97b0149e4a1775fcccb27605ff)
2021-08-11 13:02:10 +02:00
David Teigland
303017a909 lvconvert: allow writecache with other thinpool command syntax
"lvconvert --thinpool LV" should allow LV to have a writecache,
but there was an extra type check preventing it.

(cherry picked from commit c35f7722d588009edad22d59c68c82150bb5c216)
(cherry picked from commit 118ba7161355132420296546711baf13d94fa36f)
2021-08-11 13:02:02 +02:00
David Teigland
4d6035d2a8 writecache: don't pvmove device used by writecache
The existing check didn't cover the unusual case where the
cachevol exists on the same device as the origin LV.

(cherry picked from commit e7f107c24666c8577f30e530b74f1ce0347e459b)
(cherry picked from commit f15472d5aacfa8f62500edf398bc9d368d64a33f)
2021-08-11 13:01:49 +02:00
David Teigland
2b695440c3 writecache: fix lv_on_pmem
dev_is_pmem on pv->dev requires a pv segment or it could segfault.

(cherry picked from commit 247f69f9aafe731ef85268da1e6ce817295b265d)
2021-08-11 13:01:39 +02:00
David Teigland
d98e8e27ce enable command syntax for thin and writecache
converting an LV with a writecache to thin pool data in
addition to previous attaching writecache to thin pool data

(cherry picked from commit a65f8e0a62b9ab3c2fc909a63abfa0e933619a8c)
2021-08-11 13:01:20 +02:00
David Teigland
cc97773feb lvremove: fix removing thin pool with writecache on data
(cherry picked from commit 4a746f7ffcc8e61c9cb5ce9f9e8a061d1ef6b28e)
2021-08-11 13:01:01 +02:00
Zdenek Kabelac
64d9fb38ad vdo: fix preload of kvdo
Commit 5bf1dba9eb8a8b77410e386e59dadeb27801b14e broke load of kvdo
kernel module - correct it by loading kvdo instead of trying dm-vdo.

(cherry picked from commit b725b5ea6ecfeef428fd7ffcd6855a38378d761b)

Conflicts:
	WHATS_NEW
2021-08-11 13:00:36 +02:00
Marian Csontos
01b05cf51d pre-release v2_03_12 2021-05-07 23:09:09 +02:00
Marian Csontos
64719861ec make: generate 2021-05-07 17:44:43 +02:00
David Teigland
00f603de2c tests: add lvextend-caches-on-thindata
to test lvextend of thin pool data while it has
cache|writecache attached
2021-05-06 16:23:26 -05:00
David Teigland
6b00c8c910 writecache: allow attaching to thin pool data 2021-05-06 16:23:03 -05:00
David Teigland
92fcfc59b2 tests: new lvextend-caches
to test lvextend of LVs with attached cache|writecache
2021-05-06 14:43:10 -05:00
David Teigland
318bb3a06b blkid: simplify fs block size check
Only the LV path name is needed for blkid query,
the step of getting a dev struct is not needed.
2021-05-05 16:15:10 -05:00
David Teigland
71933d3496 devices file: recommend removing filter
When the devices file is enabled and the filter is set,
recommand that the user remove the filter from lvm.conf
since it's ignored.
2021-05-05 13:59:42 -05:00
David Teigland
2419345b9d pvremove: use consistent error message
When the device is not a PV print
  "No PV found on device ..."

instead of
  "Failed to read lvm info for ... PVID ."

an earlier check had been added with a different
message for the same condition.
2021-05-04 13:08:02 -05:00
David Teigland
4dc5d4ac7e label_read_pvid: separate error and no-pvid
error reading dev and no pvid on dev were both
returning 0.  make it easier for callers to
know which, if they care.

return 1 if the device could be read, regardless
of whether a pvid was found or not.
set has_pvid=1 if a pvid is found and 0 if no
pvid is found.
2021-04-23 17:37:08 -05:00
David Teigland
fcbed26393 Revert "cov: check label_read_pvid return value"
This reverts commit bf461b99c6d26e550835b77eaffe2204cbc9bed3.

label_read_pvid returns 0 for non-PVs and these callers want
to handle non-PVs.
2021-04-23 17:12:24 -05:00
Zdenek Kabelac
9cdd4dcca7 make: generate 2021-04-23 23:02:58 +02:00
Zdenek Kabelac
64a8505b96 tests: use should for expected state
While we heavily try to spot arrays that are not yet in-sync,
some kernels tends to block our lvm2 command in kernel,
while we resume these smaller raid arrays even for 5 seconds.

But since the result is not really wrong - report these
check failures only as TEST WARNING.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
05eb90db68 cleanup: indent 2021-04-23 23:00:55 +02:00
Zdenek Kabelac
fccd6e0346 makefiles: add target for man-generator
Add supporting target for recreating man-generator when dependencies needs it.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
348c46c8fc man: add some resizing examples
Add some examples with -l% usage.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
a21028dea7 man: add missing _iorig suffix 2021-04-23 23:00:55 +02:00
Zdenek Kabelac
579c941321 man: document fsadm -l option
Missed -l option in man page, although users should prefer
lvresize -r when the also want to do a volume management,
as there they can specify i.e. extents for allocation.
Also mention dm-crypt support in command description.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
6f61de3009 args.h: bold command refference 2021-04-23 23:00:55 +02:00
Zdenek Kabelac
f678052385 shellcheck: updates
Ehance some shellcheck reported issues.
2021-04-23 23:00:55 +02:00