]> sourceware.org Git - lvm2.git/log
lvm2.git
7 years agolog_info to log_very_verbose
Zdenek Kabelac [Tue, 1 Nov 2016 10:02:01 +0000 (11:02 +0100)]
log_info to log_very_verbose

Translate log_info() into log_very_verbose() which is macro
supposed to be used by our code.

log_info() is internal macro with eventually some 'symbolic' meaning
in syslogging daemons.

7 years agolog_info to log_warn
Zdenek Kabelac [Mon, 31 Oct 2016 17:00:53 +0000 (18:00 +0100)]
log_info to log_warn

Switch to log_warn level when we are reporting these message.

7 years agocleanup: log_info to log_error
Zdenek Kabelac [Mon, 31 Oct 2016 17:03:06 +0000 (18:03 +0100)]
cleanup: log_info to log_error

Switch to more appropriate logging level.

7 years agolibdm: use dm_log_with_errno always
Zdenek Kabelac [Thu, 3 Nov 2016 16:15:07 +0000 (17:15 +0100)]
libdm: use dm_log_with_errno always

Instead of compiling 2 log call for 2 different logging functions,
and runtime decide which version to use - use only 'newer' function
and when user sets his own OLD dm_log logging translate it runtime
for old arg list set.

The positive part is - we get shorter generated library,
on the negative part this translation means, we always have evaluate
all args and print the message into local on stack buffer, before
we can pass this buffer to the users' logging function with proper
expected parameters (and such function may later decide to discard
logging based on message level so whole printing was unnecessary).

7 years agotests: check that pvscan cannot activate exported VG
David Teigland [Thu, 3 Nov 2016 16:43:08 +0000 (11:43 -0500)]
tests: check that pvscan cannot activate exported VG

7 years agocleanup: add 'static' for local struct
Zdenek Kabelac [Wed, 2 Nov 2016 13:26:41 +0000 (14:26 +0100)]
cleanup: add 'static' for local struct

7 years agocleanup: drop unused attribute
Zdenek Kabelac [Wed, 2 Nov 2016 09:55:19 +0000 (10:55 +0100)]
cleanup: drop unused attribute

In this function we pass args through so make the function
header look the same as with _default_log().

7 years agodmeventd: separate dm and dmeventd logging
Zdenek Kabelac [Thu, 3 Nov 2016 11:10:45 +0000 (12:10 +0100)]
dmeventd: separate dm and dmeventd logging

Ensure different logging function for dmeventd.c logging
and dm and lvm library.

We can recognize we want to show every log_info() and
log_notice() message from dmeventd.c code while not
exposing those from libdm/libdevmapper-event

Also switch to use log with errno - it's not changing
anything and doesn't bring any more features yet to dmeventd
logging but we just properly pass dm_errno_or_class properly
through the whole code stack for possible future use
(i.e. support of class logging for dmeventd).

7 years agodmeventd: debug only subsystemd with # sign
Zdenek Kabelac [Thu, 3 Nov 2016 11:01:01 +0000 (12:01 +0100)]
dmeventd: debug only subsystemd with # sign

Reword the logging logic and try to restore previous logging
behavior for 'standalone' running daemon while preserving
debuggable feautures it has gained.

So actual rules:

dmeventd without any '-d' option will syslog all messages
from dmeventd.c it dmeventd plugins.

log_notice()==log_verbose()
log_info()==log_very_verbose()
But to show also log_debug() used has to give '-ddd'.

When user specified '-d, -dd, -ddd, -dddd' it
will also enable tracing of messages from libdm & lib
executed code - which is mainly useful for testing
i.e.: 'dmeventd -fldddd'

7 years agodmeventd: abort on internal error
Zdenek Kabelac [Wed, 2 Nov 2016 13:40:12 +0000 (14:40 +0100)]
dmeventd: abort on internal error

Provide same support for DM_ABORT_ON_INTERNAL_ERRORS we do have
with default libdm logging  as  dmeventd is libdm based tool.

7 years agolibdm: report logging with errno as changed default
Zdenek Kabelac [Thu, 3 Nov 2016 11:07:27 +0000 (12:07 +0100)]
libdm: report logging with errno as changed default

When user changes logging with 'dm_log_with_errno_init()'
also report this as non default dm logging.

7 years agologging: add more log macros
Zdenek Kabelac [Wed, 2 Nov 2016 13:39:13 +0000 (14:39 +0100)]
logging: add more log macros

Introduce macros:

log_level(), log_stderr(), log_once(), log_bypass_report()

For easier and more consisten way how to 'decoder' bits
of info from passed 'level'.

This patch fixes potential problem when 'level' of message
might not have always masked right bits.

7 years agolvmdbusd: Stop using threads for job wait
Tony Asleson [Wed, 2 Nov 2016 19:14:56 +0000 (14:14 -0500)]
lvmdbusd: Stop using threads for job wait

Instead of creating a thread to handle the case where a client
is calling job.Wait, we will utilize a timer.  This significantly
reduces the number of threads that get created and destroyed while
the service is running.

7 years agolvmdbusd: main.py: change debug msg text
Tony Asleson [Tue, 1 Nov 2016 22:52:51 +0000 (17:52 -0500)]
lvmdbusd: main.py: change debug msg text

7 years agolvmdbusd: Don't use dbus lib in worker thread
Tony Asleson [Tue, 1 Nov 2016 22:52:18 +0000 (17:52 -0500)]
lvmdbusd: Don't use dbus lib in worker thread

Simplify the code paths so that we don't utilize the dbus library code
when we are in worker thread context.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521

7 years agolvmdbusd: Execute load in main thread
Tony Asleson [Tue, 1 Nov 2016 22:50:10 +0000 (17:50 -0500)]
lvmdbusd: Execute load in main thread

We will fetch the lvm state in non-main thread and only process the new
data with the main thread to prevent hanging the main thread event loop.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521

7 years agolvmdbusd: Return results in main thread
Tony Asleson [Tue, 1 Nov 2016 22:48:39 +0000 (17:48 -0500)]
lvmdbusd: Return results in main thread

Also introduce some additional new code to execute code other code
in main thread too.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521

7 years agolvmdbusd: Use timer instead of thread
Tony Asleson [Tue, 1 Nov 2016 22:42:14 +0000 (17:42 -0500)]
lvmdbusd: Use timer instead of thread

We had a thread sitting around for cleaning up other processes, changed to
a periodic timer task.

7 years agopvscan: fix autoactivation of exported VG
David Teigland [Wed, 2 Nov 2016 21:29:52 +0000 (16:29 -0500)]
pvscan: fix autoactivation of exported VG

pvscan --cache -aay was activating LVs in exported VGs
when it should not.

It appears that this was a regression from commit 9b640c36841
"pvscan: use process_each_vg for autoactivate".

7 years agoblkdeactivate: deactivate dev stack if dev on top already unmounted
Peter Rajnoha [Tue, 1 Nov 2016 15:41:30 +0000 (16:41 +0100)]
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

7 years agotest: add raid4 checks to respective tests
Heinz Mauelshagen [Fri, 28 Oct 2016 19:54:10 +0000 (21:54 +0200)]
test: add raid4 checks to respective tests

Add missing checks for valid raid4 mapping to tests.

7 years agolvconvert: fix raid repair regression
Heinz Mauelshagen [Fri, 28 Oct 2016 19:45:00 +0000 (21:45 +0200)]
lvconvert: fix raid repair regression

Limit prevention to raid1 as intended with commit 8270ff5702e0.

Related to rhbz1311765

7 years agolvconvert: prevent non-synced raid1 primary leg repair
Heinz Mauelshagen [Fri, 28 Oct 2016 13:54:27 +0000 (15:54 +0200)]
lvconvert: prevent non-synced raid1 primary leg repair

(Automatic) repair may not be allowed during the initial sync of an upconverted
linear LV, because the data on the failing, primary leg hasn't been completely
synchronized to the N-1 other legs of the raid1 LV (replacing failed legs during
repair involves discontinuing access to any replaced legs data, thus preventing
data recovery on the primary leg e.g. via dd_rescue).

Even though repair would not cause data loss when adding legs to a fully synced
raid1 LV, we don't have information yet defining this state yet (e.g. a raid1
LV flag telling the fully synchronized status before any legs were added),
hence can't automatically decide to allow to repair.

If nonetheless a repair on a non-synced raid1 LVs is intended, the "--force"
option has to be provided.

Resolves: rhbz1311765

7 years agolvconvert: check for supported raid0/raid4 segtypes
Heinz Mauelshagen [Thu, 27 Oct 2016 14:44:32 +0000 (16:44 +0200)]
lvconvert: check for supported raid0/raid4 segtypes

Validate kernel support for raid0/raid4 on given and
requested segtype before requesting conversions on them.

Because raid10 wasn't present in old RAID targets, add
the same validation to be prepared once we support them.

7 years agolvconvert-raid-takeover.sh: fix test
Heinz Mauelshagen [Thu, 27 Oct 2016 14:38:15 +0000 (16:38 +0200)]
lvconvert-raid-takeover.sh: fix test

7 years agolvchange/vgchange/lvconvert: prevent raid4 creation/activation/conversion on non...
Heinz Mauelshagen [Thu, 27 Oct 2016 09:38:16 +0000 (11:38 +0200)]
lvchange/vgchange/lvconvert: prevent raid4 creation/activation/conversion on non-supporting raid targets

Check for dm-raid target version with non-standard raid4 mapping expecting the dedicated
parity device in the last rather than the first slot and prohibit to create, activate or
convert to such LVs from striped/raid0* or vice-versa in order to avoid data corruption.

Add related tests to lvconvert-raid-takeover.sh

Resolves: rhbz1388962

7 years agolvconvert: revert to only letting raid4 through to lv_raid_convert()
Heinz Mauelshagen [Wed, 26 Oct 2016 15:47:48 +0000 (17:47 +0200)]
lvconvert: revert to only letting raid4 through to lv_raid_convert()

Commit de78e8eae73c allowed to let any raid layout through
which we want to avoid until further validation cleanups.

Related to rhbz1386184

7 years agoraid_manip: fix typo
Heinz Mauelshagen [Wed, 26 Oct 2016 15:46:53 +0000 (17:46 +0200)]
raid_manip: fix typo

Related to rhbz1386184

7 years agodmsetup: remove stray '\n' in delete log message
Bryn M. Reeves [Mon, 24 Oct 2016 16:21:35 +0000 (17:21 +0100)]
dmsetup: remove stray '\n' in delete log message

7 years agodmsetup: obey --programid when deleting regions
Bryn M. Reeves [Mon, 24 Oct 2016 16:21:18 +0000 (17:21 +0100)]
dmsetup: obey --programid when deleting regions

7 years agolvconvert: position dedicated parity device in raid4 conversions porperly
Heinz Mauelshagen [Fri, 21 Oct 2016 16:59:59 +0000 (18:59 +0200)]
lvconvert: position dedicated parity device in raid4 conversions porperly

On conversions between striped/raid0* and raid4, the kernel expects
the dedicated raid4 parity SubLVs in the first segment area rather than
in the last it's been allocated to, thus the data mapping ain't proper.

Enhance lvconvert (lib/metadata/raid_manip.c) to shift the dedicated
parity SubLVs on conversions from striped/raid0* to raid4 and vice-versa.

In case of raid0_meta -> raid4 where the MD raid0 personality already has
stored RAID array device positions in the superblocks, the MetaLVs have to
be cleared so that the kernel doesn't fail validating the array positions
after lvm has shifted them up by one.

Add more tests to lvconvert-raid-takeover.sh including one to check for
mapping flaws by converting a created raid4 with filesystem -> striped
and fsck it.

Whilst on it:
- add missing direct striped -> raid4 conversion to the takeover array
  to avoid an intermim conversion from striped -> raid0*
- clean up the takeover array
- allow lvconvert to actually call lv_raid_convert() on all takeover requests
  in order to check parameters and display messages provided by takeover
  functions rather than just "...not supported" from within lvconvert
- fix a typo

Resolves: rhbz1386148

7 years agodmsetup: Produce partial output if dev disappears.
Alasdair G Kergon [Tue, 18 Oct 2016 17:01:52 +0000 (18:01 +0100)]
dmsetup: Produce partial output if dev disappears.

If a device disappears after obtaining the list of devices but before
processing it as a member of that list, dmsetup exits with a failure code.

Most commands still produce what output they can in these circumstances,
but 'ls --tree' and 'info -c' with fields depending on device dependencies
didn't.  Change this.

8 years agospec: move dmeventd -R from post to posttrans script for device-mapper-event package
Peter Rajnoha [Wed, 12 Oct 2016 11:50:22 +0000 (13:50 +0200)]
spec: move dmeventd -R from post to posttrans script for device-mapper-event package

See also https://bugzilla.redhat.com/show_bug.cgi?id=1382688.

8 years agolvconvert: still use strcmp for now
Zdenek Kabelac [Wed, 12 Oct 2016 09:12:48 +0000 (11:12 +0200)]
lvconvert: still use  strcmp for now

Keep for now function logic making its decision on string content.
We need bigger patch converting all things to bit-checks later.
This needs however bigger refactoring.
So this commit reverts some changes from:
c8b6c130158e1cc1a639afc21f5fd6306286fdb3

8 years agolvconvert: fix RAID SubLV --splitmirror regression
Heinz Mauelshagen [Tue, 11 Oct 2016 22:24:57 +0000 (00:24 +0200)]
lvconvert: fix RAID SubLV --splitmirror regression

Commit 088b3d036a73a7d947f6e9b12e8fad8a9f40d97f allowed repair on cache origin RAID LVs
and restricted lvconvert actions on RAID SubLVs to change number of mirrors, repair,
replace and type changes in order to avoid unsuitable coversions on them.

This introduced a regression prohibiting --splitmirrors on any RAID SubLVs
(e.g. of cache or thin LVs; lvconvert-{cache,thin}-raid.sh tests failing).

Fix allows split mirrors again.

Fix some indenting whilst on it.

8 years agolvmdbustest.py: ws fixes
Tony Asleson [Tue, 11 Oct 2016 17:22:31 +0000 (12:22 -0500)]
lvmdbustest.py: ws fixes

8 years agolvmdbustest.py: Add $PREFIX support
Tony Asleson [Tue, 11 Oct 2016 17:02:10 +0000 (12:02 -0500)]
lvmdbustest.py: Add $PREFIX support

Use the env variable PREFIX for vg & lv names

8 years agolvmdbustest.py: Use more compatible syntax
Tony Asleson [Tue, 11 Oct 2016 15:43:41 +0000 (10:43 -0500)]
lvmdbustest.py: Use more compatible syntax

8 years agolvmdbusd: Remove log ouput when ec=0 & stderr != 0 bytes
Tony Asleson [Tue, 11 Oct 2016 14:42:18 +0000 (09:42 -0500)]
lvmdbusd: Remove log ouput when ec=0 & stderr != 0 bytes

lvm likes to log to stderr virtually all the time, this isn't
helpful.

8 years agolvmdbusd: Disable lvm abort on too much log output
Tony Asleson [Tue, 11 Oct 2016 14:36:47 +0000 (09:36 -0500)]
lvmdbusd: Disable lvm abort on too much log output

The commit:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=34c55d98eefd88f85476c0f62f0649c706bde6f0

introduced an abort if lvm logs too much.  In the case of utilizing
lvm shell this is a pretty normal occurance, so we will disable
when we use lvm shell.

8 years agotests: notify dbus only for dbus test
Zdenek Kabelac [Wed, 5 Oct 2016 09:48:03 +0000 (11:48 +0200)]
tests: notify dbus only for dbus test

8 years agocleanup: indent
Zdenek Kabelac [Tue, 11 Oct 2016 09:55:19 +0000 (11:55 +0200)]
cleanup: indent

8 years agocleanup: lvconvert drop unused variable
Zdenek Kabelac [Tue, 11 Oct 2016 09:52:07 +0000 (11:52 +0200)]
cleanup: lvconvert drop unused variable

8 years agocleanup: use already set values
Zdenek Kabelac [Tue, 11 Oct 2016 11:19:44 +0000 (13:19 +0200)]
cleanup: use already set values

When we have already decoded arg_is_set into a local var
or already set  segment type - already use these
values instead of repeating calls and string checks.

8 years agocleanup: reorder code
Zdenek Kabelac [Tue, 11 Oct 2016 09:56:15 +0000 (11:56 +0200)]
cleanup: reorder code

Move some arg test into a single place with sort of alphabetic order
when possible to make reading easier.

8 years agolvconvert: use _read_conversion_type
Zdenek Kabelac [Tue, 11 Oct 2016 11:19:12 +0000 (13:19 +0200)]
lvconvert: use _read_conversion_type

Code reodering and using same pattern for reading and validating arg
(--type in this case).

8 years agolvconvert: fix error value
Zdenek Kabelac [Tue, 11 Oct 2016 09:59:43 +0000 (11:59 +0200)]
lvconvert: fix error value

Seems some error path where not converted to 'new' ECMD return value.
Fix them to always 'goto out'.
Also drop unneeded   'ret = 0' when ret already is 0.

8 years agolvmdbustest.py: Add profile and path for lvm binary
Tony Asleson [Mon, 10 Oct 2016 21:26:38 +0000 (16:26 -0500)]
lvmdbustest.py: Add profile and path for lvm binary

8 years agolvmdbustest.py: Skip test_job_handling_timer on loopback
Tony Asleson [Fri, 7 Oct 2016 23:18:36 +0000 (18:18 -0500)]
lvmdbustest.py: Skip test_job_handling_timer on loopback

This test never passes on loop back, so we will skip unless the
pv devices are real devices which contain `/dev/sd`.

We always fail because we need lvm to run slow to get a timer to
pop, and loopback are too fast.

8 years agolvmdbustest.py: Denote failure if set_execution fails
Tony Asleson [Fri, 7 Oct 2016 20:30:18 +0000 (15:30 -0500)]
lvmdbustest.py: Denote failure if set_execution fails

8 years agolvmdbustest.py: Print to stderr
Tony Asleson [Fri, 7 Oct 2016 20:09:30 +0000 (15:09 -0500)]
lvmdbustest.py: Print to stderr

It's easier to follow if we print to stderr, so that our print messages
are in the lvm error log in the correct position to other printed
messages.

8 years agolvmdbustest.py: Ensure we exit non-zero on fail
Tony Asleson [Fri, 7 Oct 2016 19:55:36 +0000 (14:55 -0500)]
lvmdbustest.py: Ensure we exit non-zero on fail

If you run multiple runs of unittest.main, unless you don't pass exit=true
the test case always ends with a 0 exit code.  Add ability to store the
result of each invocation of the test and exit with a non-zero exit code
if anyone of them fail.

8 years agolvmdbusd: Ensure tmp dir gets cleaned up
Tony Asleson [Fri, 7 Oct 2016 18:46:59 +0000 (13:46 -0500)]
lvmdbusd: Ensure tmp dir gets cleaned up

Regardless of the outcome of starting up the lvm shell process, lets
ensure we clean up the temp directory and pipe.

8 years agolvmdbusd: Ensure lvm shell still exists
Tony Asleson [Fri, 7 Oct 2016 18:45:30 +0000 (13:45 -0500)]
lvmdbusd: Ensure lvm shell still exists

8 years agolvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"
Heinz Mauelshagen [Mon, 10 Oct 2016 15:29:40 +0000 (17:29 +0200)]
lvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"

In case a RAID orig LV is being cached and fails, repair is impossible because
"lvconvert --repair" gets rejected.

Fix by allowing repair on cache orig RAID LVs and
"lvconvert --replace/--mirrors/--type {raid*|mirror|striped|linear}" as well.

Allow the same lvconvert actions on any cache pool and metadata RAID SubLVs.

Resolves: rhbz1380532

8 years agolvmdbusd: Add LvCommon.DataPercent
Tony Asleson [Wed, 5 Oct 2016 20:51:48 +0000 (15:51 -0500)]
lvmdbusd: Add LvCommon.DataPercent

8 years agolvmdbusd: Add LvCommon.MovePv
Tony Asleson [Wed, 5 Oct 2016 20:28:42 +0000 (15:28 -0500)]
lvmdbusd: Add LvCommon.MovePv

Needed for feature parity for lvm2app.

8 years agolvmdbusd: Add properties to LvCommon
Tony Asleson [Wed, 5 Oct 2016 18:59:38 +0000 (13:59 -0500)]
lvmdbusd: Add properties to LvCommon

The following LvCommon properties were added so that the API
would have the same functionality as lvm2app has.

LvCommon.MetaDataSizeBytes
LvCommon.Attr
LvCommon.MetaDataPercent
LvCommon.CopyPercent
LvCommon.SnapPercent
LvCommon.SyncPercent

8 years agotoollib: clean up coverity issue
David Teigland [Tue, 4 Oct 2016 21:25:32 +0000 (16:25 -0500)]
toollib: clean up coverity issue

in processing duplicate pvs.

8 years agoRevert "cleanup: simplier assign of cmd vars"
Alasdair G Kergon [Mon, 3 Oct 2016 17:14:17 +0000 (18:14 +0100)]
Revert "cleanup: simplier assign of cmd vars"

This reverts commit cea441f4d1e19f170d9161203ef843c59f3fbf70.

cmd->default_values is configurable and this code should not make
any assumptions about values it holds.

8 years agotests: proper wait usage
Zdenek Kabelac [Thu, 29 Sep 2016 11:18:18 +0000 (13:18 +0200)]
tests: proper wait usage

Fix missing wait so we have paired waiting.
Also 'wait' for precise PID to get 'exit' code.

Test for 'error' replacing only with newer snapshot targets.
The old one will wait for resume.

Note: 'wait -n' is not always available so can't be used..

8 years agocleanup :drop unneeded header file
Zdenek Kabelac [Mon, 3 Oct 2016 12:49:06 +0000 (14:49 +0200)]
cleanup :drop unneeded header file

Not needed  (Coverity).

8 years agocleanup: drop test for NULL
Zdenek Kabelac [Mon, 3 Oct 2016 12:37:08 +0000 (14:37 +0200)]
cleanup: drop test for NULL

Since lp->segtype has been already checked for not-being NULL,
drop this test so Coverity is not later confused it 'can be a NULL'.

8 years agocleanup: drop assign before use
Zdenek Kabelac [Mon, 3 Oct 2016 11:04:16 +0000 (13:04 +0200)]
cleanup: drop assign before use

Drop unneeded assigns singe vars are set later in code before
their first use (Coverity).

8 years agocleanup: simplier assign of cmd vars
Zdenek Kabelac [Mon, 3 Oct 2016 11:00:50 +0000 (13:00 +0200)]
cleanup: simplier assign of cmd vars

Directly assign queried args as they provide matching values for
a setting.

8 years agodmeventd: pthread_sigmask in single function
Zdenek Kabelac [Mon, 3 Oct 2016 13:39:54 +0000 (15:39 +0200)]
dmeventd: pthread_sigmask in single function

Integrate back _unblock_sigalrm() and check for error code of
pthread_sigmask() function so we do not use uninitialized
sigmask_t on error path (Coverity).

8 years agolibdm: check for mem when _canonicalize_field_ids
Zdenek Kabelac [Mon, 3 Oct 2016 14:29:55 +0000 (16:29 +0200)]
libdm: check for mem when _canonicalize_field_ids

Add missing check for dm_pool_strdup() call (Coverity).

8 years agoraid: dmeventd plugin use 64bit arithmetic
Zdenek Kabelac [Mon, 3 Oct 2016 12:58:23 +0000 (14:58 +0200)]
raid: dmeventd plugin use 64bit arithmetic

Coverity suggested to used 64bit unsigned ints instead of signed 32b int.
Assuming there is no user of >31legs raid array.

8 years agolibdm: convert FIEMAP buffer allocation from stack to dm_zalloc
Bryn M. Reeves [Mon, 3 Oct 2016 13:42:30 +0000 (14:42 +0100)]
libdm: convert FIEMAP buffer allocation from stack to dm_zalloc

8 years agolvmlockd: fix segfault in error path
David Teigland [Wed, 28 Sep 2016 18:29:55 +0000 (13:29 -0500)]
lvmlockd: fix segfault in error path

The log_debug statement was ignoring the NULL vg error case.

8 years agolvmdbusd: Use 'pv_missing' column instead of '[unknown]'
Tony Asleson [Wed, 28 Sep 2016 16:18:10 +0000 (11:18 -0500)]
lvmdbusd: Use 'pv_missing' column instead of '[unknown]'

Previously using '[unknown]' for PV device path comparison which
is incorrect as it's not always true.

8 years agolvmdbusd: Remove extraneous parameter
Tony Asleson [Wed, 28 Sep 2016 16:16:49 +0000 (11:16 -0500)]
lvmdbusd: Remove extraneous parameter

Remove 'gen_new' parameter as it's not needed, correct documentation.

8 years agolvmdbusd: Add diagnostic validate for look ups
Tony Asleson [Tue, 27 Sep 2016 15:08:23 +0000 (10:08 -0500)]
lvmdbusd: Add diagnostic validate for look ups

Make sure that the lookup tables don't have extranoues stuff in
them.

8 years agolvmdbustest.py: Make sure to test for hidden lookups
Tony Asleson [Tue, 27 Sep 2016 03:03:12 +0000 (22:03 -0500)]
lvmdbustest.py: Make sure to test for hidden lookups

Test both vgname/[hidden] and vgname/hidden forms

8 years agolvmdbusd: Allow PV device names to be '[unknown]'
Tony Asleson [Tue, 27 Sep 2016 03:02:08 +0000 (22:02 -0500)]
lvmdbusd: Allow PV device names to be '[unknown]'

When a PV device is missing lvm will return '[unknown]' for the device
path.  The object manager keeps a hash table lookup for uuid and for PV's
device name.  When we had multiple PVs with the same device path we
we only had 1 key in the table for the lvm id (device path).  This caused
a problem when the PV device transitioned from '[unknown]' to known as any
subsequent transitions would cause an exception:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/lvmdbusd/request.py", line 66, in run_cmd
    result = self.method(*self.arguments)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/manager.py", line 205, in _pv_scan
    cfg.load()
  File "/usr/lib/python3.5/site-packages/lvmdbusd/fetch.py", line 24, in load
    cache_refresh=False)[1]
  File "/usr/lib/python3.5/site-packages/lvmdbusd/pv.py", line 48, in load_pvs
    emit_signal, cache_refresh)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/loader.py", line 80, in common
    cfg.om.remove_object(cfg.om.get_object_by_path(k), True)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/objectmanager.py", line 153, in remove_object
    self._lookup_remove(path)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/objectmanager.py", line 97, in _lookup_remove
    del self._id_to_object_path[lvm_id]
KeyError: '[unknown]'

when trying to delete a key that wasn't present.  In this case we don't add a
lookup key for the device path and the PV can only be located by UUID.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1379357

8 years agolvmdbusd: Clean up objectmanager.get_object_path_by_uuid_lvm_id
Tony Asleson [Tue, 27 Sep 2016 02:56:11 +0000 (21:56 -0500)]
lvmdbusd: Clean up objectmanager.get_object_path_by_uuid_lvm_id

This method grew crufty with a number of stuble bugs.  Refactor and
simplify.

8 years agolvmdbustest.py: Make env variable work
Tony Asleson [Tue, 27 Sep 2016 02:52:08 +0000 (21:52 -0500)]
lvmdbustest.py: Make env variable work

8 years agolvconvert: Disable thin pool raid conversion while active.
Alasdair G Kergon [Tue, 27 Sep 2016 17:22:54 +0000 (18:22 +0100)]
lvconvert: Disable thin pool raid conversion while active.

Works if the pool is inactive.

Activation code doesn't notice a new raid dependency in on-disk metadata
when a thin LV is already active.

https://bugzilla.redhat.com/1365286

8 years agolibdm: fix dm_stats_delete_region() backwards compat
Bryn M. Reeves [Tue, 27 Sep 2016 16:46:52 +0000 (17:46 +0100)]
libdm: fix dm_stats_delete_region() backwards compat

The dm_stats_delete_region() call removes a region from the bound
device, and, if the region is grouped, from the group leader
group descriptor stored in aux_data.

To do this requires a listed handle: previous versions of the
library do not since no dependencies exist between regions without
grouping.

This leads to strange behaviour when a command built against an old
version of the library is used with one supporting groups. Deleting
a region with dmstats succeeds, but logs errors:

  # dmstats list
  Name             RgID RgSta RgSiz #Areas ArSize ProgID
  vg_hex-root         0     0 1.00g      1  1.00g dmstats
  vg_hex-root         1 1.00g 1.00g      1  1.00g dmstats
  vg_hex-root         2 2.00g 1.00g      1  1.00g dmstats
  # dmstats delete --regionid 2 vg_hex/root
  Region ID 2 does not exist
  Could not delete statistics region.
  Command failed
  # dmstats list
  Name             RgID RgSta RgSiz #Areas ArSize ProgID
  vg_hex-root         0     0 1.00g      1  1.00g dmstats
  vg_hex-root         1 1.00g 1.00g      1  1.00g dmstats

This happens because the call to dm_stats_delete_region() is inside
a dm_stats_walk_*() iterator: upon entry to the call, the iterator
is at its end conditions and about to terminate. Due to the call to
dm_stats_list() inside the function, it returns with an iterator at
the beginning of a walk and performs a further iteration before
exiting. This final loop makes a further attempt to delete the
(already deleted) region, leading to the confusing error messages.

8 years agolibdm: fix stats walk compatibility with older dmsetup
Bryn M. Reeves [Tue, 27 Sep 2016 13:35:22 +0000 (14:35 +0100)]
libdm: fix stats walk compatibility with older dmsetup

The current dmsetup.c handles DR_STATS and DR_STATS_META reports
separately in _display_info_cols(), meaning that the stats walk
functions are never called for these report types.

Versions before v2.02.159 have a loop using dm_stats_walk_do() and
dm_stats_walk_while(), that executes once for non-stats reports,
and once per region, or area, for DR_STATS/DR_STATS_META reports.

This older behaviour relies on the documented behaviour that the
walk functions will accept a NULL pointer as the struct dm_stats*
argument.

This was broken by commit f1f2df7b: the NULL test on dms and
dms->regions were incorrectly moved from the dm_stats_walk_end()
wrapper to the internal '_stats_walk_end()' helper.

Since the pointer is dereferenced in between these points, using
an older dmsetup with current libdm results in a segfault when
running a non-stats report:

  # dmsetup info -c vg00/lvol0
  Segmentation fault (core dumped)

Restore the NULL checks to the wrapper function as intended.

8 years agosystemd: disable service start rate limiting for lvm2-pvscan@.service
Peter Rajnoha [Tue, 27 Sep 2016 08:47:54 +0000 (10:47 +0200)]
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).

8 years agopost-release
Alasdair G Kergon [Mon, 26 Sep 2016 13:29:35 +0000 (14:29 +0100)]
post-release

8 years agopre-release v2_02_166
Alasdair G Kergon [Mon, 26 Sep 2016 13:20:08 +0000 (14:20 +0100)]
pre-release

8 years agoman: fix dmsetup stats
Zdenek Kabelac [Mon, 26 Sep 2016 10:36:04 +0000 (12:36 +0200)]
man: fix dmsetup stats

Fix typo  STATS -> STATUS.

8 years agosystemd: fix extra space in unit generated by lvm2-activation-generator
Timur Bakeyev [Mon, 26 Sep 2016 07:54:19 +0000 (09:54 +0200)]
systemd: fix extra space in unit generated by lvm2-activation-generator

8 years agotoolcontext: read all configuration sources when checking config values in lvm2-activ...
Peter Rajnoha [Fri, 23 Sep 2016 12:51:15 +0000 (14:51 +0200)]
toolcontext: read all configuration sources when checking config values in lvm2-activation-generator through lighweight toolcontext handler

We added lightweight toolcontext handle to avoid useless initialization
of some parts of the context and also to avoid problems when using the
handle very soon at system boot, like in lvm2-activation-generator
through lvm2app interface. However, we missed reading all the other
config sources like lvmlocal.conf as well as any tag config - we need to
read these too to get the final config value which may be overriden in
any of these additional config sources.

Currently, we use this lightweight toolcontext handle to read
global/use_lvmetad and global/use_lvmpolld config values in
lvm2-activation-generator using lvm2app interface (lvm_config_find_bool
lvm2app function).

8 years agomake: also clean up lvmdump.sh with substitutions - there's original lvmdump.sh.in
Peter Rajnoha [Fri, 23 Sep 2016 10:48:52 +0000 (12:48 +0200)]
make: also clean up lvmdump.sh with substitutions - there's original lvmdump.sh.in

8 years agotests: fix raid rebuild tests to work with older target versions
Heinz Mauelshagen [Thu, 22 Sep 2016 21:35:37 +0000 (23:35 +0200)]
tests: fix raid rebuild tests to work with older target versions

Pre 1.9 dm-raid targets status output was racy, which caused
the device status chars to be unreliable _during_ synchronization.
This shows paritcularly with tiny test devices used.

Enhance lvchange-rebuild-raid.sh to not check status
chars _during_ synchronization. Just check afterwards.

8 years agotests: raid repair needs devices in-sync
Zdenek Kabelac [Thu, 22 Sep 2016 13:46:18 +0000 (15:46 +0200)]
tests: raid repair needs devices in-sync

Though I'm not quite sure why we push this limit on user,
current --repair logic requires user to wait outside of command.

TODO: I'm not quite sure this repair logic is 'the most wanted'.

8 years agotests: check for TRIM support
Zdenek Kabelac [Thu, 22 Sep 2016 13:37:52 +0000 (15:37 +0200)]
tests: check for TRIM support

passdown can really work only on discardable device.
Skip 'status' test when PV does no support discard.

8 years agoconfig: use config_tree_from_string_without_dup_node_check throughout code to constru...
Peter Rajnoha [Wed, 21 Sep 2016 12:59:14 +0000 (14:59 +0200)]
config: use config_tree_from_string_without_dup_node_check throughout code to construct metadata trees

8 years agoconfig: add config_tree_from_string_without_dup_node_check to replace dm_config_from_...
Peter Rajnoha [Wed, 21 Sep 2016 12:42:16 +0000 (14:42 +0200)]
config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed

8 years agoconfig: parse config tree without dup node checking if it's metadata tree
Peter Rajnoha [Wed, 21 Sep 2016 12:27:15 +0000 (14:27 +0200)]
config: parse config tree without dup node checking if it's metadata tree

8 years agolibdm: add dm_config_parse_without_dup_node_check
Peter Rajnoha [Wed, 21 Sep 2016 12:25:24 +0000 (14:25 +0200)]
libdm: add dm_config_parse_without_dup_node_check

Introduce function for config parsing tree without checking
for duplicate nodes.

8 years agocleanup: remove unused variables
Peter Rajnoha [Wed, 21 Sep 2016 13:53:50 +0000 (15:53 +0200)]
cleanup: remove unused variables

8 years agocoverity: dmsetup: fix possible use of uninitialized value
Peter Rajnoha [Wed, 21 Sep 2016 13:52:23 +0000 (15:52 +0200)]
coverity: dmsetup: fix possible use of uninitialized value

8 years agodmsetup: ensure --filemap histogram bounds are freed
Bryn M. Reeves [Wed, 14 Sep 2016 14:44:51 +0000 (15:44 +0100)]
dmsetup: ensure --filemap histogram bounds are freed

Make sure that the temporary dm_histogram used for the bounds
argument is freed in the case that the user provided a --bounds
argument on the command line.

8 years agolvconvert: fix (automatic) raid repair regression
Heinz Mauelshagen [Tue, 20 Sep 2016 22:38:38 +0000 (00:38 +0200)]
lvconvert: fix (automatic) raid repair regression

The dm-raid target now rejects device rebuild requests during ongoing
resynchronization thus causing 'lvconvert --repair ...' to fail with
a kernel error message. This regresses with respect to failing automatic
repair via the dmeventd RAID plugin in case raid_fault_policy="allocate"
is configured in lvm.conf as well.

Previously allowing such repair request required cancelling the
resynchronization of any still accessible DataLVs, hence reasoning
potential data loss.

Patch allows the resynchronization of still accessible DataLVs to
finish up by rejecting any 'lvconvert --repair ...'.

It enhances the dmeventd RAID plugin to be able to automatically repair
by postponing the repair after synchronization ended.

More tests are added to lvconvert-rebuild-raid.sh to cover single
and multiple DataLV failure cases for the different RAID levels.

- resolves: rhbz1371717

8 years agotests: correcting kernel version test
Zdenek Kabelac [Tue, 20 Sep 2016 20:50:43 +0000 (22:50 +0200)]
tests: correcting  kernel version test

Debug force leaked in.

8 years agotests: show some more device info
Zdenek Kabelac [Tue, 20 Sep 2016 20:47:14 +0000 (22:47 +0200)]
tests: show some more device info

When passdown is not there, look for possible reason.

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