]> sourceware.org Git - lvm2.git/log
lvm2.git
9 years agometadata: change function name to _allow_extra_system_id
David Teigland [Tue, 14 Jul 2015 19:42:18 +0000 (14:42 -0500)]
metadata: change function name to _allow_extra_system_id

The previous name was misleading since this is not the
primary system_id check, only the "extra" check.

9 years agovgchange: fix lock-start filtering and waiting
David Teigland [Tue, 14 Jul 2015 19:30:01 +0000 (14:30 -0500)]
vgchange: fix lock-start filtering and waiting

Both lock_start filters were being skipped when any lock-opt
values were used.  The "auto" lock-opt should cause the
auto_lock_start_list to be used.  The lock_start_list should
always be used.

The behavior of lock_start_list/auto_lock_start_list are tested
and verified to behave like volume_list/auto_activation_volume_list.

Since the default was changed to wait for lock-start to finish,
the "wait" and "autowait" lock-opt values are not needed, but a
new "autonowait" is added to the existing "nowait" avoid the
default waiting.

9 years agolockd: fix error message after a failing to get lock
David Teigland [Tue, 14 Jul 2015 16:36:04 +0000 (11:36 -0500)]
lockd: fix error message after a failing to get lock

There are two different failure conditions detected in
access_vg_lock_type() that should have different error
messages.  This adds another failure flag so the two
cases can be distinguished to avoid printing a misleading
error message.

9 years agoconfig: {thin,cache}_{check,repair}_options are never undefined
Peter Rajnoha [Tue, 14 Jul 2015 08:03:19 +0000 (10:03 +0200)]
config: {thin,cache}_{check,repair}_options are never undefined

Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.

This means, if there are no default values for these settings defined,
we end up with this generated now:
  {thin,cache}_{check,repair}_options = [ "" ]

So the value is never undefined and if it is, it's an error.

(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)

9 years agoman lvmlockd: update method for changing lock type
David Teigland [Mon, 13 Jul 2015 21:33:58 +0000 (16:33 -0500)]
man lvmlockd: update method for changing lock type

The old description did not work.

9 years agolockd: allow vgexport and vgimport
David Teigland [Mon, 13 Jul 2015 18:48:39 +0000 (13:48 -0500)]
lockd: allow vgexport and vgimport

The "exported" state of the VG can be useful with lockd VGs
because the exported state keeps a VG from being used in general.
It's a way to keep a VG protected and out of the way.

Also fix the command flags: ALL_VGS_IS_DEFAULT is not true for
vgimport/vgexport, since they both return errors immediately if
no VG args are specified.  LOCKD_VG_SH is not true for vgexport
beause it must use an ex lock to write the VG.

9 years agolockd: allow nolocking and readonly options
David Teigland [Fri, 10 Jul 2015 22:20:22 +0000 (17:20 -0500)]
lockd: allow nolocking and readonly options

When --nolocking is used (by vgs, lvs, pvs):

. don't use lvmlockd at all (set use_lvmlockd to 0)
. allow lockd VGs to be read

When --readonly is used (by vgs, lvs, pvs, vgdisplay, lvdisplay,
pvdisplay, lvmdiskscan, lvscan, pvscan, vgcfgbackup):

. skip actual lvmlockd locking calls
. allow lockd VGs to be read
. check that only shared gl/vg locks are being requested
  (even though the actually locking is being skipped)
. check that no LV locks are requested, because no LVs
  should be activated or used in readonly mode
. disable using lvmetad so VGs are read from disk

It is important to note the limited commands that accept
the --nolocking and --readonly options, i.e. no commands
that change/write a VG or change/activate LVs accept these
options, only commands that read VGs.

9 years agovgexport: do not allow lockd VG to be exported
David Teigland [Fri, 10 Jul 2015 18:49:51 +0000 (13:49 -0500)]
vgexport: do not allow lockd VG to be exported

vgexport and vgimport have no use for a shared VG.

9 years agolockd: note that external origins don't work in lockd VGs
David Teigland [Fri, 10 Jul 2015 18:27:02 +0000 (13:27 -0500)]
lockd: note that external origins don't work in lockd VGs

in a comment at the point where it fails, and in the
lvmlockd man page.

9 years agovgchange: allow changing to lockd type when mirrors exist
David Teigland [Fri, 10 Jul 2015 16:48:50 +0000 (11:48 -0500)]
vgchange: allow changing to lockd type when mirrors exist

and update lvmlockd man page to reflect the fact that
mirror LVs work correctly in lockd VGs.

9 years agolvconvert: disallow splitting in lockd VGs
David Teigland [Fri, 10 Jul 2015 16:46:24 +0000 (11:46 -0500)]
lvconvert: disallow splitting in lockd VGs

A new lockd lock needs to be created for the new LV
created by split mirror and split snapshot.  Disallow
these options in lockd VGs until that is implemented.

9 years agolockd: disable part of lock_args validation
David Teigland [Fri, 10 Jul 2015 16:41:29 +0000 (11:41 -0500)]
lockd: disable part of lock_args validation

There are at least a couple instances where
the lock_args check does not work correctly,
(listed in the comment), so disable the
NULL check for lock_args until those are
resolved.

9 years agolvmpolld: Fix segfault on 32 bit architectures
Marian Csontos [Fri, 10 Jul 2015 09:50:06 +0000 (11:50 +0200)]
lvmpolld: Fix segfault on 32 bit architectures

Explicit conversions are needed to align writes and reads on the stack.
int64_t is popped from stack while int was pushed.

9 years agotest: Fix syntax error in prepare_devs
Marian Csontos [Fri, 10 Jul 2015 12:59:15 +0000 (14:59 +0200)]
test: Fix syntax error in prepare_devs

9 years agometadata: fix duplicated LV flag
David Teigland [Thu, 9 Jul 2015 22:02:30 +0000 (17:02 -0500)]
metadata: fix duplicated LV flag

LOCKD_SANLOCK_LV was using the WRITEMOSTLY flag instead of a new one.

9 years agovgchange: fix disallowed LV types in lockd VG
David Teigland [Thu, 9 Jul 2015 21:34:23 +0000 (16:34 -0500)]
vgchange: fix disallowed LV types in lockd VG

cow snapshots work in lockd VG (they were wrongly
disallowed), but mirror type LVs do not yet work in
lockd VGs (they were wrongly allowed).

9 years agopvcreate: remove recent warning message
David Teigland [Thu, 9 Jul 2015 20:26:32 +0000 (15:26 -0500)]
pvcreate: remove recent warning message

log_warn was added recently because no known code used
the given condition, but running pvcreate on an existing
PV uses this case, and should not produce a warning.

9 years agometadata: add comments describing lock_args for lvmlockd
David Teigland [Thu, 9 Jul 2015 20:14:19 +0000 (15:14 -0500)]
metadata: add comments describing lock_args for lvmlockd

9 years agometadata: vg_validate lock_args
David Teigland [Thu, 9 Jul 2015 18:24:28 +0000 (13:24 -0500)]
metadata: vg_validate lock_args

9 years agocoverity: cleanup related to lvmlockd
David Teigland [Thu, 9 Jul 2015 16:28:59 +0000 (11:28 -0500)]
coverity: cleanup related to lvmlockd

A couple missing mutex unlock on error bugs.
A bunch of buffer size/termination warnings.

9 years agolibdaemon: config_make_nodes_v needs fixing
Peter Rajnoha [Thu, 9 Jul 2015 14:34:02 +0000 (16:34 +0200)]
libdaemon: config_make_nodes_v needs fixing

Put the change from commit #10d27998b3d2f6100e9e29e83d1d99948c55875f
back so we have working tree again for now. This code needs a bit of
a cleanup to return proper return value to check...

9 years agocoverity: missing return value checks
Peter Rajnoha [Thu, 9 Jul 2015 13:15:15 +0000 (15:15 +0200)]
coverity: missing return value checks

9 years agocoverity: missing return value for dm_split_lvm_name pass proper DM name instead...
Peter Rajnoha [Thu, 9 Jul 2015 11:11:57 +0000 (13:11 +0200)]
coverity: missing return value for dm_split_lvm_name pass proper DM name instead of NULL value

9 years agocoverity: fix possible invalid dereferences
Peter Rajnoha [Thu, 9 Jul 2015 10:07:34 +0000 (12:07 +0200)]
coverity: fix possible invalid dereferences

lib/format1/import-export.c:167: var_deref_op: Dereferencing null pointer "vg->lvm1_system_id"
lib/cache/lvmetad.c:1023: var_deref_op: Dereferencing null pointer "this"
daemons/lvmlockd/lvmlockd-core.c:2659: check_after_deref: Null-checking "act" suggests that it may be null, but it has already been dereferenced on all paths leading to the check
/daemons/lvmetad/lvmetad-core.c:1024: check_after_deref: Null-checking "pvmeta" suggests that it may be null, but it has already been dereferenced on all paths leading to the check

9 years agolvmconf: fix ignored --startstopservices in lvmconf ... --mirrorservice on systemd
Peter Rajnoha [Thu, 9 Jul 2015 08:35:41 +0000 (10:35 +0200)]
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).

9 years agovgchange: don't disable VG lock in lock_stop
David Teigland [Wed, 8 Jul 2015 20:14:28 +0000 (15:14 -0500)]
vgchange: don't disable VG lock in lock_stop

It was an optimization to avoid a pointless unlock call.
It affects all VGs, but was only intended to affect the
VG being stopped.

9 years agolvmlockd: remove log_error instances for normal conditions
David Teigland [Wed, 8 Jul 2015 18:23:48 +0000 (13:23 -0500)]
lvmlockd: remove log_error instances for normal conditions

There are a number of log_error instances that are replaced
by log_debug because they are not errors.

9 years agoman: add lvmlocal.conf to config cascade
Andy Grover [Wed, 8 Jul 2015 17:02:28 +0000 (10:02 -0700)]
man: add lvmlocal.conf to config cascade

see BZ 1241182, lvmlocal is searched before lvm.conf but after
lvm_<tag>.conf.

9 years agolvmlockd: fix unreachable code
David Teigland [Wed, 8 Jul 2015 16:02:11 +0000 (11:02 -0500)]
lvmlockd: fix unreachable code

9 years agolvmlockctl: fix uninitialized names
David Teigland [Wed, 8 Jul 2015 15:57:57 +0000 (10:57 -0500)]
lvmlockctl: fix uninitialized names

When formatting and printing info from lvmlockd.
Also fix some new line problems.

9 years agotoollib: skip processing the sanlock LV unless named or all
David Teigland [Tue, 7 Jul 2015 21:04:18 +0000 (16:04 -0500)]
toollib: skip processing the sanlock LV unless named or all

This prevents 'lvremove vgname' from attempting to remove the
hidden sanlock LV.  Only vgremove should remove the hidden
sanlock LV holding the sanlock locks.

9 years agotests: follow symlinks
Zdenek Kabelac [Wed, 8 Jul 2015 13:14:09 +0000 (15:14 +0200)]
tests: follow symlinks

If the srcdir itself is a symlink the find would not return expected
value. So support also this config and use -L.

9 years agocoverity: fix regresions from 16e9b32c2f1
Zdenek Kabelac [Wed, 8 Jul 2015 13:35:37 +0000 (15:35 +0200)]
coverity: fix regresions from 16e9b32c2f1

16e9b32c2f1a2d7e0f05a88981824ef0e7607965 incorrectly moved
free of opened descriptor out of if{} - resulted of
closing random file handle.

9 years agocoverity: fix NULL check in lv->lvid.s
Peter Rajnoha [Wed, 8 Jul 2015 13:08:39 +0000 (15:08 +0200)]
coverity: fix NULL check in lv->lvid.s

tools/polldaemon.c:457: array_null: Comparing an array to null is not useful: "lv->lvid.s"

The lv->lvid.s is never NULL. The check was supposed to be *lv->lvid.s
to check if the string is not empty.

9 years agocoverity: fix missing initialization
Peter Rajnoha [Wed, 8 Jul 2015 12:53:23 +0000 (14:53 +0200)]
coverity: fix missing initialization

... Using uninitialized value "lockd_state" when calling "lockd_vg"
(even though lockd_vg assigns 0 to the lockd_state, but it looks at
previous state of lockd_state just before that so we need to have
that properly initialized!)

libdm/libdm-report.c:2934: uninit_use_in_call: Using uninitialized value "tm". Field "tm.tm_gmtoff" is uninitialized when calling "_get_final_time".

daemons/lvmlockd/lvmlockctl.c:273: uninit_use_in_call: Using uninitialized element of array "r_name" when calling "format_info_r_action". (just added FIXME as this looks unfinished?)

9 years agocoverity: previous commit - not "break" but "fall through"
Peter Rajnoha [Wed, 8 Jul 2015 12:42:26 +0000 (14:42 +0200)]
coverity: previous commit - not "break" but "fall through"

9 years agocoverity: missing break in switch expression
Peter Rajnoha [Wed, 8 Jul 2015 12:36:02 +0000 (14:36 +0200)]
coverity: missing break in switch expression

lib/lvmpolld/lvmpolld-client.c:109: fallthrough: The above case falls through to this one

9 years agocoverity: fix uninitialized values and other reported problems
Peter Rajnoha [Wed, 8 Jul 2015 12:19:51 +0000 (14:19 +0200)]
coverity: fix uninitialized values and other reported problems

daemons/lvmlockd/lvmlockd-core.c:5709: error[uninitStructMember]: Uninitialized struct member: ds.....
daemons/lvmlockd/lvmlockd-core.c:799: error[uninitstring]: Dangerous usage of 'version' (strncpy doesn't always null-terminate it)
daemons/lvmlockd/lvmlockd-core.c:646: error[memleakOnRealloc]: Common realloc mistake: 'pollfd' nulled but not freed upon failure

9 years agocoverity: fix resource leaks
Peter Rajnoha [Wed, 8 Jul 2015 11:56:06 +0000 (13:56 +0200)]
coverity: fix resource leaks

lib/log/log.c:115: leaked_storage: Variable "st" going out of scope leaks the storage it points to
daemons/lvmpolld/lvmpolld-core.c:573: leaked_storage: Variable "cmdargv" going out of scope leaks the storage it points to
daemons/lvmlockd/lvmlockd-core.c:5341: leaked_handle: Handle variable "fd" going out of scope leaks the handle
daemons/lvmlockd/lvmlockctl.c:575: overwrite_var: Overwriting "able_vg_name" in "able_vg_name = strdup(optarg)" leaks the storage that "able_vg_name" points to
daemons/lvmlockd/lvmlockctl.c:571: overwrite_var: Overwriting "able_vg_name" in "able_vg_name = strdup(optarg)" leaks the storage that "able_vg_name" points to
daemons/lvmlockd/lvmlockctl.c:385: leaked_handle: Handle variable "s" going out of scope leaks the handle

9 years agoconfig: replace find_config_tree_node with find_config_tree_array where appropriate
Peter Rajnoha [Wed, 8 Jul 2015 09:22:24 +0000 (11:22 +0200)]
config: replace find_config_tree_node with find_config_tree_array where appropriate

9 years agoconfig: add find_config_tree_array
Peter Rajnoha [Wed, 8 Jul 2015 08:43:59 +0000 (10:43 +0200)]
config: add find_config_tree_array

Before, we used general find_config_tree_node function to retrieve
array values. This had a downside where if the node was not found,
we had to insert default values directly in-situ after the
find_config_tree_node call. This way, we had two copies of default
values - one in config_settings.h and the other one directly in the
code where we found out that find_config_tree_node returned NULL and
hence we needed to fall back to defaults.

With separate find_config_tree_array used for array config values,
we keep all the defaults centrally in config_settings.h because
the new find_config_tree_array automatically returns these defaults
if it can't find any value set in the configuration.

This patch just makes the behaviour exactly the same for arrays as
for any other non-array type where we call find_config_tree_<type>
already, hence making the internal interface for handling array
values consistent with the rest of the config types.

9 years agospec: Move lvm2-lockd into separate package
Marian Csontos [Tue, 7 Jul 2015 14:27:17 +0000 (16:27 +0200)]
spec: Move lvm2-lockd into separate package

9 years agospec: Update to use enable_lockd_*
Marian Csontos [Tue, 7 Jul 2015 12:54:57 +0000 (14:54 +0200)]
spec: Update to use enable_lockd_*

9 years agopost-release
Alasdair G Kergon [Tue, 7 Jul 2015 12:57:13 +0000 (13:57 +0100)]
post-release

9 years agopre-release v2_02_125
Alasdair G Kergon [Tue, 7 Jul 2015 12:54:37 +0000 (13:54 +0100)]
pre-release

9 years agolvmpolld: fix possible memory corruption with mem debug
Ondrej Kozina [Tue, 7 Jul 2015 12:03:15 +0000 (14:03 +0200)]
lvmpolld: fix possible memory corruption with mem debug

if lvm2 is built with debug memory options dm_free() is not
mapped directly to std library's free(). This may cause memory corruption
as a line buffer may get reallocated in getline with realloc.

This is a temporary hotfix. Other debug memory failure needs to
be investigated and explained.

9 years agoconf: regenerate
Peter Rajnoha [Tue, 7 Jul 2015 12:27:00 +0000 (14:27 +0200)]
conf: regenerate

9 years agoWHATS_NEW: Update. Fix renamed config setting vsn.
Alasdair G Kergon [Tue, 7 Jul 2015 12:20:01 +0000 (13:20 +0100)]
WHATS_NEW: Update. Fix renamed config setting vsn.

9 years agoconf: regenerate
Peter Rajnoha [Tue, 7 Jul 2015 12:11:16 +0000 (14:11 +0200)]
conf: regenerate

9 years agotests: use old snapshot for huge volumes
Zdenek Kabelac [Sat, 4 Jul 2015 09:41:04 +0000 (11:41 +0200)]
tests: use old snapshot for huge volumes

Avoid stacking thins over thins.

9 years agocache: support clear-needs-check
Zdenek Kabelac [Tue, 7 Jul 2015 07:51:40 +0000 (09:51 +0200)]
cache: support clear-needs-check

Support newer cache tool which support new option
--clear-needs-check-flag.

Code does same as for thin_check.

9 years agolvmetactl: program to interact with lvmetad
David Teigland [Tue, 21 Oct 2014 14:42:20 +0000 (09:42 -0500)]
lvmetactl: program to interact with lvmetad

This is not installed; it's only a developer utility
at this point.

9 years agoman lvmlockd: minor updates
David Teigland [Mon, 6 Jul 2015 20:32:41 +0000 (15:32 -0500)]
man lvmlockd: minor updates

9 years agoconfigure: Separate sanlock and dlm lock config.
Alasdair G Kergon [Mon, 6 Jul 2015 17:20:20 +0000 (18:20 +0100)]
configure: Separate sanlock and dlm lock config.

9 years agoconfig: remove read_only_lock_modes
David Teigland [Mon, 6 Jul 2015 16:42:52 +0000 (11:42 -0500)]
config: remove read_only_lock_modes

It had been added as part of lvmlockd code, but it does
not seem particularly useful.

9 years agolockd: remove unused code for overriding lock modes
David Teigland [Mon, 6 Jul 2015 16:31:21 +0000 (11:31 -0500)]
lockd: remove unused code for overriding lock modes

including the allow_override_lock_modes setting.

It was not possible to override default lock modes any longer,
since the command line options had already been removed.

A mechanism will probably be required later that puts part of
this back.

9 years agoconfig: rename lock_retries lvmlockd_lock_retries
David Teigland [Mon, 6 Jul 2015 16:19:17 +0000 (11:19 -0500)]
config: rename lock_retries lvmlockd_lock_retries

Because it only applies to lvmlockd requests, but
sounded too general.

9 years agoinclude: Standardise around new tool.h.
Alasdair G Kergon [Mon, 6 Jul 2015 16:30:18 +0000 (17:30 +0100)]
include: Standardise around new tool.h.

9 years agoconfigure: enable building lvmlockd without sanlock or dlm
David Teigland [Mon, 6 Jul 2015 15:42:11 +0000 (10:42 -0500)]
configure: enable building lvmlockd without sanlock or dlm

9 years agoclean-up: typos s/bellow/below/
Jonathan Brassow [Mon, 6 Jul 2015 15:15:11 +0000 (10:15 -0500)]
clean-up: typos s/bellow/below/

9 years agomacros: Wrap PRI with FMT.
Alasdair G Kergon [Mon, 6 Jul 2015 14:09:17 +0000 (15:09 +0100)]
macros: Wrap PRI with FMT.

Create a set of wrappers with embedded % such as
  #define FMTu64 "%" PRIu64

9 years agolockd: Clean up spec
Marian Csontos [Fri, 3 Jul 2015 07:46:49 +0000 (09:46 +0200)]
lockd: Clean up spec

9 years agoBuild lockd only for Fedora >= 22 and RHEL >= 7
Marian Csontos [Fri, 26 Jun 2015 17:03:56 +0000 (19:03 +0200)]
Build lockd only for Fedora >= 22 and RHEL >= 7

9 years agopost-release
Alasdair G Kergon [Fri, 3 Jul 2015 15:58:24 +0000 (16:58 +0100)]
post-release

9 years agopre-release v2_02_124
Alasdair G Kergon [Fri, 3 Jul 2015 15:34:40 +0000 (16:34 +0100)]
pre-release

9 years agotests: update for new thin pool messaging
Zdenek Kabelac [Wed, 1 Jul 2015 11:31:23 +0000 (13:31 +0200)]
tests: update for new thin pool messaging

9 years agothin: move pool messaging from resume to suspend
Zdenek Kabelac [Wed, 1 Jul 2015 11:31:37 +0000 (13:31 +0200)]
thin: move pool messaging from resume to suspend

Existing messaging intarface for thin-pool has a few 'weak' points:

* Message were posted with each 'resume' operation, thus not allowing
activation of thin-pool with the existing state.

* Acceleration skipped suspend step has not worked in cluster,
since clvmd resumes only nodes which are suspended (have proper lock
state).

* Resume may fail and code is not really designed to 'fail' in this
phase (generic rule here is resume DOES NOT fail unless something serious
is wrong and lvm2 tool usually doesn't handle recovery path in this case.)

* Full thin-pool suspend happened, when taken a thin-volume snapshot.

With this patch the new method relocates message passing into suspend
state.

This has a few drawbacks with current API, but overal it performs
better and gives are more posibilities to deal with errors.

Patch introduces a new logic for 'origin-only' suspend of thin-pool and
this also relates to thin-volume when taking snapshot.

When suspend_origin_only operation is invoked on a pool with
queued messages then only those messages are posted to thin-pool and
actual suspend of thin pool and data and metadata volume is skipped.

This makes taking a snapshot of thin-volume lighter operation and
avoids blocking of other unrelated active thin volumes.

Also fail now happens in 'suspend' state where the 'Fail' is more expected
and it is better handled through error paths.

Activation of thin-pool is now not sending any message and leaves upto a tool
to decided later how to finish unfinished double-commit transaction.

Problem which needs some API improvements relates to the lvm2 tree
construction. For the suspend tree we do not add target table line
into the tree, but only a device is inserted into a tree.
Current mechanism to attach messages for thin-pool requires the libdm
to know about thin-pool target, so lvm2 currently takes assumption, node
is really a thin-pool and fills in the table line for this node (which
should be ensured by the PRELOAD phase, but it's a misuse of internal API)
we would possibly need to be able to attach message to 'any' node.

Other thing to notice - current messaging interface in thin-pool
target requires to suspend thin volume origin first and then send
a create message, but this could not have any 'nice' solution on lvm2
side and IMHO we should introduce something like 'create_after_resume'
message.

Patch also changes the moment, where lvm2 transaction id is increased.
Now it happens only after successful finish of kernel transaction id
change. This change was needed to handle properly activation of pool,
which is in the middle of unfinished transaction, and also this corrects
usage of thin-pool by external apps like Docker.

9 years agolibdm: support for posting messages in suspend
Zdenek Kabelac [Wed, 1 Jul 2015 11:30:14 +0000 (13:30 +0200)]
libdm: support for posting messages in suspend

Add support for sending message in suspend tree for thin-pools.
When this operation is requested whole subtree suspend is then skipped.

This is experimantal support for new lvm2 code for sending message
in suspend phase where 'thin-pool origin-only suspend' will send
messages instead of really suspending thin-pool tree.

When suspening thin volume origin-only - only thin volume is suspended,
then messages are posted and thin-pool suspend is skipped.

9 years agothin: check for overprovisioning
Zdenek Kabelac [Fri, 3 Jul 2015 13:31:31 +0000 (15:31 +0200)]
thin: check for overprovisioning

9 years agoreport: select: add handler to recognize fuzzy time specification
Peter Rajnoha [Fri, 3 Jul 2015 08:43:07 +0000 (10:43 +0200)]
report: select: add handler to recognize fuzzy time specification

Recognize date and time specification within selection criteria
that is formulated in a more free-form way besides to the original
basic YYYY-MM-DD HH:MM format that libdevmapper supports.

Currently, this free-form format is recognized for lv_time field.

Users are able to use expressions from this set:
  - weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat")
  - labels for points in time ("noon", "midnight")
  - labels for a day relative to current day ("today", "yesterday")
  - points back in time with relative offset from today (N is a number)
    ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago")
    ( "N" "secs"/"mins"/"hrs" ... "ago")
    ( "N" "s"/"m"/"h" ... "ago")
  - time specification either in hh:mm:ss format or with AM/PM suffixes
  - month names ("January" - "December" or abbreviated as "Jan" - "Dec")

For example:

$ date
Fri Jul  3 10:11:13 CEST 2015

$ lvmconfig --type full report/time_format
time_format="%a %Y-%m-%d %T %z %Z [%s]"

$ lvs
  LV    VG     Time
  lvol0 vg     Fri 2014-08-22 21:25:41 +0200 CEST [1408735541]
  lvol2 vg     Sun 2015-04-26 14:52:20 +0200 CEST [1430052740]
  root  fedora Wed 2015-05-27 08:09:21 +0200 CEST [1432706961]
  swap  fedora Wed 2015-05-27 08:09:21 +0200 CEST [1432706961]
  lvol1 vg     Tue 2015-06-30 03:25:43 +0200 CEST [1435627543]
  lvol3 vg     Tue 2015-06-30 14:52:23 +0200 CEST [1435668743]
  lvol6 vg     Wed 2015-07-01 13:35:56 +0200 CEST [1435750556]
  lvol4 vg     Thu 2015-07-02 12:12:02 +0200 CEST [1435831922]
  lvol5 vg     Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

$ lvs -S 'time=yesterday'
  LV    VG   Time
  lvol4 vg   Thu 2015-07-02 12:12:02 +0200 CEST [1435831922]
  lvol5 vg   Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

$ lvs -S 'time since "June 30"'
  LV    VG   Time
  lvol1 vg   Tue 2015-06-30 03:25:43 +0200 CEST [1435627543]
  lvol3 vg   Tue 2015-06-30 14:52:23 +0200 CEST [1435668743]
  lvol6 vg   Wed 2015-07-01 13:35:56 +0200 CEST [1435750556]
  lvol4 vg   Thu 2015-07-02 12:12:02 +0200 CEST [1435831922]
  lvol5 vg   Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

$ lvs -S 'time since "noon June 30"'
  LV    VG   Time
  lvol3 vg   Tue 2015-06-30 14:52:23 +0200 CEST [1435668743]
  lvol6 vg   Wed 2015-07-01 13:35:56 +0200 CEST [1435750556]
  lvol4 vg   Thu 2015-07-02 12:12:02 +0200 CEST [1435831922]
  lvol5 vg   Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

$ lvs -S 'time since "2 July 9AM"'
  LV    VG   Time
  lvol4 vg   Thu 2015-07-02 12:12:02 +0200 CEST [1435831922]
  lvol5 vg   Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

$ lvs -S 'time since "2 July 1PM"'
  LV    VG   Time
  lvol5 vg   Thu 2015-07-02 14:30:32 +0200 CEST [1435840232]

...and so on.

9 years agoreport: call appropriate handler to evaluate fuzzy reserved names and dynamic reserve...
Peter Rajnoha [Wed, 20 May 2015 16:47:54 +0000 (18:47 +0200)]
report: call appropriate handler to evaluate fuzzy reserved names and dynamic reserved values

Wire the dm_report_reserved_handler instance call in reporting/selection
infrastructure to handle reserved value actions (currently only
DM_REPORT_RESERVED_PARSE_FUZZY_NAME and DM_REPORT_RESERVED_GET_DYNAMIC_VALUE
actions).

9 years agoreport: add infrastructure to recognize fuzzy reserved names and returning dynamic...
Peter Rajnoha [Tue, 19 May 2015 11:01:48 +0000 (13:01 +0200)]
report: add infrastructure to recognize fuzzy reserved names and returning dynamic reserved values

With fuzzy names we mean the names for which it's hard or even impossible
to enumerate all possible variations of the name - the name needs to
be evaluated. An example of fuzzy name is a name which has a base
(substring) which matches and it can contain arbitrary variations
around this base. We can cover human language better with fuzzy
names as people may use several different names (or sentences) to
denote the same thing.

With dynamic values we mean the values which are not constants
and they need to be evaluated in runtime. An example of dynamic
value is a value which depends on current system state (e.g. time,
current configuration or any other state which may change and it
needs runtime evaluation).

There's a handler that can be registered with reporting/selection
using dm_report_reserved_handler instance. This is a central point
in which the computation/evaluation happens when processing reserved
values. Currently, there are two actions declared:

  DM_REPORT_RESERVED_PARSE_FUZZY_NAME
  (translates fuzzy name into canonical name)

  DM_REPORT_RESERVED_GET_DYNAMIC_VALUE
  (gets value for canonical name)

The handler is then registered as value in struct
dm_report_reserved_value (see explaining comments besided
the struct dm_report_reserved_value in libdevmapper.h).

Also, this patch provides support for simple caching of values
used during report/selection via dm_report_value_cache_{set,get}.
This is supposed to be used mainly in the dm_report_reserved_handler
instances to save values among calls so all the handler calls work
with the same base value used in computation/evaluation and/or
possibly to save resources if the evaluation is more time-consuming.
The cache is attached to the dm_report handle and so the cache is
dropped one dm_report is dropped.

9 years agocleanup: commit fe70b03 turned lv_time to STR, put it back to TIM
Peter Rajnoha [Fri, 3 Jul 2015 07:22:48 +0000 (09:22 +0200)]
cleanup: commit fe70b03 turned lv_time to STR, put it back to TIM

9 years agolockd: fix stub functions for LV locking
David Teigland [Thu, 2 Jul 2015 21:33:51 +0000 (16:33 -0500)]
lockd: fix stub functions for LV locking

The stub functions for lockd LV locking were returning
the wrong result when lvm was compiled without lvmlockd.

9 years agoAdd lvmlockd
David Teigland [Thu, 5 Mar 2015 20:00:44 +0000 (14:00 -0600)]
Add lvmlockd

9 years agoreport: adjust shared flags based on expected type for reserved values
Peter Rajnoha [Thu, 2 Jul 2015 14:05:25 +0000 (16:05 +0200)]
report: adjust shared flags based on expected type for reserved values

Generic numbers and time values share some operators so make sure
we have the flags correctly adjusted based on expected type if
we're using reserved values.

9 years agotests: add test for 454782f (select with synonyms for string field types)
Peter Rajnoha [Thu, 2 Jul 2015 09:46:58 +0000 (11:46 +0200)]
tests: add test for 454782f (select with synonyms for string field types)

9 years agoreport: fix regression while selecting string fields using synonyms
Peter Rajnoha [Thu, 2 Jul 2015 09:31:54 +0000 (11:31 +0200)]
report: fix regression while selecting string fields using synonyms

$ lvs -o name,cache_policy vg/lvol0
  LV    Cache Policy
  lvol0

Before this patch:
$ lvs -o name,cache_policy -S 'cache_policy=undefined' vg/lvol0
  (no match)

With this patch applied:
$ lvs -o name,cache_policy -S 'cache_policy=undefined' vg/lvol0
  LV    Cache Policy
  lvol0

9 years agodisplay: missed to count with 0
Zdenek Kabelac [Wed, 1 Jul 2015 22:04:38 +0000 (00:04 +0200)]
display: missed to count with 0

dm_snprintf() returns upon success the number of characters printed
(excluding the null byte used to end output to strings).

So add extra byte to preserve \0.
This fixes regression when displaying more then a single lv name.

9 years agolibdm: enhance tracing messages
Zdenek Kabelac [Wed, 1 Jul 2015 11:29:32 +0000 (13:29 +0200)]
libdm: enhance tracing messages

Use new _node_name() and print name major:minor for thin-pool device.

9 years agolibdm: add helper function to print _node_name
Zdenek Kabelac [Wed, 1 Jul 2015 07:54:57 +0000 (09:54 +0200)]
libdm: add helper function to print _node_name

_node_name() prepares into dm_tree internal buffer device
name and it (major:minor) for easy usage for debug messages.

To avoid any allocation a small buffer in struct dm_tree is preallocated
to store this message.

9 years agoconfig: report/time_format appeared in v2.02.123
Peter Rajnoha [Wed, 1 Jul 2015 06:19:40 +0000 (08:19 +0200)]
config: report/time_format appeared in v2.02.123

9 years agolocking: Add missing error handling.
Alasdair G Kergon [Tue, 30 Jun 2015 17:54:38 +0000 (18:54 +0100)]
locking: Add missing error handling.

Add missing error logging and detection to unlock_vg and callers
of sync_local_dev_names etc.

9 years agopost-release
Alasdair G Kergon [Tue, 30 Jun 2015 16:12:56 +0000 (17:12 +0100)]
post-release

9 years agopre-release v2_02_123
Alasdair G Kergon [Tue, 30 Jun 2015 16:11:21 +0000 (17:11 +0100)]
pre-release

9 years agoconf: Regenerate.
Alasdair G Kergon [Tue, 30 Jun 2015 16:09:56 +0000 (17:09 +0100)]
conf: Regenerate.

Fix missing --clear-needs-check-flag.

9 years agolibdm: Rename struct time_value variables.
Alasdair G Kergon [Tue, 30 Jun 2015 15:17:22 +0000 (16:17 +0100)]
libdm: Rename struct time_value variables.

warning: declaration of ‘time’ shadows a global declaration

9 years agoreport: add support for time (basic)
Peter Rajnoha [Thu, 21 May 2015 13:19:03 +0000 (15:19 +0200)]
report: add support for time (basic)

This patch adds support for time values used in reporting fields.
The raw values are always stored as number of seconds since epoch.

The support that comes with this patch is the basic one which allows
only for recognition of strictly formatted date and time in selection
criteria (the format follows a subset of formats defined by ISO 8601):

  date time timezone

  date:
    YYYY-MM-DD (or shortly YYYYMMDD)
    YYYY-MM (shortly YYYYMM), auto DD=1
    YYYY, auto MM=01 and DD=01

  time:
    hh:mm:ss (or shortly hhmmss)
    hh:mm (or shortly hhmm), auto ss=0
    hh (or shortly hh), auto mm=0, auto ss=0

  timezone (always with + or - sign):
    +hh:mm or -hh:mm (or shortly +hhmm or -hhmm)
    +hh or -hh

Or directly the time (number of seconds) since Epoch (1970-01-01 00:00:00 UTC)
when the number value is prefixed by "@":

   @number_of_seconds_since_epoch

This patch also adds aliases for comparison operators
used together with time values which are more intuitive
to use:
  since (as alias for >=)
  after (as alias for >)
  until (as alias for <=)
  before (as alias for <)

For example:

$ lvmconfig --type full report/time_format
time_format="%Y-%m-%d %T %z %Z [%s]"

$ lvs -o name,time vg
  LV    Time
  lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541]
  lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543]
  lvol2 2015-04-26 14:52:20 +0200 CEST [1430052740]
  lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743]

$ lvs vg -o name,time -S 'time since "2015-04-26 15:00" && time until "2015-06-30"'
  LV    Time
  lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541]
  lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543]
  lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743]

$ lvs vg -o name,time -S 'time since "2015-04-26 15:00" && time until "2015-06-30 6:00"'
  LV    Time
  lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541]
  lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543]

$ lvs vg -o name,time -S 'time since @1435519541'
  LV    Time
  lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541]
  lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543]
  lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743]

This is basic time recognition support that is directly a part of
libdevmapper. Recognition of more free-form expressions will be a
part of subsequent patches.

9 years agoconfigure: set DEFAULT_FALLBACK_TO_LVM1 in configure and use it in config_settings.h
Peter Rajnoha [Tue, 30 Jun 2015 12:09:00 +0000 (14:09 +0200)]
configure: set DEFAULT_FALLBACK_TO_LVM1 in configure and use it in config_settings.h

Just like we have DEFAULT_USE_LVMETAD (or DEFUALT_USE_LVMPOLLD), use
fallback_to_lvm1=1 lvm.conf setting if we configured lvm2 with
--enable-lvm1-fallback and use fallback_to_lvm1=0 otherwise.

Also, generate proper lvm.conf.in with unconfigured value.

9 years agocleanup: report: use internal wrapper for various variables used for handling reserve...
Peter Rajnoha [Tue, 30 Jun 2015 08:23:35 +0000 (10:23 +0200)]
cleanup: report: use internal wrapper for various variables used for handling reserved values

Just a cleanup - wrap several variables we use to handle reserved
values into a structure for easier manipulation in the code.

9 years agoselect: add support for range reserved values and flagging named-only values
Peter Rajnoha [Tue, 30 Jun 2015 08:13:35 +0000 (10:13 +0200)]
select: add support for range reserved values and flagging named-only values

This patch allows for registration and recognition of reserved
values which are ranges, so they're composed of two values actually
to denote the lower and upper bound for the range (stored as an array
with exactly two items to define the boundaries).

Also, this patch allows for flagging reserved values as named-only
which means that such values are not strictly reserved. The strictly
reserved values are reserved values as used before this patch.

Distinction between strictly-reserved and named-only values
is clearly visible with comparisons. Normally, strictly reserved
value is not accounted for if we do "greater than" or "lower than"
comparisons, for example:

1  2  3 ....
   |
  abc

- we have "abc" as reserved value for field with value "2"
- the value reported for the field is "abc" (or "2", it doesn't matter here)
- the selection we're processing is -S 'field < abc'
- the result of the selection gives nothing as "abc" is strictly
reserved value (bound to "2") and there's no order defined for
it and it would only match if we directly compared the value
(so -S 'field = abc' would match)

With named-only values, the "abc" is named-only value for "2",
so selection -S 'field < abc" is the same as using -S 'field < 2'.
The "abc" is just an alias for some value so the value or its
assigned name can be used equally in selection criteria.

9 years agocleanup: time: error out on incorrect time_format and indentation in config_settings.h
Peter Rajnoha [Mon, 29 Jun 2015 14:16:58 +0000 (16:16 +0200)]
cleanup: time: error out on incorrect time_format and indentation in config_settings.h

9 years agolv: time: increase buffer to 4k in lv_time_dup
Peter Rajnoha [Mon, 29 Jun 2015 13:24:00 +0000 (15:24 +0200)]
lv: time: increase buffer to 4k in lv_time_dup

9 years agotoolcontext: use proper set of chars to check time format against
Peter Rajnoha [Mon, 29 Jun 2015 12:45:45 +0000 (14:45 +0200)]
toolcontext: use proper set of chars to check time format against

9 years agoconf: make time format configurable
Peter Rajnoha [Mon, 25 May 2015 14:13:07 +0000 (16:13 +0200)]
conf: make time format configurable

Make it possible to define format for time that is displayed.
The way the format is defined is equal to the way that is used
for strftime function, although not all formatting options as
used in strftime are available for LVM2 - the set is restricted
(e.g. we do not allow newline to be printed). The lvm.conf
comments contain the whole list that LVM2 accepts for time format
together with brief description (copied from strftime man page).

For example:
(defaults used - the format is the same as used before this patch)
$ lvs -o+time vg/lvol0 vg/lvol1
  LV    VG   Attr       LSize Time
  lvol0 vg   -wi-a----- 4.00m 2015-06-25 16:18:34 +0200
  lvol1 vg   -wi-a----- 4.00m 2015-06-29 09:17:11 +0200

(using 'time_format = "@%s"' in lvm.conf - number of seconds
since the Epoch)
$ lvs -o+time vg/lvol0 vg/lvol1
  LV    VG   Attr       LSize Time
  lvol0 vg   -wi-a----- 4.00m @1435241914
  lvol1 vg   -wi-a----- 4.00m @1435562231

9 years agoconfig: regenerate lvm.conf.in and lvmlocal.conf.in
Peter Rajnoha [Mon, 29 Jun 2015 11:43:28 +0000 (13:43 +0200)]
config: regenerate lvm.conf.in and lvmlocal.conf.in

9 years agorefactor: rename _out_tags fn to _out_list and use it for string lists in general
Peter Rajnoha [Wed, 6 May 2015 12:06:44 +0000 (14:06 +0200)]
refactor: rename _out_tags fn to _out_list and use it for string lists in general

9 years agocleanup: remove unused tags.c file
Peter Rajnoha [Wed, 6 May 2015 11:59:49 +0000 (13:59 +0200)]
cleanup: remove unused tags.c file

9 years agorefactor: rename alloc_printed_tags fn to _alloc_printed_str_list and use it for...
Peter Rajnoha [Wed, 6 May 2015 11:58:17 +0000 (13:58 +0200)]
refactor: rename alloc_printed_tags fn to _alloc_printed_str_list and use it for string lists in general

9 years agorefactor: rename read_tags fn to _read_str_list and use it for string lists in general
Peter Rajnoha [Wed, 6 May 2015 11:19:21 +0000 (13:19 +0200)]
refactor: rename read_tags fn to _read_str_list and use it for string lists in general

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