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

1039 Commits

Author SHA1 Message Date
Zdenek Kabelac
596cf2c6fa tests: check LV in proper VG 2017-06-30 12:09:10 +02:00
Zdenek Kabelac
0cc49bda15 tests: show more debug info
Helpful for analysis (revert later).
2017-06-24 23:02:42 +02:00
Zdenek Kabelac
1b9bf5ce9e tests: slightly longer delay
Try to avoid race with slightly longer delay.
2017-06-24 22:58:08 +02:00
Zdenek Kabelac
cac9e0b681 tests: correct percent values are reported 2017-06-24 17:44:42 +02:00
Zdenek Kabelac
2a50a28f3e tests: use allocate policy in raid test 2017-06-23 23:32:44 +02:00
Zdenek Kabelac
1598bf154e tests: add transient failure test
Check raid  repairs still 'present', but failed device.

TODO: tests needs more checking about repair actually doing its work.
2017-06-23 23:32:44 +02:00
Zdenek Kabelac
535f7209d2 tests: request 1.12 for reshaping raid
We will need  1.12 as the kernel needs some mandatory md fixes,
otherwise random freezes may appear.
2017-06-23 18:44:01 +02:00
Zdenek Kabelac
d0c97b4401 tests: handle su login difference
Workaround case, where it matters if 'su' was user with '-' or without.
2017-06-23 18:44:01 +02:00
Zdenek Kabelac
cb2c2484b9 tests: flushing of cache is abortable 2017-06-22 20:17:20 +02:00
Zdenek Kabelac
7d5afcc0cb tests: check lvdisplay for cache works 2017-06-22 20:17:20 +02:00
Zdenek Kabelac
93fbfa2ed3 tests: lvresize needs --yes 2017-06-21 14:03:29 +02:00
Zdenek Kabelac
710f51e7f2 tests: test also different lock holder 2017-06-20 18:25:10 +02:00
Zdenek Kabelac
31cd01c9b3 tests: check conversion of thin-pool 2017-06-19 23:30:11 +02:00
Jonathan Brassow
915d20d0e6 test: New test file for validating kernel status during sync ops
New tests to add checking for '100%' in-sync at start of "recover"
process (it shouldn't happen, but I've seen it before).  Also,
check status over the whole cycle of various sync processes ("resync"
and "recover").
2017-06-16 10:16:07 -05:00
Zdenek Kabelac
dd866a67f4 tests: use exclusive activation
Conversion needs exlusively active LV for clustered testing.
2017-06-16 17:04:02 +02:00
Jonathan Brassow
3592243afb test: New test file for validating kernel status during sync ops
First test in this file checks whether 'aa' is ever spotted during
a "recover" operation (it should not be).  More tests should follow
in this file to look for oddities in status output - especially as
it relates to the sync_ratio, dev_health, and sync_action fields.
2017-06-15 11:06:08 -05:00
Jonathan Brassow
1f57a5263e clean-ups: remove unused var, add 'static' for local fn, adjust test
For the test clean-up, I was providing too many devices to the first
command - possibly allowing it to allocate in the wrong place.  I was
also not providing a device for the second command - virtually ensuring
the test was not performing correctly at times.
2017-06-14 14:49:42 -05:00
Jonathan Brassow
ddb14b6b05 lvconvert: Disallow removal of primary when up-converting (recovering)
This patch ensures that under normal conditions (i.e. not during repair
operations) that users are prevented from removing devices that would
cause data loss.

When a RAID1 is undergoing its initial sync, it is ok to remove all but
one of the images because they have all existed since creation and
contain all the data written since the array was created.  OTOH, if the
RAID1 was created as a result of an up-convert from linear, it is very
important not to let the user remove the primary image (the source of
all the data).  They should be allowed to remove any devices they want
and as many as they want as long as one original (primary) device is left
during a "recover" (aka up-convert).

This fixes bug 1461187 and includes the necessary regression tests.
2017-06-14 08:41:05 -05:00
Jonathan Brassow
c87907dcd5 lvconvert: linear -> raid1 upconvert should cause "recover" not "resync"
Two of the sync actions performed by the kernel (aka MD runtime) are
"resync" and "recover".  The "resync" refers to when an entirely new array
is going through the process of initializing (or resynchronizing after an
unexpected shutdown).  The "recover" is the process of initializing a new
member device to the array.  So, a brand new array with all new devices
will undergo "resync".  An array with replaced or added sub-LVs will undergo
"recover".

These two states are treated very differently when failures happen.  If any
device is lost or replaced while "resync", there are no worries.  This is
because any writes created from the inception of the array have occurred to
all the devices and can be safely recovered.  Even though non-initialized
portions will still be resync'ed with uninitialized data, it is ok.  However,
if a pre-existing device is lost (aka, the original linear device in a
linear -> raid1 convert) during a "recover", data loss can be the result.
Thus, writes are errored by the kernel and recovery is halted.  The failed
device must be restored or removed.  This is the correct behavior.

Unfortunately, we were treating an up-convert from linear as a "resync"
when we should have been treating it as a "recover".  This patch
removes the special case for linear upconvert.  It allows each new image
sub-LV to be marked with a rebuild flag and treats the array as 'in-sync'.
This has the correct effect of causing the upconvert to be treated as a
"recover" rather than a "resync".  There is no need to flag these two states
differently in LVM metadata, because they are already considered differently
by the kernel RAID metadata.  (Any activation/deactivation will properly
resume the "recover" process and not a "resync" process.)

We make this behavior change based on the presense of dm-raid target
version 1.9.0+.
2017-06-14 08:35:22 -05:00
Zdenek Kabelac
b6945b8510 tests: no longer allowed too big thin-pools for small chunks 2017-06-09 13:03:42 +02:00
Zdenek Kabelac
b3ef051e06 cache: lvcreate --cachepool checks for cache pool
Code path missed validation of lvcreate --cachepool argument.
If the non cache-pool LV was passed in, code has still continued
further work and failed later on internal error.  Validate this
condition at right place now.
2017-06-09 10:59:37 +02:00
Zdenek Kabelac
ee5ecde35e tests: check thin-pool boundary sizes 2017-06-08 11:58:36 +02:00
Zdenek Kabelac
743ffb1962 tests: longer delay
Slower sync a bit more and use bigger raid arrays to
be more sure we will catch raid being sychronized.
2017-05-31 13:59:42 +02:00
Zdenek Kabelac
42b87c23e2 tests: add some extra udev waits
To get less random results on older systems with systemd (i.e. fc23)
put few extra udev wait operations to avoid any udev event collision.
2017-05-31 13:23:34 +02:00
Zdenek Kabelac
091c55a13f tests: skip reshaping raid10
Needs newer target  >= 1.10.1 for reshaping of raid10 LVs.
2017-05-31 12:59:53 +02:00
Zdenek Kabelac
c245996d70 tests: missed to export lvm binary for fsadm 2017-05-30 18:43:56 +02:00
Zdenek Kabelac
b876e8c915 tests: drop extra debug vvvv
Also show output of mount so when it fails we can check the state.
2017-05-30 18:43:56 +02:00
Zdenek Kabelac
7c84c5c421 tests: also check new flag with segtype
Make sure new unknown flag is having same behavior as old unknown segtype.
2017-05-30 18:43:56 +02:00
Zdenek Kabelac
597b3576c7 tests: wait for raid in sync
Lvchange needs synchronized raid.
2017-05-29 14:41:53 +02:00
Zdenek Kabelac
5e8beb4023 tests: fix test for fsadm
Avoid mountinfo
Pass 'y'  - since ATM lvresize cannot pass --yes to fsadm.
2017-05-23 14:02:43 +02:00
Zdenek Kabelac
3877ef0e43 tests: catch some fsadm tricky paths
When user is renaming a device, we are getting into troubles.
We needs to recognize which case is actually supportable by fsadm.
2017-05-22 15:12:31 +02:00
Marian Csontos
9291fb7bf5 test: Fix condition 2017-05-17 11:43:49 +02:00
Marian Csontos
1fb13e8660 test: Fix skipped cleanup 2017-05-17 11:37:29 +02:00
Heinz Mauelshagen
48408ece6d test: add missing yes option to lvconvert stripe removal 2017-05-16 17:52:54 +02:00
Marian Csontos
f4f408610c test: Fix previous commit - skip only RAID6 part 2017-05-16 10:47:53 +02:00
Marian Csontos
cdb49216c5 test: Update condition for changing RAID regionsize
The test is failing on F23 and F25 with 1.9.1
2017-05-16 10:44:52 +02:00
Zdenek Kabelac
b817cc5746 tests: better skip 2017-05-10 15:40:32 +02:00
Zdenek Kabelac
455a4de090 dmeventd: restore multiple warnings
With recent updates for thin pool monitoring in version 169
we lost multiple WARNINGs to be printed in syslog, when
pool crossed  80%, 85%, 90%, 95%, 100%.

Restore this logic as we want to keep user informed more
then just once when 80% boundary is passed.
2017-05-10 15:39:36 +02:00
David Teigland
4f9ff14508 pvcreate: add prompt when setting dev size
If the device size does not match the size requested
by --setphysicalvolumesize, then prompt the user.

Make the pvcreate checking/prompting code handle
multiple prompts for the same device, since the
new prompt can be in addition to the existing
prompt when the PV is in a VG.
2017-04-27 13:25:41 -05:00
Heinz Mauelshagen
33afe2ca76 test: add -y to raid1 up conversions 2017-04-27 15:56:58 +02:00
Marian Csontos
14c84c79db test: Update pattern to match code
Fix commit a3fdc966b5
2017-04-27 15:30:03 +02:00
Alasdair G Kergon
813bcb24f0 test: Add -y to pvresize --setphysicalvolumesize 2017-04-27 02:57:59 +01:00
Heinz Mauelshagen
effeb2b93d test: add raid4 to upconvert allocation failure tests 2017-04-22 00:43:31 +02:00
Heinz Mauelshagen
149e4fa04b test: consider changed default
commit b81b4aad24
raised the region size so demand the sizes the
test checks for.
2017-04-22 00:42:09 +02:00
Heinz Mauelshagen
7c7122a3b1 test: add upconvert allocation failure tests 2017-04-21 20:57:31 +02:00
Heinz Mauelshagen
d48b816764 test: also prevent lvconvert-raid-reshape.sh on single core 2017-04-21 02:17:55 +02:00
Heinz Mauelshagen
a004cceed2 test: Adjust previous commit
Change have_single_core to  have_multi_core and go back to || logic in related test scripts.
2017-04-21 01:21:24 +02:00
Heinz Mauelshagen
18bf954801 test: Fix skip some reshape tests that hang on single core machines
Fix commit c7fb0cb861.
2017-04-20 21:45:56 +02:00
Alasdair G Kergon
c7fb0cb861 test: Skip some reshape tests that hang on single core machines
Skip hanging raid reshape tests until https://bugzilla.redhat.com/1443999
is fixed
2017-04-20 20:05:07 +01:00
Zdenek Kabelac
aa25cfe084 test: correcting binary usage
Ensure 'test suite' run uses fsadm and dmeventd from compiled dir,
while for 'rpm' installed test use binaries installed in system.
2017-04-14 01:03:18 +02:00
Zdenek Kabelac
a3e8354479 tests: use egrep to check for message
Seems we may get different '' around option on different nixes.
2017-04-12 23:05:50 +02:00
Zdenek Kabelac
56704383bf tests: test for new supported commands
New tests for:

lvconvert --regionsize | --swapmetadata | --startpoll |
          --mergesnapshot | mergethin
2017-04-12 21:34:08 +02:00
Zdenek Kabelac
f8034e14e6 tests: restore some test changes
Restore existing tests and separate new tests
for new options later.

Keep coverage for existing syntax

Reverts bits from commits:

a801b92b2c.
d71aaca07b
fa2a728a39
1e2420bca8
46abc28a48
0e3e611a13
2017-04-12 21:34:08 +02:00
Zdenek Kabelac
1095322901 thin: properly check for status for max sizes metadata
When metadata LV size was over DM_THIN_MAX_METADATA_SIZE sectors,
the info() routine was incorrectly trying to match bigger size,
while we do never pass any bigger device.

Fixing a case, where lvs should be displaying status for metadata
LV with 16GB size.
2017-04-12 21:34:08 +02:00
Heinz Mauelshagen
532388fad5 lvconvert: fix failing valid regionsize change
Reshape check failed when regionsize changed and current raid type
was provided with no other change requested (stripes or stripesize).

E.g. "lvconvert --type raid6 --regionsize 256K" on a raid6 LV
with != 256K regionsize.

Enable --type in test script.
2017-04-12 14:38:49 +02:00
Heinz Mauelshagen
0f65d7ec3a lvconvert: prompt on raid1 image changes
Don't change resilience of raid1 LVs without --yes.

Adjust respective tests.
2017-04-06 18:47:41 +02:00
Zdenek Kabelac
88e408b8ed tests: update to better fit
Die is automatic on 'error' result
Cleanup everything on 'regular' code path.
2017-03-27 20:50:19 +02:00
Zdenek Kabelac
17b56a4aed tests: early detect leaking error dev
lvconvert should not leak 'error' device.

(This patch is not fix the problem, just makes it more easily visible
instead of more confusing 'clvmd' trace).
2017-03-20 14:18:50 +01:00
Zdenek Kabelac
07ea9887d3 tests: raise min dm cache version
Since we want to test different cache policies with profiles mq&smq
raise version to 1.8.

TODO: maybe split in more tests so older targets can test here as well.
N.B.: passthrough is also not supported with version 1.3
2017-03-17 14:22:33 +01:00
Heinz Mauelshagen
17bee733d1 raid: conditionally reject convert to striped/raid0*
If SubLVs to be removed still exist after an image removing
conversion (i.e. "lvconvert --yes --force --stripes N "
with N < total stripes) any request to convert to a different
striped/raid* level has to be rejected until after those freed
SubLVs got removed by running the aforementioned lvconvert again.

Add tests to check conversion to striped/raid* gets rejected.
Enhance a test comment.

Related: rhbz1191935
Related: rhbz1366296
2017-03-17 13:58:54 +01:00
Heinz Mauelshagen
b0336e8b3c lvconvert: ensure upconversion restrictions
Ensure minimum number of 3 data stripes on conversions to raid6.

Add test for it.

Resolves: rhbz1432675
2017-03-16 22:10:32 +01:00
Heinz Mauelshagen
76b843a4bf test: adjust to proper dm-raid target version
Adjust to final target version 1.10.1 supporting reshape
properly and to recently changed report field specifications
(e.g. rehape_len_le) to allow these tests to run.

Lower mirror region size to suite the tiny test VG.
2017-03-16 21:17:58 +01:00
Zdenek Kabelac
51b9de7249 tests: better disk delay
Delay only writable extents.
Skip zeroing for earlier lvcreate finish.
2017-03-16 08:49:52 +01:00
Zdenek Kabelac
7fa08ae4e8 tests: add missing --yes 2017-03-16 08:44:44 +01:00
Zdenek Kabelac
53f5cf0af0 tests: cache profile and metadata2
New tests trying to cover support syntax variants.
A lot it still missing...
2017-03-10 19:33:02 +01:00
David Teigland
716c345334 tests relative-sign-options: only skip thin part 2017-03-09 11:29:54 -06:00
David Teigland
43bcd7393c tests relative-sign-options.sh: skip without thin 2017-03-09 10:43:41 -06:00
Heinz Mauelshagen
6dfe1ce251 lvconvert: prompt when splitting off LV of a 2-legged raid1 LV
Splitting off an image LV of a 2-legged
raid1 LV causes loss of resilience.

Ask user to avoid uninformed loss of all resilience.

Don't ask for N > 2 legged raid1 LVs.

Adjust tests.
2017-03-09 13:59:47 +01:00
Heinz Mauelshagen
6b1b66c266 test: raid1 down convert to linear
Missed one test in last commit.
2017-03-09 13:21:21 +01:00
Heinz Mauelshagen
4b0ae266c2 test: raid1 down convert to linear
Add/adjust more tests for commit 7fbe6ef16b.
2017-03-09 13:16:08 +01:00
Heinz Mauelshagen
3d1df10af3 test: raid1 down convert to linear / split and track tests
Add/adjust tests for commits d250aa7208 and 7fbe6ef16b.
2017-03-09 04:01:47 +01:00
Heinz Mauelshagen
8daad11666 test: "lvconvert --repair" after vgreduce
Add test for commit 921b496fff.
2017-03-09 02:35:57 +01:00
Heinz Mauelshagen
00b8c2bebc test: Copyright 2017-03-09 00:10:55 +01:00
David Teigland
14c7912f45 tests: add test for relative option values
Combinations of: lvcreate/lvresize/lvextend/lvreduce,
--size/--extents/--poolmetadatasize, +/-/nosign.
2017-03-08 13:51:33 -06:00
Heinz Mauelshagen
43fb4aa69b test: add delay to lvchange-raid1-writemostly.sh
Commit 8ab0725077 introduced this new test.

Add a read delay to the PVs to avoid a race
in the script causing the test to fail.

Correct comment.
2017-03-07 15:18:13 +01:00
Heinz Mauelshagen
17838e6439 test: fix typo 2017-03-03 23:22:29 +01:00
Heinz Mauelshagen
48778bc503 lvconvert: add new reporting fields for reshaping
During an ongoing reshape, the MD kernel runtime reads stripes relative
to data_offset and starts storing the reshaped stripes (with new raid
layout and/or new stripesize  and/or new number of stripes) relative
to new_data_offset.  This is to avoid writing over any data in place
which is non-atomic by nature and thus be recoverable without data loss
in the transition.  MD uses the term out-of-place reshaping for it.

There's 2 other areas we don't have report capability for:
- number of data stripes vs. total stripes
  (e.g. raid6 with 7 stripes toal has 5 data stripes)
- number of (rotating) parity/syndrome chunks
  (e.g. raid6 with 7 stripes toal has 2 parity chunks; one
   per stripe for P-Syndrome and another one for Q-Syndrome)

Thus, add the following reportable keys:

- reshape_len      (in current units)
- reshape_len_le   (in logical extents)
- data_offset      (in sectors)
- new_data_offset  (     "    )
- data_stripes
- parity_chunks

Enhance lvchange-raid.sh, lvconvert-raid-reshape-linear_to_striped.sh,
lvconvert-raid-reshape-striped_to_linear.sh, lvconvert-raid-reshape.sh
and lvconvert-raid-takeover.sh to make use of new keys.

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-03-01 18:50:35 +01:00
Heinz Mauelshagen
76f60cc430 lvconvert: add missed new test scripts for reshaping
Add aforementioned but forgotten new test scripts
lvconvert-raid-reshape-linear_to_striped.sh,
lvconvert-raid-reshape-striped_to_linear.sh and
lvconvert-raid-reshape.sh

Those presume dm-raid target version 1.10.2
provided by a following kernel patch.

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-02-24 05:20:59 +01:00
Heinz Mauelshagen
34caf83172 lvconvert: add infrastructure for RaidLV reshaping support
In order to support striped raid5/6/10 LV reshaping (change
of LV type, stripesize or number of legs), this patch
introduces the changes to call the reshaping infratructure
from lv_raid_convert().

Changes:
- add reshaping calls from lv_raid_convert()
- add command definitons for reshaping to tools/command-lines.in
- fix raid_rimage_extents()
- add 2 new test scripts lvconvert-raid-reshape-linear_to_striped.sh
  and lvconvert-raid-reshape-striped_to_linear.sh to test
  the linear <-> striped multi-step conversions
- add lvconvert-raid-reshape.sh reshaping tests
- enhance lvconvert-raid-takeover.sh with new raid10 tests

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-02-24 05:20:58 +01:00
Heinz Mauelshagen
8ab0725077 lvchange: reject writemostly/writebehind on raid1 during resync
The MD kernel raid1 personality does no use any writemostly leg as the primary.

In case a previous linear LV holding data gets upconverted to
raid1 it becomes the primary leg of the new raid1 LV and a full
resynchronization is started to update the new legs.

No writemostly and/or writebehind setting may be allowed during
this initial, full synchronization period of this new raid1 LV
(using the lvchange(8) command), because that would change the
primary (i.e the previous linear LV) thus causing data loss.

lvchange has a bug not preventing this scenario.

Fix rejects setting writemostly and/or writebehind on resychronizing raid1 LVs.

Once we have status in the lvm2 metadata about the linear -> raid upconversion,
we may relax this constraint for other types of resynchronization
(e.g. for user requested "lvchange --resync ").

New lvchange-raid1-writemostly.sh test is added to the test suite.

Resolves: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855895
2017-02-23 15:09:29 +01:00
Zdenek Kabelac
f44e69f9fc tests: not slowing work with metadata
Slows only data extents on a PV.
2017-02-22 15:40:28 +01:00
Zdenek Kabelac
7c14004f69 tests: make sure which PV is used for allocation 2017-02-21 09:38:04 +01:00
Zdenek Kabelac
921d5972e8 tests: use exclusive activation for mirror
Test suite does not support clustered mirroring.
2017-02-21 00:52:05 +01:00
Zdenek Kabelac
5f2639d01d tests: update lvresize testing
Add missing tests for some lvresize acceptable options.
2017-02-20 00:44:12 +01:00
David Teigland
46abc28a48 lvconvert: add command to change region size of a raid LV 2017-02-13 08:21:58 -06:00
David Teigland
a801b92b2c tests: use swapmetadata
and some other pool/cache/thin related changes
2017-02-13 08:20:10 -06:00
David Teigland
0e3e611a13 lvconvert: use command defs for thin/cache/pool creation
Everything related to thin and cache.
2017-02-13 08:20:10 -06:00
David Teigland
d71aaca07b lvconvert: add startpoll command using command def
This is a new explicit version of 'lvconvert LV'
which has been an obscure way of triggering polling
to be restarted on an LV that was previously converted.
2017-02-13 08:20:10 -06:00
David Teigland
fa2a728a39 lvconvert: snapshot: use command definitions
Lift all the snapshot utilities (merge, split, combine)
out of the monolithic lvconvert implementation, using
the command definitions.  The old code associated with
these commands is now unused and will be removed separately.
2017-02-13 08:20:10 -06:00
David Teigland
1e2420bca8 commands: new method for defining commands
. Define a prototype for every lvm command.
. Match every user command with one definition.
. Generate help text and man pages from them.

The new file command-lines.in defines a prototype for every
unique lvm command.  A unique lvm command is a unique
combination of: command name + required option args +
required positional args.  Each of these prototypes also
includes the optional option args and optional positional
args that the command will accept, a description, and a
unique string ID for the definition.  Any valid command
will match one of the prototypes.

Here's an example of the lvresize command definitions from
command-lines.in, there are three unique lvresize commands:

lvresize --size SizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
--stripes Number, --stripesize SizeKB, --poolmetadatasize SizeMB
OP: PV ...
ID: lvresize_by_size
DESC: Resize an LV by a specified size.

lvresize LV PV ...
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB
ID: lvresize_by_pv
DESC: Resize an LV by specified PV extents.
FLAGS: SECONDARY_SYNTAX

lvresize --poolmetadatasize SizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --stripes Number, --stripesize SizeKB
OP: PV ...
ID: lvresize_pool_metadata_by_size
DESC: Resize a pool metadata SubLV by a specified size.

The three commands have separate definitions because they have
different required parameters.  Required parameters are specified
on the first line of the definition.  Optional options are
listed after OO, and optional positional args are listed after OP.

This data is used to generate corresponding command definition
structures for lvm in command-lines.h.  usage/help output is also
auto generated, so it is always in sync with the definitions.

Every user-entered command is compared against the set of
command structures, and matched with one.  An error is
reported if an entered command does not have the required
parameters for any definition.  The closest match is printed
as a suggestion, and running lvresize --help will display
the usage for each possible lvresize command.

The prototype syntax used for help/man output includes
required --option and positional args on the first line,
and optional --option and positional args enclosed in [ ]
on subsequent lines.

  command_name <required_opt_args> <required_pos_args>
          [ <optional_opt_args> ]
          [ <optional_pos_args> ]

Command definitions that are not to be advertised/suggested
have the flag SECONDARY_SYNTAX.  These commands will not be
printed in the normal help output.

Man page prototypes are also generated from the same original
command definitions, and are always in sync with the code
and help text.

Very early in command execution, a matching command definition
is found.  lvm then knows the operation being done, and that
the provided args conform to the definition.  This will allow
lots of ad hoc checking/validation to be removed throughout
the code.

Each command definition can also be routed to a specific
function to implement it.  The function is associated with
an enum value for the command definition (generated from
the ID string.)  These per-command-definition implementation
functions have not yet been created, so all commands
currently fall back to the existing per-command-name
implementation functions.

Using per-command-definition functions will allow lots of
code to be removed which tries to figure out what the
command is meant to do.  This is currently based on ad hoc
and complicated option analysis.  When using the new
functions, what the command is doing is already known
from the associated command definition.
2017-02-13 08:20:10 -06:00
Zdenek Kabelac
2923d9e47d tests: update 2017-02-13 10:06:19 +01:00
Zdenek Kabelac
c3b1f1a07a tests: fix dev path
Use proper device path for test devices.
Use mkfs.ext4 and drop  'echo y|' to it.
Use smaller device size to consume less memory and CPU time.
2017-02-13 10:06:19 +01:00
Heinz Mauelshagen
28ea66d46d lvconvert: add region size checks
Add:
- region size checks to raid_manip.c types array and supporting functions
- tests to lvconvert-raid-takeover.sh to check bogus
  "lvconvert --type  --regionsize N " requests

Related: rhbz1366296
2017-02-10 23:37:08 +01:00
Heinz Mauelshagen
caa2094e33 test: lvresize-raid.sh missing conditional
Test missed to check for raid0 present in the kernel.

Related: rhbz1366296
2017-02-10 21:22:38 +01:00
Ondrej Kozina
035c614c19 dmsetup: do not suppress kernel key descriptions in tables
Kernel 4.10 (dm-crypt v1.15.0) and later supports loading device
tables with crypt segment having key in kernel keyring retention
service.

dmsetup hid key section of tables output. With this patch dmsetup
no longer hides key section if it detects kernel key description
instead of hex byte representation of key itself.
2017-02-10 19:18:49 +01:00
Heinz Mauelshagen
baba3f8e2a lvconvert: add conversion from/to raid10
Add:
- conversion support from striped/raid0/raid0_meta to/from raid10;
  raid10 goes by the near format (same as used in creation of
  raid10 LVs), which groups data copies together with their original
  blocks (e.g. 3-way striped, 2 data copies resulting in 112233 in the
  first stripe followed by 445566 in the second etc.) and is limited
  to even numbers of legs for now
- related tests to lvconvert-raid-takeover.sh
- typo

Related: rhbz1366296
2017-02-10 19:13:02 +01:00
Heinz Mauelshagen
55eaabd118 lvreduce/lvresize: add ability to reduce the size of a RaidLV
- support shrinking of raid0/1/4/5/6/10 LVs
- enhance lvresize-raid.sh tests: add raid0* and raid10
- fix have_raid4 in aux.sh to allow lv_resize-raid.sh
  and other scripts to test raid4

Resolves: rhbz1394048
2017-02-09 22:42:03 +01:00
Heinz Mauelshagen
46a772fbc4 lvconvert: add support to change RAID region size (fixup)
Commit cfb6ef654d introduced
support to change RAID region size.

Add:
- missing conditions to support any types to function with
  it in lv_raid_convert();  temporary workaround used until
  cli validation patches get merged
- tests requesting "-R " to lvconvert-raid-takeover.sh
  involving a cleanup of the script

Related: rhbz1392947
2017-02-07 16:52:04 +01:00
Heinz Mauelshagen
cfb6ef654d lvconvert: add support to change RAID region size
Add:
- support to change region size of existing RaidLVs
  (all RAID LV types but raid0/raid0_meta)
- lvconvert-raid-regionsize.sh with test variations
  for different RAID types and region sizes

Resolves: rhbz1392947
2017-02-07 01:01:19 +01:00
Zdenek Kabelac
51d03acb1c tests: drop zeroing
Well waiting for zeroing may take enough time to finish 'raid' sync.
So make the test running faster without zeroing and better avoid race
to have chance to happen (i.e. lvcreate is finished after array
gets already in sync).
2017-02-06 13:15:39 +01:00
Zdenek Kabelac
48abbdf452 tests: drop /tmp polution
Drop forgotten extra metadata debug.
2017-02-06 11:43:07 +01:00
Heinz Mauelshagen
a4bbaa3b89 lvconvert: add segtypes raid6_{ls,rs,la,ra}_6 and conversions to/from it
Add:
- support for segment types raid6_{ls,rs,la,ra}_6
  (striped raid with dedicated last Q-Syndrome SubLVs)
- conversion support from raid5_{ls,rs,la,ra} to/from raid6_{ls,rs,la,ra}_6
- setting convenient segtypes on conversions from/to raid4/5/6
- related tests to lvconvert-raid-takeover.sh factoring
  out _lvcreate,_lvconvert funxtions

Related: rhbz1366296
2017-02-05 00:56:27 +01:00
Heinz Mauelshagen
3673ce48e0 lvconvert: add segtype raid6_n_6 and conversions to/from it
Add:
- support for segment type raid6_n_6 (striped raid with dedicated last parity/Q-Syndrome SubLVs)
- conversion support from striped/raid0/raid0_meta/raid4 to/from raid6_n_6
- related tests to lvconvert-raid-takeover.sh

Related: rhbz1366296
2017-02-04 01:42:21 +01:00
Heinz Mauelshagen
60ddd05f16 lvconvert: add segtype raid5_n and conversions to/from it
Add:
- support for segment type raid5_n (striped raid with dedicated last parity SubLVs)
- conversion support from striped/raid0/raid0_meta/raid4 to/from raid5_n
- related tests to lvconvert-raid-takeover.sh

Related: rhbz1366296
2017-02-03 20:40:26 +01:00
Zdenek Kabelac
2d48317d3a tests: umount when above 95
Add code to check if resulting data or metadata remained over 95%
and in such case invoke umount.
2017-01-21 22:53:57 +01:00
Zdenek Kabelac
e2fa90bf38 tests: properly quote heredoc
Prepend \$ for vars which should remain in script.
Also drop --lazy umount.
Move inittest call up, so mntdir and mntusedir have proper full path.
2017-01-21 19:28:06 +01:00
Zdenek Kabelac
1a2b88516b tests: implement umount in script
Since dmeventd no longer umounts thin devices, such logic
needs to be implemented by external script.
Add some very simple one for the start.
2017-01-21 17:42:19 +01:00
Zdenek Kabelac
47c11c7b1c tests: enusure units in TiB 2017-01-21 17:42:19 +01:00
Zdenek Kabelac
15e657f110 tests: ignore racy test failure
When test fails here, make it just warning instead of failing whole
test.
2017-01-06 23:39:53 +01:00
Zdenek Kabelac
d757b2431a tests: make test more race immune
Add more delay and increase raid size.
Speedup volume during wait for sync.
Drop --yes from lvcreate.
2017-01-06 23:39:53 +01:00
Zdenek Kabelac
0d2a9ebec6 vgchange: also -l is uint32 2017-01-06 21:51:36 +01:00
Zdenek Kabelac
b92a9c3e1a tests: slow down devs for raid more
Since we still experience occasiaonal test failure - slow
things down even more to avoid race.

Add support for 'quick' table changes between normal & delayed tables.
2017-01-05 15:54:14 +01:00
Zdenek Kabelac
c64f4447d9 tests: drop FIXME
Since we fixed core trouble with sequence of
suspend/resume/suspend without udev wait
we can drop 'should' and expect volume is still mounted.
2017-01-05 15:54:14 +01:00
Zdenek Kabelac
4fd41cf67f vgchange: max_pv limited to uint32
Solves: https://bugzilla.redhat.com/1280496

The only reasonable behaviour here is to error on
any number out of accepted range (i.e. now numbers
wrapping around with some hidden logic).

As this is plain bug there is no support for
backward compatibility since noone should
set numbers >UINT32_MAX and expect 0 or error
depending on how big number was used....

TODO: more fields might need to be converted.
2017-01-03 14:55:16 +01:00
Zdenek Kabelac
96a1943fb8 tests: update test
lvm2 now correctly reports thin_id  after action of merged thin,
but before physical metadata update as we know the merge has happened.
2016-12-23 13:16:35 +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
62be9c8de4 tests: use hold_device_open 2016-12-22 23:37:07 +01:00
Zdenek Kabelac
1053d46aff tests: workaround failure on fc23 2016-12-22 23:37:07 +01:00
Zdenek Kabelac
f47da0ad23 tests: usage of cached volume for snapshot 2016-12-19 14:41:43 +01:00
Zdenek Kabelac
8d6ac1c3ba tests: using cached LV for external origin 2016-12-18 19:38:51 +01:00
Zdenek Kabelac
75ec7c8dee tests: update seg_size_pe
Default prepare_vg uses 512K - so update test accordingly
2016-12-12 11:51:50 +01:00
Zdenek Kabelac
3dd6e2c7e1 tests: use prepare_vg more often 2016-12-12 11:22:41 +01:00
Zdenek Kabelac
273ccb1170 tests: remove unwanted exit
Exit seemes slipped in from local testing in:
eb6b2a11e3
2016-12-11 23:24:19 +01:00
Zdenek Kabelac
b902fd08f6 tests: remove some leaking device
These tests leaks devices (known bugs).
Remove them via dmsetup.

TODO: fix actual commands
2016-12-11 23:24:19 +01:00
Zdenek Kabelac
bcf59a1b18 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.
2016-12-11 23:24:19 +01:00
Zdenek Kabelac
198f335139 tests: slower device
Some of test machines are too fast, slow raid syncing even more.
2016-12-11 23:24:19 +01: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
0ce9ae3cda tests: more snaps
Check lvs reports 'origin' not openned.
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
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
Zdenek Kabelac
e7da8e7e1f tests: fix checking for pvmove LV
Use consitently egrep.

TODO: make probably aux func
2016-11-14 12:55:43 +01:00
Zdenek Kabelac
de3d054f78 tests: avoid using polling 2016-11-11 16:58:20 +01:00
Zdenek Kabelac
c1862ea84c tests: for repair we need neewer version
Older cache targets were not able to report write failures.
2016-11-08 16:01:35 +01:00
Zdenek Kabelac
2ec3e7dca8 tests: test raid0_meta type
Enable testing of raid0_meta type.
Also slow down devices a bit more.
2016-11-08 16:01:35 +01:00
Alasdair G Kergon
6dce0e9489 tests: Disable 3-leg raid1 pre-sync repair attempt
Test fails as it doesn't ensure device isn't already in sync.
2016-11-04 00:23:08 +00:00
David Teigland
221d8ff2a4 tests: check that pvscan cannot activate exported VG 2016-11-03 11:43:37 -05:00
Heinz Mauelshagen
a9651adc84 test: add raid4 checks to respective tests
Add missing checks for valid raid4 mapping to tests.
2016-10-28 21:54:10 +02:00
Heinz Mauelshagen
61ae07966d lvconvert-raid-takeover.sh: fix test 2016-10-27 16:38:15 +02: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
Heinz Mauelshagen
de78e8eae7 lvconvert: position dedicated parity device in raid4 conversions porperly
On conversions between striped/raid0* and raid4, the kernel expects
the dedicated raid4 parity SubLVs in the first segment area rather than
in the last it's been allocated to, thus the data mapping ain't proper.

Enhance lvconvert (lib/metadata/raid_manip.c) to shift the dedicated
parity SubLVs on conversions from striped/raid0* to raid4 and vice-versa.

In case of raid0_meta -> raid4 where the MD raid0 personality already has
stored RAID array device positions in the superblocks, the MetaLVs have to
be cleared so that the kernel doesn't fail validating the array positions
after lvm has shifted them up by one.

Add more tests to lvconvert-raid-takeover.sh including one to check for
mapping flaws by converting a created raid4 with filesystem -> striped
and fsck it.

Whilst on it:
- add missing direct striped -> raid4 conversion to the takeover array
  to avoid an intermim conversion from striped -> raid0*
- clean up the takeover array
- allow lvconvert to actually call lv_raid_convert() on all takeover requests
  in order to check parameters and display messages provided by takeover
  functions rather than just "...not supported" from within lvconvert
- fix a typo

Resolves: rhbz1386148
2016-10-21 19:00:31 +02:00
Zdenek Kabelac
9e33781d95 tests: proper wait usage
Fix missing wait so we have paired waiting.
Also 'wait' for precise PID to get 'exit' code.

Test for 'error' replacing only with newer snapshot targets.
The old one will wait for resume.

Note: 'wait -n' is not always available so can't be used..
2016-10-03 17:49:56 +02:00
Heinz Mauelshagen
f2efd04052 tests: fix raid rebuild tests to work with older target versions
Pre 1.9 dm-raid targets status output was racy, which caused
the device status chars to be unreliable _during_ synchronization.
This shows paritcularly with tiny test devices used.

Enhance lvchange-rebuild-raid.sh to not check status
chars _during_ synchronization. Just check afterwards.
2016-09-22 23:35:37 +02:00
Zdenek Kabelac
38a6a39daa tests: raid repair needs devices in-sync
Though I'm not quite sure why we push this limit on user,
current --repair logic requires user to wait outside of command.

TODO: I'm not quite sure this repair logic is 'the most wanted'.
2016-09-22 15:46:18 +02:00
Zdenek Kabelac
eb6b2a11e3 tests: check for TRIM support
passdown can really work only on discardable device.
Skip 'status' test when PV does no support discard.
2016-09-22 15:37:52 +02:00
Heinz Mauelshagen
5d455b28fc lvconvert: fix (automatic) raid repair regression
The dm-raid target now rejects device rebuild requests during ongoing
resynchronization thus causing 'lvconvert --repair ...' to fail with
a kernel error message. This regresses with respect to failing automatic
repair via the dmeventd RAID plugin in case raid_fault_policy="allocate"
is configured in lvm.conf as well.

Previously allowing such repair request required cancelling the
resynchronization of any still accessible DataLVs, hence reasoning
potential data loss.

Patch allows the resynchronization of still accessible DataLVs to
finish up by rejecting any 'lvconvert --repair ...'.

It enhances the dmeventd RAID plugin to be able to automatically repair
by postponing the repair after synchronization ended.

More tests are added to lvconvert-rebuild-raid.sh to cover single
and multiple DataLV failure cases for the different RAID levels.

- resolves: rhbz1371717
2016-09-21 00:39:29 +02:00
Zdenek Kabelac
9f6b006272 tests: show some more device info
When passdown is not there, look for possible reason.
2016-09-20 22:47:14 +02:00
Zdenek Kabelac
67d4b3b7f2 cache: restore reported origin field
Commit 199697accf rerouted funtion
for priting cache volume origin to lvm2app app function - which
however had a bug.  So restore the original functionality
and print correct LV as cache origin LV.
2016-09-20 14:26:11 +02:00
Zdenek Kabelac
b3b8834724 tests: enhance lvchange of thin pool tests
Validate also content of dmtable.
Check operations with unused thin-pool as well.
2016-09-19 14:00:56 +02:00
Zdenek Kabelac
1a30adc062 tests: check for metadata test working properly
Add more tests to check they guard minimum free space in metadata
for new thin volume creation.
2016-09-19 14:00:56 +02:00
Zdenek Kabelac
cebcc8a604 tests: slightly bigger raid arrays
Just to ensure we catch devices in sync.
2016-09-13 12:25:36 +02:00