1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00
Commit Graph

396 Commits

Author SHA1 Message Date
Zdenek Kabelac
1f5dde38a7 cleanup: more use of lvseg_name
Use existing function lvseg_name().
2017-01-03 14:55:16 +01:00
Heinz Mauelshagen
95d68f1d0e lvchange: allow a transiently failed RaidLV to be refreshed
Add to commits 87117c2b25 and 0b8bf73a63 to avoid refreshing two
times altogether, thus avoiding issues related to clustered, remotely
activated RaidLV.  Avoid need to repeat "lvchange --refresh RaidLV"
two times as a workaround to refresh a RaidLV.  Fix handles removal
of temporary *-missing-* devices created for any missing segments
in RAID SubLVs during activation.

Because the kernel dm-raid target isn't able to handle transiently
failing devices properly we need
"[dm-devel][PATCH] dm raid: fix transient device failure processing"
as well.

test: add lvchange-raid-transient-failures.sh
      and enhance lvconvert-raid.sh

Resolves: rhbz1025322
Related:  rhbz1265191
Related:  rhbz1399844
Related:  rhbz1404425
2016-12-23 03:41:32 +01:00
Zdenek Kabelac
a24eae6e82 cache: prepare status checking for layer
To be ready to show status of cache volume, call the status
with layer.  Layer is automatically detected in this case when
cache volume is used in 'layered' form (needs -real suffix).
2016-12-18 19:23:13 +01:00
Zdenek Kabelac
c71fefad8d lvs: show status for layer
When LV is external origin, show info for LV but
status for -layer.  So we expose more info to a user
as otherwise active external origin is only linear
mapping of -real layer.

We do the same for i.e. old snaphost origin.
2016-12-18 19:12:12 +01:00
Zdenek Kabelac
81ef4eb4f8 cleanup: indent and messsages updates 2016-12-05 17:12:42 +01:00
Zdenek Kabelac
e2c7e0ad11 activation: optimize away lv_has_target_type
It's actually not needed to call extra lv_has_target_type() to detect
snapshot merge is in progress - decode this right during status
capturing and save even few extra ioctl calls.
2016-12-05 17:10:14 +01:00
Zdenek Kabelac
6fd20be629 activation: lv_info_with_seg_status API change
Drop LV from passed API arg - it's always segment being checked.
Also use_layer is now in full control of lv_info_with_seg_status().
It decides which device needs to be checked to get 'the most info'.

TODO: future version should be able to expose status from
2016-12-05 17:09:47 +01:00
Zdenek Kabelac
ed93f0973a activation: lv_info_with_seg_status unify status selection
Start moving selection of status taken for a LV into a single place.
The logic for showing info & status has been spread over multiple
places and were doing too complex decision going agains each other.

Unify selection of status of origin & cow scanned device.

TODO: in future we want to grab status for LV and layered LV and have
both statuses present for display - i.e. when 'old snapshot'
of thinLV is takes and there is ongoing merge - at some moment
we are not capable to show all needed info.
2016-12-05 17:09:13 +01:00
Zdenek Kabelac
0089201588 cleanup: swap test order
Check for lv != lvseg->lv.
Make the logic of following patches look better and easier to read.
2016-12-05 17:05:23 +01:00
Zdenek Kabelac
9cbe4c1af9 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.
2016-11-03 17:49:07 +01:00
Heinz Mauelshagen
ff05ed7afd 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
2016-10-27 11:42:07 +02:00
Alasdair G Kergon
414d39085c snapshots: Fix monitoring to use cow not internal LV. 2016-09-20 02:30:58 +01:00
Zdenek Kabelac
b592ea5bbc activation: dso always defined for monitoring query
Ensure 'dso' has always a defined (NULL) value,
and also ensure NULL 'dso' is not dereferenced.
2016-09-12 16:49:49 +02:00
Zdenek Kabelac
81970d22d8 cache: do not monitor cache-pool
Avoid monitoring of activated cache-pool - where the only purpose ATM
is to clear metadata volume which is actually activate in place
of cache-pool name (using public LV name).

Since VG lock is held across whole clear operation, dmeventd cannot
be used anyway - however in case of appliction crash we may
leave unmonitored device.

In future we may provide better mechanism as the current name
replacemnet is creating 'uncommon' table setups in case the metadata
LV is more complex type like raid  (needs some futher thinking about
error path results).

Another point to think about is the fact we should not clear device
while holding lock (i.e. dmeventd mirror repair cannot work in cases
like this).
2016-08-29 20:51:15 +02:00
Alasdair G Kergon
2d65ce9711 dmeventd: Add fixed timeout when unmonitoring. 2016-08-23 16:09:18 +01:00
Alasdair G Kergon
b975532433 dmeventd: Simplify replacement unmonitor code. 2016-08-23 12:16:39 +01:00
Alasdair G Kergon
97ee5a1cd3 dmeventd: Start merging back replacement unmonitor code. 2016-08-23 11:30:34 +01:00
Alasdair G Kergon
952e413328 dmeventd: Fix unmonitoring when segtype changes.
When the segment type is being changed, unmonitoring an LV requires
the existing dso to be specified as a parameter, not the new one.
2016-08-23 02:26:14 +01:00
Zdenek Kabelac
6268d0a080 cleanup: add dots to some messages
Add missing dots and one comment.
2016-06-23 14:57:08 +02:00
Zdenek Kabelac
eb51be4fbe activation: _lv_active returns 0 on error
We have only 2 users of _lv_active() - one was already checking for ==1
while the other use (_lv_is_active()) could have take '-1' as a sign of having
an LV active. So return 0 and log_debug also the reason while detection
has failed (i.e. in case  --driverload n  - it's kind of expectable,
but might have confused user seeing just <backtrace>).
2016-06-23 14:55:35 +02:00
Zdenek Kabelac
af36f5ad36 activation: switch to warning
Since this function does not have a way to return error use correct
reporting level as warning.
2016-06-23 14:53:59 +02:00
Zdenek Kabelac
8e4db009b8 cleanup: compile fixes for --disable-devmapper
Make lvm2 compilable when configured with: --disable-devmapper.
2016-06-03 12:46:43 +02:00
Zdenek Kabelac
04003cf1ff cache: add log_error on error path
Validate and report error when lv_cache_status is called
for inactive LV, or pending delete or unused cache_pool.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
f7f395667e lvstatus: enhance seg_status to handle snapshot
Add more code to properly store status for snapshot segment
maintaining lvm2 fiction of COW and snapshot internal volumes.

The key issue here is however not though-through reporting
logic - as there is no single answer for whole line state.
It not counting with layer and we may need few more ioctl to
cover all reporting needs depending upon what is actually
needed.

In reality we need to 'cache' more ioctl status queries for
individual LVs and their segments (so they checked at most once).

The other 'hard' topic for conversion is mirror segment handling.

Also we definitelly need to relocate some logic into segment's methods,
yet it might be complex as we have not clear border between targets.

TODO: define more clearly how are reporting fields defined in case
we 'stack' volumes like   -   cache of stacked  thin LV snapshot origin.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
a4f8d1165c setup_task: add with_flush
To get better control when flushing is used add extra arg when
setting up dm task.

By default now check dm device status without flush.
(At this moment this should effect only thin and cache volumes).

Also switch dev_manager_thin_pool_status() to use more
readable 'flush' parameter instead of 'no_flush'.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
1202713f94 activation: activation check is mandatory
Make missing activation() check before calling target_persent
an INTERNAL_ERROR.
2016-05-06 16:48:16 +02:00
Zdenek Kabelac
4d116d7a28 cleanup: gather version info with single check
As we already collect version info anyway, allow to use it through
a single call (can makes logs shorter and saves ioctl).
2016-05-05 23:34:30 +02:00
Zdenek Kabelac
2a2efab0b1 cleanup: use log_debug_activation 2016-04-27 00:01:08 +02:00
Zdenek Kabelac
aa91fe3d3c 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.
2016-04-26 23:23:03 +02:00
Alasdair G Kergon
01181a299e activate: Hide errors when snapshot merge delayed. 2016-04-21 22:14:10 +01:00
Alasdair G Kergon
6954de22e2 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.)
2016-04-15 02:33:38 +01:00
Alasdair G Kergon
ff09bda7d5 activation: Add LV name to a debug message. 2016-04-14 22:41:25 +01:00
Alasdair G Kergon
f40dfb48ad activation: Skip another non-prefixed info ioctl.
_percent() also does a lookup by dm uuid.
Also get kernel version from cmd->kernel_vsn.
2016-04-08 16:27:12 +01:00
Zdenek Kabelac
9be7bca4be cleanup: indent 2016-04-06 11:31:02 +02:00
Zdenek Kabelac
7c1937f8df suspend: fix suspend with noflush limitation
Commit 844b009584 tried to move
limit for usage of noflush to 'preload' however this was not
correctly processed.

Intead explicitly check for which types we do not want noflush
and also add debug message in this case.
2016-04-06 11:31:02 +02:00
Zdenek Kabelac
86db143307 cleanup: debug message fix
Reported-by: Ming-Hung Tsai <mingnus gmail com>
2016-03-31 12:21:25 +02:00
Peter Rajnoha
109b7e2095 revert: 6129d2e64d
Unfortunately, commit 6129d2e64d may
cause performance issue. There's going to be a better fix...
2016-03-24 14:06:12 +01:00
Peter Rajnoha
6129d2e64d monitoring: sync /dev content before contacting dmeventd for monitor/unmonitor
dmeventd daemon may call further code itself that looks at /dev, e.g.
via dmeventd_lvm2_command call. We need to have a consistent view of
the /dev content at that time. Therefore, sync /dev content before
calling monitoring hook which contacts dmeventd.

This problem was quite hidden before, but now it has manifested itself
because of recent additions to dev-cache code where we started looking
at device holders as seen in sysfs. What happened here was that the
device was already in sysfs, but not yet under /dev and this triggered
the new error message sometimes:

  log_error("%s: failed to find associated device structure for holder %s.", devname, devpath);

This problem has manifested recently in our api/pytest.sh test from
testsuite where we create thin pool LVs and thin LVs and hence it also
causes dmeventd to be used as well and these error messages were
visible there.
2016-03-24 12:40:19 +01:00
Zdenek Kabelac
e04a0184cb cleanup: use lv_is_partial
Check for PARTIAL_LV flag in standard way.
2016-03-03 10:17:03 +01:00
M.H. Tsai
53058e5234 debug: cut_and_paste type in message
Typo in debug message.
2016-02-11 18:38:40 +01:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
Alasdair G Kergon
2da7525c83 activation: remote node check doesn't work yet 2016-01-20 02:54:11 +00:00
Alasdair G Kergon
2304286f68 activation: Add lv_is_active_remotely. 2016-01-19 22:01:59 +00:00
Alasdair G Kergon
c812c2dbc7 locking: Add node parameter to query_resource. 2016-01-19 21:42:22 +00:00
Zdenek Kabelac
922fccc656 cleanup: using display_lvname
Use for showing vgname/lvname in messages.
No functional change.
2015-11-26 09:27:37 +01:00
Zdenek Kabelac
b7b59ad932 cleanup: remove unused code
Remove long outstand unused code lines, which were already
been obsoleted by other code.

Statuses and snapshot tree creation is already handled differently.

Also drop some 'extra' log_error() and use only stack;
since error has already been reported.
2015-11-26 09:27:37 +01:00
Zdenek Kabelac
4312b09635 cleanup: change ondisk committed
Patch has no functional change.
2015-11-25 11:39:26 +01:00
Zdenek Kabelac
5e50e5f0b4 thin: skip detach preload from pools
lv preload for detached LVs started to be used also
for various other types which just happens to pass through
weak if() condition.

TODO: find here better solution to rather explicitly check
for types we really need to preload.
2015-11-23 23:42:59 +01:00
Zdenek Kabelac
6d6c233768 cleanup: move towards using direct LV pointers
We do not won't to 'expose'  internals of VG struct.
ATM we use lists to keep all LVs - we may want to switch
to better struct for quicker 'search'.

Since we do not need 'lists' but always actual LV,
switch find_lv_in_vg_by_lvid() to return LV,
and replaces some use case of  find_lv_in_vg()
with 'better' working find_lv() which already
returns LV.
2015-11-23 23:42:59 +01:00
Peter Rajnoha
3b6840e099 config: replace find_config_tree_node with find_config_tree_array where appropriate 2015-07-08 13:03:08 +02:00