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

10262 Commits

Author SHA1 Message Date
Peter Rajnoha
cc755853c2 config: fix version of introduction for devices/external_device_info_source (v115->v116) 2015-02-12 09:30:40 +01:00
Peter Rajnoha
54c2e9859f tests: add select-tools.sh to test selection support in toollib
Tests for selection within non-reporting tools while using process_each_* fns.
2015-02-11 18:39:47 +01:00
Peter Rajnoha
599cb41f99 tests: rename report-select.sh to select-report.sh
Let's name all selection-related tests with the "select-" prefix for
better sorting.
2015-02-11 16:17:05 +01:00
Peter Rajnoha
263f7831df report: define ba_start, vg_free and seg_start fields as DM_REPORT_FIELD_TYPE_SIZE instead of DM_REPORT_FIELD_TYPE_NUM
This makes a difference when using selection criteria based on
these fields - if those fields are defined as DM_REPORT_FIELD_TYPE_SIZE
(in contrast to DM_REPORT_FIELD_TYPE_NUMBER), units are also
recognize in selection clause.

For example:
$ lvs -o+seg_start vg1/lv2
  LV   VG   Attr       LSize  Start
  lv2  vg1  -wi-a----- 12.00m    0
  lv2  vg1  -wi-a----- 12.00m 8.00m

Before this patch:
$ lvs -o+seg_start --select 'seg_start=8m'
  Found size unit specifier but numeric value expected for selection field seg_start.
  Selection syntax error at 'seg_start=8m'.
  Use 'help' for selection to get more help.

With this patch applied:
$lvs -o+seg_start --select 'seg_start=8m'
  LV   VG   Attr       LSize  Start
  lv2  vg1  -wi-a----- 12.00m 8.00m

(the same applies for ba_start and vg_free fields)
2015-02-11 13:57:18 +01:00
Peter Rajnoha
b88b75f55f conf: update profile templates for recent changes 2015-02-11 13:22:31 +01:00
Peter Rajnoha
437b17964c man: reference -S/--select in {vg,lv,pv}change, {vg,lv}remove, {vg,lv,pv}display and vg{import,export} man pages 2015-02-11 10:04:21 +01:00
Peter Rajnoha
bc1bb7f8c5 toollib: select: issue an error message for failed VG/LV/PV selection 2015-02-11 09:36:09 +01:00
Peter Rajnoha
3505e88b18 man: dumpconfig: mention LVM_COMMAND_PROFILE env var and add more references to --mergedconfig option
The LVM_COMMAND_PROFILE env var is new - mention it in dumpconfig's
man page.

Also, dumpconfig always displays the top of the config cascade.
To display all the config found in the cascade merged (just like
it's used during LVM command processing), --mergedconfig option
must be used - this one's already described in that man page,
just make sure it's clear and add reference for this option also
in --profile/--commandprofile/--metadataprofile description.
2015-02-11 09:34:19 +01:00
Petr Rockai
801e47e089 NIX: Drop Fedora 16 builds. 2015-02-10 17:27:10 +01:00
Petr Rockai
79dc8f5ddd NIX: Adjust lists of extra RPMs to install. 2015-02-10 17:27:10 +01:00
Marian Csontos
a8b45b7a4c test: Fix harness not building on RHEL5 2015-02-10 17:02:01 +01:00
Peter Rajnoha
7f2eebf519 select: initialize selection handle for process_each_* fns with initial report type
This is a followup patch for previous patchset that enables selection in
process_each_* fns to fix an issue where field prefixes are not
automatically used for fields in selection criteria.

Use initial report type that matches the intention of each process_each_* functions:
- _process_pvs_in_vg - PVS
- process_each_vg - VGS
- process_each_lv and process_each_lv_in_vg - LVS

This is not normally needed for the selection handle init, BUT we would
miss the field prefix matching, e.g.

lvchange -ay -S 'name=lvol0'

The "name" above would not work if we didn't initialize reporting with
the LVS type at its start. If we pass proper init type, reporting code
can deduce the prefix automatically ("lv_name" in this case).

This report type is then changed further based on what selection criteria we
have. When doing pure selection, not report output, the final report type
is purely based on combination of this initial report type and report types
of the fields used in selection criteria.
2015-02-10 16:10:17 +01:00
Peter Rajnoha
80cca53611 tools: allow -S|--select for vgexport and vgimport 2015-02-10 16:10:17 +01:00
Peter Rajnoha
b93f586954 tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C
We already allowed -S|--select with {vg,lv,pv}display -C (which
was then equal to {vg,lv,pv}s command. Since we support selection
in toolib now, we can support -S also without using -C in *display
commands now.
2015-02-10 16:09:40 +01:00
Peter Rajnoha
00744b053f tools: allow -S|--select for vgremove and lvremove 2015-02-10 16:08:42 +01:00
Peter Rajnoha
f784c60cd6 tools: allow -S|--select for vgchange, lvchange and pvchange 2015-02-10 16:08:04 +01:00
Peter Rajnoha
d6c8f0de28 pvchange: use processing_handle when processing items for pvchange
pvchange is an exception that does not use toollib yet for iterating
over the list of PVs (process_each_pv) so intialize the
processing_handle and use just like it's used in toollib.
2015-02-10 16:07:01 +01:00
Peter Rajnoha
56846d7873 report: implement report_for_selection
We have 3 input report types:
  - LVS (representing "_select_match_lv")
  - VGS (representing "_select_match_vg")
  - PVS (representing "_select_match_pv")

The input report type is saved in struct selection_handle's "orig_report_type"
 variable.

However, users can use any combination of fields of different report types in
selection criteria - the resulting report type can thus differ. The struct
selection_handle's "report_type" variable stores this resulting report type.

The resulting report_type can end up as one of:
  - LVS
  - VGS
  - PVS
  - SEGS
  - PVSEGS

This patch adds logic to report_for_selection based on (sensible) combination
of orig_report_type and report_type and calls appropriate reporting functions
or iterates over multiple items that need reporting to determine the selection
result.
2015-02-10 16:06:53 +01:00
Peter Rajnoha
984ae7f72d report: add report_for_selection and use it in select_match_{pv,vg,lv}
The report_for_selection does the actual "reporting for selection only".
The selection status will be saved in struct selection_handle's "selected"
variable.
2015-02-10 16:05:36 +01:00
Peter Rajnoha
e5b345aff3 refactor: report: factor out code to determine final report type
The code to determine final report type based on combination of input
report type (determined from fields used for reporting to output and selection)
can be reused for pure reporting for selection - factor out this code into
_get_final_report_type function.
2015-02-10 16:05:35 +01:00
Peter Rajnoha
de27324711 toollib: select the whole structure if at least one of its items is selected
This applies to:
  - process_each_lv_in_vg - the VG is selected only if at least one of its LVs is selected
  - process_each_segment_in_lv - the LV is selected only if at least one of its LV segments is selected
  - process_each_pv_in_vg - the VG is selected only if at least one of its PVs is selected
  - process_each_segment_in_pv - the PV is selected only if at least one of its PV segments is selected

So this patch causes the selection result to be properly propagated up to callers.
2015-02-10 16:05:32 +01:00
Peter Rajnoha
56011918e6 toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns
Call _init_processing_handle, _init_selection_handle and
_destroy_processing_handle in process_each_* and related functions to
set up and destroy handles used while processing items.
2015-02-10 16:05:29 +01:00
Peter Rajnoha
a91bc7a19b toollib: add init_processing_handle, init_selection_handle and destroy_processing_handle helper functions
The init_processing_handle, init_selection_handle and
destroy_processing_handle are helper functions that allocate and
initialize the handles used when processing items in process_each_*
and related functions.
2015-02-10 16:05:27 +01:00
Peter Rajnoha
c3180c4a05 toollib: pass struct processing_handle to _select_match_* functions
The "struct processing_handle" contains handles to drive the selection/matching
so pass it to the _select_match_* functions which are entry points to the
selection mechanism used in process_each_* and related functions.

This is revised and edited version of former Dave Teigland's patch which
provided starting point for all the select support in process_each_* fns.
2015-02-10 16:05:26 +01:00
Peter Rajnoha
a64b39aef8 report: add report_init_for_selection fn and modify report_object to support reporting for selection only
The new "report_init_for_selection" is just a wrapper over
dm_report_init_with_selection that initializes reporting for selection
only. This means we're not going to do the actual reporting to output
for display and as such we intialize reporting as if no fields are reported
or sorted. The only fields "reported" are taken from the selection criteria
string and all such fields are marked as hidden automatically (FLD_HIDDEN flag).
These fields are used solely for selection criteria matching.

Also, modify existing report_object function that was used for reporting to
output for display. Now, it can either cause reporting to output or reporting
for selection only. The selection result is stored in struct selection_handle's
"selected" variable which can be handled further by any report_object caller.
2015-02-10 16:05:25 +01:00
Peter Rajnoha
51d96a1703 toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related)
This patch replaces "void *handle" with "struct processing_handle *handle"
in process_each_*, process_single_* and related functions.

The struct processing_handle consists of two handles inside now:

  - the "struct selection_handle *selection_handle" used for
    applying selection criteria while processing process_each_*,
    process_single_* and related functions (patches using this
    logic will follow)

  - the "void* custom_handle" (this is actually the original handle
    used before this patch - a pointer to custom data passed into
    process_each_*, process_single_* and related functions).
2015-02-10 16:05:24 +01:00
Peter Rajnoha
2a19866a74 cleanup: make report type condition consistent with the rest of the code
It's just more readable this way (each condition resulting in a certain
report type is always on one line), just like it's used elsewhere in the
code.
2015-02-10 16:05:23 +01:00
David Teigland
455ef6f2f5 toollib: prepare select_match_{pv,vg,lv} hooks
These hooks will check currently processed PV/VG/LV with current selection
criteria and the processing continues only if there's a match.
2015-02-10 16:04:41 +01:00
Peter Rajnoha
123a3383a0 libdm: report: add dm_report_object_is_selected
The new dm_report_object_is_selected fn makes it possible to opt whether the
object reported should be displayed on output or not. Also, in addition to
that, it makes it possible to save the result of selection (either 0 or 1).

So dm_report_object_is_selected is simply  more general form of object
reporting fn - combinations now allow for:

  dm_report_object_is_selected(rh, object, 1, NULL):
  This is exactly the original dm_report_object fn and it's fully equal
  to it.

  dm_report_object_is_selected(rh, object, 0, selected):
  Do not display the result on output, but save info whether the object
  is selected or not in 'selected' variable.

  dm_report_object_is_selected(rh, object, 1, selected):
  Display the result on output (if it passes selection criteria) and save
  whether the object is selected or not in 'selected' variable.

  dm_report_object(rh, object, 0, NULL):
  This combination is not allowed - it will end up with internal error.
  We're either interested in selection status or we want to display the
  result on output or both, but never nothing of the two.
2015-02-10 16:04:38 +01:00
Petr Rockai
2ee3bcb877 test: Fix a typo in shell/pvmove-restart.sh. 2015-02-10 12:42:05 +01:00
Peter Rajnoha
b6f558adcc lvm: recognize LVM_COMMAND_PROFILE env var for default command profile to use in LVM commands
Once LVM_COMMAND_PROFILE environment variable is specified, the profile
referenced is used just like it was specified using "<lvm command> --commandprofile".
If both --commandprofile cmd line option and LVM_COMMAND_PROFILE env
var is used, the --commandprofile cmd line option gets preference.
2015-02-09 14:16:30 +01:00
Peter Rajnoha
4e4ea46cfe reporter: properly check for _do_info_and_status return value and free the mempool if created within the fn 2015-02-09 11:48:21 +01:00
Petr Rockai
4065741a67 configure: Fix a warning about test/Makefile.in. 2015-02-05 16:30:50 +01:00
Petr Rockai
43d6b44a9f NIX: Request {fedora,centos}-release packages explicitly. 2015-02-05 14:21:31 +01:00
Petr Rockai
b9a017d94c NIX: Adjust install_rpms (kernel rpm is now required). 2015-02-05 13:51:39 +01:00
Petr Rockai
81b34dce61 NIX: We need to install lcov for ./configure now as well. 2015-02-05 13:51:38 +01:00
Petr Rockai
5cd6cce5a4 NIX: Move corosynclib-devel & valgrind-devel out of common. 2015-02-05 13:51:37 +01:00
Petr Rockai
57c39ecbcd NIX: Allow adding/overriding test configurations. 2015-02-05 13:51:07 +01:00
Petr Rockai
7c9d690f9e NIX: Set ulimit -c to unlimited, to get backtraces in logs. 2015-02-05 13:51:07 +01:00
Petr Rockai
6ba05212f7 NIX: Add a CentOS 7.0 64b build. 2015-02-05 13:51:06 +01:00
Petr Rockai
4686b8cea5 test: Fix a segfault in the test runner. 2015-02-05 13:51:06 +01:00
Petr Rockai
45e2aee8f9 test: It is not an error for a test daemon to exit before teardown. 2015-02-05 13:51:06 +01:00
Petr Rockai
78ba413ed1 test: Remove spurious set -x in lvm-wrapper. 2015-02-05 13:51:06 +01:00
Petr Rockai
d8983d4bd4 test: Properly detect warnings from testcases. 2015-02-05 13:51:06 +01:00
Petr Rockai
c96e42006d test: Only force an IO sync when the testcase has finished. 2015-02-05 13:51:06 +01:00
Petr Rockai
72ee3f920b test: Allow a longer timeout for lvextend-snapshot-dmeventd. 2015-02-05 13:51:06 +01:00
Petr Rockai
839ea48aa9 test: Make dmsetup remove more robust in pvmove-restart. 2015-02-05 13:51:06 +01:00
Petr Rockai
210a66fbf8 test: Make killing local (test) daemons more robust. 2015-02-05 13:51:06 +01:00
Petr Rockai
17575403d4 test: Disable lvmetad debug log on another bunch of tests. 2015-02-05 13:51:06 +01:00
Petr Rockai
1f727f3f3d test: Call $VALGRIND directly in lvm-wrapper. 2015-02-05 13:51:06 +01:00