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

74 Commits

Author SHA1 Message Date
Zdenek Kabelac
17baeb65a9 configure: update use_devicesfile in example.conf
Example.conf missed to properly replace default value for
use_devicesfile setting and left there @VAR@.
2022-11-02 13:59:34 +01:00
David Teigland
264827cb98 lvresize: add new options and defaults for fs handling
The new option "--fs String" for lvresize/lvreduce/lvextend
controls the handling of file systems before/after resizing
the LV.  --resizefs is the same as --fs resize.

The new option "--fsmode String" can be used to control
mounting and unmounting of the fs during resizing.

Possible --fs values:

checksize
  Only applies to reducing size; does nothing for extend.
  Check the fs size and reduce the LV if the fs is not using
  the affected space, i.e. the fs does not need to be shrunk.
  Fail the command without reducing the fs or LV if the fs is
  using the affected space.

resize
  Resize the fs using the fs-specific resize command.
  This may include mounting, unmounting, or running fsck.
  See --fsmode to control mounting behavior, and --nofsck to
  disable fsck.

resize_fsadm
  Use the old method of calling fsadm to handle the fs
  (deprecated.) Warning: this option does not prevent lvreduce
  from destroying file systems that are unmounted (or mounted
  if prompts are skipped.)

ignore
  Resize the LV without checking for or handling a file system.
  Warning: using ignore when reducing the LV size may destroy the
  file system.

Possible --fsmode values:

manage
  Mount or unmount the fs as needed to resize the fs,
  and attempt to restore the original mount state at the end.

nochange
  Do not mount or unmount the fs. If mounting or unmounting
  is required to resize the fs, then do not resize the fs or
  the LV and fail the command.

offline
  Unmount the fs if it is mounted, and resize the fs while it
  is unmounted. If mounting is required to resize the fs,
  then do not resize the fs or the LV and fail the command.

Notes on lvreduce:

When no --fs or --resizefs option is specified:
. lvextend default behavior is fs ignore.
. lvreduce default behavior is fs checksize
  (includes activating the LV.)

With the exception of --fs resize_fsadm|ignore, lvreduce requires
the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE.
FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV,
which determines if reducing the fs is necessary.
2022-09-13 15:15:05 -05:00
Zdenek Kabelac
5aa8683e86 configure: remove some obsolete or duplicate checks
As autoupdate suggested, drop unneeded checks.
2022-08-30 13:54:19 +02:00
Zdenek Kabelac
bda93ed4bc configure: check for mallinfo2 2022-08-30 13:54:19 +02:00
Marian Csontos
31f9c4bfab configure: fix typo 2022-08-09 16:17:40 +02:00
Zdenek Kabelac
1b104ddb55 configure.ac: remove unused part
As we are not using 'enable-compat' for anything, remove this section.
Also remove duplicated check for blkid.
Move setting of some AC_ARG_ENABLE defaults into the macro so it's always
defined.
2021-10-18 19:17:27 +02:00
Zdenek Kabelac
8aefd97252 configure: fix use of withval
Newly added option --with-default-use-devices-file needs to use withval.
2021-10-15 23:35:05 +02:00
Zdenek Kabelac
9d87549f80 configure.ac: enhance systemd testing
Enhance logic for checking supported systemd version,
while doing only a single check for systemd package.
For version checking use  PKG_CHECK_EXISTS() macro.

Also use one pkg check for blkid.

Avoid checking version for thin/cache_check when tools are not present
on system.
2021-10-15 10:09:21 +02:00
Zdenek Kabelac
52a52d5567 configure: bash var typo 2021-10-15 00:32:36 +02:00
Zdenek Kabelac
438408de7d configure: missed braces
Missed [] around AS_IF internals,
Also missed to call pkg_config_init prior PKG_CHECK_MODULES().
2021-10-15 00:08:29 +02:00
Zdenek Kabelac
6635ff77e3 configure.ac: improvement
Handle automatically new setttings

--disable-systemd-journal
--disable-appmachineid

Both setting will check presence of apropriate header files.
In case they are present, build will try to automatically build with
them (adding systemd dependency)

User can anytime disabled them and drop systemd dependency.

Also add --with-default-use-devices-file  configure option to
select automatically default value for this option.
For this moment keep default upstream as 0
2021-10-14 23:34:11 +02:00
David Teigland
3e1316bb09 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.
2021-10-07 12:06:49 -05:00
Zdenek Kabelac
6a186dd1e8 configure: replace AC_HELP_STRING with AS_
Upgrade to newer autoconf setup is approaching...
Will cause large set of configure changes.
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
ff788ef19c configure: check ffs __builtin_ffs versionsort
Check for presence of ffs(), __builtin_ffs() and versionsort().
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
12ba43ccd0 vdo: rename vdoimport to lvm_import_vdo
Missed bits in previous rename commits.
2021-08-26 19:10:28 +02:00
Marian Csontos
bbbd4fed69 vdo: Rename vdoimport to lvm_import_vdo. 2021-08-26 17:13:59 +02:00
Zdenek Kabelac
ed48cb26a3 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
2021-07-09 14:57:59 +02:00
Leo Yan
7a8b7b4add lvmlockd: idm: Introduce new locking scheme
Alongside the existed locking schemes of DLM and sanlock, this patch is
to introduce new locking scheme: In-Drive-Mutex (IDM).

With the IDM support in the drive, the locks are resident in the drive,
thus, the locking lease is maintained in a central place: the drive
firmware.  We can consider this is a typical client-server model,
every host (or node) in the server cluster launches the request for
leasing mutex to a drive firmware, the drive firmware works as an
arbitrator to grant the mutex to a requester and it can reject other
applicants if the mutex has been acquired.  To satisfy the LVM
activation for different modes, IDM supports two locking modes:
exclusive and shareable.

Every IDM is identified with two IDs, one is the host ID and another is
the resource ID.  The resource ID is a unique identifier for what the
resource it's protected, in the integration with lvmlockd, the resource
ID is combined with VG's UUID and LV's UUID; for the global locking,
the bytes in resource ID are all zeros, and for the VG locking, the
LV's UUID is set as zero.   Every host can generate a random UUID and
use it as the host ID for the SCSI command, this ID is used to clarify
the ownership for mutex.

For easily invoking the IDM commands to drive, like other locking
scheme (e.g. sanlock), a daemon program named IDM lock manager is
created, so the detailed IDM SCSI commands are encapsulated in the
daemon, and lvmlockd uses the wrapper APIs to communicate with the
daemon program.

This patch introduces the IDM locking wrapper layer, it forwards the
locking requests from lvmlockd to the IDM lock manager, and returns the
result from drives' responding.

One thing should be mentioned is the IDM's LVB.  IDM supports LVB to max
7 bytes when stores into the drive, the most significant byte of 8 bytes
is reserved for control bits.  For this reason, the patch maps the
timestamp in macrosecond unit with its cached LVB, essentially, if any
timestamp was updated by other nodes, that means the local LVB is
invalidate.  When the timestamp is stored into drive's LVB, it's
possbile to cause time-going-backwards issue, which is introduced by the
time precision or missing synchronization acrossing over multiple nodes.
So the IDM wrapper fixes up the timestamp by increment 1 to the latest
value and write back into drive.

Currently LVB is used to track VG changes and its purpose is to notify
lvmetad cache invalidation when detects any metadata has been altered;
but lvmetad is not used anymore for caching metadata, LVB doesn't
really work.  It's possible that the LVB functionality could be useful
again in the future, so let's enable it for IDM in the first place.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-05-20 16:00:59 -05:00
Zdenek Kabelac
679116a9b8 man: with internal build install cache, thin, vdo
Do not install .7 man pages when building --without internal segtype
support for types: cache, thin, vdo.
2021-04-19 14:37:08 +02:00
Zdenek Kabelac
57b5bc9c87 configure: make aio optional
Add support for external AIO_CFLAGS and AIO_LIBS so user
can point to his own build - this might be useful when
user wants to use own libaio library.
2021-04-12 09:54:15 +02:00
Zdenek Kabelac
744afec6c0 configure: better support for use of --without
When --with-... option is used as --without-... it gets
assigned value 'no' - so support it better where we can.

Also remove 'shared' from help as it's not supported.
2021-04-12 09:54:15 +02:00
Zdenek Kabelac
1cedbaf137 configure: support builds without versioning
Not all libc (like musl, uclibc dietlibc) libraries support full symbol
version resolution in runtime like glibc.
Add support to not generate symbol versions when compiling against them.

Additionally libdevmapper.so was broken when compiled against
uclibc. Runtime linker loader caused calling dm_task_get_info_base()
function recursively, leading to segmentation fault.

Introduce --with-symvers=STYLE option, which allows to choose
between gnu and disabled symbol versioning. By default gnu symbol
versioning is used.
__GNUC__ check is replaced now with GNU_SYMVER.
Additionally ld version script is included only in
case of gnu option, which slightly reduces output size.

Providing --without-symvers to configure script when building against
uclibc library fixes segmentation fault error described above, due to
lack of several versions of the same symbol in libdevmapper.so
library.

Based on:
https://patchwork.kernel.org/project/dm-devel/patch/20180831144817.31207-1-m.niestroj@grinn-global.com/

Suggested-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-03-30 13:06:19 +02:00
Marian Csontos
b6cff47bde lvm: Fix editline compilation 2021-03-22 11:37:19 +01:00
David Teigland
f5fbb1b76f lvmlockctl: replace popen and system
with fork and exec to avoid use of shell.
largely copied from lib/misc/lvm-exec.c

require lvmlockctl_kill_command to be full path

use lvm config instead of lvmconfig to avoid need for LVM_DIR
2021-03-03 17:43:29 -06:00
David Teigland
89a3440fc0 lvmlockctl: use lvm.conf lvmlockctl_kill_command
which specifies a command to run by lvmlockctl --kill.
2021-03-03 13:57:15 -06:00
Zdenek Kabelac
9885c9b43a configure: use our ordered list of python names
Since it seems it's prefered now to use python3 in path name,
prefer this name as first in the list.
2020-10-02 20:52:38 +02:00
Zdenek Kabelac
ae96a43f05 configure: check for BLKZEROOUT support 2020-10-02 20:48:41 +02:00
Zdenek Kabelac
3ed11170da configure: update help
Help shows new defaults.
2020-09-29 10:43:56 +02:00
Bastian Germann
168e2ffbcd lvm: add readline alternative editline
LVM2 is distributed under GPLv2 only. The readline library changed its
license long ago to GPLv3. Given that those licenses are incompatible
and you follow the FSF in their interpretation that dynamically linking
creates a derivative work, distributing LVM2 linked against a current
readline version might be legally problematic.

Add support for the BSD licensed editline library as an alternative for
readline.

Link: https://thrysoee.dk/editline
2020-09-29 10:13:24 +02:00
David Teigland
72b931d664 configure: enable integrity by default 2020-09-16 15:14:51 -05:00
Zdenek Kabelac
27383a4b3d configure: just upper case start of sentence 2020-09-14 00:15:14 +02:00
Zdenek Kabelac
6d392776b0 configure: compile with vdo and writecache by default
Enable compilation of vdo and writecache support as internaly
supported segment types by default.

For disabling use:

--with-vdo=none
--with-writcache=none
2020-09-10 23:54:10 +02:00
David Teigland
d9e8895a96 Allow dm-integrity to be used for raid images
dm-integrity stores checksums of the data written to an
LV, and returns an error if data read from the LV does
not match the previously saved checksum.  When used on
raid images, dm-raid will correct the error by reading
the block from another image, and the device user sees
no error.  The integrity metadata (checksums) are stored
on an internal LV allocated by lvm for each linear image.
The internal LV is allocated on the same PV as the image.

Create a raid LV with an integrity layer over each
raid image (for raid levels 1,4,5,6,10):

lvcreate --type raidN --raidintegrity y [options]

Add an integrity layer to images of an existing raid LV:

lvconvert --raidintegrity y LV

Remove the integrity layer from images of a raid LV:

lvconvert --raidintegrity n LV

Settings

Use --raidintegritymode journal|bitmap (journal is default)
to configure the method used by dm-integrity to ensure
crash consistency.

Initialization

When integrity is added to an LV, the kernel needs to
initialize the integrity metadata/checksums for all blocks
in the LV.  The data corruption checking performed by
dm-integrity will only operate on areas of the LV that
are already initialized.  The progress of integrity
initialization is reported by the "syncpercent" LV
reporting field (and under the Cpy%Sync lvs column.)

Example: create a raid1 LV with integrity:

$ lvcreate --type raid1 -m1 --raidintegrity y -n rr -L1G foo
  Creating integrity metadata LV rr_rimage_0_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_0_imeta" created.
  Creating integrity metadata LV rr_rimage_1_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_1_imeta" created.
  Logical volume "rr" created.
$ lvs -a foo
  LV                  VG  Attr       LSize  Origin              Cpy%Sync
  rr                  foo rwi-a-r---  1.00g                     4.93
  [rr_rimage_0]       foo gwi-aor---  1.00g [rr_rimage_0_iorig] 41.02
  [rr_rimage_0_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_0_iorig] foo -wi-ao----  1.00g
  [rr_rimage_1]       foo gwi-aor---  1.00g [rr_rimage_1_iorig] 39.45
  [rr_rimage_1_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_1_iorig] foo -wi-ao----  1.00g
  [rr_rmeta_0]        foo ewi-aor---  4.00m
  [rr_rmeta_1]        foo ewi-aor---  4.00m
2020-04-15 12:10:32 -05:00
Zdenek Kabelac
aefd177b04 configure: continue build if prlimit is missing 2019-08-26 17:34:45 +02:00
Zdenek Kabelac
55f1d8a269 configure: check for prlimit
Update configure and make code compilable if prlimit() is not present.
Since the code is suspicious do not cope yet with it's replacement
with  set/getrlimit().
2019-08-26 17:24:37 +02:00
Marian Csontos
4a3e707402 configure: Fix setting of CLDFLAGS default 2019-08-19 15:28:01 +02:00
Marian Csontos
9b63f59016 configure: Fix the default in help string 2019-08-19 15:28:01 +02:00
Zdenek Kabelac
116bd314cb configure: check for pselect 2019-04-16 12:14:31 +02:00
David Teigland
85e68a8333 lvextend: refresh shared LV remotely using dlm/corosync
When lvextend extends an LV that is active with a shared
lock, use this as a signal that other hosts may also have
the LV active, with gfs2 mounted, and should have the LV
refreshed to reflect the new size.  Use the libdlmcontrol
run api, which uses dlm_controld/corosync to run an
lvchange --refresh command on other cluster nodes.
2019-03-21 12:38:20 -05:00
Zdenek Kabelac
0b19387dae headers: use configure.h as 1st. header
Ensure configure.h is always 1st. included header.
Maybe we could eventually introduce gcc -include option, but for now
this better uses dependency tracking.

Also move _REENTRANT and _GNU_SOURCE into configure.h so it
doesn't need to be present in various source files.
This ensures consistent compilation of headers like stdio.h since
it may produce different declaration.
2018-12-14 15:09:13 +01:00
Marian Csontos
92b0d014aa build: Upse PYTHON_CONFIG env.variable when set
This adds up to Commit 6462e8dffc.
2018-12-06 09:02:47 +01:00
David Teigland
904e1e3d26 Place the first PE at 1 MiB for all defaults
. When using default settings, this commit should change
  nothing.  The first PE continues to be placed at 1 MiB
  resulting in a metadata area size of 1020 KiB (for
  4K page sizes; slightly smaller for larger page sizes.)

. When default_data_alignment is disabled in lvm.conf,
  align pe_start at 1 MiB, based on a default metadata area
  size that adapts to the page size.  Previously, disabling
  this option would result in mda_size that was too small
  for common use, and produced a 64 KiB aligned pe_start.

. Customized pe_start and mda_size values continue to be
  set as before in lvm.conf and command line.

. Remove the configure option for setting default_data_alignment
  at build time.

. Improve alignment related option descriptions.

. Add section about alignment to pvcreate man page.

Previously, DEFAULT_PVMETADATASIZE was 255 sectors.
However, the fact that the config setting named
"default_data_alignment" has a default value of 1 (MiB)
meant that DEFAULT_PVMETADATASIZE was having no effect.

The metadata area size is the space between the start of
the metadata area (page size offset from the start of the
device) and the first PE (1 MiB by default due to
default_data_alignment 1.)  The result is a 1020 KiB metadata
area on machines with 4KiB page size (1024 KiB - 4 KiB),
and smaller on machines with larger page size.

If default_data_alignment was set to 0 (disabled), then
DEFAULT_PVMETADATASIZE 255 would take effect, and produce a
metadata area that was 188 KiB and pe_start of 192 KiB.
This was too small for common use.

This is fixed by making the default metadata area size a
computed value that matches the value produced by
default_data_alignment.
2018-11-26 16:36:50 -06:00
David Teigland
4b5d6de86b pvscan systemd service for event based activation
The pvscan systemd service for autoactivation was
mistakenly dropped along with the lvmetad related
services.

The activation generator program now looks at the new
lvm.conf setting "event_activation" (default 1) to
switch between event activation and direct activation.

Previously, the old use_lvmetad setting was used to
switch between event and direct activation.
2018-11-26 14:33:31 -06:00
David Teigland
3ae5569570 Add dm-writecache support
dm-writecache is used like dm-cache with a standard LV
as the cache.

$ lvcreate -n main -L 128M -an foo /dev/loop0

$ lvcreate -n fast -L 32M -an foo /dev/pmem0

$ lvconvert --type writecache --cachepool fast foo/main

$ lvs -a foo -o+devices
  LV            VG  Attr       LSize   Origin        Devices
  [fast]        foo -wi-------  32.00m               /dev/pmem0(0)
  main          foo Cwi------- 128.00m [main_wcorig] main_wcorig(0)
  [main_wcorig] foo -wi------- 128.00m               /dev/loop0(0)

$ lvchange -ay foo/main

$ dmsetup table
foo-main_wcorig: 0 262144 linear 7:0 2048
foo-main: 0 262144 writecache p 253:4 253:3 4096 0
foo-fast: 0 65536 linear 259:0 2048

$ lvchange -an foo/main

$ lvconvert --splitcache foo/main

$ lvs -a foo -o+devices
  LV   VG  Attr       LSize   Devices
  fast foo -wi-------  32.00m /dev/pmem0(0)
  main foo -wi------- 128.00m /dev/loop0(0)
2018-11-06 14:18:41 -06:00
Marian Csontos
1e40e734e6 build: Fix CLDFLAGS default 2018-10-30 10:15:44 +01:00
Marian Csontos
6462e8dffc build: Use PYTHON env. variable when provided 2018-10-10 13:27:16 +02:00
David Teigland
19a59cc53c More cleanup needed for dropped scripts
and drop the lvm2 prefix from lvmlockd service
2018-09-13 11:09:25 -05:00
Peter Rajnoha
a0f6f18841 configure: fix LVMCONFIG_PATH assignment 2018-08-30 13:14:10 +02:00
David Teigland
117160b27e Remove lvmetad
Native disk scanning is now both reduced and
async/parallel, which makes it comparable in
performance (and often faster) when compared
to lvm using lvmetad.

Autoactivation now uses local temp files to record
online PVs, and no longer requires lvmetad.

There should be no apparent command-level change
in behavior.
2018-07-11 11:26:42 -05:00
Zdenek Kabelac
4a90b0c4c9 build: add vdo configuration option --with-vdo=
Checks whether VDO support is enabled.
Detects presence of 'vdoformat' tool which is required for to format VDO pool.

ATM build of VDO is NOT automatically enabled (None is default).
To enable build of LVM with VDO support use:

configure --with-vdo=internal

TODO: Maybe future version may switch to link some small VDO library for formating
(would require linking and package dependency).
2018-07-09 15:28:35 +02:00