]> sourceware.org Git - lvm2.git/log
lvm2.git
7 years agolibdm: ensure first extent is always counted
Bryn M. Reeves [Tue, 13 Dec 2016 21:36:11 +0000 (21:36 +0000)]
libdm: ensure first extent is always counted

If FIEMAP returns a single extent after the first call, no extent
boundary is detected and the first extent is not counted by the
normal mechanism.

In this case, increment nr_extents at the same time the extent is
added to the region table, before returning.

7 years agocleanup: remove wrapping function
Zdenek Kabelac [Tue, 13 Dec 2016 11:28:12 +0000 (12:28 +0100)]
cleanup: remove wrapping function

backup is not 'tested' for success and also it should
actually happen just when command is finished.
We do not target to make backups with each inter-step
metadata change.

7 years agocleanup: log message updates
Zdenek Kabelac [Mon, 12 Dec 2016 23:10:01 +0000 (00:10 +0100)]
cleanup: log message updates

7 years agocleanup: more lv_is_ usage
Zdenek Kabelac [Mon, 12 Dec 2016 23:09:15 +0000 (00:09 +0100)]
cleanup: more  lv_is_  usage

7 years agocleanup: allocate NAME_LEN size for lv name
Zdenek Kabelac [Mon, 12 Dec 2016 23:09:38 +0000 (00:09 +0100)]
cleanup: allocate NAME_LEN size for lv name

7 years agoraid: avoid manipulation of segment status
Zdenek Kabelac [Tue, 13 Dec 2016 13:52:06 +0000 (14:52 +0100)]
raid: avoid manipulation of segment status

RAID is LV property

TODO: only 2 flags are seg->status: PVMOVE & MERGING
At least the second one should be soon elimanted as again
we merge LV not a segment.

7 years agosegtype: check for seg type instead of status
Zdenek Kabelac [Tue, 13 Dec 2016 13:50:48 +0000 (14:50 +0100)]
segtype: check for seg type instead of status

RAID is LV property - which has single segment of raid type.

7 years agoraid: improve table reload sequence
Zdenek Kabelac [Tue, 13 Dec 2016 11:31:28 +0000 (12:31 +0100)]
raid: improve table reload sequence

This is another place for 'common' use pattern or
reload and activation of deleted devices.
(Moving the exclusive activation to _deactivate_and_remove_lvs()).

TODO: looks like halve of raid function is reloading
just 'origin' - and the other full LV.

7 years agolibdm: add min_num_bits to dm_bitset_parse_list()
Bryn M. Reeves [Sun, 11 Dec 2016 22:41:45 +0000 (22:41 +0000)]
libdm: add min_num_bits to dm_bitset_parse_list()

It's useful to be able to specify a minimum number of bits for a
new bitmap parsed from a list, for e.g. to allow for expansing a
group without needing to copy/reallocate the bitmap.

Add a backwards compatible symbol for programs linked against old
versions of the library.

7 years agolibdm: use dm_bit_get_last() in _stats_group_tag_fill()
Bryn M. Reeves [Tue, 13 Dec 2016 10:32:29 +0000 (10:32 +0000)]
libdm: use dm_bit_get_last() in _stats_group_tag_fill()

Instead of iterating over all bits, use dm_bit_get_last() to find
the last set bit in the group bitmap.

7 years agolibdm: add dm_bit_get_last()/dm_bit_get_prev()
Bryn M. Reeves [Sun, 11 Dec 2016 12:44:45 +0000 (12:44 +0000)]
libdm: add dm_bit_get_last()/dm_bit_get_prev()

It is sometimes convenient to iterate over the set bits in a dm
bitset in reverse order (from the highest set bit toward zero), or
to quickly find the last set bit.

Add dm_bit_get_last() and dm_bit_get_prev(), mirroring the existing
dm_bit_get_first() and dm_bit_get_next().

dm_bit_get_prev() uses __builtin_clz when available to efficiently
test the bitset in reverse.

7 years agoutil: add clz() and use __builtin_clz() if available
Bryn M. Reeves [Mon, 12 Dec 2016 12:03:50 +0000 (12:03 +0000)]
util: add clz() and use __builtin_clz() if available

Add a macro for the clz (count leading zeros) operation.

Use the GCC __builtin_clz() for clz() if it is available and fall
back to a shift based implementation on systems that do not set
HAVE___BUILTIN_CLZ.

7 years agoconfigure: check for __builtin_clz()
Bryn M. Reeves [Mon, 12 Dec 2016 12:03:16 +0000 (12:03 +0000)]
configure: check for __builtin_clz()

7 years agolibdm: fix start of file detection in _stats_map_extents()
Bryn M. Reeves [Tue, 13 Dec 2016 18:14:13 +0000 (18:14 +0000)]
libdm: fix start of file detection in _stats_map_extents()

7 years agolibdm: break up _stats_get_extents_for_file()
Bryn M. Reeves [Tue, 13 Dec 2016 12:03:00 +0000 (12:03 +0000)]
libdm: break up _stats_get_extents_for_file()

Split out the loop that iterates over each batch of FIEMAP
extent data from the function that sets up and calls the ioctl
to reduce nesting and simplify local variable use:

  _stats_get_extents_for_file()
  ->  _stats_map_extents()

The _stats_map_extents() function is responsible for detecting
eof and extent boundaries and adding whole, allocated extents
to the file extent table for region creation.

7 years agolibdm: fix dm_stats_foreach_group() macro
Bryn M. Reeves [Tue, 13 Dec 2016 15:32:34 +0000 (15:32 +0000)]
libdm: fix dm_stats_foreach_group() macro

7 years agolibdm: check for non-existent region_id values in groups
Bryn M. Reeves [Tue, 13 Dec 2016 14:31:39 +0000 (14:31 +0000)]
libdm: check for non-existent region_id values in groups

Check that all region_id values specified in a group bitmap are
actually present: although this should not normally happen when
using the dmstats tool, it is possible as a result of manual
changes (or bugs) for a group descriptor to contain one or more
group_id values that do not exist.

Check for this situation when reading group descriptors, warn
the user the user, and clear these bits in the bitmap when
formatting it for output.

7 years agolibdm: fix segfault with invalid group descriptor
Bryn M. Reeves [Tue, 13 Dec 2016 13:56:10 +0000 (13:56 +0000)]
libdm: fix segfault with invalid group descriptor

If a region has a a DMS_GROUP tag in aux_data where the first
region_id in the bitmap is not the same as the containing region,
dmstats will segfault:

  # '2' is never a valid group bitset list for region_id == 0
  # dmsetup message vg_hex/root 0 "@stats_set_aux 0 DMS_GROUP=img:2#"

  # dmsetup message vg_hex/root 0 "@stats_list"
  0: 45383680+16384 16384 dmstats DMS_GROUP=img:2#
  1: 46071808+32768 32768 dmstats -
  2: 47382528+16384 16384 dmstats -

  # dmstats list
  Segmentation fault (core dumped)

The crash will occur in some arbitrary dm_stats_get_* property
method - this happens while processing the 1st region_id in the
bitset, because the region is marked as grouped, but there is
no group bitmap present at dms->groups[2]->regions.

Fix this by detecting a mismatch between the expected region_id
and dm_bit_get_first() for the parsed bitset during
_parse_aux_data_group().

7 years agolibdm: fix region overlap tests
Bryn M. Reeves [Mon, 12 Dec 2016 22:49:31 +0000 (22:49 +0000)]
libdm: fix region overlap tests

7 years agolibdm: fix _stats_get_extents_for_file()
Bryn M. Reeves [Mon, 12 Dec 2016 20:40:27 +0000 (20:40 +0000)]
libdm: fix _stats_get_extents_for_file()

Handle files that contain multiple logical extents in a single
physical extent properly:

  - In FIEMAP terms a logical extent is a contiguous range of
    sectors in the file's address space.

  - One or more physically adjacent logical extents comprise a
    physical extent: these are the disk areas that will be mapped
    to regions.

  - An extent boundary occurs when the start sector of extent
    n+1 is not equal to (n.start + n.length).

This requires that we accumulate the length values of extents
returned by FIEMAP until a discontinuity is found (since each
struct fiemap_extent returned by FIEMAP only represents a single
logical extent, which may be contiguous with other logical
extents on-disk).

This avoids creating large numbers of regions for physically
adjacent (logical) extents and fixes the earlier behaviour which
would only map the first logical extent of the physical extent,
leaving gaps in the region table for these files.

7 years agolvchange: allow a transiently failed RaidLV to be refreshed
Heinz Mauelshagen [Mon, 12 Dec 2016 21:06:17 +0000 (22:06 +0100)]
lvchange: allow a transiently failed RaidLV to be refreshed

Enhance commit 0b8bf73a63d8 to refresh the top-level LV correctly
in case of a clustered, remotely activated RaidLV.

Related: rhbz1399844

7 years agotests: update seg_size_pe
Zdenek Kabelac [Mon, 12 Dec 2016 10:49:26 +0000 (11:49 +0100)]
tests: update seg_size_pe

Default prepare_vg uses 512K - so update test accordingly

7 years agotests: use prepare_vg more often
Zdenek Kabelac [Mon, 12 Dec 2016 10:22:41 +0000 (11:22 +0100)]
tests: use prepare_vg more often

7 years agotests: no left devices check for skipped test
Zdenek Kabelac [Mon, 12 Dec 2016 10:22:10 +0000 (11:22 +0100)]
tests: no left devices check for skipped test

7 years agocov: use unsigned for single bit values
Zdenek Kabelac [Mon, 12 Dec 2016 10:21:42 +0000 (11:21 +0100)]
cov: use unsigned for single bit values

Avoid using signed int.

7 years agotests: track leaked devices in tests
Zdenek Kabelac [Sun, 11 Dec 2016 09:25:15 +0000 (10:25 +0100)]
tests: track leaked devices in tests

When test calls teardown, no devices created by test are expected
to be left in table. Trap such orphans and make the test fail.

7 years agotests: remove unwanted exit
Zdenek Kabelac [Sun, 11 Dec 2016 09:21:26 +0000 (10:21 +0100)]
tests: remove unwanted exit

Exit seemes slipped in from local testing in:
eb6b2a11e3548f7598c726787494be2c3ea4dca1

7 years agotests: remove some leaking device
Zdenek Kabelac [Sun, 11 Dec 2016 09:24:06 +0000 (10:24 +0100)]
tests: remove some leaking device

These tests leaks devices (known bugs).
Remove them via dmsetup.

TODO: fix actual commands

7 years agotests: test should clean devices it has created
Zdenek Kabelac [Sun, 11 Dec 2016 09:18:44 +0000 (10:18 +0100)]
tests: test should clean devices it has created

To be able to detect lvm2 command is not leaking some
'unexpected' device - remove all devices before
test exits by its own command so test teardown
now can check what was 'left' unexpectedly.

7 years agotests: slower device
Zdenek Kabelac [Sat, 10 Dec 2016 14:07:14 +0000 (15:07 +0100)]
tests: slower device

Some of test machines are too fast, slow raid syncing even more.

7 years agocov: declaration matching
Zdenek Kabelac [Fri, 9 Dec 2016 22:10:00 +0000 (23:10 +0100)]
cov: declaration matching

7 years agocov: add internal error for impossible code path
Zdenek Kabelac [Fri, 9 Dec 2016 21:55:25 +0000 (22:55 +0100)]
cov: add internal error for impossible code path

7 years agodebug: missing stack traces
Zdenek Kabelac [Sat, 10 Dec 2016 21:37:34 +0000 (22:37 +0100)]
debug: missing stack traces

7 years agocleanup: use NAME_LEN stack buffer
Zdenek Kabelac [Sun, 11 Dec 2016 11:19:38 +0000 (12:19 +0100)]
cleanup: use NAME_LEN stack buffer

Using NAME_LEN we get at least easy max LV name size validation.
Also code gets more simple.

7 years agocleanup: reuse existing function
Zdenek Kabelac [Sun, 11 Dec 2016 13:31:47 +0000 (14:31 +0100)]
cleanup: reuse existing function

Call lv_update_and_reload implementation.

7 years agolibdm: validate vsnprintf
Zdenek Kabelac [Fri, 9 Dec 2016 21:54:08 +0000 (22:54 +0100)]
libdm: validate vsnprintf

Avoid using buffer when no output has been generated.
Missed in ee13f265f043b47a1b023321fb9e8470fb5703c1.

7 years agopvmove: fix activation order
Zdenek Kabelac [Sun, 11 Dec 2016 13:26:17 +0000 (14:26 +0100)]
pvmove: fix activation order

For proper locking we need to gain lock first for mirror which
needs to be deactivated later to be working in cluster.

7 years agoraid: avoid _ at end of name of extracted metadata LV
Zdenek Kabelac [Sat, 10 Dec 2016 13:51:00 +0000 (14:51 +0100)]
raid: avoid _ at end of name of extracted metadata LV

Do not generate @PREFIX@vg/LV1_rmeta_1_extracted_.

7 years agoraid: optimize clearing of lvs
Zdenek Kabelac [Sat, 10 Dec 2016 19:53:17 +0000 (20:53 +0100)]
raid: optimize clearing of lvs

Activate whole list of metadata lvs first before clearing them.
(Similar to commit ada5733c5652d456ffa138b0d07e6897824813b0)

TODO: make this clearing in a single common function.

7 years agoraid: fix delete on clustered vg
Zdenek Kabelac [Sat, 10 Dec 2016 19:00:32 +0000 (20:00 +0100)]
raid: fix delete on clustered vg

For clustered VG ensure lock is grabbed first,
so later deactivation works.

TODO: fix tree to solve device removal automatically.

7 years agoraid: fix raid1 to mirror conversion
Zdenek Kabelac [Sat, 10 Dec 2016 19:01:05 +0000 (20:01 +0100)]
raid: fix raid1 to mirror conversion

Fix order of operation when converting raid1 into old mirror.
Before any later metadata modification are initiated prepare
mirror_log device with all clearing.
Then directly convert  raid1 into mirror with mirror_log.
This convertion now properly see as precommitted metadata
new 'mirror' and committed old 'raid' and is able to
preload all LVs.

7 years agomirror: add prepare_mirror_log
Zdenek Kabelac [Sat, 10 Dec 2016 18:54:09 +0000 (19:54 +0100)]
mirror: add prepare_mirror_log

Function prepares new mirror log LV in-sync optionaly.
This is useful to have such device ready when converting
raid1 to mirror.

7 years agotest: add results/ to .gitignore
Bryn M. Reeves [Sat, 10 Dec 2016 18:00:25 +0000 (18:00 +0000)]
test: add results/ to .gitignore

7 years agolvmdbusd: add path.py to .gitignore
Bryn M. Reeves [Sat, 10 Dec 2016 17:59:07 +0000 (17:59 +0000)]
lvmdbusd: add path.py to .gitignore

7 years agoscripts: add systemd unit files to .gitignore
Bryn M. Reeves [Sat, 10 Dec 2016 17:58:10 +0000 (17:58 +0000)]
scripts: add systemd unit files to .gitignore

com.redhat.lvmdbus1.service
lvm2_lvmdbusd_systemd_red_hat.service

.gitignore

7 years agoscripts: add lvmdump.sh to .gitignore
Bryn M. Reeves [Sat, 10 Dec 2016 17:56:56 +0000 (17:56 +0000)]
scripts: add lvmdump.sh to .gitignore

7 years agolibdm: fix filemap cleanup loop condition
Bryn M. Reeves [Sat, 10 Dec 2016 13:28:21 +0000 (13:28 +0000)]
libdm: fix filemap cleanup loop condition

7 years agolibdm: use a private pool for filemap extent table
Bryn M. Reeves [Sat, 10 Dec 2016 13:07:03 +0000 (13:07 +0000)]
libdm: use a private pool for filemap extent table

When mapping regions to a file descriptor, a temporary table of
extent descriptors is built using the dm_pool object building
interface.

Previously this use borrowed the dms->mem region and counter
table pool (since nothing can interleave with the allocation
while the caller is still in dm_stats_create_regions_from_fd()).

This turns out to be problematic for error recovery. When a
region creation operation fails partway through file mapping,
we need to roll back the set of already created regions and
this requires a listed handle: the dm_stats_list() will then
allocate from the same pool as the extents; we either have
to throw away valid list data, or leak the extent table, to
return the handle in a valid state.

Avoid this problem by creating a new, temporary mem pool in
_stats_create_file_regions() to hold the extent data, and
discarding it on exit from the function.

7 years agodoc: add filemap creation fixes to WHATS_NEW_DM
Bryn M. Reeves [Sat, 10 Dec 2016 12:02:30 +0000 (12:02 +0000)]
doc: add filemap creation fixes to WHATS_NEW_DM

7 years agolibdm: fix performance of failed filemap cleanup
Bryn M. Reeves [Fri, 9 Dec 2016 23:59:51 +0000 (23:59 +0000)]
libdm: fix performance of failed filemap cleanup

While cleaning up the table of already created regions during a
failed dm_stats_create_regions_from_fd(), list the handle once,
and call _stats_delete_region() directly. This avoids sending a
@stats_list message for each region deleted, reducing runtime
from 6s to 0.7s when cleaning up ~250 out of ~10000 regions:

  # time dmstats create --filemap b.img
  device-mapper: message ioctl on (253:0) failed: Cannot allocate memory
  Failed to create region 246 of 309 at 9388032.
  Could not create regions from file /root/b.img
  << pauses here >>
  Command failed

  real 0m6.267s
  user 0m3.770s
  sys 0m2.487s

  # time dmstats create --filemap b.img
  device-mapper: message ioctl on (253:0) failed: Cannot allocate memory
  Failed to create region 246 of 309 at 9388032.
  Could not create regions from file /root/b.img
  Command failed

  real 0m0.716s
  user 0m0.034s
  sys 0m0.581s

Testing the error path requires region creation to start to
fail part way through the operation (in order to have regions
to clean up): the simplest way is to ensure the system is
close to the kernel limit of 1/4 RAM or 1/2 vmalloc space
consumed by dmstats data.

7 years agolibdm: split off internal _stats_delete_region()
Bryn M. Reeves [Fri, 9 Dec 2016 22:58:25 +0000 (22:58 +0000)]
libdm: split off internal _stats_delete_region()

Split dm_stats_delete_region() so that internal callers can manage
the handle state themselves.

dm_stats_delete_region() now just handles checking the state of the
handle, reporting validation errors, and calling dm_stats_list() if
necessary, before calling _stats_delete_region().

The new _stats_delete_region() function performs the actual group
member removal and region deletion, and requires a fully listed
handle to operate.

Callers that repeatedly delete regions can use a single listed
handle for many operations on the same device, avoiding one
message ioctl per region deleted: since @stats_list with many
regions is expensive, this yields large runtime improvements.

7 years agolvmetad: fix segfault in daemon_reply_simple
David Teigland [Fri, 9 Dec 2016 21:17:53 +0000 (15:17 -0600)]
lvmetad: fix segfault in daemon_reply_simple

missing NULL termination

7 years agolibdm: use correct region_id when cleaning up a failed filemap
Bryn M. Reeves [Fri, 9 Dec 2016 15:50:41 +0000 (15:50 +0000)]
libdm: use correct region_id when cleaning up a failed filemap

If we fail to create a region during dm_stats_create_regions_from_fd(),
we must remove all regions that were created to do this to date. This
needs to loop over the table of region_id values that were populated
by _stats_create_file_regions() before the error.

The code for this failure case in the out_remove branch incorrectly
uses the table index as the region_id:

    for (--i; i != DM_STATS_REGION_NOT_PRESENT; i--) {
            if (!dm_stats_delete_region(dms, i))
                    log_error("Could not delete region " FMTu64 ".", i);
    }

This causes the cleanup code to delete a completely unrelated set
of regions (since the index here will always be nr_regions..0).

Fix it to pass the actual region_id stored in regions[i] instead.

7 years agolibdm-stats: clear dms->groups in _stats_groups_destroy()
Bryn M. Reeves [Fri, 9 Dec 2016 15:49:06 +0000 (15:49 +0000)]
libdm-stats: clear dms->groups in _stats_groups_destroy()

7 years agolibdm-stats: clear dms->regions in _stats_regions_destroy()
Bryn M. Reeves [Fri, 9 Dec 2016 15:47:55 +0000 (15:47 +0000)]
libdm-stats: clear dms->regions in _stats_regions_destroy()

7 years agotests: fix missing exclusive activation
Zdenek Kabelac [Thu, 8 Dec 2016 15:27:24 +0000 (16:27 +0100)]
tests: fix missing exclusive activation

For cluster conversion  LV for caching needs to be activated
exclusively.

7 years agocleanup: zero baton in struct initilizer
Zdenek Kabelac [Fri, 9 Dec 2016 14:08:04 +0000 (15:08 +0100)]
cleanup: zero baton in struct initilizer

7 years agocleanup: easier code for raid plugin
Zdenek Kabelac [Fri, 9 Dec 2016 12:58:19 +0000 (13:58 +0100)]
cleanup: easier code for raid plugin

Set bits only when then were not yet assigned.

7 years agocleanup: messages in raid
Zdenek Kabelac [Fri, 9 Dec 2016 13:27:45 +0000 (14:27 +0100)]
cleanup: messages in raid

Use display_lvname and add 'dots'.
Add some missing WARNING and log_debug_metadata.

7 years agolibdm-stats: fix dm_stats_delete_region() performance
Bryn M. Reeves [Thu, 8 Dec 2016 20:55:47 +0000 (20:55 +0000)]
libdm-stats: fix dm_stats_delete_region() performance

Fix a silly bug in dm_stats_delete_region() that hugely inflates
runtimes when deleting a large number of regions.

For ~50,000 regions this change reduces the runtime from 98s to
6s on my test systems (a ~93% reduction).

The bug exists because dm_stats_delete_region() applies a truth
test to the return value of dm_stats_get_nr_areas(); this is
never correct usage - it will walk the entire region table and
calculate area counts for each region (which is roughly O(n^2)
in the number of regions, as dm_stats_delete_region() is being
called inside a region walk).

Although the individual area calculation is not that costly,
uselessly running anything 2,500,000,000 times over gets a bit
slow.

A much cheaper test (which is always true if the areas check is
true) is to just test dm_stats_get_nr_regions() or dms->regions;
if either is true it implies at least one area exists.

Old:

 Performance counter stats for 'dmstats delete --allregions --alldevices':

      98117.791458      task-clock (msec)         #    1.000 CPUs utilized
               127      context-switches          #    0.001 K/sec
                 3      cpu-migrations            #    0.000 K/sec
             6,631      page-faults               #    0.068 K/sec
   307,711,724,562      cycles                    #    3.136 GHz
   544,762,959,577      instructions              #    1.77  insn per cycle
    84,287,824,115      branches                  #  859.047 M/sec
         2,538,875      branch-misses             #    0.00% of all branches

      98.119578733 seconds time elapsed

New:

 Performance counter stats for 'dmstats delete --allregions --alldevices':

       6427.251074      task-clock (msec)         #    1.000 CPUs utilized
                 6      context-switches          #    0.001 K/sec
                 0      cpu-migrations            #    0.000 K/sec
             6,634      page-faults               #    0.001 M/sec
    21,613,018,724      cycles                    #    3.363 GHz
     3,794,755,445      instructions              #    0.18  insn per cycle
       852,974,026      branches                  #  132.712 M/sec
           808,625      branch-misses             #    0.09% of all branches

       6.428953647 seconds time elapsed

7 years agotests: more snaps
Zdenek Kabelac [Sun, 4 Dec 2016 21:27:57 +0000 (22:27 +0100)]
tests: more snaps

Check lvs reports 'origin' not openned.

7 years agotests: apostrof
Zdenek Kabelac [Mon, 28 Nov 2016 16:36:43 +0000 (17:36 +0100)]
tests: apostrof

7 years agotests: check we recognize broken table entry
Zdenek Kabelac [Thu, 1 Dec 2016 09:45:37 +0000 (10:45 +0100)]
tests: check we recognize broken table entry

One (initial) test to recognize we see a mismatching
table entry for cache LV.

7 years agodebug: add missing backtrace
Zdenek Kabelac [Sun, 4 Dec 2016 21:29:18 +0000 (22:29 +0100)]
debug: add missing backtrace

7 years agocleanup: simplier code
Zdenek Kabelac [Thu, 1 Dec 2016 13:59:02 +0000 (14:59 +0100)]
cleanup: simplier code

7 years agocleanup: indent and messsages updates
Zdenek Kabelac [Thu, 1 Dec 2016 13:53:35 +0000 (14:53 +0100)]
cleanup: indent and messsages updates

7 years agocleanup: simplify code
Zdenek Kabelac [Mon, 5 Dec 2016 13:30:13 +0000 (14:30 +0100)]
cleanup: simplify code

Drop unneeded assignemnt in structs (var is set by called function).

7 years agodev_manager: use setup_task_run for mknod
Zdenek Kabelac [Fri, 2 Dec 2016 12:46:47 +0000 (13:46 +0100)]
dev_manager: use setup_task_run for mknod

Simplify info run for use only for INFO & STATUS.
Drop handling MKNODES within _info_run() call
and use more advanced _setup_task_run() directly.

This allows to further simplify _info_run().

7 years agodev_manager: extend setup_task
Zdenek Kabelac [Thu, 1 Dec 2016 13:56:32 +0000 (14:56 +0100)]
dev_manager: extend setup_task

Integrate also query for inactive table and
handle dm_task_run() and dm_task_get_info()
(thus switching to setup_task_run)

Add one exception case for DM_DEVICE_TARGET_MSG.

This allows further shortening and simplification of all
other users of this function.

7 years agoactivation: optimize away lv_has_target_type
Zdenek Kabelac [Mon, 5 Dec 2016 14:23:18 +0000 (15:23 +0100)]
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.

7 years agoactivation: lv_info_with_seg_status API change
Zdenek Kabelac [Mon, 5 Dec 2016 13:31:25 +0000 (14:31 +0100)]
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

7 years agoactivation: lv_info_with_seg_status unify status selection
Zdenek Kabelac [Mon, 5 Dec 2016 09:20:42 +0000 (10:20 +0100)]
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.

7 years agocleanup: swap test order
Zdenek Kabelac [Wed, 30 Nov 2016 12:43:43 +0000 (13:43 +0100)]
cleanup: swap test order

Check for lv != lvseg->lv.
Make the logic of following patches look better and easier to read.

7 years agoactivation: improve error handling for status reading
Zdenek Kabelac [Thu, 1 Dec 2016 09:37:03 +0000 (10:37 +0100)]
activation: improve error handling for status reading

When lvm2 wants to see a status, it needs to validate,
segment for status reading is matching whan lvm2 expects in
metadata.

Also ensure status failure will not cause '0' from info reading
when actual info was collected properly.
Failure in 'status' reading is considered to be
a 'log_warn()' event only.

7 years agoactivation: status check switch to warn
Zdenek Kabelac [Fri, 2 Dec 2016 12:57:52 +0000 (13:57 +0100)]
activation: status check switch to warn

When we can't parse status, switch to warning as this is not
considered an errornous case.  LVS is not supposed to return
error status code when  device is not what it's been expected to
be - but it should be WARNING a user there is something unexpected.

7 years agolv: always check status type
Zdenek Kabelac [Thu, 1 Dec 2016 09:43:55 +0000 (10:43 +0100)]
lv: always check status type

Always validate status type has an expected value,
before accessing status struct members.

7 years agostriped: implement compatible target name
Zdenek Kabelac [Thu, 1 Dec 2016 15:09:53 +0000 (16:09 +0100)]
striped: implement compatible target name

Linear is handled by striped target.

7 years agosnapshot: reporting uses statusinfo
Zdenek Kabelac [Thu, 1 Dec 2016 16:58:06 +0000 (17:58 +0100)]
snapshot: reporting uses statusinfo

Convert lvs -o lv_merge_failed,lv_snapshot_invalid to use
lv_info_and_status function.

This makes it equal to attr value showing this info
(as they were different since they were derived from
different data set and different logic as well).

Also saves couple extra ioctl that were needed to obtain this info.

7 years agoreport: order fields by type for field defintions in columns.h
Peter Rajnoha [Thu, 1 Dec 2016 13:39:21 +0000 (14:39 +0100)]
report: order fields by type for field defintions in columns.h

When displaying <reporting_command> -o help, we'd like to have fields
grouped nicely, not starting having groups interleaved as it was before.
The code that displays the help output for fields takes the order as
written in columns.h file - this caused output like:

$ lvs -o help

Logical Volume Fields
---------------------
...field list...

Logical Volume Device Info and Status Combined Fields
-----------------------------------------------------
...field list...

Logical Volume Fields
---------------------
...field list...

Logical Volume Device Status Fields
-----------------------------------
...field list...

Logical Volume Fields
---------------------
...field list...

Instead, let's have it without groups interleaved which may be
a bit confusing, so:

Logical Volume Fields
---------------------
...field list...

Logical Volume Device Status Fields
-----------------------------------
...field list...

Logical Volume Device Info and Status Combined Fields
-----------------------------------------------------
...field list...

..and so on.

7 years agopost-release
Alasdair G Kergon [Wed, 30 Nov 2016 23:21:11 +0000 (23:21 +0000)]
post-release

7 years agopre-release v2_02_168
Alasdair G Kergon [Wed, 30 Nov 2016 23:14:34 +0000 (23:14 +0000)]
pre-release

7 years agoraid: fix sync percent on large RaidLVs
Heinz Mauelshagen [Wed, 30 Nov 2016 23:00:02 +0000 (00:00 +0100)]
raid: fix sync percent on large RaidLVs

Resolves: rhbz1400301

7 years agolvmdbusd: Only allow 0..N for --blackboxsize argument
Tony Asleson [Wed, 30 Nov 2016 22:45:50 +0000 (16:45 -0600)]
lvmdbusd: Only allow 0..N for --blackboxsize argument

7 years agoWHATS_NEW: New argument --blackboxsize
Tony Asleson [Wed, 30 Nov 2016 22:40:49 +0000 (16:40 -0600)]
WHATS_NEW: New argument --blackboxsize

7 years agoWHATS_NEW: Allow a transiently failed RaidLV to be refreshed
Heinz Mauelshagen [Wed, 30 Nov 2016 22:17:21 +0000 (23:17 +0100)]
WHATS_NEW: Allow a transiently failed RaidLV to be refreshed

7 years agolvmdbustest.py: Rename env test variable
Tony Asleson [Wed, 30 Nov 2016 20:58:29 +0000 (14:58 -0600)]
lvmdbustest.py: Rename env test variable

Use LVM_DBUSD_TEST_MODE env variable to customize what we test.
Default is the same where we try to test all combinations of all
modes.  Renamed to make it consistent with the other env variables
that are used in the unit test.

7 years agolvmdbustest.py: Remove redundant import
Tony Asleson [Wed, 30 Nov 2016 20:54:39 +0000 (14:54 -0600)]
lvmdbustest.py: Remove redundant import

7 years agolvmdbustest.py: Remove outdated TODOs
Tony Asleson [Wed, 30 Nov 2016 20:51:20 +0000 (14:51 -0600)]
lvmdbustest.py: Remove outdated TODOs

- We check that all properties match the introspection data.  We
don't verify values for every property as only lvm knows what they
should be.

- We are testing vg.Move

7 years agolvmdbustest.py: Re-enable test_vg_uuid_gen
Tony Asleson [Wed, 30 Nov 2016 20:16:59 +0000 (14:16 -0600)]
lvmdbustest.py: Re-enable test_vg_uuid_gen

This looks to be working now, not sure when it was resolved.

7 years agolvmdbusd: Emit signal on Job completion
Tony Asleson [Wed, 30 Nov 2016 19:39:48 +0000 (13:39 -0600)]
lvmdbusd: Emit signal on Job completion

Added a properties changed signal on the job dbus object so that client
can wait for a signal that the job is complete instead of polling or
blocking on the wait method.

7 years agolvmdbusd: Remove TODO on concurrent access to properties
Tony Asleson [Wed, 30 Nov 2016 19:03:25 +0000 (13:03 -0600)]
lvmdbusd: Remove TODO on concurrent access to properties

As the code now uses a single thread to handle all changes to the
dbus model we no longer need to handle this potential race
condition.

7 years agolvmdbusd: Supress protected member access warning
Tony Asleson [Wed, 30 Nov 2016 18:59:46 +0000 (12:59 -0600)]
lvmdbusd: Supress protected member access warning

We want _run to be protected so that users outside of the class
don't mistakenly use it.  It's for internal use only.

7 years agolvmdbusd: Add --blackboxsize command line argument
Tony Asleson [Wed, 30 Nov 2016 00:01:56 +0000 (18:01 -0600)]
lvmdbusd: Add --blackboxsize command line argument

Allows the user to override the number of commands that get dumped
to the log when we encounter a lvm error.  Also useful during
development when you don't want to see the blackbox output.

7 years agolvmdbusd: Remove unused variable
Tony Asleson [Tue, 29 Nov 2016 23:02:53 +0000 (17:02 -0600)]
lvmdbusd: Remove unused variable

This variable has been un-used for a long time.

7 years agolvchange: allow a transiently failed RaidLV to be refreshed
Heinz Mauelshagen [Wed, 30 Nov 2016 21:56:37 +0000 (22:56 +0100)]
lvchange: allow a transiently failed RaidLV to be refreshed

In case any SubLV of a RaidLV transiently fails, it needs
two "lvchange --refresh RaidLV" runs to get it to fully
operational mode again.  Reason being, that lvm reloads all
targets for the RaidLV tree but doesn't resume the SubLVs
until after the whole tree has been reloaded in the first
refresh run.  Thus the live mapping table of the SubLVs
still point to an "error" mapping and the dm-raid target
can't retrieve any superblock from the MetaLV(s) in processing
the constructor during this preload thus not discovering the
again accessible SubLVs.  In the second run, the SubLV targets
map proper (meta)data, hence the constructor discovers those
fine now.

Solve by resuming the SubLVs of the RaidLV before
preloading the respective top-level RaidLV target.

Resolves: rhbz1399844

7 years agolvmdbusd: Remove debug log_error
Tony Asleson [Tue, 29 Nov 2016 21:02:52 +0000 (15:02 -0600)]
lvmdbusd: Remove debug log_error

7 years agolvmdbusd: WS fix
Tony Asleson [Tue, 29 Nov 2016 21:01:41 +0000 (15:01 -0600)]
lvmdbusd: WS fix

7 years agolvmdbusd: Simplfy reading streams
Tony Asleson [Tue, 29 Nov 2016 18:37:59 +0000 (12:37 -0600)]
lvmdbusd: Simplfy reading streams

Remove redundant code and make code paths the same for all streams.

7 years agolvmdbusd: Make lvm shell read more robust
Tony Asleson [Tue, 29 Nov 2016 17:07:21 +0000 (11:07 -0600)]
lvmdbusd: Make lvm shell read more robust

Make sure JSON is correct before we stop trying to read.

7 years agotests: ensure there is dbus config file
Zdenek Kabelac [Fri, 25 Nov 2016 23:17:40 +0000 (00:17 +0100)]
tests: ensure there is dbus config file

Copy lvmdbusd.profile to lib as installed place.
Use  TESTOLDPWD and avoid add new 'same' variable test_data_dir.

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