]> sourceware.org Git - lvm2.git/log
lvm2.git
8 years agodatastruct: Add str_list_wipe.
Alasdair G Kergon [Fri, 29 Apr 2016 18:47:15 +0000 (19:47 +0100)]
datastruct: Add str_list_wipe.

8 years agolibdm: Add dm_udev_wait_immediate.
Alasdair G Kergon [Wed, 27 Apr 2016 23:54:27 +0000 (00:54 +0100)]
libdm: Add dm_udev_wait_immediate.

dm_udev_wait() waits inside the library.
dm_udev_wait_immediate allows the caller to do other things if the
cookie isn't yet ready to be decremented.

8 years agopvscan: autoactivation should ignore some VGs
David Teigland [Wed, 27 Apr 2016 20:33:23 +0000 (15:33 -0500)]
pvscan: autoactivation should ignore some VGs

pvscan autoactivation has its own VG processing implementation,
so it can't properly handle things like foreign or shared VGs,
so make it ignore those VG types (or errors from them) as best
as possible.

Add a FIXME stating that pvscan autoactivation must really be
moved to the standard VG processing by calling process_each_vg
to do activation once the scanning / cache update is finished.

8 years agolvmetad: improve warning after lvmetad message fails
David Teigland [Wed, 27 Apr 2016 19:49:27 +0000 (14:49 -0500)]
lvmetad: improve warning after lvmetad message fails

Make it more consistent with the other similar warning.

8 years agometadata: fix segfault when filters reject devices
David Teigland [Wed, 27 Apr 2016 17:13:26 +0000 (12:13 -0500)]
metadata: fix segfault when filters reject devices

Checking for devices uses is_missing_pv() to check
if there is a device for the PV.  is_missing_pv()
is based on the MISSING_PV flag, which does not
always correspond to !pv->dev.  When using lvmetad,
a command like:

pvs --config 'devices/filter=["a|/dev/sdb|", "r|.*|"]'

will cause a number of PVs to have NULL pv->dev, but
not the MISSING_PV flag.  So, NULL pv->dev needs to
also be checked.

8 years agocache: better support for alias check
Zdenek Kabelac [Tue, 26 Apr 2016 22:19:04 +0000 (00:19 +0200)]
cache: better support for alias check

To still support disabling of policies for test we need
better logic for alias detection introduced in
588455d03ea40ffa37f466023691b0ec2bdf5e82.

8 years agocleanup: use log_debug_activation
Zdenek Kabelac [Tue, 26 Apr 2016 22:01:08 +0000 (00:01 +0200)]
cleanup: use log_debug_activation

8 years agocleanup: smaller timeout
Zdenek Kabelac [Tue, 26 Apr 2016 21:59:20 +0000 (23:59 +0200)]
cleanup: smaller timeout

1s -> 0.5s
Also indent fix.

8 years agoman: lvcreate doc passthrough
Zdenek Kabelac [Mon, 25 Apr 2016 11:38:24 +0000 (13:38 +0200)]
man: lvcreate doc passthrough

Add few more words about passthough mode.

8 years agoman: lvchange updates
Zdenek Kabelac [Sun, 24 Apr 2016 09:40:59 +0000 (11:40 +0200)]
man: lvchange updates

Drop never existing --degrade.

8 years agolvchange: use better arg functions
Zdenek Kabelac [Tue, 26 Apr 2016 20:04:19 +0000 (22:04 +0200)]
lvchange: use better arg functions

8 years agolvchange: always check for sigint
Zdenek Kabelac [Mon, 25 Apr 2016 11:44:42 +0000 (13:44 +0200)]
lvchange: always check for sigint

Check sigint() state during process_each_lv.

8 years agolvchange: fix return code
Zdenek Kabelac [Mon, 25 Apr 2016 11:40:26 +0000 (13:40 +0200)]
lvchange: fix return code

We already opened VG for this - so not an invalid cmdline.

8 years agothin: zero and transaction_id also with thin volumes
Zdenek Kabelac [Sat, 23 Apr 2016 19:08:46 +0000 (21:08 +0200)]
thin: zero and transaction_id also with thin volumes

Show trasaction_id when thin volume was created.
Also show zeroing state of thin-pool with thin volume (so user
doesn't need to lookup thin-pool).

8 years agocache: check for clean cache as separete function
Zdenek Kabelac [Tue, 26 Apr 2016 19:45:48 +0000 (21:45 +0200)]
cache: check for clean cache as separete function

8 years agocache: with cache target 1.9 mq is alias to smq
Zdenek Kabelac [Tue, 26 Apr 2016 19:43:41 +0000 (21:43 +0200)]
cache: with cache target 1.9 mq is alias to smq

Avoid useless check for mq policy, it's loaded as smq
and aliased.

8 years agomodprobe: check /sys/module entry first
Zdenek Kabelac [Tue, 26 Apr 2016 19:41:04 +0000 (21:41 +0200)]
modprobe: check /sys/module entry first

Before executing modprobe for given module name, just check
if the module is not already present in /sys/module.

Useful when checking dm-cache-policy modules as we do not
having matching interface like for targets.

8 years agoudev: rules: add comments explaining subsystem-specific rules
Peter Rajnoha [Tue, 26 Apr 2016 10:51:06 +0000 (12:51 +0200)]
udev: rules: add comments explaining subsystem-specific rules

8 years agoudev: rules: remove mpath from 10-dm.rules, superseded by 11-dm-mpath.rules (mpath...
Peter Rajnoha [Mon, 25 Apr 2016 12:48:46 +0000 (14:48 +0200)]
udev: rules: remove mpath from 10-dm.rules, superseded by 11-dm-mpath.rules (mpath>=0.6.0)

Multipath 0.6.0 contains new 11-dm-mpath.rules which supersede the rule
that was in 10-dm.rules. The 11-dm-mpath.rules are also more complete,
fixing several other issues. Using the new 11-dm-mpath.rules from
multipath-tools >= 0.6.0 is strongly recommended for proper
DM multipath functionality!

See also:
  http://christophe.varoqui.free.fr
  http://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=blob;f=multipath/11-dm-mpath.rules

8 years agocleanup: do not mention segment in warning message if device not found for a PV when...
Peter Rajnoha [Mon, 25 Apr 2016 09:41:36 +0000 (11:41 +0200)]
cleanup: do not mention segment in warning message if device not found for a PV when checking used/assumed devs for an LV

[0] fedora/~ # pvs --config 'devices/filter=["a|/dev/sda|", "r|.*|"]'
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Couldn't find device for segment belonging to fedora/root while checking used and assumed devices.
  WARNING: Couldn't find device for segment belonging to fedora/swap while checking used and assumed devices.
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda          lvm2 ---  128.00m 128.00m
  [unknown]  fedora lvm2 a-m   19.49g      0

Probably not worth mentioning "segments" here, just state that devices
for an LV can't be all found during the check - it's less mysterious for
user then:

[0] fedora/~ # pvs --config 'devices/filter=["a|/dev/sda|", "r|.*|"]'
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Couldn't find all devices for LV fedora/root while checking used and assumed devices.
  WARNING: Couldn't find all devices for LV fedora/swap while checking used and assumed devices.
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda          lvm2 ---  128.00m 128.00m
  [unknown]  fedora lvm2 a-m   19.49g      0

8 years agometadata: log warning instead of error if device not found while checking used and...
Peter Rajnoha [Mon, 25 Apr 2016 09:15:44 +0000 (11:15 +0200)]
metadata: log warning instead of error if device not found while checking used and assumed devs

When checking assumed PVs against real devices used for LVs and if
there's no device assigned for an assumed PV (e.g. due to filters),
do log_warn instead of log_error and continue checking LV segments
and associated assumed PVs further, just like we do log_warn elsewhere
in this situation.

This way user will see the warning for each LV which couldn't be
checked completely against real PVs used. Before, we logged only
the very first occurence of missing device for an LV in a VG and we
returned from the function doing this check for all the LVs in VG
immediately which may be a bit misleading because it didn't tell
user about all the other LVs and whether they could be checked
or not.

For example, we have this setup:

[0] fedora/~ # pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda          lvm2 ---  128.00m 128.00m
  /dev/vda2  fedora lvm2 a--   19.49g      0

[0] fedora/~ # lvs -o+devices
  LV   VG     Attr       LSize   Devices
  root fedora -wi-ao----  19.00g /dev/vda2(0)
  swap fedora -wi-ao---- 500.00m /dev/vda2(4864)

Before this patch (only the very first LV in a VG is logged to have a
problem while checking used and assumed devices):

[0] fedora/~ # pvs --config 'devices/filter=["a|/dev/sda|", "r|.*|"]'
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  Couldn't find device for segment belonging to fedora/root while checking used and assumed devices.
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda          lvm2 ---  128.00m 128.00m
  [unknown]  fedora lvm2 a-m   19.49g      0

With this patch applied (all LVs where we hit problem while checking
used and assumed devices are logged and it's warning, not error):

[0] fedora/~ # pvs --config 'devices/filter=["a|/dev/sda|", "r|.*|"]'
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Device for PV Qcxpcy-XgtP-UD3s-PmG0-qLyE-Z0ho-DYsxoz not found or rejected by a filter.
  WARNING: Couldn't find device for segment belonging to fedora/root while checking used and assumed devices.
  WARNING: Couldn't find device for segment belonging to fedora/swap while checking used and assumed devices.
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda          lvm2 ---  128.00m 128.00m
  [unknown]  fedora lvm2 a-m   19.49g      0

8 years agopost-release
Alasdair G Kergon [Fri, 22 Apr 2016 23:43:13 +0000 (00:43 +0100)]
post-release

8 years agopre-release v2_02_151
Alasdair G Kergon [Fri, 22 Apr 2016 23:33:59 +0000 (00:33 +0100)]
pre-release

8 years agotests: drop cluster testing with pvmove
Zdenek Kabelac [Fri, 22 Apr 2016 12:08:31 +0000 (14:08 +0200)]
tests: drop cluster testing with pvmove

Unwanteadly enabled in previous check-in.

8 years agocoverity: check for sys error in clock call
Zdenek Kabelac [Fri, 22 Apr 2016 12:06:58 +0000 (14:06 +0200)]
coverity: check for sys error in clock call

8 years agocoverity: ignore some dm_strncpy results
Zdenek Kabelac [Fri, 22 Apr 2016 12:06:15 +0000 (14:06 +0200)]
coverity: ignore some dm_strncpy results

Using them only for debug so ignorable.
Also don't mark stack char buffer alignment, compiler already knows
what's the best here.

8 years agocoverity: keep expression using 64bit
Zdenek Kabelac [Fri, 22 Apr 2016 12:05:03 +0000 (14:05 +0200)]
coverity: keep expression using 64bit

Use 64bit input to remain with whole evaluation in 64bit.

8 years agocoverity: is_used_pv needs valid pv pointer
Zdenek Kabelac [Thu, 21 Apr 2016 18:23:13 +0000 (20:23 +0200)]
coverity: is_used_pv needs valid pv pointer

8 years agotests: make test independent on usage [] for hidden LVs
Zdenek Kabelac [Fri, 22 Apr 2016 10:51:54 +0000 (12:51 +0200)]
tests: make test independent on usage [] for hidden LVs

8 years agocache: fix previous change and correct ()
Zdenek Kabelac [Fri, 22 Apr 2016 10:31:02 +0000 (12:31 +0200)]
cache: fix previous change and correct ()

412f09ca332c644e08421e289a3e8d54890971ba missed parentheses.

8 years agolibdm-stats: check for empty region and area lists
Bryn M. Reeves [Fri, 22 Apr 2016 09:35:07 +0000 (10:35 +0100)]
libdm-stats: check for empty region and area lists

Check that @stats_list and @stats_print returned data in the
_stats_parse_list() and _stats_parse_region() functions before
attempting to operate on region and area values.

This avoids a coverity warning since fgets() could potentially
return no data from the memory buffer returned by the ioctl.

In both cases the ioctl would return an error, preventing these
functions from running, however it is cleaner to test for the
condition explicitly and fail in those cases.

8 years agotests: keep using [] for hidden volumes
Zdenek Kabelac [Thu, 21 Apr 2016 22:04:23 +0000 (00:04 +0200)]
tests: keep using [] for hidden volumes

Figure out which test needs to see hidden volumes without [].
But normally use [] for debug printing in tests.
It's confusing otherwise.

8 years agocoverity: drop abadoing object
Zdenek Kabelac [Thu, 21 Apr 2016 18:55:23 +0000 (20:55 +0200)]
coverity: drop abadoing object

As mempool is destroyed on by caller don't bother for
mempool freeing here.

8 years agocoverity: avoid using signed types for single bits
Zdenek Kabelac [Thu, 21 Apr 2016 18:54:54 +0000 (20:54 +0200)]
coverity: avoid using signed types for single bits

8 years agocoverity: return non-null string with internal error
Zdenek Kabelac [Thu, 21 Apr 2016 18:53:22 +0000 (20:53 +0200)]
coverity: return non-null string with internal error

While we return internal error we should not let tool crash on NULL
access, so return valid string for such case.

8 years agocoverity: use wider type for whole expression
Zdenek Kabelac [Thu, 21 Apr 2016 22:14:40 +0000 (00:14 +0200)]
coverity: use wider type for whole expression

Coverity likes when the types are same through the whole expression.
And since dev_t is 64b - widen int type early.

8 years agocoverity: drop unused header file
Zdenek Kabelac [Thu, 21 Apr 2016 18:20:13 +0000 (20:20 +0200)]
coverity: drop unused header file

8 years agocoverity: fix error paths
Zdenek Kabelac [Thu, 21 Apr 2016 18:19:24 +0000 (20:19 +0200)]
coverity: fix error paths

Patch 74e704bb4465960b361711c890733cbae1f06e42 missed to update
error path. Since now we just need to 'return_0' as 'dmt is NULL
and thus may not be destroyed.

8 years agocoverity: fix memory access
Zdenek Kabelac [Thu, 21 Apr 2016 18:21:59 +0000 (20:21 +0200)]
coverity: fix memory access

Commit  52e0d0db4460d90172e9bd45b9ef30e7f4f75ae7 introduced regression
as code may access   buf[0 - 1].

Reorder code to first remove '\n' and then check buffer size for
empty.

8 years agocleanup: use kdev_t header in lvm tree
Zdenek Kabelac [Thu, 21 Apr 2016 18:52:12 +0000 (20:52 +0200)]
cleanup: use kdev_t header in lvm tree

Reuse libdm header in lvm so we have single definition
of MAJOR/MINOR/MKDEV macros in use.

8 years agocleanup: simplify code
Zdenek Kabelac [Thu, 21 Apr 2016 18:19:53 +0000 (20:19 +0200)]
cleanup: simplify code

dm_strncpy() also check the size fits.

8 years agoWHATS_NEW: disable lvmetad for lvm1
David Teigland [Thu, 21 Apr 2016 21:40:44 +0000 (16:40 -0500)]
WHATS_NEW: disable lvmetad for lvm1

8 years agoactivate: Hide errors when snapshot merge delayed.
Alasdair G Kergon [Thu, 21 Apr 2016 21:14:10 +0000 (22:14 +0100)]
activate: Hide errors when snapshot merge delayed.

8 years agopoll daemon: only call lvmetad_connect when needed
David Teigland [Thu, 21 Apr 2016 20:58:34 +0000 (15:58 -0500)]
poll daemon: only call lvmetad_connect when needed

When lvm is not using lvmetad, the lvmetad_connect()
in the forked polling process is not needed and was
generating unwanted warnings.

8 years agotests: GLIBC decided to obsolete readdir_r
Zdenek Kabelac [Thu, 21 Apr 2016 13:30:14 +0000 (15:30 +0200)]
tests: GLIBC decided to obsolete readdir_r

Keep the code compilatible without warnings on newer glibc.

8 years agolvmetad: warn about making changes while not using lvmetad
David Teigland [Thu, 21 Apr 2016 15:28:01 +0000 (10:28 -0500)]
lvmetad: warn about making changes while not using lvmetad

If lvmetad is running, and a command opts to not use it
(--config global/use_lvmetad=0), and the command changes
metadata, then the metadata change is not visible to
lvmetad.  Subsequent commands using lvmetad to change
metadata may cause corruption based on the invalid
lvmetad state.

Eventually we can set the disabled state in lvmetad
to prevent this problem, but for now print a warning
about the possibility.

8 years agolvmetad: fix compile without lvmetad
David Teigland [Thu, 21 Apr 2016 15:06:47 +0000 (10:06 -0500)]
lvmetad: fix compile without lvmetad

Last commit was missing stub function.

8 years agolvmetad: check pid for warning case
David Teigland [Thu, 21 Apr 2016 14:50:59 +0000 (09:50 -0500)]
lvmetad: check pid for warning case

When command is not using lvmetad because
use_lvmetad=0 in the config, but the lvmetad
pidfile exists, print a warning (previously
this checked for the socket existing instead
of the pidfile existing.)

8 years agolvmetad: check for socket in connect
David Teigland [Thu, 21 Apr 2016 14:27:20 +0000 (09:27 -0500)]
lvmetad: check for socket in connect

We can connect if the socket is present, even
though the pidfile may not exist, since systemd
may start the process when the socket is opened.

8 years agodisplay: Avoid internal snapshot LV names in msgs.
Alasdair G Kergon [Wed, 20 Apr 2016 23:30:17 +0000 (00:30 +0100)]
display: Avoid internal snapshot LV names in msgs.

vg/snapshotN should not appear anywhere.

No code should be showing this, but it was noticed in some logs last
week and we can deal with it in display_lvname().

8 years agolvmetad: fix compilation without lvmetad#
Zdenek Kabelac [Wed, 20 Apr 2016 22:16:17 +0000 (00:16 +0200)]
lvmetad: fix compilation without lvmetad#

8 years agotests: minor update
Zdenek Kabelac [Wed, 20 Apr 2016 21:21:03 +0000 (23:21 +0200)]
tests: minor update

8 years agotests: still show systems stas when command has not produced debug.log file
Zdenek Kabelac [Wed, 20 Apr 2016 21:19:33 +0000 (23:19 +0200)]
tests: still show systems stas when command has not produced debug.log file

When no debug.log* file is present whole stacktracking was skipped.
Add extra test the file exists to catch this case.

8 years agotests: document make parametr for tracing aux scripts
Zdenek Kabelac [Wed, 20 Apr 2016 21:18:51 +0000 (23:18 +0200)]
tests: document make parametr for tracing aux scripts

8 years agodebug: move misplaced log_debug
Zdenek Kabelac [Wed, 20 Apr 2016 10:45:15 +0000 (12:45 +0200)]
debug: move misplaced log_debug

It should log action before taking it instead of only in error path.

8 years agoconfigure: respect --disable-lvmetad/lvmpolld
Zdenek Kabelac [Wed, 20 Apr 2016 22:31:15 +0000 (00:31 +0200)]
configure: respect --disable-lvmetad/lvmpolld

When user requested on cmdline disabling of lvmetad/lvmpoll,
respect it and when lvmlockd requires these daemon,
Error configure with clear message about misconfiguration.

8 years agoconfigure: detect for /var/lock dir
Zdenek Kabelac [Wed, 20 Apr 2016 21:15:00 +0000 (23:15 +0200)]
configure: detect for /var/lock dir

Detecs systems with /run/lock dir and use such path directly instead
of /var/lock.

8 years agolvmetad: connect from forked polling process
David Teigland [Tue, 19 Apr 2016 22:07:22 +0000 (17:07 -0500)]
lvmetad: connect from forked polling process

With commit 5e9e43074a6c, lvmetad connections are
now made explicitly, so a new connection must be
created from a child created for polling.

8 years agotest: lvmetad-override
David Teigland [Tue, 19 Apr 2016 19:26:05 +0000 (14:26 -0500)]
test: lvmetad-override

Fix test case where a warning appears when it's not expected.

8 years agolvmetad: rework command connection setup and checking
David Teigland [Wed, 13 Apr 2016 22:00:01 +0000 (17:00 -0500)]
lvmetad: rework command connection setup and checking

The lvmetad connection is created within the
init_connections() path during command startup,
rather than via the old lvmetad_active() check.

The old lvmetad_active() checks are replaced
with lvmetad_used() which is a simple check that
tests if the command is using/connected to lvmetad.

The old lvmetad_set_active(cmd, 0) calls, which
stopped the command from using lvmetad (to revert to
disk scanning), are replaced with lvmetad_make_unused(cmd).

8 years agolvmetad: use defines for disabled reason strings
David Teigland [Tue, 19 Apr 2016 15:51:11 +0000 (10:51 -0500)]
lvmetad: use defines for disabled reason strings

8 years agotest: lvmetad-warning
David Teigland [Mon, 18 Apr 2016 21:49:22 +0000 (16:49 -0500)]
test: lvmetad-warning

The test was a weak attempt at verifying the special
combination of lvchange/vgchange -aay --sysinit, but
was only looking for lvmetad connection warnings.

Update the warning checks, and check the LV activation
state directly which is the main point.

Rename the test to reflect its purpose of checking
the -aay --sysinit combination.

8 years agotest: lvmetad-override
David Teigland [Mon, 18 Apr 2016 20:19:45 +0000 (15:19 -0500)]
test: lvmetad-override

8 years agotest: lvmetad-no-cluster
David Teigland [Mon, 18 Apr 2016 18:39:03 +0000 (13:39 -0500)]
test: lvmetad-no-cluster

Update warning message check

8 years agotest: update lvmetad-disabled
David Teigland [Mon, 18 Apr 2016 18:07:11 +0000 (13:07 -0500)]
test: update lvmetad-disabled

Update the check about lvmetad running but not used.

Also add tests related to the new lvmetad disabled state.
lvm1 metadata is used here to test the disabled state
because lvm1 metadata is the first condition using the
disabled state.

8 years agotest: update lvm1 test
David Teigland [Tue, 19 Apr 2016 14:18:31 +0000 (09:18 -0500)]
test: update lvm1 test

Make it a generic lvm1 test, which should work
with or without lvmetad now that lvmetad is just
disabled when lvm1 is used.

8 years agolvmetad: disable if command uses lvm1
David Teigland [Wed, 6 Apr 2016 20:57:09 +0000 (15:57 -0500)]
lvmetad: disable if command uses lvm1

Alternatively, a command could return an error saying
that lvm1 and lvmetad are not compatible.

8 years agolvmetad: clear the disabled flag in lvmetad
David Teigland [Wed, 6 Apr 2016 20:37:52 +0000 (15:37 -0500)]
lvmetad: clear the disabled flag in lvmetad

After a device rescan that repopulates lvmetad,
if no reason for disabling lvmetad was seen
(lvm1 metadata or duplicate PVs), then clear
the disabled flag in lvmetad.  This allows
commands to resume using the lvmetad cache
after the cause for disabling it has been removed.

8 years agolvmetad: use the disabled flag in commands
David Teigland [Wed, 6 Apr 2016 20:31:15 +0000 (15:31 -0500)]
lvmetad: use the disabled flag in commands

Commands already check if the lvmetad token is valid,
and if not, they rescan devices to repopulate lvmetad
before running.  Now, in addition to checking the
lvmetad token, they also check if the lvmetad disabled
flag is set.  If so, they do not use the lvmetad cache
and revert to disk scanning.

8 years agolvmetad: set disabled flag in lvmetad if lvm1 metadata is found
David Teigland [Fri, 29 Jan 2016 17:30:57 +0000 (11:30 -0600)]
lvmetad: set disabled flag in lvmetad if lvm1 metadata is found

When devices are being scanned, if lvm1 metadata is seen,
tell lvmetad to set its disabled flag because of lvm1 metadata.

8 years agolvmetad: add disabled state
David Teigland [Thu, 28 Jan 2016 22:54:36 +0000 (16:54 -0600)]
lvmetad: add disabled state

A global flag in lvmetad indicates it has been disabled.
Other flags indicate the reason it was disabled.
These flags can be queried using get_global_info.

The lvmetactl debugging utility can set and clear the
disabled flag in lvmetad.  Nothing else sets the
disabled flag yet.

Commands will check these flags after connecting to
lvmetad.  If the disabled flag is set, the command
will not use the lvmetad cache, but revert to disk
scanning.

To test this feature:

$ lvmetactl get_global_info
response = "OK"
global_invalid = 0
global_disable = 0
disable_reason = "none"
token = "filter:3041577944"

$ vgs
(should report VGs from lvmetad)

$ lvmetactl set_global_disable 1

$ lvmetactl get_global_info
response = "OK"
global_invalid = 0
global_disable = 1
disable_reason = "DIRECT"
token = "filter:3041577944"

$ vgs
  WARNING: Not using lvmetad because the disable flag was set directly.
(should report VGs without contacting lvmetad)

$ lvmetactl set_global_disable 0

$ vgs
(should report VGs from lvmetad)

8 years agotoollib: remove unneeded call in process_each_pv
David Teigland [Thu, 7 Apr 2016 18:45:26 +0000 (13:45 -0500)]
toollib: remove unneeded call in process_each_pv

process_each_pv was doing:

1. lvmcache_seed_infos_from_lvmetad()
   sends pv_list request to lvmetad.

2. get_vgnameids()
   sends vg_list request to lvmetad.

3. _get_all_devices()
   first calls lvmcache_seed_infos_from_lvmetad(),
   which is a no-op if it's already been called.

Because get_vgnameids() does not use the information
from lvmcache_seed_infos_from_lvmetad(), it does not
need to be called prior to get_all_devices where
it is actually needed.

8 years agometadata: don't repair shared VGs
David Teigland [Thu, 14 Apr 2016 21:40:26 +0000 (16:40 -0500)]
metadata: don't repair shared VGs

When the in-use flag looks like it needs to be repaired.

8 years agolvmlockd: skip unnecessary lvmetad cache update
David Teigland [Thu, 14 Apr 2016 18:45:10 +0000 (13:45 -0500)]
lvmlockd: skip unnecessary lvmetad cache update

In cases where a VG is reread from disk, but the
seqno matches what is currently in lvmetad, the
metadata in lvmetad doesn't need to be updated.

8 years agotests: use should for failing test
Zdenek Kabelac [Mon, 18 Apr 2016 21:12:05 +0000 (23:12 +0200)]
tests: use should for failing test

It's better to use 'should' for failing test before it gets fixed,
when we ignore failing result.

8 years agotests: use bigger raid size
Zdenek Kabelac [Mon, 18 Apr 2016 21:09:17 +0000 (23:09 +0200)]
tests: use bigger raid size

To avoid problem with report of array in-sync use for now bigger
raid size 64M.

8 years agolvchange: improve refresh for merging thin volume
Zdenek Kabelac [Mon, 18 Apr 2016 20:44:30 +0000 (22:44 +0200)]
lvchange: improve refresh for merging thin volume

When running lvchange --refresh on merging thin volume,
try to deactivate snapshot thinLV in case it's preventing
startup of merge process.

8 years agosnapshot: improve merge
Zdenek Kabelac [Mon, 18 Apr 2016 20:54:27 +0000 (22:54 +0200)]
snapshot: improve merge

Improve code for snapshot merge for readabilty
and also reduce number of tests needed to decide
if merging can or cannot be started.

(Further improving 9cccf5245a97a64f900f253fcf948edd5d7ba8c0)

8 years agodebug: use display_lvname
Zdenek Kabelac [Mon, 18 Apr 2016 09:04:06 +0000 (11:04 +0200)]
debug: use display_lvname

8 years agodebug: update message in libdm
Zdenek Kabelac [Sun, 17 Apr 2016 12:51:58 +0000 (14:51 +0200)]
debug: update message in libdm

When dm_tree_find_node_by_uuid() fails to find passed uuid,
report in lof_debug the complete original uuid,
not the one stripped of LVM- prefix.

TODO: inspect manipulation with LVM- prefix here.

8 years agodebug: fix error message
Zdenek Kabelac [Sun, 17 Apr 2016 12:44:13 +0000 (14:44 +0200)]
debug: fix error message

log_error is replaced with warn since the result
of function is not result in command error.

8 years agothin: improve recognizing of merge in progress
Zdenek Kabelac [Mon, 18 Apr 2016 09:04:16 +0000 (11:04 +0200)]
thin: improve recognizing of merge in progress

Rewrite too condensed condition in more readable form,
wher decision are clearly separated and commented and
also add debug messages for them.

8 years agothin: check runtime table line for merging
Zdenek Kabelac [Sun, 17 Apr 2016 12:51:48 +0000 (14:51 +0200)]
thin: check runtime table line for merging

To recognize in runtime if we are merging or not
to make consistent decision between suspend and resume
add function to parse thin table line when add
merging thin device to the table.

8 years agotests: fix check_lvmlockd_test
David Teigland [Fri, 15 Apr 2016 17:35:20 +0000 (12:35 -0500)]
tests: fix check_lvmlockd_test

8 years agoactivate: Improve snapshot merge initiation
Alasdair G Kergon [Fri, 15 Apr 2016 01:21:27 +0000 (02:21 +0100)]
activate: Improve snapshot merge initiation

A snapshot merge into its origin cannot be initiated while the devices
are in use.  If there is outside interference (such as from udev),
the suspend (preload) and resume stages can reach conflicting decisions
about whether or not to proceed.

Try to make the logic more robust by checking the inactive or live
table during resume.  (This is still not perfect.)

8 years agoactivation: Log when pending snap merge postponed.
Alasdair G Kergon [Thu, 14 Apr 2016 22:42:56 +0000 (23:42 +0100)]
activation: Log when pending snap merge postponed.

8 years agoWHATS_NEW for lvmetad scanning changes
David Teigland [Thu, 14 Apr 2016 21:55:34 +0000 (16:55 -0500)]
WHATS_NEW for lvmetad scanning changes

8 years agoactivation: Add LV name to a debug message.
Alasdair G Kergon [Thu, 14 Apr 2016 21:41:25 +0000 (22:41 +0100)]
activation: Add LV name to a debug message.

8 years agosnapshot: Don't deactivate fictional snapshot LV.
Alasdair G Kergon [Thu, 14 Apr 2016 19:48:28 +0000 (20:48 +0100)]
snapshot: Don't deactivate fictional snapshot LV.

Commit 971ab733b74e0ffecc3f9f60af48628cd3fba1db ("thin: activation of
merging thin snapshot") also added an incorrect deactivation attempt
for non-thin LVs: find_snapshot(lv)->lv is not designed to be
activated and any attempt to deactivate it is incorrect.

8 years agotoollib: Fix misleading message when forking.
Alasdair G Kergon [Thu, 14 Apr 2016 16:21:02 +0000 (17:21 +0100)]
toollib: Fix misleading message when forking.

Commands like pvscan --background run entirely in the background,
but others fork only for polling.

8 years agorefactor: factor out vg/lv/pv handling part from report_for_selection fn
Peter Rajnoha [Thu, 14 Apr 2016 13:21:41 +0000 (15:21 +0200)]
refactor: factor out vg/lv/pv handling part from report_for_selection fn

Functionality will be reused by future patches. Also, it makes the code
more readable.

8 years agotests: lvmetad-lvm1 fix
David Teigland [Wed, 13 Apr 2016 20:07:53 +0000 (15:07 -0500)]
tests: lvmetad-lvm1 fix

workaround this test failure until the proper
lvmetad/lvm1 fixes arrive shortly.

8 years agolvmetad: add FIXME to comment
David Teigland [Wed, 13 Apr 2016 19:08:29 +0000 (14:08 -0500)]
lvmetad: add FIXME to comment

8 years agolvmetad: preemptively check and rescan in commands
David Teigland [Thu, 28 Jan 2016 22:40:26 +0000 (16:40 -0600)]
lvmetad: preemptively check and rescan in commands

Move checking the lvmetad state, and the possible rescan,
out of lvmetad_send() to the start of the command.

Previously, the token mismatch and rescan would occur
within lvmetad_send() for some other request.  Now,
the token mismatch is detected earlier, so the
rescan can be done before the main command is in
progress.  Rescanning deep within the processing of
another command will disturb the lvmcache state of
that other command.

A rescan already exists at the start of the command
for the case where foreign VGs are going to be read.
This same rescan is now also performed when there is
an lvmetad token mismatch (from a changed global_filter).

The commands pvscan/vgscan/lvscan/vgimport are excluded
from this preemptive checking/rescanning for lvmetad
because they want to do rescanning themselves explicitly.

If rescanning devices fails, then lvmetad has not been
correctly repopulated and should not be used, so make
the command revert to not using lvmetad.

8 years agodebug: unify some tracing messages
Zdenek Kabelac [Tue, 12 Apr 2016 11:06:16 +0000 (13:06 +0200)]
debug: unify some tracing messages

Introduce  FMTVGID - although it might be possibly better to ensure
vgid is always \0 ended string.

Unify some lvmcache reported messages.

8 years agocleanup: gcc warn about comparing int with uint
Zdenek Kabelac [Tue, 12 Apr 2016 09:47:21 +0000 (11:47 +0200)]
cleanup: gcc warn about comparing int with uint

8 years agocleanup: avoid declaring var in the middle of code
Zdenek Kabelac [Tue, 12 Apr 2016 09:46:41 +0000 (11:46 +0200)]
cleanup: avoid declaring var in the middle of code

Easier to read code.

8 years agorename function read_vgname to read_vgsummary
David Teigland [Tue, 9 Feb 2016 19:32:26 +0000 (13:32 -0600)]
rename function read_vgname to read_vgsummary

The name did not clearly represent what it does.

8 years agodevcache: do not insert devices without device node
Zdenek Kabelac [Mon, 11 Apr 2016 08:08:16 +0000 (10:08 +0200)]
devcache: do not insert devices without device node

When not obtaining device from udev, we are doing deep devdir scan,
and at the same time we try to insert everything what /sys/dev/block
knows about. However in case  lvm2 is configured to use nonstardard
devdir this way it will see (and scan) devices from a real system.

lvm2 test suite is using its own test devdir with its
own device nodes. To avoid touching real /dev  devices, validate
the device node exist in give dir and do not insert such device
into a cache.

With obtain list from udev this patch has no effect
(the normal user path).

8 years agodevcache: index devices also without udev
Zdenek Kabelac [Mon, 11 Apr 2016 08:23:16 +0000 (10:23 +0200)]
devcache: index devices also without udev

We have _insert_dirs() for  udev and non-udev compilation.
Compiling without udev missed to call dev_cache_index_devs().
Move the call after _insert_dirs() call so both compilation
gets it.

This page took 0.075357 seconds and 5 git commands to generate.