1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

13363 Commits

Author SHA1 Message Date
Bryn M. Reeves
97c4490cc5 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.
2016-12-10 11:57:14 +00:00
David Teigland
c459f23565 lvmetad: fix segfault in daemon_reply_simple
missing NULL termination
2016-12-09 15:22:30 -06:00
Bryn M. Reeves
30ad254d84 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.
2016-12-09 16:04:13 +00:00
Bryn M. Reeves
7fd2fa22dd libdm-stats: clear dms->groups in _stats_groups_destroy() 2016-12-09 16:04:13 +00:00
Bryn M. Reeves
cb8c04760f libdm-stats: clear dms->regions in _stats_regions_destroy() 2016-12-09 16:04:13 +00:00
Zdenek Kabelac
900d203586 tests: fix missing exclusive activation
For cluster conversion  LV for caching needs to be activated
exclusively.
2016-12-09 15:15:02 +01:00
Zdenek Kabelac
c5aeb21015 cleanup: zero baton in struct initilizer 2016-12-09 15:15:02 +01:00
Zdenek Kabelac
f9c6c115d3 cleanup: easier code for raid plugin
Set bits only when then were not yet assigned.
2016-12-09 15:15:02 +01:00
Zdenek Kabelac
15e4ab3e93 cleanup: messages in raid
Use display_lvname and add 'dots'.
Add some missing WARNING and log_debug_metadata.
2016-12-09 15:15:02 +01:00
Bryn M. Reeves
6dd0bd0255 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
2016-12-09 10:55:39 +00:00
Zdenek Kabelac
0ce9ae3cda tests: more snaps
Check lvs reports 'origin' not openned.
2016-12-05 17:12:42 +01:00
Zdenek Kabelac
3f6ade4b0d tests: apostrof 2016-12-05 17:12:42 +01:00
Zdenek Kabelac
022d3af068 tests: check we recognize broken table entry
One (initial) test to recognize we see a mismatching
table entry for cache LV.
2016-12-05 17:12:42 +01:00
Zdenek Kabelac
36b211b464 debug: add missing backtrace 2016-12-05 17:12:42 +01:00
Zdenek Kabelac
3331199cc9 cleanup: simplier code 2016-12-05 17:12:42 +01:00
Zdenek Kabelac
81ef4eb4f8 cleanup: indent and messsages updates 2016-12-05 17:12:42 +01:00
Zdenek Kabelac
69c79ed2f4 cleanup: simplify code
Drop unneeded assignemnt in structs (var is set by called function).
2016-12-05 17:12:42 +01:00
Zdenek Kabelac
114f7e6285 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().
2016-12-05 17:12:39 +01:00
Zdenek Kabelac
5163b8f697 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.
2016-12-05 17:11:49 +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
5ba2d58d28 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.
2016-12-05 17:05:17 +01:00
Zdenek Kabelac
4a4b22e114 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.
2016-12-05 17:04:24 +01:00
Zdenek Kabelac
325c2c5687 lv: always check status type
Always validate status type has an expected value,
before accessing status struct members.
2016-12-05 17:03:38 +01:00
Zdenek Kabelac
6a450952ad striped: implement compatible target name
Linear is handled by striped target.
2016-12-05 17:02:01 +01:00
Zdenek Kabelac
254f73e3ef 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.
2016-12-05 17:01:15 +01:00
Peter Rajnoha
07f9889b53 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.
2016-12-01 14:55:29 +01:00
Alasdair G Kergon
bb5eb324e3 post-release 2016-11-30 23:21:11 +00:00
Alasdair G Kergon
57e24817b7 pre-release 2016-11-30 23:14:34 +00:00
Heinz Mauelshagen
745250073c raid: fix sync percent on large RaidLVs
Resolves: rhbz1400301
2016-12-01 00:00:02 +01:00
Tony Asleson
c9848bb7ea lvmdbusd: Only allow 0..N for --blackboxsize argument 2016-11-30 16:47:39 -06:00
Tony Asleson
c0a508cfab WHATS_NEW: New argument --blackboxsize 2016-11-30 16:47:31 -06:00
Heinz Mauelshagen
5da10fda4c WHATS_NEW: Allow a transiently failed RaidLV to be refreshed 2016-11-30 23:17:21 +01:00
Tony Asleson
ad7fd775f2 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.
2016-11-30 15:59:06 -06:00
Tony Asleson
ea2eb2df97 lvmdbustest.py: Remove redundant import 2016-11-30 15:59:06 -06:00
Tony Asleson
b75d1a591c 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
2016-11-30 15:59:06 -06:00
Tony Asleson
bb845cab76 lvmdbustest.py: Re-enable test_vg_uuid_gen
This looks to be working now, not sure when it was resolved.
2016-11-30 15:59:06 -06:00
Tony Asleson
53ef496719 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.
2016-11-30 15:59:06 -06:00
Tony Asleson
1d52090953 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.
2016-11-30 15:59:06 -06:00
Tony Asleson
37f05ccab1 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.
2016-11-30 15:59:06 -06:00
Tony Asleson
3bc69cb23c 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.
2016-11-30 15:59:06 -06:00
Tony Asleson
b0757ac96e lvmdbusd: Remove unused variable
This variable has been un-used for a long time.
2016-11-30 15:59:06 -06:00
Heinz Mauelshagen
0b8bf73a63 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
2016-11-30 22:57:54 +01:00
Tony Asleson
58f4d98af1 lvmdbusd: Remove debug log_error 2016-11-29 16:50:30 -06:00
Tony Asleson
617a819abc lvmdbusd: WS fix 2016-11-29 16:50:30 -06:00
Tony Asleson
d882edb32d lvmdbusd: Simplfy reading streams
Remove redundant code and make code paths the same for all streams.
2016-11-29 16:50:30 -06:00
Tony Asleson
25b5413f89 lvmdbusd: Make lvm shell read more robust
Make sure JSON is correct before we stop trying to read.
2016-11-29 16:50:30 -06:00
Zdenek Kabelac
b0bda09005 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.
2016-11-26 00:22:38 +01:00