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

10847 Commits

Author SHA1 Message Date
Zdenek Kabelac
244ca7ee77 tests: minimize teardown when uneeded
If test has not yet initilized any device,
make teardown a bit faster.
2015-04-29 15:09:58 +02:00
Zdenek Kabelac
c5b4327f3d tests: bash-fu for lvmconf
Sqeeze about 0.1s out of every created conf and use internal
bash associative arrays instead of lot of command forking
2015-04-29 15:09:58 +02:00
Zdenek Kabelac
923902013c lvmetad: drop unused vars
Squash some unused vars introduced in some previous commit.s
2015-04-29 15:09:58 +02:00
bkabrda@redhat.com
5d8b31ffad python: python 3 compat patch for lvm2
As provided by rhbz: 1136366
2015-04-29 15:09:56 +02:00
Petr Rockai
4946c64092 lvmetad: Avoid duplicate entries in the list of alternate devices. 2015-04-29 13:23:23 +02:00
Peter Rajnoha
3be3eb2995 lvmconfig: add --type list and -l|--list
lvmconfig --type list displays plain list of configuration settings.
Some of the existing decorations can be used (--withsummary and
--withversions) as well as existing options/switches (--ignoreadvanced,
--ignoreunsupported, --ignorelocal, --atversion).

For example (displaying only "config" section so the list is not long):

$lvmconfig --type list config
config/checks
config/abort_on_errors
config/profile_dir

$ lvmconfig --type list --withsummary config
config/checks - If enabled, any LVM configuration mismatch is reported.
config/abort_on_errors - Abort the LVM process if a configuration mismatch is found.
config/profile_dir - Directory where LVM looks for configuration profiles.

$ lvmconfig -l config
config/checks - If enabled, any LVM configuration mismatch is reported.
config/abort_on_errors - Abort the LVM process if a configuration mismatch is found.
config/profile_dir - Directory where LVM looks for configuration profiles.

$ lvmconfig --type list --withsummary --withversions config
config/checks - If enabled, any LVM configuration mismatch is reported. [2.2.99]
config/abort_on_errors - Abort the LVM process if a configuration mismatch is found. [2.2.99]
config/profile_dir - Directory where LVM looks for configuration profiles. [2.2.99]

Example with --atversion (displaying global section):

$ lvmconfig --type list global
global/umask
global/test
global/units
global/si_unit_consistency
global/suffix
global/activation
global/fallback_to_lvm1
global/format
global/format_libraries
global/segment_libraries
global/proc
global/etc
global/locking_type
global/wait_for_locks
global/fallback_to_clustered_locking
global/fallback_to_local_locking
global/locking_dir
global/prioritise_write_locks
global/library_dir
global/locking_library
global/abort_on_internal_errors
global/detect_internal_vg_cache_corruption
global/metadata_read_only
global/mirror_segtype_default
global/raid10_segtype_default
global/sparse_segtype_default
global/lvdisplay_shows_full_device_path
global/use_lvmetad
global/thin_check_executable
global/thin_dump_executable
global/thin_repair_executable
global/thin_check_options
global/thin_repair_options
global/thin_disabled_features
global/cache_check_executable
global/cache_dump_executable
global/cache_repair_executable
global/cache_check_options
global/cache_repair_options
global/system_id_source
global/system_id_file

$ lvmconfig --type list global --atversion 2.2.50
global/umask
global/test
global/units
global/suffix
global/activation
global/fallback_to_lvm1
global/format
global/format_libraries
global/segment_libraries
global/proc
global/locking_type
global/wait_for_locks
global/fallback_to_clustered_locking
global/fallback_to_local_locking
global/locking_dir
global/library_dir
global/locking_library
2015-04-29 11:58:14 +02:00
Peter Rajnoha
0ba332e82a refactor: dumpconfig: keep --withcomments to display full comment and use --withsummary for one line summary 2015-04-29 11:14:18 +02:00
Ondrej Kozina
15a563c376 polldaemon: remove redundant log messages
also alter comments describing the change in _poll_vg
wrt correct handling of multiple LVs
2015-04-28 23:19:20 +02:00
Ondrej Kozina
ea5c1b0a73 pvmove: make log messages more comprehensible
clarify messages printed during pvmove set up (in
_update_metadata fn) and subsequent metadata updates
during a segment progression
2015-04-28 22:45:54 +02:00
Ondrej Kozina
a1474b98f9 update copyright info in various files
basically transfer former date ranges from files where
the code originated from (pvmove.c and lvconvert.c)
2015-04-28 22:45:19 +02:00
Ondrej Kozina
90cbc5576f tests: try harder to kill all dangling procs
also simplify and make less prone to an error checks
for running bg processes inside a pvmove-resume tests
2015-04-28 22:31:50 +02:00
Ondrej Kozina
8c9ab2a4dd tests: simplify removal of dangling bg procs
some tests left dangling bg processes originating in
lvm2 commands being able to spawn any bg polling process
(lvchange, vgchange, pvmove, lvconvert...)

Initial fn 'add_to_kill_list' should collect processes with
specific parameters (proc's command line and parent processes ID).
After testing finishes the fn kill_listed_processes should remove these
listed by 'add_to_kill_list'.

Unfortunately it proved to be prone to an error especially in scenarios
where cmd line of initiating command contained characters required to
be espaced before passing to shell script to make it work correctly.
(Or if cmd spawned more than one bg process with same cmd line. i.e.:
vgchange or lvchange).

The new implementation is much simpler. It uses env. variable (LVM_TEST_TAG)
for marking a process desired to be killed later or during test env. teardown.
(i.e.: LVM_TEST_TAG=kill_me_$PREFIX to kill only processes related to
current test environment)
2015-04-28 22:31:40 +02:00
Alasdair G Kergon
3f0434057b config: Introduce lvmconfig.
'lvm dumpconfig' now does a lot more than just dumping configuration
information and is no longer only a support tool.  Users now need
to run it to find out about configuration information that has been
removed from the lvm.conf man page so we need to promote this to full
command line status as 'lvmconfig'.  Also accept 'lvm config' and mention
it in the usage information of lvmconf (which should also get merged in
eventually).
2015-04-28 17:00:37 +01:00
David Teigland
beb229e1e8 devices: improve handling of duplicate PVs
Example:

/dev/loop0 and /dev/loop1 are duplicates,
created by copying one backing file to the
other.

'identity /dev/loopX' creates an identity
mapping for loopX named idmloopX, which
adds a duplicate for the named device.

The duplicate selection code for lvmetad is
incomplete, and lvmetad is disabled for this
example.

[~]# losetup -f loopfile0
[~]# pvs
  PV         VG           Fmt  Attr PSize   PFree
  /dev/loop0 foo          lvm2 a--  308.00m 296.00m

[~]# losetup -f loopfile1
[~]# pvs
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
  Using duplicate PV /dev/loop1 which is more recent, replacing /dev/loop0
  PV         VG           Fmt  Attr PSize   PFree
  /dev/loop1 foo          lvm2 a--  308.00m 308.00m

[~]# ./identity /dev/loop0
[~]# pvs
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
  Using duplicate PV /dev/loop1 without holders, replacing /dev/loop0
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop0 not /dev/loop1
  Using duplicate PV /dev/mapper/idmloop0 from subsystem DM, replacing /dev/loop1
  PV                   VG           Fmt  Attr PSize   PFree
  /dev/mapper/idmloop0 foo          lvm2 a--  308.00m 296.00m

[~]# ./identity /dev/loop1
[~]# pvs
  WARNING: duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV is being used from both devices /dev/loop0 and /dev/loop1
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
  Using duplicate PV /dev/loop1 which is more recent, replacing /dev/loop0
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop0 not /dev/loop1
  Using duplicate PV /dev/mapper/idmloop0 from subsystem DM, replacing /dev/loop1
  Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop1 not /dev/mapper/idmloop0
  Using duplicate PV /dev/mapper/idmloop1 which is more recent, replacing /dev/mapper/idmloop0
  PV                   VG           Fmt  Attr PSize   PFree
  /dev/mapper/idmloop1 foo          lvm2 a--  308.00m 308.00m
2015-04-28 10:41:32 -05:00
David Teigland
6cc37275ce config: improve the description of options lists
Describe
thin_check_options, thin_repair_options,
cache_check_option, scache_repair_options

as a "list of options", rather than a "string of options"
because a single string, e.g. "-q --clear-needs-check-flag"
does not work, and needs to be entered as a list,
e.g. ["-q", "--clear-needs-check-flag"]
2015-04-28 10:06:23 -05:00
Peter Rajnoha
ae0014e2df config: also evaluate default unconfigured values in runtime for 'cfg_runtime' settings
The settings which have their default value evaluated in runtime should
have their 'unconfigured' counterparts also evaluated in runtime since
those values can be constructed by using other settings.

For example, before this patch:

$ lvm dumpconfig --type default --unconfigured devices/cache_dir devices/cache
cache_dir="@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
cache="/etc/lvm/cache/.cache

With this patch applied:

$ lvm dumpconfig --type default --unconfigured devices/cache_dir devices/cache
cache_dir="@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
cache="@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@/.cache"
2015-04-28 15:36:35 +02:00
Peter Rajnoha
afcf472464 config: make it possible to set default unconfigured_value for settings of all types, not just strings
The @something@ used for unconfigured default value is not bound to
CFG_TYPE_STRING settings defined in config_settings.h, it can be
used for any other config type too.
2015-04-28 15:32:38 +02:00
Peter Rajnoha
de6deec3b8 refactor: rename struct cfg_def_item's 'unconfigured_path' to 'unconfigured_value'
It's not only path that can be used for setting's default value
in unconfigured form as @something@.
2015-04-28 15:30:48 +02:00
Alasdair G Kergon
d0c46c9ed5 conf: Avoid temp files when generating config. 2015-04-28 13:02:19 +01:00
Zdenek Kabelac
71dbfd7c20 tests: more help# 2015-04-28 11:35:56 +02:00
Zdenek Kabelac
3fbb7b6e35 tests: always zero disk header
It appear that older wipefs doesn't wipe partition table.
So ensure there is no partition on LVM_TEST_BACKING_DEVICE.
2015-04-28 11:32:52 +02:00
Zdenek Kabelac
1bb5b498f0 tests: more descriptive aux
Tell what's reason of aux fail here.
2015-04-28 11:23:16 +02:00
Zdenek Kabelac
a378e5a6dd tests: drop debug test
Remove 'debug leftover' from test.
2015-04-28 11:23:16 +02:00
David Teigland
0c1bda9b53 example.conf.in: regenerate
From recent config_settings.h changes.
2015-04-27 14:15:24 -05:00
David Teigland
cfb0174fed config: fix a couple mistakes with defaults
for archive, archive_dir, and cache
2015-04-27 13:54:45 -05:00
Zdenek Kabelac
a7d28639eb tests: use new help in aux
Simplify tests and use aux mdadm helpers.
2015-04-25 00:40:02 +02:00
Zdenek Kabelac
1e3c135d71 tests: aux for mdadm
Implement aux helper fce for mdadm.
2015-04-25 00:40:02 +02:00
Zdenek Kabelac
f50229041b tests: allow add printable skip message 2015-04-25 00:40:02 +02:00
Zdenek Kabelac
a939857a63 tests: check sysfs more generically
Allow to access more files in device sysfs subtree.
2015-04-25 00:40:02 +02:00
Ondrej Kozina
d9176782fe tests: add double quotes around add_to_kill_list parms 2015-04-25 00:40:02 +02:00
Zdenek Kabelac
d7888e8316 tests: try more advanced clean
When test is executed on real device - lets try a more complete
cleanup - discard whole device first and try to wipe any
headers it might be left from previous test.
2015-04-25 00:39:43 +02:00
Peter Rajnoha
066d0a4e19 cleanup: ancestors -> lv_ancestors, descendants -> lv_descendants
Use "lv_" prefix as they're LV fields.
2015-04-24 14:19:28 +02:00
Peter Rajnoha
6e4aee0492 report: add lv_ancestors and lv_descendants reporting fields
Show full chain of ancestors and descendants for snapshots
(both thick and thin - in case of thick, the "ancestor" field
is actually equal to "origin" field as snapshots can't be
chained for thick snapshots).

These fields display current state as it is, they do not
display any history! If the snapshot chain is broken in
the middle, we don't report the historical origin (this
is going to be a part of another patch and a different
set of fields or just a switch for existing fields to
show ancestors and descendants with history included).

For example:

(origin --> snapshot)

lvol1 --> lvol2 --> lvol3 --> lvol4
              \
                --> lvol5 --> lvol6 --> lvol7 --> lvol8

$ lvs -o name,pool_lv,origin,ancestors,descendants vg
  LV    Pool Origin Ancestors                     Descendants
  lvol1 pool                                      lvol2,lvol3,lvol4,lvol5,lvol6,lvol7,lvol8
  lvol2 pool lvol1  lvol1                         lvol3,lvol4,lvol5,lvol6,lvol7,lvol8
  lvol3 pool lvol2  lvol2,lvol1                   lvol4
  lvol4 pool lvol3  lvol3,lvol2,lvol1
  lvol5 pool lvol2  lvol2,lvol1                   lvol6,lvol7,lvol8
  lvol6 pool lvol5  lvol5,lvol2,lvol1             lvol7,lvol8
  lvol7 pool lvol6  lvol6,lvol5,lvol2,lvol1       lvol8
  lvol8 pool lvol7  lvol7,lvol6,lvol5,lvol2,lvol1
2015-04-24 11:51:52 +02:00
Peter Rajnoha
82f6dbfaf7 select: fix matching reserved values while <,<=,>,>= is used in selection criteria
Scenario:

$ vgs -o+vg_mda_copies
  VG     #PV #LV #SN Attr   VSize VFree #VMdaCps
  fedora   1   2   0 wz--n- 9.51g    0  unmanaged
  vg      16   9   0 wz--n- 1.94g 1.83g         2

$ lvs -o+read_ahead vg/lvol6 vg/lvol7
  LV    VG   Attr       LSize Pool Origin Data%  Rahead
  lvol6 vg   Vwi-a-tz-- 1.00g pool lvol5  0.00      auto
  lvol7 vg   Vwi---tz-k 1.00g pool lvol6         256.00k

Before this patch:

$vgs -o vg_name,vg_mda_copies -S 'vg_mda_copies < unmanaged'
  VG   #VMdaCps
  vg          2

Problem:
Reserved values can be only used with exact match = or !=, not <,<=,>,>=.
In the example above, the "unamanaged" is internally represented as
18446744073709551615, but this should be ignored while not comparing
field directly with "unmanaged" reserved name with = or !=. Users
should not be aware of this internal mapping of the reserved value
name to its internal value and hence it doesn't make sense for such
reserved value to take place in results of <,<=,> and >=.
There's no order defined for reserved values!!! It's a special
*reserved* value that is taken out of the usual value range
of that type.

This is very similar to what we have already fixed with
2f7f6932dc, but it's the other way round
now - we're using reserved value name in selection criteria now
(in the patch 2f7f693, we had concrete value and we compared it
with the reserved value). So this patch completes patch 2f7f693.

This patch also fixes this problem:

$ lvs -o+read_ahead vg/lvol6 vg/lvol7 -S 'read_ahead > 32k'
  LV    VG   Attr       LSize Pool Origin Data%  Rahead
  lvol6 vg   Vwi-a-tz-- 1.00g pool lvol5  0.00      auto
  lvol7 vg   Vwi---tz-k 1.00g pool lvol6         256.00k

Problem:
In the example above, the internal reserved value "auto" is in the
range of selection "> 32k" - it shouldn't match as well. Here the
"auto" is internally represented as MAX_DBL and of course, numerically,
MAX_DBL > 256k. But for users, the reserved value should be uncomparable
to any number so the mapping of the reserved value name to its interna
 value is transparent to users. Again, there's no order defined for
reserved values and hence it should never match if using <,<=,>,>=
operators.

This is actually exactly the same problem as already described in
2f7f6932dc, but that patch failed for
size field types because of incorrect internal representation used.

With this patch applied, both problematic scenarios mentioned
above are fixed now:

$ vgs -o vg_name,vg_mda_copies -S 'vg_mda_copies < unmanaged'
(blank)

$ lvs -o+read_ahead vg/lvol6 vg/lvol7 -S 'read_ahead > 32k'
  LV    VG   Attr       LSize Pool Origin Rahead
  lvol7 vg   Vwi---tz-k 1.00g pool lvol6  256.00k
2015-04-24 09:48:57 +02:00
Zdenek Kabelac
de0ce46361 tests: fix md raid test on real /dev
Zero raid signatures when raid is stopped - so signatures
are not requiring wipe when pvcreate follows.

Handle real /dev
2015-04-23 20:28:44 +02:00
Alasdair G Kergon
8853462528 libdm: Add uuid/devno to ioctl failure log message. 2015-04-23 19:26:52 +01:00
Alasdair G Kergon
1906619187 libdm: Add DM_INTERNAL_SUSPEND_FLAG.
Still needs to be reported by dmsetup.
2015-04-23 18:39:04 +01:00
David Teigland
95da21cc18 config: fix check_options array
The code used it as both a single string, and as
an array of strings in different places.  Fix it
so that it's an array of strings everywhere.
2015-04-23 10:35:34 -05:00
David Teigland
a8bdfbe959 config: thin_disabled_features default should be undefined
An array that's empty by default should be flagged as
undefined.
2015-04-23 10:19:00 -05:00
David Teigland
3fc9615d15 Improve duplicate PV handling
Make the processing of duplicate PVs the
same with and without lvmetad.
2015-04-22 13:22:14 -05:00
Petr Rockai
92607ecfe6 man: Escape single quotes in an example to avoid groff's unicode conversion. 2015-04-22 17:31:11 +02:00
David Teigland
33429ea083 make: autoconfisms for generate 2015-04-22 10:05:02 -05:00
David Teigland
808f88f9f0 make: let generate use the just built libdm 2015-04-22 09:37:56 -05:00
Alasdair G Kergon
81d03b46b0 doc: Update dm kernel files.
v4.0-9804-gdb4fd9c
2015-04-22 15:34:25 +01:00
Zdenek Kabelac
2fea720881 tests: add missing "" around dev 2015-04-22 11:18:31 +02:00
Zdenek Kabelac
4b161de2e5 tests: aux works better with installed_testsuite
When test suite is used from installed rpm package
we need to handle things better.

This patch is rather first approach - expecting few more
tweaks needed.
2015-04-22 11:18:31 +02:00
Zdenek Kabelac
7a64a157e1 tests: simplify teardown
If TESTNAME has not been created yet, avoid running complex teardown.
2015-04-22 11:18:31 +02:00
Zdenek Kabelac
7f8d942268 makefiles: avoid // in datadir usage
DESTDIR already comes with '/'
2015-04-22 10:59:03 +02:00
Zdenek Kabelac
d8874556cd tests: install also api test
Install .t & .py binaries.
On 'make clean'  ensure also -t files are removed.
2015-04-22 10:57:42 +02:00
Zdenek Kabelac
3216a9a819 tests: drop DEBUG log after success
At this moment LVM_LOG_FILE_EPOCH with
LVM_EXPECTED_EXIT_STATUS  properly deletes debug logs
only for real commands - support for lvm2 API does not yet
exists
2015-04-22 10:55:37 +02:00