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

465 Commits

Author SHA1 Message Date
Zdenek Kabelac
8a07f57ba4 lvm_import_vdo: spelling fixes 2023-06-29 13:10:42 +02:00
Zdenek Kabelac
8b75bbe47d vdo: lvm_import_vdo correct parsing output
Output from vdo manager may actually indent output with spaces,
so trim leading and ending space.

Also add support for verbosity flag for vdo conversion tool.
2023-06-29 13:10:42 +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
Zdenek Kabelac
657dde6208 lvm_import_vdo: correct the converted virtual size
Ensure the volume after conversion has the properly aligned size to the
volume group extent size. This would be visible when using virtual size,
that cannot be divided by extent size.

Before the user had to manually adjust the size after conversion to get
access to all data stored on VDO volume.
2023-06-23 18:05:03 +02:00
Zdenek Kabelac
be6c34212b vdo: enhance lvm_vdo_import
Add support for usage of 'dm-snapshot' for doing whole device conversion
in a snapshot which could be merged once the whole conversion has been
made.
This helps with cases where there would be any unexpected failure in the
middle of conversion process and user can continue using original
device until problem in conversion is fixed.

Import tool now uses 'truncate' tool to create a small backend file (20M) for loop device
to hold COW exception store.

Option  --vdo-config has been added to allow specifing location of vdo
configuration file.

Option --no-snapshot allows to use import tool without creation of
snapshot, however recovery after finished VDO conversion and unfinished
lvm2 conversion is then very difficult.

Option --uuid-prefix allow to specify DM UUID prefix for snapshot
device.

Use read with -r.
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
773bc01377 tests: cleanup some shellcheck warns
Reduce shellcheck warnings about missing {} for possible array
dereference.

Make sure we are not loosing error code when assigning local vars
and explicitely ignore 'errors' from standalone lines when needed.

Add some missing quotes.

Use $() instead of ancient ``

Avoid writing some temporary data into /tmp - test need to store
files within its own 'testdir' - so it can be properly discarded.
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
35e1f15e03 lvresize_fs_helper: cleanup shellcheck warns
Use commands directly in 'if cmd; then'.
Use shell vars in $(( )) in recommended way.
2023-02-10 17:50:27 +01:00
David Teigland
81acde7ffd lvresize: fix cryptsetup resize in helper
typo used "cryptresize" as command name

this affects cases where the file system is resized
independently, and then the lvresize command is used
which only needs to resize the crypt device and the LV.
2023-01-03 11:40:53 -06:00
Marian Csontos
a0fc61177e make: Fix build in chroot
When building in a buildroot, must create libexec directory explicitly.
2022-09-20 15:56:13 +02: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
d2667bc25b vdo: fix conversion of vdo_slab_size_mb 2nd
Patch 1b070f366b should have
been already fixing this issue but since it the incorrect
patch rebasing the change to vdo_slabSize got lost.
So again now with explicit one-line patch.
2022-07-11 01:18:24 +02:00
Zdenek Kabelac
1b070f366b vdo: fix conversion of vdo_slab_size_mb
When converting VDO volume, the parameter vdo_slabSize was
incorrectly copied as vdo_blockMapCacheSize, however this parameter
is then no longer used for any table line creation so the wrong
value was only stored in metadata.

Also use just single get_kb_size_with_unit_ and remove it's duplicate
functionality with get_mb_size_with_unit_.

Use $VERB for vdo remove call.
2022-06-07 17:14:08 +02:00
David Teigland
ee8fb0310c remove static autoactivation
event based autoactivation is now the only method that lvm
provides for autoactivation.

Setting lvm.conf event_activation=0 can still be used to disable
event based autoactivation commands, but doing so will no longer
enable static autoactivation.
2022-01-27 16:43:11 -06:00
Andrew Walsh
522561e64b vdo: ensure VDO config is removed
Make sure to remove the VDO config after conversion
of LVM-backed VDO.

Addresses point 3 in rhbz#1987024#c5
2021-12-20 16:13:28 +01:00
David Teigland
5f7cb97743 lvm2-pvscan: include --autoactivation event
in the pvscan --cache -aay command so that the use
of the command for event activation is explicit.
2021-11-04 14:14:37 -05:00
David Teigland
67722b3123 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>
2021-10-07 12:42:31 -05:00
Zdenek Kabelac
bb6fd1a15f shellcheck: warning enhancements 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
4c0354fe0f cleanup: better wording
Follow-up advice of native speaker.
2021-09-20 15:41:14 +02:00
Zdenek Kabelac
a0bbdfba7f cleanup: typo fix 2021-09-17 22:42:41 +02:00
Zdenek Kabelac
3817392d87 lvm_import_vdo: --dry-run automatically verbose
Dry-run is way more usable when it's verbose.
2021-09-17 16:49:17 +02:00
Zdenek Kabelac
3b24c0fe4e vdo: prompt with no return failure
Exit 1  (failure) when prompt for conversion is answered as 'No'.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
9db4ddabc1 vdo: lvm_import_vdo script needs to continue when vgname does not exist
When the script cannot find vgname - it needs to continue to run.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
89595a3665 vdo: more lvm_import_vdo fixes
Do not call 'dmsetup info' for non-dm devices.

Better handling for VGNAME and LVNAME - so when convering LV as
backend device automatically recognize it and reuse LV name for VDOLV.

Add prompt for final confirmation before actual conversion is started
(once confirmed, lvm2 commands no longer prompts to avoid leaving
conversion in the middle of its process.)
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
3287d37f44 vdo: better message for missing device
Show readable message when passed device cannot be accessed.
And use STAT shell var wrapper to call 'stat' command.
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
8d5b7de54f vdo: lvm_import_vdo fix max_discard size
Use correct 4K units in lvm2 for max_discard VDO option.
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
1ae157a0f6 vdo: fixes
Better identify VDO device with major:minor.
Handle different LV name from originally converted origin LV.
Improve --dry-run handling.
2021-08-31 22:05:47 +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
Zdenek Kabelac
f678052385 shellcheck: updates
Ehance some shellcheck reported issues.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
28865f971e fsadm: handle error from blkid
Fsadm wants to print its own error message when it can't detect
type of the filesystem on a block device.
Otherwise fsadm exits with no message on an unused block device.
2021-03-24 16:37:09 +01:00
Zdenek Kabelac
63c58d2a5d fsadm: fix condition when using --getsize64
When blocksize --getsize64 gives empty result we want to fallback
to ancient  --getsize * --getss  calculation (RHBZ #1942486).

Reported by: ajschorr@alumni.princeton.edu
2021-03-24 16:34:34 +01:00
Zdenek Kabelac
81d3639955 git: update .gitignore
Hide some files from older builds.
2021-03-19 23:21:18 +01:00
Zdenek Kabelac
e5e957e330 shellcheck: avoid assign warnings
Shellcheck seems to be happier when assigning variables with quotes.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
39eee85fff makefiles: better logging
Show only filename instead of full path name when building
in builddir != srcdir
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
646e3280dd fsadm: avoid access to unbound variable 2021-02-23 14:56:47 +01:00
Zdenek Kabelac
47608ff49b fsadm: fix unbound variable usage
When 'fsadm resize vg/lv' is used without size, it should just
resize filesystem to match device - but since we now check
for unbound variable in bash - the previous usage no longer
works and needs explicit check.
2020-12-08 20:32:34 +01:00
Zdenek Kabelac
b033384135 fsadm: better check for getsize64 support
Older blockdev tool return failure error code with --help,
and since now the tool abort on command failure, lets
detect missing --getsize64 support directly by running
command and check if it returns something usable.

It's likely very hard to have the system with
such old blockdev tool and newer lvm2 compiled.
2020-10-26 13:06:52 +01:00
Zdenek Kabelac
8c2779ba34 fsadm: enhance error handling
Set more secure bash failure mode for pipilines.
Avoid using unset variables.
Enhnace error reporting for failing command.
Avoid using error via 'case..esac || error'.
2020-10-24 01:42:16 +02:00
Zdenek Kabelac
51a532719c fsadm: handle fsck return 1 for corrected fs 2020-10-24 01:42:16 +02:00
Zdenek Kabelac
73ef86ae3f fsadm: use NULL
Use consistently $NULL as in other places.
2020-10-24 01:42:16 +02:00
Peter Rajnoha
8806f2d5ed blkdeactivate: add missing VDO_AVAILABLE check in deactivate_vdo 2020-06-08 15:41:35 +02:00
Maxim Plotnikov
a509776588 Fix scripts/lvmlocks.service.in using nonexistent --lock-opt autowait
The --lock-opt autowait was dropped back in 9ab6bdce01,
and attempting to specify it has quite an opposite effect:
no waiting is done, which makes the unit almost useless.
2020-04-21 16:52:45 -05:00
Peter Rajnoha
0dd905c959 blkdeactivate: add support for VDO in blkdeactivate script
Make it possible to tear down VDO volumes with blkdeactivate if VDO is
part of a device stack (and if VDO binary is installed). Also, support
optional -o|--vdooptions configfile=file.
2020-04-09 15:29:29 +02:00
Peter Rajnoha
25f231cf06 systemd: put back DefaultDependencies=no for lvmpolld socket unit
Previous commit 0cab341e1d removed this
by mistake - we have to keep the DefaultDependencies=no - the
sockets.target is after sysinit.target.
2019-04-11 12:18:02 +02:00
Peter Rajnoha
0cab341e1d systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.

Reported here: https://github.com/lvmteam/lvm2/issues/17
2019-04-09 12:24:37 +02:00
Zdenek Kabelac
da31541bd8 gitignore: update 2019-03-20 14:35:09 +01:00
David Teigland
ce79b62bc2 pvscan service: use StartLimitIntervalSec
systemd changed the name
2019-02-28 08:50:37 -06:00
Zdenek Kabelac
fdd612b824 generators: avoid contacting syslog with generators
The systemd generators are executed very early during the switch
from initramfs to system partition and the syslog is not yet fully
operational - it may cause blocking, if some debug logging is enabled
at the same time in /etc/lvm/lvm.conf log{} section.

To avoid timeouting and killing this generator - rather enhance lvm
code to suppress any syslog communication when LVM_SUPPRESS_SYSLOG
envvar is set.

Use of this envvar is needed since the parsing of i.e. cmdline options
that could eventually override lvm.conf setting happens in this case
way too late and number of lines could have been already streamed to
syslog.
2019-01-08 13:13:54 +01:00
Peter Rajnoha
6298eaeca5 scripts: lvm2-activation-generator fix lvmconfig call
Fix a scenario where global/event_activation setting is not found. In
this case we need to take default value just like lvm tools do when
executed. So use "lvmconfig --type full".

Also, if we fail to execute lvmconfig for whatever reason, fallback to
generating the activation units as failsafe action.

Reported by: Bastian Blank <waldi debian org>
2019-01-08 13:11:46 +01:00