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

478 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
9830aa207c cleanup: missing copyright header 2018-12-21 21:42:30 +01:00
Zdenek Kabelac
0161ebe484 scripts: simplify including for generator
Uses included .c file as primary header includer.
2018-12-21 21:42:30 +01:00
Zdenek Kabelac
a4577c427a scripts: avoid voiding write result
Gcc doesn't want to ignore write() return code.
2018-12-21 21:42:30 +01:00
Zdenek Kabelac
94237354dd makefiles: correcting login of makefile
Fixing some ordering issue with inclusion of common make.tmpl.
Correcting dependency calculation
Simplifying inclusive makefile
2018-12-17 10:55:20 +01:00
Zdenek Kabelac
a665206453 makefiles: missing cleaning 2018-12-17 10:36:52 +01:00
Zdenek Kabelac
f619cac598 makefiles: quite install 2018-12-17 10:36:52 +01:00
Zdenek Kabelac
ceb2f0ad3b makefiles: updates for less verbosity 2018-11-29 23:05:43 +01:00
David Teigland
2d1152103f blk_availability service drop lvmetad 2018-11-26 14:51:32 -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
d44bfe90f1 scripts: remove lvmetad from makefile 2018-11-15 09:25:55 -06:00
David Teigland
df2fa88e63 lvm2-monitoring service shouldn't refer to lvmetad 2018-11-15 09:20:47 -06:00
Zdenek Kabelac
bc1976011a cov: explicit ignore if failures
Here we can't do anything better than just ignore syscall failures
(with silence as there is no loging mechanism)
2018-11-03 16:09:36 +01: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
David Teigland
e9b6cdd6e6 add lvmlocks service to start and stop lockspaces 2018-09-13 10:50:50 -05:00
David Teigland
81ca0cb161 Remove init scripts related to clvm and lvmetad 2018-09-13 10:08:03 -05:00
David Teigland
297f6d5122 lvmlockd: improve systemd service file
use notify type so the daemon is ready
immediately after start.
2018-09-13 09:52:39 -05:00
Peter Rajnoha
03ed2aae3a scripts: lvm2-activation-generator: also log possible execv error 2018-08-30 13:14:10 +02:00
Peter Rajnoha
3d5c4847b6 scripts: lvm2-activation-generator: add prefix for all kmsg messages
Add "lvm2-activation-generator: " prefix for all kmsg messages written by
lvm2-activation-generator so we can identify the message in global system log.
2018-08-30 13:14:10 +02:00
Peter Rajnoha
cb17ef221b scripts: add After=rbdmap.service to {lvm2-activation-net,blk-availability}.service
We need to have Ceph RBD devices mapped first before use in a stack
where LVM is on top so make sure rbdmap.service is called before
generated lvm2-activation-net.service.

On shutdown, we need to stop blk-availability first before we stop the
rbdmap.service.

Resolves: rhbz1623479
2018-08-30 12:35:58 +02:00
Zdenek Kabelac
b55d30956d build: drop some more old files 2018-07-02 10:21:42 +02:00
David Teigland
428514a07f Drop --ignoreskippedcluster option
It's no longer needed.  Clustered VGs are now handled in
the same way as foreign VGs, and as shared VGs that
can't be accessed:

- A command processing all VGs sees a clustered VG,
  prints a message ("Skipping clustered VG foo."),
  skips it, and does not fail.

- A command where the clustered VG is explicitly
  named on the command line, prints a message and fails.
  "Cannot access clustered VG foo, see lvmlockd(8)."

The option is listed in the set of ignored options for
the commands that previously accepted it.  (Removing it
entirely would cause commands/scripts to fail if they
set it.)
2018-06-15 15:59:34 -05:00
Zdenek Kabelac
7d8bd97187 scripts: clvmd gone 2018-06-15 00:46:24 +02:00
Zdenek Kabelac
b58160a191 systemd: add conficting sockets
Since we are using "DefaultDependencies=no" we do not get automatic STOP
job on socket connection - so automatically refuse connection on
shutdown by adding this Conflict definition to socket Unit.
2018-06-14 22:02:01 +02:00
David Teigland
9b79f0244a Remove makefile entries for removed script 2018-06-13 15:04:26 -05:00
David Teigland
fa00fce97c Remove systemd script for starting shared VG
Shared VGs will generally be started and activated by
the resource agent.  Without the agent, this script doesn't
have a good way to know which LVs to activate.
2018-06-13 14:37:16 -05:00
Joe Thornber
286c1ba336 device_mapper: rename libdevmapper.h -> all.h
I'm paranoid a file will include the global one in /usr/include
by accident.
2018-06-08 12:31:45 +01:00
Joe Thornber
bd8c6cf862 scripts/lvm2_activation_generator_systemd_red_hat: rewrite to use lvmconfig
Unit tested the new code, but not run functional tests (assuming they exist).
2018-06-07 16:15:04 +01:00
Joe Thornber
232918fb86 build: libbase.a 2018-06-04 13:53:07 +01:00
Joe Thornber
21a5be2364 build: link lvm2_activation_generator_systemd_red_hat with libdevice-mapper.a 2018-06-04 10:00:44 +01:00
Joe Thornber
dbba1e9b93 Merge branch 'master' into 2018-05-11-fork-libdm 2018-06-01 13:04:12 +01:00
Joe Thornber
3417d6229d scripts/code-stats.rb: count files better, handle bad utf8 2018-05-17 09:52:13 +01:00
Joe Thornber
64dd656ef7 scripts: add a little scripts to show git history for the last 2 weeks. 2018-05-16 15:27:52 +01:00
Joe Thornber
ccc35e2647 device-mapper: Fork libdm internally.
The device-mapper directory now holds a copy of libdm source.  At
the moment this code is identical to libdm.  Over time code will
migrate out to appropriate places (see doc/refactoring.txt).

The libdm directory still exists, and contains the source for the
libdevmapper shared library, which we will continue to ship (though
not neccessarily update).

All code using libdm should now use the version in device-mapper.
2018-05-16 13:00:50 +01:00
Joe Thornber
7f97c7ea9a build: Don't generate symlinks in include/ dir
As we start refactoring the code to break dependencies (see doc/refactoring.txt),
I want us to use full paths in the includes (eg, #include "base/data-struct/list.h").
This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in
metadata/ from base/
2018-05-14 10:30:20 +01:00
Joe Thornber
0a2b5d5748 [scripts] remove scripts/vg_convert
- it doesn't do anything other than tell you to run vgconvert
- it used to convert from lvm1 format, which is obsolete
2018-04-30 09:46:05 +01:00
David Teigland
697fa7aa1d [makefile] add -laio to makefiles 2018-04-20 11:13:17 -05:00
Zdenek Kabelac
cafcc5813a fsadm: shellcheck prefer explicit escaping
Backslash is literal in "\t". Prefer explicit escaping: "\\t".
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
d45a9c0f5b shellcheck: fsadm cleanup
Use some more "" for bash vars
2017-11-07 21:26:11 +01:00
Zdenek Kabelac
0f0baec1f3 blkdeactive: use /sbin for mdamd
Do not using lvm's  @SBINDIR@ for mdadm path.
Set this directly to  /sbin/mdadm like other tools.

Group them separately
2017-11-07 21:26:11 +01:00
Bastian Blank
58b763c99c systemd: remove Install sections from socket-activated services
We always preferred and recommended socket activation for our services
so remove the Install section in related .service units which are unused
in this case and keep only the Install section in associated .socket
units.

Signed-off-by: Bastian Blank <waldi@debian.org>
2017-11-01 15:37:19 +01:00
Zdenek Kabelac
35df4b10eb shellcheck: some apostrophe changes and cleanups 2017-10-25 22:02:54 +02:00
Zdenek Kabelac
34618c2d30 scripts: paths update
Correct usage of sbindir also for scripts so the path
no longer needs resolving more vars like exec_prefix & prefix.
2017-10-25 22:02:54 +02:00
Zdenek Kabelac
d809fbb541 systemd: use proper sbindir path
Replace lowercase  @sbindir@  with  @SBINDIR@ which contains
fully decoded path.

Same with  @usrsbindir@ which is also used with clvmd and cmirrord.

Also handle SYSCONFDIR for EnvironmentFile.

Patch fixes generated unit files with strings like:
ExecStart=${exec_prefix}/sbin/lvm
2017-10-25 22:02:54 +02:00
Ondrej Kozina
dcc8f90c58 fsadm: refactor resize_crypt function
split resize_crypt function in two.

a) Detect proper dm-crypt device type and count new --size
   value for cryptsetup resize command.

b) Perform the resize
2017-10-24 13:41:16 +02:00
Ondrej Kozina
9916d8fa9a fsadm: rename local variables to avoid confusion 2017-10-24 13:41:09 +02:00
Ondrej Kozina
af781897fa fsadm: fix bug in LUKS grow/shrink decision branch 2017-10-24 13:40:54 +02:00
Ondrej Kozina
6df7917581 fsadm: add luks specific error message for small devices 2017-10-24 13:40:50 +02:00
Ondrej Kozina
f5beb58561 fsadm: implement 'check' for a fs on top of LUKS 2017-10-11 14:39:22 +02:00
Ondrej Kozina
c795a3b37f fsadm: fail 'check' explicitly on unsupported fs type 2017-10-11 14:39:15 +02:00
Ondrej Kozina
74fd0dd6c4 fsadm: respect DM_DEV_DIR variable 2017-10-11 14:39:07 +02:00
Ondrej Kozina
59145715f1 fsadm: minor fixes for crypt support
drop useless asterisk expansion
enforce matching string prefix by adding ^
2017-10-10 15:21:35 +02:00
Ondrej Kozina
30293baaa0 fsadm: add support for crypt devices 2017-10-10 14:18:57 +02:00
Thomas Lamprecht
a781b1c178 dmeventd: ensure systemd service gets stopped on shutdown
Add these for dmeventd systemd unit (dm-event.service):

  Before: shutdown.target
  Conflicts: shutdown.target

This will cause the dmeventd to be properly stopped at shutdown (after
all the dmeventd clients unregistered their devices from monitoring)
with dm-event.service's stop action (there's no direct action defined
for the "stop" so systemd sends SIGTERM instead).

Before, we let dmeventd to get killed only as part of the very last
SIGTERM/SIGKILL for all the remaining processes late in the shutdown
sequence so we may have missed some logs if dmeventd encountered an
error during its shutdown (logging facilities are already off at this
late time in shutdown sequence).

Ref: https://www.redhat.com/archives/lvm-devel/2017-October/msg00000.html
2017-10-05 13:01:55 +02:00
Zdenek Kabelac
3ae8adce92 fsadm: add --help
Newer version of blockdev tool needs --help as the tool is no longer
printing help without this option like it used to in past.
2017-10-05 10:23:20 +02:00
Peter Rajnoha
b0f4e0fcec blkdeactivate: cleanup
Use a different variable for translated name in dm/md_deactivate fn
Fix dmraidoption/dmraidoptions in man page.
2017-09-22 11:10:57 +02:00
Peter Rajnoha
096fcb5a6e blkdeactivate: also try to unmount /boot on blkdeactivate -u if on top of supported device
There's nothing special about /boot other than it's used during boot.
But when blkdeactivate is called either on all devices or including a
device where the /boot is on top, we should also include this mount
point when doing unmount before deactivation of supported devices.
2017-09-21 17:15:48 +02:00
Peter Rajnoha
584b4ae38b blk-availability: use blkdeactivate -r wait in blk-availability systemd service/initscript 2017-09-21 17:10:15 +02:00
Peter Rajnoha
95087c8f96 blkdeactivate: add blkdeactivate -r wait option to wait for MD resync/recovery/reshape
The new blkdeactivate -r|mdraidoption wait causes blkdeactivate to wait
for any resync/recovery/reshape that is currently in progress before
deactivating the device.

If this option is used, blkdeactivate calls mdadm -W|--wait before
mdadm -S|--stop.
2017-09-21 17:10:15 +02:00
Peter Rajnoha
7fa0d52262 blkdeactivate: fix blkdeactivate regression with failing DM/MD devs deactivation
Revert dc50f2f4a0.

We're canonicalizing/escaping the names here and we're reusing the
variable name so the code doesn't need to use extra variables and
further assignments that may confuse us. Let's keep the code simple.

The

   local name=(...$name)

is not the same as

   local name
   name=(...$name)

(I know various code-checking tools fuss about this and recommend
the 2nd way, but let's ignore those tools' nitpicking here please.)
2017-09-21 17:10:15 +02:00
Peter Rajnoha
9f34125d5d blkdeactivate: fix --{dm,lvm,mpath}options option name recognition
There was a typo in blkdeactivate --dmoption/--lvmoption/mpathoption,
it had missing "s" at the end and it was not recognized properly, only
short names for the options (-d/-l/-m).
2017-09-21 17:08:44 +02:00
Zdenek Kabelac
ad44543e81 makefiles: script executable missed dynamic
Add missing  ELDFLAGS when linking binary.
Also pass CFLAGS for cases where we build code coverage compilation.
2017-08-01 18:32:16 +02:00
Zdenek Kabelac
95dd5bc7fb configure: tune BUILD_DMEVENTD
Drop 'DMEVENT' make variable and use  BUILD_DMEVENTD like with other daemons.
NOTE: by default we do not build dmeventd - maybe time to change
as lot of build targets basically do need dmeventd...

Switch to use SYSTEMD_LIBS and avoid linking systemd library with
every linked tool when dbus notification are enabled.
(TODO  add missing testing for lib presence)
2017-08-01 18:17:06 +02:00
Zdenek Kabelac
73bbd5528c tests: scripts double quote 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
191dadc623 clvmd_fix_conf.sh: double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
99925d0d41 clvmd_fix_conf.sh: legacy code
Use $(..) instead of legacy `..`.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
afa0bd916e vgimportclone.sh: do not quote regex
Don't quote rhs of =~, it'll match literally rather than as a regex.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
ef4506069a vgimportclone.sh: use well defined tests
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
8dc29d7cc7 vgimportclone.sh: drop extra $
$/${} is unnecessary on arithmetic variables.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
16a38dede9 vgimportclone.sh: add -r to read
read without -r will mangle backslashes.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
588b12e71d vgimportclone.sh: avoid legacy syntax
Use $(..) instead of legacy `..`.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
d745593e89 vgimportclone.sh: cannot trap signal 9 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
275eeb4631 vgimportclone.sh: double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
96a2e00240 vgimportclone.sh: no mixing string and array
Argument mixes string and array. Use * or separate argument.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
4d34bc65dd lvm2_cluster_activation_red_hat.sh: double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
051c7f88cf lvmconf_lockingtype2: double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
ef8691a2d2 lvmconf_lockingtype2: preferable syntax
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
030912ec03 lvmdump: replace individual redirects
Consider using { cmd1; cmd2; } >> file instead of individual redirects.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
df57845f61 lvmdump: drop useless cat
Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
a458065aa1 lvmdump: legacy syntax
Use $(..) instead of legacy `..`.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
a0740f831c lvmdump: drop extra $
$/${} is unnecessary on arithmetic variables.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
e08e714b68 lvmdump: replace printf
Don't use variables in the printf format string. Use printf "..%s.." "$foo".
Advice replaced with plain 'echo'.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
e292c1a1ca lvmdump: double quote
Double quote to prevent globbing and word splitting.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
6330e2dc86 lvmconf: prefer well defined and
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
ccdb75adcc lvmconf: double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
de04e36fda lvmconf: fix test for setting external locking type
Fix test for check of set locking lib dir.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
daa372f78d blkdeactivate: quote literal
This { is literal. Check expression (missing ;/\n?) or quote it.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
b5fc0d73e5 blkdeactivate: more readable if-then-else-fi 2017-06-29 22:23:16 +02:00