1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

396 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
dc50f2f4a0 blkdeactivate: split local declaration and assign 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
ce1383fe46 blkdeactivate: drop unused var 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
45861557b5 blkdeactivate: double quote
Using double quote to prevent globbing and word splitting.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
bd359aec86 blkdeactivate: replace obsoleted syntax 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
95ca7cfdff fsadm: make if statement more clear 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
c6a5964ce9 fsadm: add -r to read
read without -r will mangle backslashes
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
afded3e532 fsadm: no mixing string and array
Argument mixes string and array. Use * or separate argument.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
05a6d43476 fsadm: split local var dev
Split defining of local variables from being them
assigned at the same time (lossing error code).
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
439aaca3bc fsadm: remove surrounding $()
Remove surrounding $() to avoid executing output
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
b68235c519 fsadm: fix shell globbing
Fixing reported issue for shellcheck.
Use "" properly to avoid having shell variables split.
2017-06-29 22:23:15 +02:00
Zdenek Kabelac
1c212b8a43 fsadm: restore no answer
Commit 1fe4f80e45 in current version
introduced regression for a terminal user, as he could not enter 'n'
as answer. Add missing break for this case (No whats_new).
2017-06-19 12:40:03 +02:00
Zdenek Kabelac
1fe4f80e45 fsadm: avoid hidden --yes
When 'fsadm' was running without terminal (i.e. pipe), it's been
automatically working like in '--yes'.

Detect terminal and only accept empty "" input in this mode.
2017-05-23 14:02:41 +02:00
Zdenek Kabelac
9e04e0483f fsadm: enhance detection of already mounted volumes
Add more validation to catch mainly renamed devices, where
filesystem utils are not able to handle devices properly,
as they are not addressed by major:minor by rather via some
symbolic path names which can change over time via rename operation.
2017-05-22 15:11:21 +02:00
Zdenek Kabelac
2b7ac2bfb3 fsadm: always detect mounted fs with extX
Since we add more validation to 'detect_mounted' function make sure
we always use it even with 'resize' action, so numerous validations
are not skipped.
2017-05-22 15:10:16 +02:00
Zdenek Kabelac
a1a9ae0aa5 fsadm: all path define MAJOR MINOR 2017-05-10 15:40:32 +02:00
Zdenek Kabelac
8ea33b633a fsadm: some cleanup
Put some extra "" around vars.
Indent.
Error messages with dots.
2017-05-10 15:40:31 +02:00
Zdenek Kabelac
1107d483a2 fsadm: fix test of subshell return value
Subshell is not returning error code value upward thus
error results in this case were actually ignored.
Also add dots to moved error messages.
2017-05-10 15:40:29 +02:00
Peter Rajnoha
448bf9491a lvmconf: fix systemd unit existence check for lvmconf --services --startstopservices
We have to unset the LoadState variable from previous use when we check
for systemd unit state. We use this variable to check if systemd services
are loaded or not and if it is loaded, we issue systemctl commands to
enable/disable and start/stop the service. We don't issue these commands
if the unit is not loaded to avoid error messages which may confuse users.
2017-04-05 11:06:56 +02:00
Peter Rajnoha
d90320f4f1 blkdeactivate: also unmount mount point on top of MD device if using blkdeactivate -u
The blkdeactivate script processes MD devices too so we should unmount
any mount point on top of an MD device if blkdeactivate -u|--umount is
called.

Diagnosed and reported by: Rick Warner <rick@microway.com>
See also https://bugzilla.redhat.com/show_bug.cgi?id=1410585.
2017-01-06 11:16:07 +01:00
Bryn M. Reeves
f9c9772a80 scripts: add systemd unit files to .gitignore
com.redhat.lvmdbus1.service
lvm2_lvmdbusd_systemd_red_hat.service

.gitignore
2016-12-10 17:58:10 +00:00
Bryn M. Reeves
383683ffd3 scripts: add lvmdump.sh to .gitignore 2016-12-10 17:56:56 +00:00
Peter Rajnoha
2ad66b4e7b scripts: fix comment about blk-availability init script
The original comment got there as copy-paste error and it wasn't edited
properly for blk-availability.
2016-11-25 11:30:55 +01:00
Peter Rajnoha
4585785613 blkdeactivate: deactivate dev stack if dev on top already unmounted
If blkdeactivate finds out that the device on top of device stack
is already unmounted, it still proceeds with device stack deactivation
underneath now.

This situation can happen if blkdeactivate is started and the mount
point is unmounted in parallel by chance (so when blkdeactivate
gets the the actual umount call, the device is not mounted anymore).
Before, the blkdeactivate added such device to skip list which caused
all the stack underneath to be skipped too on deactivation. Now, we
proceed just as if blkdeactivate did the umount itself.

For example, in the example below, the vg-lvol0 is mounted on /mnt/test
when blkdeactivate is called, but it gets unmounted in parallel later
on when blkdeactivate gets to the actual umount call.

Before this patch (vg-lvol0 underneath not deactivated):

  $ blkdeactivate -u
  Deactivating block devices:
    [UMOUNT]: unmounting vg-lvol0 (dm-2) mounted on /mnt/test... skipping

With this patch applied (vg-lvol0 underneath still deactivated):

  $ blkdeactivate -u
  Deactivating block devices:
    [UMOUNT]: unmounting vg-lvol0 (dm-2) mounted on /mnt/test... already unmounted
    [LVM]: deactivating Logical Volume vg/lvol0... done
2016-11-01 16:52:51 +01:00
Peter Rajnoha
0a480c5c52 systemd: disable service start rate limiting for lvm2-pvscan@.service
We shouldn't be losing pvscans just because of the fact that the
underlying device (PV) appears and disappears quickly in the system,
otherwise lvmetad may not see the device if it appears again (or it may
still keep the device in cache even it's already gone).
2016-09-27 10:48:01 +02:00
Timur Bakeyev
70be57c8da systemd: fix extra space in unit generated by lvm2-activation-generator 2016-09-26 09:54:19 +02:00
Peter Rajnoha
dbcfd59714 make: also clean up lvmdump.sh with substitutions - there's original lvmdump.sh.in 2016-09-23 12:48:52 +02:00
Alasdair G Kergon
5da35d879a lvmdump: Use O_DIRECT to gather metadata. 2016-09-15 14:00:39 +01:00
Peter Rajnoha
16ed726610 lvmdump: use lsblk -s and lsblk -O in lvmdump only if these options are supported
The lsblk is just a nice helper here - it's not crucial for lvmdump so
do best effort here and use the most we can from current version of
lsblk that is installed on system. The lsblk -s option was added a bit
later after lsblk introduction and lsblk -O support even more later -
so if these are not available, use only pure lsblk output without any
extras.
2016-08-30 15:38:34 +02:00
Peter Rajnoha
19e652b182 scripts: blkdeactivate: fix typo for DEV_DIR when executing blkdeactivate -m disablequeueing 2016-07-20 13:48:59 +02:00
Peter Rajnoha
07be2b864f lvmdump: include major and minor numbers for pvs and lvs reports
Including major and minor numbers in pvs and lvs output when calling
lvmdump -a makes it a bit easier to match these items with possible
system log/journal.
2016-07-14 14:33:33 +02:00
Peter Rajnoha
42e76a1920 blkdeactivate: add -m|--mpathoption disablequeueing and use it for blk-availability systemd service and initscript
blkdeactivate -m disablequeueing causes "multipathd disablequeueing maps"
call inside blkdeactivate script before deactivating devices. This
avoids a situation where blkdeactivate may wait for paths to appear if
multipath is set to queueing and there's a stack of other devices and/or
mount points on top of such multipath device.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1344381.
2016-07-12 10:01:07 +02:00
David Teigland
ebd2758dab vgimportclone: add native command
This is cleaner and more efficient than the script.
The args and usage are unchanged.
2016-06-22 13:13:10 -05:00
Peter Rajnoha
cfdc87b623 lvmdump: also collect output from lsblk command when running lvmdump -s
lsblk provides nice and quick overview of the storage/sysfs structure
that is useful for debugging - collect its output when running lvmdump -s.
2016-06-09 13:54:15 +02:00
Peter Rajnoha
7ae05adf46 blkdeactivate: fix regression in blkdeactivate causing dm and md devices to be skipped.
Commit #5b3a4a9 caused the "name" variable to be cleared if
declaration and assignment is on two lines so put it back
so it's on one line for it to work again.
2016-06-06 14:57:46 +02:00
Peter Rajnoha
fc37ee63c0 make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean 2016-06-02 11:58:54 +02:00
Peter Rajnoha
5b3a4a9595 coverity: blkdeactivate: separate format and args for printf and declare and assign separately to avoid masking return values 2016-05-31 09:39:06 +02:00
David Teigland
591ef307b3 lvm2_activation_generator: don't create full context for liblvm2app
Don't use lvm_init() to create a full command context, which
does a lot of command setup (like connecting to daemons), which
is unnecessary for simply reading a value from lvm.conf.

Passing a NULL context arg to the lvm_config_ function is now
allowed, in which case lvm.conf is read without doing lvm
command setup.
2016-05-18 09:05:26 -05:00
Alasdair G Kergon
f19ec0e36d lvmdump: If dir exists check dir perms too. 2016-04-06 22:56:45 +01:00
Alasdair G Kergon
55001ae9ec lvmdump: Allow dir to exist already if it is empty 2016-04-06 22:36:42 +01:00
Tony Asleson
86e9d12b6f lvmdbusd: Remove --udev in service file
With commit 2d5dc6512e the dbus server
no longer needs to utilize udev to know when to update its internal
state.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2016-03-21 17:28:51 -05:00
Peter Rajnoha
6c10d1f3d9 fsadm: use stat to get major:minor pair for non-standard /dev layouts
If we're using non-standard /dev layout so we can't get the dm-X name
easily, we can't also look at the /sys/blocl/dm-X/dev to get the major:minor
pair. Use "stat" in this case even though it triggers automounts
(but there's no better way for now).
2016-03-18 17:21:47 +01:00
Peter Rajnoha
2879eff86e fsadm: if available, use /proc/self/mountinfo to detect mounted volume
The /proc/self/mountinfo is not bound to device names like /proc/mounts
and it uses major:minor pairs instead.

This fixes a situation in which a volume is mounted and then renamed
later on - that makes /proc/mounts unreliable when detecting mounted
volumes.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1196910.
2016-03-18 13:42:06 +01:00
Peter Rajnoha
b39473a537 lvmdump: also list historical LVs in lvmdump 2016-03-03 13:50:59 +01:00
Vratislav Podzimek
3e31f51869 dbus: fix the systemd service providing the DBus service
Correct name is lvm2-lvmdbusd.service not lvmdbusd.service.
This makes the bus-activation (auto-activation) work.

Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
2016-02-26 10:20:08 +01:00
Alasdair G Kergon
5987562cf9 lvmdbus: Add new daemon. 2016-02-17 23:53:35 +00:00
Peter Rajnoha
55056c2d16 vgimportclone: fix VG name variable reference in error message after failed PV uuid change 2016-01-21 14:47:48 +01:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
Peter Rajnoha
4304a95dfd lvmdump: also add lvm2-activation{-early,-net}.service systemd status for lvmdump -s
The lvm2-activation{-early,-net}.service systemd unit statuses were missing
in dump gathered by lvmdump -s. These are quite important when debugging
scenarios with systemd environment and where lvmetad is not used.
2016-01-04 15:12:25 +01:00
Zdenek Kabelac
bbef4edd06 makefiles: switch to rpath-link
Plain rpath is to invasive and gets into binary.
We only want to provide hint for linker.
2015-10-14 00:51:55 +02:00
Zdenek Kabelac
a91fbe9d27 makefiles: older gcc needs hint with rpath
gcc 4.3 seems not to be able to find linked library without
specifying -rpath to linker  (plain -L) is not enough.
2015-10-13 22:02:17 +02:00
Zdenek Kabelac
83f00e9156 makefiles: drop explicit linking
Nothing in /sscripts needs devmapper-event library so drop its linking.
2015-10-13 16:02:20 +02:00
Peter Rajnoha
75420282e1 vgimportclone: make sure there's no prefix in VG name list
Make sure log/prefix is set to "" when getting the list of VG names.
We need this for the format to be correct so it's properly searched
through later on.
2015-10-12 12:54:59 +02:00
Peter Rajnoha
38df48d108 vgimportclone: fix vgimportclone with -n to not add number unnecessarily to base VG name
$ vgcreate vgA /dev/sda
  Volume group "vgA" successfully created

$ dd if=/dev/sda of=/dev/sdb bs=1M
$ dd if=/dev/sda of=/dev/sdc bs=1M

(the new VG name is prefix of existing VG name)
$ vgimportclone -n vg /dev/sdb

(the new VG name is suffix of existing VG name)
$ vgimportclone -n gA /dev/sdc

Before this patch:
------------------
(we end up with "vg1" and "gA1" names with the "1" suffix which is not needed)
$ vgs -o vg_name
  VG
  gA1
  vg1
  vgA

With this patch applied:
------------------------
(we end up with "vg" and "gA" names as they're unique already and no extra suffix is added)
$ # vgs -o vg_name
  VG
  gA
  vg
  vgA

Of course, if the name supplied is not unique, the number is added correctly:
$ dd if=/dev/sda of=/dev/sdb bs=1M
$ vgimportclone -n vgA /dev/sdb
$ vgs -o vg_name
  VG
  vgA
  vgA1
2015-10-12 11:11:34 +02:00
Peter Rajnoha
1f30ba6178 vgimportclone: cleanup the script and remove dependency on awk, grep, cut and tr
We can replace the expressions with awk/grep/cut/tr with --select now and
more suitable reporting options and modes. Also, we don't need to check
the temporary lvm.conf generated within vgimportclone script since we're
generating it ourselves now using lvmconfig, not using sed anymore like
it was before (so we can be pretty sure it's correct - we use lvmconfig
now even for generating the lvm.conf itself).
2015-10-09 16:31:02 +02:00
Zdenek Kabelac
4b1cadbd87 man: fsadm 2015-10-06 15:21:36 +02:00
Peter Rajnoha
5f7a94a03e blkdeactivate: recognize and deactivate MD devices too 2015-10-06 13:25:41 +02:00
Peter Rajnoha
cb82919b0d systemd: use {local,remote}-fs-pre.target instead of {local,remote}-fs.target
We want most of our units to be started before any local/remote mount
points are mounted - we used {local,remote}-fs.target for this purpose
before, but it was not 100% correct as there's even {local,remote}-fs-pre.target
special systemd unit reserved for this exact purpose.

See also man 7 systemd.special and "local-fs-pre.target"/"remote-fs-pre.target"
description.
2015-09-23 13:30:51 +02:00
Peter Rajnoha
001f747963 lvmconf: set locking_type=2 if external library is requested
Also, set safe use_lvmetad=0 for external locking (locking_type=2)
similarly to locking_type=3.
2015-09-22 13:33:12 +02:00
Zdenek Kabelac
e42ee69988 vgimporeclone: use correct cache dir path
Commit 00b36ef06a had a typo
and missed '{' for shell variable, thus command used slightly
different 'tmp' dir name for cache dir (with extra '}').

Such change was unnoticed until a recent fix in persistent
filter, lvm2 missed to update cache file when --config
was specified.

The result was, /tmp dir was accumulating snap.XXXXX} dirs when
running vgimportclose  script.
2015-09-14 09:31:26 +02:00
Zdenek Kabelac
fd3d795b93 makefiles: distclean missing files 2015-09-11 21:52:27 +02:00
Alasdair G Kergon
3934ade5a2 gitignore: Update for in-place build. 2015-07-27 13:18:35 +01:00
Peter Rajnoha
cb305b9fc0 lvmconf: fix ignored --startstopservices in lvmconf ... --mirrorservice on systemd
If running lvmconf ... --startstopservice --mirrorservice in systemd
environment, handle lvm2-cmirrord accordingly. A typo in the script
caused the lvm2-cmirrord to not start/stop immediately, it was
only enabled/disabled (so the --startstopservice was ignored in this
case).
2015-07-09 10:40:14 +02:00
David Teigland
fe70b03de2 Add lvmlockd 2015-07-02 15:42:26 -05:00
Zdenek Kabelac
9c86d33e68 cleanup: avoid printing gcc warning
Casting to (void) with gcc doesn't remove unused_result warning.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
2015-06-23 11:06:02 +02:00
Peter Rajnoha
ba68aed836 scripts: activation generator: do not use --sysinit if lvmpolld used
If lvmetad is not used, we generate lvm2-activation{-early,-net}.service
systemd services to activate any VGs found on the system. So far we used
--sysinit during this activation as polling was still forked off of the
lvm activation command.

This has changed with lvmpolld - we have proper lvmpolld systemd
service now (activated via its socket unit). As such, we don't need
to use --sysinit anymore during activation in systemd environment
as polling was the only barrier to remove the need for --sysinit.
2015-05-21 12:20:30 +02:00
Ondrej Kozina
2bbf0425e7 lvmdump.sh: print out lvmpolld service status 2015-05-11 19:07:47 +02:00
Ondrej Kozina
e587b0677b lvmpolld: Add standalone polldaemon.
See doc/lvmpolld_overview.txt
2015-05-09 00:59:18 +01:00
Alasdair G Kergon
3f0434057b config: Introduce lvmconfig.
'lvm dumpconfig' now does a lot more than just dumping configuration
information and is no longer only a support tool.  Users now need
to run it to find out about configuration information that has been
removed from the lvm.conf man page so we need to promote this to full
command line status as 'lvmconfig'.  Also accept 'lvm config' and mention
it in the usage information of lvmconf (which should also get merged in
eventually).
2015-04-28 17:00:37 +01:00
Peter Rajnoha
375ed98ae9 make: move blkdeactivate script and blkdeactivate.8 man page installation from install_lvm2 to install_device-mapper target
This completes commit 7a4e27eee5.
2015-04-14 15:24:37 +02:00
Peter Rajnoha
7a4e27eee5 blkdeactivate: check for lvm binary and skip LVM processing if not present
This removes dependency on lvm binary - if it's not present, all LVM
processing is skipped (shouldn't normally happen because if lvm binary
is missing then there's obviously nothing that would activate it, but
let's make sure).

Without this tight dependency on lvm, the blkdeactivate script can
be packaged with libdevmapper/dmsetup (in contrast to lvm as it was
before) and as such the script can still be used to handle other DM
devices.
2015-04-14 13:35:11 +02:00
Peter Rajnoha
f814d763c6 lvmconf: add --enable-halvm, --disable-halvm, --services, --mirrorservice, --startstopservices options and use proper global/use_lvmetad default value
This patch adds new options to lvmconf:

  --enable-halvm (just like --enable-cluster, but configure LVM
                  for use in HA LVM - meaning disabling lvmetad and
                  making sure we have locking_type=1)

  --disable-halvm (just like --disable-cluster, but configure LVM
                   back from HA LVM - meaning enabling lvmetad if
                   it's enabled by default and making sure we have
                   default locking type set)

  --services (causes clvmd and lvmetad services to be enabled or
              disabled appropriately and conforming to the changes
              in lvm configuration we've just made with lvmconf)

  --mirrorservice (in addition to clvmd and lvmetad services, also
                   enable or disable cmirrord service appropriately;
                   this is a separate option because cmirrord is
                   optional and it doesn't need to be always enabled
                   when clvmd is enabled)

  --startstopservices (in addition to enabling or disabling services,
                       start and stop these services immediately)

These options are supposed to help users to make their system ready
for cluster with clvmd (active-active) or HA LVM (active-passive) use
while lvmconf script can handle services as well so users don't need
to bother about setting them manually.

Also, before this patch, we hardcoded global/use_lvmetad=0 as default
value in lvmconf script. Howeverm this default may change by just
flipping the value in config_settings.h and we may forget to edit
the lvmconf. It's better to use lvm dumpconfig --type default global/use_lvmetad
to get the actual default value and use this one instead of hardcoded one.
2015-04-13 15:27:17 +02:00
Peter Rajnoha
20c6192fbb systemd: stop lvm2-monitor.service before dm-event.service 2015-03-31 15:50:16 +02:00
Michael Lass
666738d57a systemd: stop lvm2-pvscan@.service before lvm2-lvmetad.service
When lvm2-pvscan@.service and lvm2-lvmetad.service are scheduled to be
stopped lvm2-pvscan@.service should be stopped first since pvscan uses
lvmetad.

This is especially important if lvm2-lvmetad.socket is also scheduled to
be stopped as in this case connection requests are suppressed causing
pvscan to fail.
2015-03-31 15:47:01 +02:00
Peter Rajnoha
05f23e7763 systemd: blk-availability.service: add After=iscsi-shutdown.service
The iscsi-shutdown.service is the one responsible for logging out
iscsi sessions so blk-availability.service (running the blkdeactivate
script) should be run before that on shutdown (so we need to use
After=iscsi-shutdown.service because "After" relates to starting
the service and the opposite order is automatically applied on
stopping the service at shutdown).
2015-03-13 12:08:20 +01:00
Peter Rajnoha
e09f8a82f1 initscripts: lvm2-monitor: use @DMEVENTD_PIDFILE@ instead of hardcoded /var/run/dmeventd.pid 2015-02-27 15:48:10 +01:00
Jose Castillo
57e9e76da4 initscripts: lvm2-monitor: implement status action
Two new functions added in the init script: rh_status and rh_status_q.
First one to be used in status() and second one to be used in start(),
stop(), force_stop(). Check for 'dmeventd' added and print list of
lvs being monitored in status().
2015-02-27 15:38:34 +01:00
David Teigland
a164d603d3 vgimportclone: remove arg check that uses pvs
The arg check using pvs is unnecessary.  If the arg is not a PV,
the command will just fail later.  Using the pvs command at this
point in the command is a problem when lvmetad is running, because
the pvs command does not report duplicate PVs when using lvmetad.
(Alternatively, use_lvmetad could be disabled by adding a --config
override to this pvs command.)
2015-01-20 13:08:22 -06:00
Alasdair G Kergon
8f90f632f5 vgimportclone: Say safe to ignore lvmetad message. 2015-01-17 11:29:38 +00:00
Peter Rajnoha
6a77b6f43c scripts: clvmd: replace awk functionality with LVM's selection
No need to use awk now to get appropriate VGs/LVs, use LVM's
own --select - it's quicker, it removes a need for external
dependency on awk and it's also more readable.
2015-01-09 16:41:07 +01:00
Peter Rajnoha
b21a8412c4 vgimportclone: also notify lvmetad about changes if it's used
All the LVM commands are run in mode without lvmetad use (since lvmetad
can't handle duplicates). When we're finished with vgimportclone, we
need to notify lvmetad about changes.

Before this patch (/dev/sda and /dev/sdb contains a copy VG called "vg"):
$ vgimportclone --basevgname vg_snap /dev/sdb
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Physical volume "/tmp/snap.zcJ8LCmj/vgimport0" changed  1 physical volume changed / 0 physical volumes not changed
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Volume group "vg" successfully changed
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Volume group "vg" successfully renamed to "vg_snap"
  Reading all physical volumes.  This may take a while...
  Found volume group "vg" using metadata type lvm2
  Found volume group "fedora" using metadata type lvm2

$ vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  fedora   1   2   0 wz--n-   9.50g      0
  vg       1   1   0 wz--n- 124.00m 120.00m

(...lvmetad doesn't see the new "vg_snap"!)

With this patch applied:
$ vgimportclone --basevgname vg_snap /dev/sdb
  ...
  WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
  Volume group "vg" successfully renamed to "vg_snap"
Notifying lvmetad about changes since it was disabled temporarily.
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_snap" using metadata type lvm2
  Found volume group "fedora" using metadata type lvm2
  Found volume group "vg" using metadata type lvm2

$ vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  fedora    1   2   0 wz--n-   9.50g      0
  vg        1   1   0 wz--n- 124.00m 120.00m
  vg_snap   1   1   0 wz--n- 124.00m 120.00m

The "restart lvmetad before enabling it" message is a bit misleading
here - we should probably suppress this one, but we can't suppress
warning messages selectively at the moment and we don't want to lose
other warning/error messages printed...
2014-12-10 14:00:56 +01:00
Peter Rajnoha
00b36ef06a vgimportclone: replace awk with dumpconfig to generate temporary lvm.conf for vgimportclone
With current dumpconfig, we can generate lvm.conf easily - we can merge
current lvm.conf with the config given on cmd line:
  lvm dumpconfig --mergedconfig --config "..."

This is a bit simpler than using awk and it also avoids problems when some of
the configuration is missing in existing lvm.conf file and hardcoded defaults
are used instead. The dumpconfig handles this transparently.
2014-12-10 13:59:38 +01:00
Peter Rajnoha
13e2049c32 initscripts: fix typo in clvmd initscript causing CLVMD_STOP_TIMEOUT variable to be ignored 2014-11-25 15:19:11 +01:00