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

584 Commits

Author SHA1 Message Date
Jonathan Brassow
ed3c2537b8 raid: Allow repair to reuse PVs from same image that suffered a PV failure
When repairing RAID LVs that have multiple PVs per image, allow
replacement images to be reallocated from the PVs that have not
failed in the image if there is sufficient space.

This allows for scenarios where a 2-way RAID1 is spread across 4 PVs,
where each image lives on two PVs but doesn't use the entire space
on any of them.  If one PV fails and there is sufficient space on the
remaining PV in the image, the image can be reallocated on just the
remaining PV.
2014-06-25 22:26:06 -05:00
Jonathan Brassow
b35fb0b15a raid/misc: Allow creation of parallel areas by LV vs segment
I've changed build_parallel_areas_from_lv to take a new parameter
that allows the caller to build parallel areas by LV vs by segment.
Previously, the function created a list of parallel areas for each
segment in the given LV.  When it came time for allocation, the
parallel areas were honored on a segment basis.  This was problematic
for RAID because any new RAID image must avoid being placed on any
PVs used by other images in the RAID.  For example, if we have a
linear LV that has half its space on one PV and half on another, we
do not want an up-convert to use either of those PVs.  It should
especially not wind up with the following, where the first portion
of one LV is paired up with the second portion of the other:
------PV1-------  ------PV2-------
[ 2of2 image_1 ]  [ 1of2 image_1 ]
[ 1of2 image_0 ]  [ 2of2 image_0 ]
----------------  ----------------
Previously, it was possible for this to happen.  The change makes
it so that the returned parallel areas list contains one "super"
segment (seg_pvs) with a list of all the PVs from every actual
segment in the given LV and covering the entire logical extent range.

This change allows RAID conversions to function properly when there
are existing images that contain multiple segments that span more
than one PV.
2014-06-25 21:20:41 -05:00
Jonathan Brassow
1f1675b059 test: Test addition to show incorrect allocator behavior
If a RAID LV has images that are spread across more than one PV
and you allocate a new image that requires more than one PV,
parallel_areas is only honored for one segment.  This commit
adds a test for this condition.
2014-06-21 15:33:52 -05:00
Zdenek Kabelac
93597bcbdc tests: add udev sync point
Missed synchronization with udev may lead to error on vgcreate,
if previous vgremove was not handled fast enough by udev.
2014-06-20 11:14:29 +02:00
Zdenek Kabelac
bc0a1ca83d tests: remove dmeventd usage
This test is testing --use-policies on cmdline.
So monitoring must not be used.
2014-06-19 12:48:21 +02:00
Jonathan Brassow
57faf97e6f test: Clean-up pvmove-basic for atomic pvmove test
The way I was testing for the existence of pvmove mimages was
incorrect for rhel5.  This patch makes it more generic/universal.
2014-06-18 15:40:06 -05:00
Peter Rajnoha
0548a82e63 cleanup: gcc warnings and report-select test vs snap_percent 0%
Fix gcc warnings:
libdm-report.c:1952:5: warning: "end_op_flag_hit" may be used uninitialized in this function [-Wmaybe-uninitialized]
libdm-report.c:2232:28: warning: "custom" may be used uninitialized in this function [-Wmaybe-uninitialized]

And snap_percent is not 0% in dm < 1.10.0 so
don't test comparison with 0% here.
2014-06-18 13:26:47 +02:00
Jonathan Brassow
5ebff6cc9f pvmove: Enable all-or-nothing (atomic) pvmoves
pvmove can be used to move single LVs by name or multiple LVs that
lie within the specified PV range (e.g. /dev/sdb1:0-1000).  When
moving more than one LV, the portions of those LVs that are in the
range to be moved are added to a new temporary pvmove LV.  The LVs
then point to the range in the pvmove LV, rather than the PV
range.

Example 1:
	We have two LVs in this example.  After they were
	created, the first LV was grown, yeilding two segments
	in LV1.  So, there are two LVs with a total of three
	segments.

	Before pvmove:
	      ---------  ---------   ---------
	      | LV1s0 |  | LV2s0 |   | LV1s1 |
	      ---------  ---------   ---------
	         |           |           |
	   -------------------------------------
	PV | 000 - 255 | 256 - 511 | 512 - 767 |
	   -------------------------------------

	After pvmove inserts the temporary pvmove LV:
	          ---------   ---------   ---------
	          | LV1s0 |   | LV2s0 |   | LV1s1 |
	          ---------   ---------   ---------
	              |           |           |
	        -------------------------------------
	pvmove0 |   seg 0   |   seg 1   |   seg 2   |
	        -------------------------------------
	              |           |           |
	        -------------------------------------
	PV      | 000 - 255 | 256 - 511 | 512 - 767 |
	        -------------------------------------

	Each of the affected LV segments now point to a
	range of blocks in the pvmove LV, which purposefully
	corresponds to the segments moved from the original
	LVs into the temporary pvmove LV.

The current implementation goes on from here to mirror the temporary
pvmove LV by segment.  Further, as the pvmove LV is activated, only
one of its segments is actually mirrored (i.e. "moving") at a time.
The rest are either complete or not addressed yet.  If the pvmove
is aborted, those segments that are completed will remain on the
destination and those that are not yet addressed or in the process
of moving will stay on the source PV.  Thus, it is possible to have
a partially completed move - some LVs (or certain segments of LVs)
on the source PV and some on the destination.

Example 2:
	What 'example 1' might look if it was half-way
	through the move.
	             ---------   ---------   ---------
	             | LV1s0 |   | LV2s0 |   | LV1s1 |
	             ---------   ---------   ---------
	                 |           |           |
	           -------------------------------------
	pvmove0    |   seg 0   |   seg 1   |   seg 2   |
	           -------------------------------------
	                 |           |           |
	                 |     -------------------------
	source PV        |     | 256 - 511 | 512 - 767 |
	                 |     -------------------------
	                 |           ||
	           -------------------------
	dest PV    | 000 - 255 | 256 - 511 |
	           -------------------------

This update allows the user to specify that they would like the
pvmove mirror created "by LV" rather than "by segment".  That is,
the pvmove LV becomes an image in an encapsulating mirror along
with the allocated copy image.

Example 3:
	A pvmove that is performed "by LV" rather than "by segment".

	                   ---------   ---------
	                   | LV1s0 |   | LV2s0 |
	                   ---------   ---------
	                       |           |
	                 -------------------------
	        pvmove0  |  * LV-level mirror *  |
	                 -------------------------
                             /                \
	   pvmove_mimage0   /          pvmove_mimage1
	   -------------------------   -------------------------
	   |   seg 0   |   seg 1   |   |   seg 0   |   seg 1   |
	   -------------------------   -------------------------
	        |            |               |           |
	   -------------------------   -------------------------
	   | 000 - 255 | 256 - 511 |   | 000 - 255 | 256 - 511 |
	   -------------------------   -------------------------
	           source PV                    dest PV

The thing that differentiates a pvmove done in this way and a simple
"up-convert" from linear to mirror is the preservation of the
distinct segments.  A normal up-convert would simply allocate the
necessary space with no regard for segment boundaries.  The pvmove
operation must preserve the segments because they are the critical
boundary between the segments of the LVs being moved.  So, when the
pvmove copy image is allocated, all corresponding segments must be
allocated.  The code that merges ajoining segments that are part of
the same LV when the metadata is written must also be avoided in
this case.  This method of mirroring is unique enough to warrant its
own definitional macro, MIRROR_BY_SEGMENTED_LV.  This joins the two
existing macros: MIRROR_BY_SEG (for original pvmove) and MIRROR_BY_LV
(for user created mirrors).

The advantages of performing pvmove in this way is that all of the
LVs affected can be moved together.  It is an all-or-nothing approach
that leaves all LV segments on the source PV if the move is aborted.
Additionally, a mirror log can be used (in the future) to provide tracking
of progress; allowing the copy to continue where it left off in the event
there is a deactivation.
2014-06-17 22:59:36 -05:00
Peter Rajnoha
b16f5633ab test: fix report_select test to work in cluster
The snapshot LV is used to check selection of percent values.
The orig volume must be activated exclusively in cluster.
2014-06-17 18:34:46 +02:00
Peter Rajnoha
ef43a50926 tests: update lvcreate-thin for latest changes
With recent changes introduced with the report selection support,
the content of lv_modules field is of string list type (before
it was just string type).

String list elements are always ordered now so update lvcreate-thin
test to expect the elements to be ordered.
2014-06-17 18:20:08 +02:00
Peter Rajnoha
0d8e94ce2e tests: select: add test for report selection feature 2014-06-17 16:27:21 +02:00
Zdenek Kabelac
378fa9d158 tests: check new snapshot skills 2014-06-17 13:43:05 +02:00
Zdenek Kabelac
8403bbd4ad tests: detect version of thin_restore command
Skip test when missing.
2014-06-17 13:43:05 +02:00
Jonathan Brassow
962a40b981 cache: Properly rename origin LV tree when adding "_corig"
When creating a cache LV with a RAID origin, we need to ensure that
the sub-LVs of that origin properly change their names to include
the "_corig" extention of the top-level LV.  We do this by first
performing a 'lv_rename_update' before making the call to
'insert_layer_for_lv'.
2014-06-16 18:15:39 -05:00
Zdenek Kabelac
cf4d5ead02 test: pvs bz1108394 2014-06-12 11:56:06 +02:00
Zdenek Kabelac
c230ae95ab tests: change to inittest 2014-06-11 17:46:55 +02:00
Zdenek Kabelac
3f81b7c55c tests: update vgchange -c
Vgchange now detects runnig clvmd - so update test to reflect this.
2014-06-11 11:11:10 +02:00
Zdenek Kabelac
5c5177c37c tests: rename test to inittest
We are getting into problem when we use 'test' for commands like
should/not/...

So avoid overloading test name and change it to inittest.
2014-06-10 10:51:27 +02:00
Petr Rockai
4bb1efe2fb test: Reflect that --sysinit only treats lvmetad specially with -aay (not -ay). 2014-06-08 23:37:08 +02:00
Petr Rockai
ee200ddfc3 pvremove: Update lvmcache => avoid spurious error messages. 2014-06-08 22:57:04 +02:00
Petr Rockai
150165591f test: Try harder to vgremove in lvmetad-lvm1.sh. 2014-06-08 22:01:02 +02:00
Petr Rockai
b3bdd41092 lvm1: Fail vg_write graciously when devices are missing. 2014-06-08 21:57:18 +02:00
Petr Rockai
60443d6a5d test: Fix the vgck test after vg_write change. 2014-06-08 21:10:47 +02:00
Petr Rockai
f58a7f305b test: Fail devices silently in lvconvert-repair-transient.sh. 2014-06-08 21:10:47 +02:00
Zdenek Kabelac
7b8133e0b2 tests: fix test compare
Comparing 64T can't use -eq
2014-06-05 23:06:45 +02:00
Zdenek Kabelac
eb7ca96b59 tests: adapt test for newline delimit
content of DEVICES is now delimited by newlines
2014-06-05 23:05:52 +02:00
Zdenek Kabelac
c4e0c61272 tests: typo 2014-06-05 17:49:35 +02:00
Zdenek Kabelac
54da0ea61a tests: use get_devs
Check how get_devs is usable with shell array DEVICES
2014-06-05 17:49:35 +02:00
Zdenek Kabelac
9196942312 tests: add get_devs function
Instead of rereading device list via cat - keep
the list in bash array. (Also solves problem
with spaces in device path)

Move usage of  "$path" out of lvm shell usage,
since we don't support such thing there...
2014-06-05 17:49:34 +02:00
Jonathan Brassow
4454a580df test: use direct I/O when injecting bad data into RAID images
When directly corrupting RAID images for the purpose of testing,
we must use direct I/O (or a 'sync' after the 'dd') to ensure that
the writes are not caught in the buffer cache in a way that is not
reachable by the top-level RAID device.
2014-05-30 17:26:10 -05:00
Zdenek Kabelac
8212dac849 tests: rename test 2014-05-28 15:41:06 +02:00
Zdenek Kabelac
171a668e81 tests: dd needs to hit disk
Unsure if this is feature or bug of syncaction,
but it needs to be present physically on the media
and it ignores content of buffer cache...

(maybe lvchange should implicitely fsync all disks
that are members of raid array before starting test??)
2014-05-28 15:33:41 +02:00
Zdenek Kabelac
ba3e6e7c32 tests: raid syncaction activation race
Demonstrace problem of syncaction being called right after activation.
2014-05-28 15:33:41 +02:00
Zdenek Kabelac
a67774c1fa tests: detect same uuid on PV
Check we know how to handle same UUID
Test  currently does NOT work on lvmetad
(or it's unclear it even should - thus test error
is currently lowered to 'test warning')

TODO: replace lib/test with a better shell script name
2014-05-27 17:09:05 +02:00
Zdenek Kabelac
b3539907f5 tests: support thin_restore configurable
Currently this tool is used only in tests.
2014-05-26 23:30:09 +02:00
Zdenek Kabelac
cfe18d85c1 tests: improve command coverage 2014-05-23 23:35:42 +02:00
Zdenek Kabelac
c5c3995ed5 tests: increase min version for raid testing
Seems smaller version are causing weird kernel lookups.
2014-05-23 23:35:42 +02:00
Zdenek Kabelac
ec9da34d86 tests: check more things with vgchange 2014-05-22 12:01:44 +02:00
Zdenek Kabelac
65b0948c1e tests: swap tests 2014-05-22 12:01:44 +02:00
Zdenek Kabelac
406ce3760b tests: detect raid presence 2014-05-22 12:01:44 +02:00
Zdenek Kabelac
b2da0f0a5b tests: raid and dmeventd 2014-05-21 23:14:42 +02:00
Zdenek Kabelac
37b4dc7775 tests: more pvchange tests 2014-05-21 23:14:42 +02:00
Zdenek Kabelac
79f4665243 tests: more vgcfgrestore testing
Check '-l' and archiving.
2014-05-21 23:14:41 +02:00
Zdenek Kabelac
8db67d2aff tests: skips on unsupported systems 2014-05-21 16:48:06 +02:00
Zdenek Kabelac
b57b4db889 tests: checking mirror_remove_missing
FIXME:

Seems like conversion of log is not supported in clustered VG
and needs to be fixed.
2014-05-20 22:50:52 +02:00
Zdenek Kabelac
f919a255b7 tests: lvconvert needs --yes 2014-05-20 22:50:33 +02:00
Zdenek Kabelac
2e9792121f tests: add have_cache and have_raid
Need to be aware of build options, when system would be
configure without raid or cache support
2014-05-20 21:50:30 +02:00
Zdenek Kabelac
7f92c3a13e tests: wait before down-convert 2014-05-20 21:50:29 +02:00
Zdenek Kabelac
205be24768 tests: update lvconvert test
Split raid test to separate file
Add --yes flag to automated testing
2014-05-20 21:50:29 +02:00
Peter Rajnoha
83f468be4e tests: update profiles.sh test for latest changes 2014-05-20 16:27:09 +02:00
Zdenek Kabelac
ecccb75904 tests: drop nosync
Mirrors currently do not support any conversion,
when they are created no-sync.
2014-05-19 13:22:46 +02:00
Zdenek Kabelac
76c06c7252 tests: speedup
Avoid some expencive raid/mirror synchronization when testing
just allocation sizes.
Use lv_attr_bit
2014-05-15 12:08:35 +02:00
Zdenek Kabelac
7b766b0648 tests: updates
Move thin test out of listing.
2014-05-13 10:28:55 +02:00
Zdenek Kabelac
6f057e3c66 tests: replance hostname call 2014-05-12 16:24:40 +02:00
Zdenek Kabelac
4e559103d5 tests: lets the test continue
unwanted start of dmeventd was caused by seg_monitor status.
2014-04-30 10:26:31 +02:00
Zdenek Kabelac
26989e0cd7 tests: improve coverage
Test more code paths for lvscan & lvdisplay
2014-04-28 12:42:57 +02:00
Jonathan Brassow
3bce3ad52a test: Add the new vgsplit RAID test file forgotten in the last commit 2014-04-25 16:59:09 -05:00
Jonathan Brassow
c671be434c test: Move the RAID vgsplit test into a separate file 2014-04-25 16:57:43 -05:00
Jonathan Brassow
3c4234f825 vgsplit: Make RAID 4/5/6 fail cleanly when too few PV specified
While the 'raid1/10' segment types were being handled inadvertently
by '_move_mirrors()', the parity RAIDs were not being properly checked
to ensure that the user had specified all necessary PVs when moving
them.  Thus, internal errors were being triggered when only part of
a RAID LV was moved to the new VG.  I've added a new function,
'_move_raid()', which properly checks over any affected RAID LVs and
ensures that all the necessary PVs are being moved.
2014-04-25 16:24:50 -05:00
Jonathan Brassow
4dffb9fca9 test/vgsplit-operation.sh: Add vgsplit tests for RAID
vgsplit of RAID volumes was problematic because the metadata area
and data areas were always on the same PVs.  This problem is similar
to one that was just fixed for mirrors that had log and images sharing
a PV (commit 9ac858f).  We can now add RAID LVs to the tests for
vgsplit.

Note that there still seems to be an issue when specifying an
incomplete set of PVs when moving RAID LVs.
2014-04-25 16:22:40 -05:00
Jonathan Brassow
9ac858fe6b vgsplit: Make vgsplit work on mirrors with leg and log on same PV
Given a named mirror LV, vgsplit will look for the PVs that compose it
and move them to a new VG.  It does this by first looking at the log
and then the legs.  If the log is on the same device as one of the mirror
images, a problem occurs.  This is because the PV is moved to the new VG
as the log is processed and thus cannot be found in the current VG when
the image is processed.  The solution is to check and see if the PV we are
looking for has already been moved to the new VG.  If so, it is not an
error.
2014-04-25 14:53:34 -05:00
Marian Csontos
795944f178 test: add lvresize tests
- test for Bug 1088153
- test lvextend does not reduce nor lvreduce extend LV
2014-04-22 12:53:30 +02:00
Zdenek Kabelac
47a60369a0 unknown: fix mempool used for name allocation
Use cmd libmem mempool for name allocation, since mem mempool
is released after each clvmd command.
2014-04-18 16:38:47 +02:00
Zdenek Kabelac
3c82a37aee tests: correct test condition
Abort loop when PIDFILE is gone
2014-04-14 14:55:14 +02:00
Zdenek Kabelac
92ee51a4c3 tests: check there is really pvmove lv
Since the kill may take various amount of time,
(especially when running with valgrind)
check it's really pvmoved LV.

Restore initial restart of clvmd - it's currently
broken at various moments - basically killed lvm2
command may leave clvmd and confusing state leading
to reports of internal errors.
2014-04-14 13:02:28 +02:00
Peter Rajnoha
35721ee134 tests: add test for pvcreate --dataalignment --dataalignmentoffset --restorefile compatibility
Also, avoid division by zero in the pvcreate's param validation
in case someone supplies "pvcreate --dataalignment 0".
2014-04-10 15:02:35 +02:00
Peter Rajnoha
05eb6a167e tests: add separate test file for bootloader area support and enhance tests
Enahnce bootloader area test to check whether restoring values from
backup works correctly.
2014-04-10 14:18:59 +02:00
Peter Rajnoha
b45d2768a8 tests: add some coverage for bootloader areas 2014-04-09 15:44:26 +02:00
Zdenek Kabelac
87e559f1ec tests: check prohibited names 2014-04-08 11:00:16 +02:00
Zdenek Kabelac
c95d43b28c tests: update lvcreate-cache 2014-04-01 20:54:10 +02:00
Peter Rajnoha
504c328e3d tests: add profiles-thin and prepare_profiles helper fn 2014-04-01 15:52:54 +02:00
Petr Rockai
490226fc47 pvs: Wipe persistent filters when given a device argument. 2014-04-01 14:46:22 +02:00
Peter Rajnoha
a30219a8c0 tests: update profiles.sh for recent changes 2014-04-01 11:48:49 +02:00
Zdenek Kabelac
367e4551a1 tests: add more rename test
Drop test, which are now in other files (listings.sh)
2014-03-31 12:05:35 +02:00
Zdenek Kabelac
ee8708cc8e tests: more listing tests 2014-03-31 12:05:35 +02:00
Zdenek Kabelac
8f9150c241 tests: add more pvdisplay tests 2014-03-30 23:45:00 +02:00
Zdenek Kabelac
1216aa7826 tests: workaround clvmd .cache consistency
May need futher fixes, but it's needed only on non-udev systems
(systems which still needs .cache - just like test suite)
2014-03-30 23:45:00 +02:00
Zdenek Kabelac
2c8f0c9800 tests: more vgexport tests
cover more options
2014-03-30 23:45:00 +02:00
Zdenek Kabelac
5aa2e5ec8c tests: update pvs test
TODO:
It seems commit 7e685e6c70
has changed the old logic, when  'pvs device_name' used
to work. (regression from 2.02.104)
Currently put in extra pvscan.
2014-03-28 17:06:13 +01:00
Zdenek Kabelac
3181dc72e7 tests: more coverage for pvchange
Change metadataignore
Argless pvchange
Alocatability for orphans
2014-03-28 11:38:50 +01:00
Zdenek Kabelac
2a79971004 tests: check pvchange changes uuid 2014-03-28 10:41:59 +01:00
Zdenek Kabelac
09b180cfc2 tests: expect failing pvs when missing PV 2014-03-28 10:41:59 +01:00
Zdenek Kabelac
a512ea6a6a tests: updates 2014-03-28 00:41:19 +01:00
Zdenek Kabelac
bd805ff048 tests: move some tests to better places
Some tests already have separate test scripts - so move
those tests to listing and vgcfgbackup files.
2014-03-28 00:41:19 +01:00
Zdenek Kabelac
4ebdfcfb59 tests: more pvchange options examined 2014-03-27 13:13:22 +01:00
Zdenek Kabelac
04a6918518 tests: cover more commands
Visit more code lines.
2014-03-27 13:13:09 +01:00
Zdenek Kabelac
a2614c6866 tests: missed exclusive activation 2014-03-26 00:22:23 +01:00
Zdenek Kabelac
5b900dbef5 tests: pass list devs to allocate from 2014-03-26 00:05:46 +01:00
Zdenek Kabelac
1259ae5954 tests: cover code from more commands 2014-03-26 00:05:46 +01:00
Zdenek Kabelac
4b30863e85 tests: check forced backup 2014-03-26 00:05:46 +01:00
Zdenek Kabelac
4adbb85c37 tests: disable test for broken kernel raid targe
Since using raid5 - validate it's usable on the system
2014-03-26 00:04:59 +01:00
Zdenek Kabelac
8471fb01d8 tests: wipe signature
Check for usable blkid.
2014-03-25 11:23:00 +01:00
Zdenek Kabelac
3c9204a75a tests: update 2014-03-25 11:23:00 +01:00
Zdenek Kabelac
36d87eddcf tests: use exclusive activation
pvmove in cluster needs exlusive activation or cmirrord running.
2014-03-25 11:23:00 +01:00
Zdenek Kabelac
db1d4ba4ac tests: argless pvremove 2014-03-25 11:23:00 +01:00
Zdenek Kabelac
04861b9bed tests: more pvresize tests
Maybe move to separate pvresize test,
remove vgck size this is already executed elsewhere.
2014-03-25 11:22:59 +01:00
Zdenek Kabelac
db04d3e6d2 tests: relocate vgimport test
It seem like a better-fit here.
2014-03-25 11:22:59 +01:00
Zdenek Kabelac
8b1916fd5a tests: simplify 2014-03-21 22:29:28 +01:00
Zdenek Kabelac
de5683d8d9 tests: add quotes around device paths 2014-03-21 22:29:27 +01:00
Petr Rockai
f12ee43f2e polldaemon: Re-initialise lvmcache properly on fork (fixes RHBZ 1073670). 2014-03-19 16:25:12 +01:00
Zdenek Kabelac
aed36c12f8 tests: use check lv_tree_on
Use internal /lib function.
Reduce extent size for test to create smaller devices.
2014-03-18 10:28:09 +01:00
Zdenek Kabelac
31b1d06ddd tests: replace skip_if_mirror_recovery_broken
Use mirror_recovery_works instead with easier to follow logic.
2014-03-17 16:33:29 +01:00
Zdenek Kabelac
e3d208f7c2 tests: put vars in quotes
This shell var has space in middle
2014-03-17 16:30:52 +01:00
Zdenek Kabelac
a2c544dc91 tests: make test usable in cluster
Origin needs exclusive activation
2014-03-17 15:18:20 +01:00
Zdenek Kabelac
ae2d80dd7e tests: update error message check 2014-03-17 15:18:02 +01:00
Zdenek Kabelac
e398901ed1 tests: zero and error type tests 2014-03-17 14:31:45 +01:00
Zdenek Kabelac
fe8603dd60 tests: lvconvert snapshot testing 2014-03-17 14:31:45 +01:00
Zdenek Kabelac
27d556de9e tests: enhance snapshot test
Improve cleanup routine and use it also for vg removal.
2014-03-17 14:31:45 +01:00
Zdenek Kabelac
95f74af404 tests: skip mangling test
Mangling is only using dmsetup commands,
so there is no lvm command and no contact with
clvmd nor lvmetad so skip this test there.
2014-03-17 14:31:45 +01:00
Zdenek Kabelac
909e2207bd tests: test spare volume removal 2014-03-17 14:31:44 +01:00
Zdenek Kabelac
404593c710 tests: more coverage 2014-03-17 14:31:44 +01:00
Peter Rajnoha
12eb284eec tests: fix name-mangling test
We need to use "--verifyudev" for dmsetup mangle command used in
the name-mangling test since without the --verifyudev, we'd end up
with the failed rename.

Also, add direct check for the dev nodes - node with old name must
be gone and node with new name must be present. Before, we checked
just the output of the command.

One bug popped up here when renaming with udev and libdevmapper
fallback checking the udev when target mangle mode is "none"
(fixme added in the libdevmapper's node rename code).
2014-03-17 11:51:30 +01:00
Zdenek Kabelac
a2c64e21fd tests: check we are no reading pool device 2014-03-12 00:26:47 +01:00
Zdenek Kabelac
dd690d5fd1 tests: add inactive pool creation test 2014-03-12 00:25:59 +01:00
Zdenek Kabelac
41e1b12e03 tests: skip another kernel
This kernel has still buggy kmem_cache debugging so skip it for raid456.
2014-03-10 12:24:10 +01:00
Zdenek Kabelac
d913fcbd46 tests: improve wait for open
Add loop to detect open device from 'sleep <'
2014-03-10 12:24:10 +01:00
Zdenek Kabelac
fa23234e71 tests: reuse existing check dev_md5sum
Create md5sum in reusable way and use exiting check function.
2014-03-10 12:24:10 +01:00
Zdenek Kabelac
ef1d910dee tests: updates for new test
snaphost needs exclusive origin for cluster
older md5 needs 2 space char
2014-03-06 18:01:21 +01:00
Zdenek Kabelac
6b561a7a3b tests: check created snapshot has good max size
Testing if we are creating large enough old-snapshot
(so the COW max size is correct)
https://bugzilla.redhat.com/show_bug.cgi?id=1035871
2014-03-06 17:30:10 +01:00
Zdenek Kabelac
d0673b0ddc tests: detect old-snap metadata consitency
Add some test for correctness of snapshot metadata.
Based upon original test from Mikulas.
Needs correctly working kernel snapshot target.
2014-03-06 17:30:10 +01:00
Peter Rajnoha
cfc9e178bf tests: fix name-mangling test and remove udev transaction in dmsetup wrapper 2014-03-06 14:46:50 +01:00
Petr Rockai
3c9887467f test: Use correct path to /dev in lvchange-raid.sh. 2014-03-05 10:22:39 +01:00
Zdenek Kabelac
52007a9191 tests: split raid test
Use separate files for raid1, raid456, raid10.
They need different target versions to work, so support
more precise test selection.

Optimize duplicate tests of target avalability and skip
unsupported test cases sooner.
2014-03-03 11:23:57 +01:00
Marian Csontos
445c0a5585 test: Remove incorrect evaluation 2014-03-03 08:31:33 +01:00
Zdenek Kabelac
33d69162e4 tests: split raid test
Use separate test file for raid456
Change test for broken kernel which has broken raid456 support.
2014-03-02 21:27:26 +01:00
Zdenek Kabelac
3ff10f5e61 tests: disable test which leaks node
This test is not detected as fault but leak device node
on a real /dev.
Added FIXME.
2014-03-02 21:27:26 +01:00
Zdenek Kabelac
a2af5855c5 tests: use longer sleep
Eplore why 30sec is not enough for hydra and try higher value.
2014-03-02 21:27:25 +01:00
Petr Rockai
fade191aed test: Test that we cope with stray device nodes. 2014-03-02 20:53:43 +01:00
Petr Rockai
3b958984f1 test: Properly synchronize direct dmsetup calls. 2014-03-02 20:53:43 +01:00
Zdenek Kabelac
72ecf8e591 tests: detect reiserfs support
Since reiserfs is not commonly available detect its presence in kernel.
Stop reporting skipped test as WARNING.
2014-03-01 14:08:59 +01:00
Petr Rockai
daa897fe90 test: Fix stat calls in lvmetad-pvscan-filter. 2014-02-28 23:33:30 +01:00
Petr Rockai
1bb29bb402 test: Downgrade lvmetad-lvm1 failure to a warning. 2014-02-28 23:33:17 +01:00
Petr Rockai
f3b9fe6024 test: Add lvmetad_talk and lvmetad_dump to aux. 2014-02-28 11:23:53 +01:00
Petr Rockai
bf29eabdba lvmetad: Keep the cache consistent when a PV moves around.
In cases where PV appears on a new device without disappearing from an old one
first, the device->pvid pointers could become ambiguous. This could cause the
ambiguous PV to be lost from the cache when a different PV comes up on one of
the ambiguous devices.
2014-02-28 11:23:52 +01:00
Petr Rockai
a368698672 lvmetad: Hide corrupt MDAs from the cache.
This is probably not optimal, but makes the lvmetad case mimic non-lvmetad code
more closely. It also fixes vgremove of a partially corrupt VG with lvmetad, as
_vg_write_raw (and consequently, entire vg_write) currently panics when it
encounters a corrupt MDA. Ideally, we'd be able to explicitly control when it is
safe to ignore them.
2014-02-28 11:23:52 +01:00
Jonathan Brassow
38ab4c31a6 test: warn rather than fail when %FREE isn't working right
%FREE allocation has been broken for RAID.  At 100%FREE, there is
still an extent left for certain tests.  For now, change the test
to warn rather than completely fail.
2014-02-27 22:47:30 -06:00
Zdenek Kabelac
a7dc422bde tests: remove extra vgremove
These vgremove calls were not correct.
2014-02-27 14:53:33 +01:00
Zdenek Kabelac
c23cd12023 tests: quote dev 2014-02-27 14:49:49 +01:00
Zdenek Kabelac
f4afd07700 tests: drop remove
Generates waaaaay too much log from lvmetad test.

TODO: once we will be able to remove more LVs with a single
write - we may restore....
2014-02-27 14:48:32 +01:00
Zdenek Kabelac
47b15b805e tests: updates
Add some vgremove calls.
Remove uneeded test for some unused commands.
Add tests for missing commands.
2014-02-27 13:01:04 +01:00
Zdenek Kabelac
d00fc1de78 snapshot: correct previous snapshot commit
Condition was swapped - however since it's been based on 'random'
memory content it's been missed as attribute has not been set.

So now we have quite a few possible results when testing.

We have old status without separate metadata and
we have kernels with fixed snapshot leak bug.

(in-release update)
2014-02-27 13:00:49 +01:00
Zdenek Kabelac
40e6176d25 snapshots: fix incorrect calculation of cow size
Code uses target driver version for better estimation of
max size of COW device for snapshot.

The bug can be tested with this script:
VG=vg1
lvremove -f $VG/origin
set -e
lvcreate -L 2143289344b -n origin $VG
lvcreate -n snap -c 8k -L 2304M -s $VG/origin
dd if=/dev/zero of=/dev/$VG/snap bs=1M count=2044 oflag=direct

The bug happens when these two conditions are met
* origin size is divisible by (chunk_size/16) - so that the last
  metadata area is filled completely
* the miscalculated snapshot metadata size is divisible by extent size -
  so that there is no padding to extent boundary which would otherwise
  save us

Signed-off-by:Mikulas Patocka <mpatocka@redhat.com>
2014-02-26 14:25:09 +01:00
Zhiqing Zhang
014ba37cb1 lvresize: fix stripe size validation
While stripe size is twice the physical extent size,
the original code will not reduce stripe size to maximum
(physical extent size).

Signed-off-by: Zhiqing Zhang <zhangzq.fnst@cn.fujitsu.com>
2014-02-26 13:25:50 +01:00
Zdenek Kabelac
b5e03c88b8 tests: support for older snapshot target version
TODO: unsure about 1.10...
2014-02-26 11:17:39 +01:00
Zdenek Kabelac
aef6016011 tests: improve read-only test for snapshot
Switch to use ext2 to make it usable on older systems.
Previous test has not been able to catching problem.

Multiple tests are now put in.

FIXME: validate what is doing kernel target when
the header is undeleted and same chunk size is used.

It seems snapshot target successfully resumes and
just complains COW is not big enough:

kernel: dm-8: rw=0, want=40, limit=24
kernel: attempt to access beyond end of device

When chunk size is different it fails instantly.

For checking this with lvm2 and this test case use this patch:

--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -769,7 +769,7 @@ static int _read_activation_params(struct
lvcreate_params *lp,
        lp->permission = arg_uint_value(cmd, permission_ARG,
                                        LVM_READ | LVM_WRITE);

-       if (lp->snapshot) {
+       if (0 && lp->snapshot) {
                /* Snapshot has to zero COW header */
                lp->zero = 1;
                lp->wipe_signatures = 0;

---
and switch to use  -c 4 for both snapshots
2014-02-26 10:19:46 +01:00
Zdenek Kabelac
2b044452e3 snapshot: zero cow header for read-only snapshot
When read-only snapshot was created, tool was skipping header
initialization of cow device.  If it happened device has been
already containing header from some previous snapshot, it's
been 'reused' for a newly created snapshot instead of being cleared.
2014-02-26 00:22:46 +01:00
Zdenek Kabelac
3e49753e6c tests: cache needs 1.3 2014-02-25 09:36:07 +01:00
Zdenek Kabelac
8083143822 tests: add extra wait
Parallel upconvert & downconvert is now tested separately
in lvconvert-mirror-updown.sh
2014-02-24 21:13:36 +01:00
Zdenek Kabelac
32138969f9 tests: enhance thin test
Add more tests to also check validaty of transaction_id
and also detect we are not leaving active unusable thin pool LVs.
2014-02-24 21:13:36 +01:00
Zdenek Kabelac
9c9f4515ae tests: add some quotes
Use quotes for DM_DEV_DIR
2014-02-24 21:13:36 +01:00
Jonathan Brassow
ee89ac7b88 pvmove: Disallow pvmove of cache LVs
Skip over LVs that have a cache LV in their tree of LV dependencies
when performing a pvmove.

This means that users cannot move a cache pool or a cache LV's origin -
even when that cache LV is used as part of another LV (e.g. a thin pool).

The new test (pvmove-cache-segtypes.sh) currently builds up various LV
stacks that incorporate cache LVs.  pvmove tests are then performed to
ensure that cache related LVs are /not/ moved.  Once pvmove is enabled
for cache, those tests will switch to ensuring that the LVs /are/
moved.
2014-02-24 12:25:18 -06:00
Jonathan Brassow
46223c4284 test: move RAID10 tests from lvcreate-raid.sh to lvcreate-raid10.sh 2014-02-21 18:28:16 -06:00
Petr Rockai
294671fa62 test: Only try raid10 on dm-raid versions that support it. 2014-02-21 19:47:06 +01:00
Zdenek Kabelac
5e83682ccf tests: add small test for clustered conversion of mirror
Test currently fails with make check_cluster - so uses 'should'

CLVMD[4f435880]: Feb 19 23:27:36 Send local reply
format_text/archiver.c:230   WARNING: This metadata update is NOT backed up
metadata/mirror.c:1105   Failed to initialize log device
metadata/mirror.c:1145         <backtrace>
lvconvert.c:1547         <backtrace>
lvconvert.c:3084         <backtrace>
2014-02-19 23:34:07 +01:00
Jonathan Brassow
00ce01e52d cache-pool: Change segtype name from cache_pool to cache-pool
Thin pools use "thin-pool" for the segment type name.  To be consistent,
we use "cache-pool" instead of "cache_pool".
2014-02-19 09:26:03 -06:00
Zdenek Kabelac
c71a3bcbc0 activation: lv_activation_skip remove always same arg.
Remove 'skip' argument passed into the function.
We always used '0' - as this is the only supported
option (-K) and there is no complementary option.

Also add some testing for behaviour of skipping.
2014-02-19 11:33:39 +01:00
Zdenek Kabelac
fdcd95a3b3 tests: check locking is not lost during thin_check 2014-02-18 14:58:41 +01:00
Zdenek Kabelac
0e0f91b6dd tests: use exclusive activation for mirror case
Since mirror doesn't take exclusive lock implicitely yet,
enforce it for cluster testing.
2014-02-18 10:39:29 +01:00
Jonathan Brassow
6a00a7e33d RAID: Allow implicit stripe (and parity) when creating RAID LVs
There are typically 2 functions for the more advanced segment types that
deal with parameters in lvcreate.c: _get_*_params() and _check_*_params().
(Not all segment types name their functions according to this scheme.)
The former function is responsible for reading parameters before the VG
has been read.  The latter is for sanity checking and possibly setting
parameters after the VG has been read.

This patch adds a _check_raid_parameters() function that will determine
if the user has specified 'stripe' or 'mirror' parameters.  If not, the
proper number is computed from the list of PVs the user has supplied or
the number that are available in the VG.  Now that _check_raid_parameters()
is available, we move the check for proper number of stripes from
_get_* to _check_*.

This gives the user the ability to create RAID LVs as follows:
# 5-device RAID5, 4-data, 1-parity (i.e. implicit '-i 4')
~> lvcreate --type raid5 -L 100G -n lv vg /dev/sd[abcde]1

# 5-device RAID6, 3-data, 2-parity (i.e. implicit '-i 3')
~> lvcreate --type raid6 -L 100G -n lv vg /dev/sd[abcde]1

# If 5 PVs in VG, 4-data, 1-parity RAID5
~> lvcreate --type raid5 -L 100G -n lv vg

Considerations:
This patch only affects RAID.  It might also be useful to apply this to
the 'stripe' segment type.  LVM RAID may include RAID0 at some point in
the future and the implicit stripes would apply there.  It would be odd
to have RAID0 be able to auto-determine the stripe count while 'stripe'
could not.

The only draw-back of this patch that I can see is that there might be
less error checking.  Rather than informing the user that they forgot
to supply an argument (e.g. '-i'), the value would be computed and it
may differ from what the user actually wanted.  I don't see this as a
problem, because the user can check the device count after creation
and remove the LV if they have made an error.
2014-02-17 20:18:23 -06:00
Zdenek Kabelac
18cac16540 tests: more clustered testing 2014-02-17 22:25:53 +01:00
Zdenek Kabelac
37cf201906 tests: on older system use mirror type 2014-02-17 22:25:53 +01:00
Zdenek Kabelac
8eedb18c73 tests: add short delay
Give some extra delay so the file will be opened.
2014-02-17 22:25:53 +01:00
Zdenek Kabelac
25cea92338 thin: fix merge of old snaphost
Fix merging of old snapshot into thinvolume origin.
Add also internal error for the error case when
merging requests activation of merged LV.
2014-02-17 22:25:53 +01:00
Jonathan Brassow
fa4812bf7b cache: Fix cache LV not being instantiated in kernel
When an origin exists and the 'lvcreate' command is used to create
a cache pool + cache LV, the table is loaded into the kernel but
never instantiated (suspend/resume was never called).  A user running
LVM commands would never know that the kernel did not have the
proper state unless they also ran the dmsetup 'table/status' command.
The solution is to suspend/resume the cache LV to make the loaded
tables become active.
2014-02-14 16:04:31 -06:00
Jonathan Brassow
4b6e3b5e5e allocation: Allow approximate allocation when specifying size in percent
Introduce a new parameter called "approx_alloc" that is set when the
desired size of a new LV is specified in percentage terms.  If set,
the allocation code tries to get as much space as it can but does not
fail if can at least get some.

One of the practical implications is that users can now specify 100%FREE
when creating RAID LVs, like this:
~> lvcreate --type raid5 -i 2 -l 100%FREE -n lv vg
2014-02-13 21:10:28 -06:00
Zdenek Kabelac
d68e5d5ab9 tests: utilize check and get
Replace some in-test use of lvs commands with their check
and get equivalent.

Advantage is these 'checking' commands are not necessarily always
valiadated via extensive valgrind testing and also the output noice
is significantly reduces since the output of check/get is suppressed.
2014-02-11 19:00:07 +01:00
Jonathan Brassow
96626f64fa cache: Code to allow the create/remove of cache LVs
This patch allows users to create cache LVs with 'lvcreate'.  An origin
or a cache pool LV must be created first.  Then, while supplying the
origin or cache pool to the lvcreate command, the cache can be created.

Ex1:
Here the cache pool is created first, followed by the origin which will
be cached.
~> lvcreate --type cache_pool -L 500M -n cachepool vg /dev/small_n_fast
~> lvcreate --type cache -L 1G -n lv vg/cachepool /dev/large_n_slow

Ex2:
Here the origin is created first, followed by the cache pool - allowing
a cache LV to be created covering the origin.
~> lvcreate -L 1G -n lv vg /dev/large_n_slow
~> lvcreate --type cache -L 500M -n cachepool vg/lv /dev/small_n_fast

The code determines which type of LV was supplied (cache pool or origin)
by checking its type.  It ensures the right argument was given by ensuring
that the origin is larger than the cache pool.

If the user wants to remove just the cache for an LV.  They specify
the LV's associated cache pool when removing:
~> lvremove vg/cachepool

If the user wishes to remove the origin, but leave the cachepool to be
used for another LV, they specify the cache LV.
~> lvremove vg/lv

In order to remove it all, specify both LVs.

This patch also includes tests to create and remove cache pools and
cache LVs.
2014-02-04 16:50:16 -06:00
Zdenek Kabelac
ef557b8091 tests: update test
Remove some unneeded traces and outputs.
2014-02-04 14:49:38 +01:00
Zdenek Kabelac
42fa0e6dd1 tests: validate acceptable external origin size 2014-01-29 14:59:09 +01:00
Zdenek Kabelac
e9d9852c55 thin: more validation of thin name
Avoid starting conversion of the LV to the thin pool and thin volume
at the same time.  Since this is mostly a user mistake, do not try
to just convert to one of those type, since we cannot assume if the
user wanted LV to become thin volume or thin pool.

Before the fix tool reported pretty strange internal error:
Internal error: Referenced LV lvol1_tdata not listed in VG mvg.

Fixed output:
lvconvert --thinpool lvol0 -T mvg/lvol0
Can't use same LV mvg/lvol0 for thin pool and thin volume.
2014-01-28 13:21:39 +01:00
Zdenek Kabelac
bc5f40ee1c tests: check for mkfs
Test mkfs.ext3 presence for test.
Test also on singlenode cluster.
Speed up a bit slowed down device.
2014-01-28 10:40:08 +01:00
Zdenek Kabelac
c0bd436dcb thin: disable extension of reduced thin with etx.origin
Since we are currently incapable of providing zeroes for
reextended thin volume area, let's disable extension of
such already reduce thin volumes.

(in-release change)
2014-01-28 10:40:08 +01:00
Zdenek Kabelac
6b73d21ba9 locking: avoid dropping locks
When lvm2 command forks, it calls reset_locking(),
which as an unwanted side effect unlinked lock file from filesystem.

Patch changes the behavior to just close locked file descriptor
in children - so the lock is being still properly hold in the parent.
2014-01-27 12:13:29 +01:00
Zdenek Kabelac
f18ee04fab lvmetad: respect LVM_LVMETAD_PIDFILE settings in lvm
Test LVM_LVMETAD_PIDFILE for pid for lvm command.
Fix WHATS_NEW envvar name usage
Fix init order in prepare_lvmetad to respect set vars
and avoid clash with system settings.
Update test to really test the 'is running' message.
2014-01-24 15:59:38 +01:00
Zdenek Kabelac
c1df1f3a81 tests: thin external origin resize 2014-01-23 14:22:34 +01:00
Zdenek Kabelac
efe36fcd43 tests: more testing for online thin metadata resize
Some more tests for online resize, but it's still disabled
by default, since kernel doesn't work yet for this feature.
2014-01-21 13:53:10 +01:00
Zdenek Kabelac
79768b2e9c tests: update testing for xfs 2014-01-20 12:02:33 +01:00
Petr Rockai
1937715d2c test: Add a regression test for pvcreate -ff. 2014-01-08 15:24:43 +01:00
Zdenek Kabelac
fd73b2b7b9 tests: skip pool-label test for lvmetad
Unsupported by lvmetad.
2013-12-17 14:08:54 +01:00
Zdenek Kabelac
e3b7fa4b8d thin: thin metadata resize unsupported with 1.9
Thin kernel target 1.9 still does not support online resize of
thin pool metadata properly - so disable it with expectation
for much higher version - and reenable after fixing kernel.
2013-12-10 11:17:37 +01:00
Alasdair G Kergon
16eab3ec08 config: shorten new sig wiping option string
Rename wipe_signatures_on_new_logical_volumes_when_zeroing  to
wipe_signatures_when_zeroing_new_lvs.
2013-12-09 09:35:47 +00:00
Zdenek Kabelac
c144305d3e tests: update pvmove-test
Do not lock test when trying to grab cluster lock.
There seems to be still something weird in this test
so it still needs some inspection.
2013-12-04 17:10:31 +01:00
Zdenek Kabelac
1592bb216e test: thin snapshot merge
Testing thin snapshot merge cases.
TODO: Probably still misses some cases.
2013-12-04 14:30:26 +01:00
Peter Rajnoha
163666e513 tests: one LV should be active and one inactive in covercmd test 2013-12-04 09:38:00 +01:00
Peter Rajnoha
6232cac86c vgdisplay: select only active volumes groups if -A option is used
Where "active" means "at least one LV is active in the volume group".
2013-12-03 14:43:00 +01:00
Peter Rajnoha
3f8083107e tests: add test for lvcreate signature wiping 2013-11-28 15:47:20 +01:00
Peter Rajnoha
08bab406b5 tests: wipe fs signature manually in pvcreate-operation test
So that the next pvcreate that is called does not issue any
warnings/prompts about existing signature (when blkid wiping is used).
2013-11-28 14:10:55 +01:00
Zdenek Kabelac
b0b061cdbc tests: skip raid test on 3.12.0
3.12.0 kernel prevents raid test to be usable,
leaving unremovable devices in table.

This needs to be fixed ASAP, meanwhile disable test to make
test machines at least usable.
2013-11-19 11:49:33 +01:00
Zdenek Kabelac
fe609141a8 tests: on 32bit test with <16T devs
Add  'can_use_16T' to detect systems where we could
safely use 16T devices without causing system deadlocks.

16T size leads on those to endless loops in udevd
- it calls blkid which tries cached read from such device
- this ends in endless loop.

Related problems:
https://bugzilla.redhat.com/show_bug.cgi?id=1015028
2013-11-19 10:55:14 +01:00
Petr Rockai
b8a6b8f467 test: Force label-based reporting in pv-duplicate.sh. 2013-11-18 17:53:06 +01:00
Petr Rockai
ae337d472e report: Print UUIDs for missing PVs when possible. 2013-11-17 22:36:13 +01:00
Petr Rockai
71b6565529 report: Convert pv_mda_size to a type "label" field. 2013-11-17 21:43:06 +01:00
Petr Rockai
a8aa8d4b5c report: Make PV UUID into a "label" type field. 2013-11-17 21:43:06 +01:00
Petr Rockai
fc02f24178 test: Fix fallout from pv_read changes. 2013-11-17 21:41:27 +01:00
Petr Rockai
0a59305c44 test: Add a test for the failing pv_read optimisation. 2013-11-17 21:41:26 +01:00
Zdenek Kabelac
803f8ca714 tests: used -n for fsck 2013-11-15 12:38:37 +01:00
Zdenek Kabelac
37b7c67079 thin: report thin device id
Support   lvs -o+thin_id  to report thin device id.
This device_id is connection between kernel and lvm2 user space thin
metadata.
2013-11-15 12:38:37 +01:00
Zdenek Kabelac
14b852609b tests: testing thin lvchange
Test various thin change operation,
including activation logic - which is somewhat
limited with singlenode emulation.

More tests needs to be added.
2013-11-01 13:05:05 +01:00
Jonathan Brassow
7763607f36 TEST: Test was trying to kill 2 devices in RAID5 instead of RAID6
Segment type being used for test should have been 'raid6'.
2013-10-18 09:33:37 -05:00
Zdenek Kabelac
93a07a1b84 tests: fix exporting content of make vars
Further tune script, so it works correctly with
usable and unusable thin tools.
2013-10-17 11:57:35 +02:00
Zdenek Kabelac
9b13cb8687 tests: correct LVM_TEST_THIN_CHECK_CMD
missed to use proper shell variable
2013-10-16 15:10:03 +02:00
Zdenek Kabelac
73971e1e7b tests: test repairability of thin pool
Initial testing of thin pool's metadata with thin repairing tools.
Try to use tools from configuration settings, but allow them
to be overriden by settings of these variables:
LVM_TEST_THIN_CHECK_CMD,
LVM_TEST_THIN_DUMP_CMD,
LVM_TEST_THIN_REPAIR_CMD

FIXME: test reveals some more important bugs:
  pvremove -ff also needs --yes
  vgremove -ff doesn not remove metadata when there are no real LVs.
  vgreduce is not able to reduce VG with pool without pool's PVs
2013-10-16 10:54:59 +02:00
Zdenek Kabelac
7ab5f29a9c tests: add wait
We need to wait till kill really kills sleep
2013-10-16 10:53:03 +02:00
Zdenek Kabelac
0f55d7cccc tests: lvcreate and snapshot update
Test creation really in cluster.
Update test to check removal when snapshot device is being held open.
2013-10-14 00:29:03 +02:00
Petr Rockai
17f3b8280b test: Correctly trigger inconsistent metadata repair in lvmcache-exercise.
Since lvconvert --repair sets handles_missing_pvs, it will not repair
inconsistent metadata automatically. Calling lvs instead should do the trick.
2013-10-09 14:44:15 +02:00
Zdenek Kabelac
830d233b17 tests: needed --type mirror
Avoid testing raids here (would need kernel module)
2013-10-08 16:56:09 +02:00
Zdenek Kabelac
2ee969e851 tests: reappering device
Simulation of problem for:
https://bugzilla.redhat.com/show_bug.cgi?id=995440
2013-10-08 16:19:14 +02:00
Zdenek Kabelac
273373bf53 tests: lvconvert more thin extorg conversions
Add test for conversion of pool and thin lv at the same time.
2013-10-08 13:42:10 +02:00
Zdenek Kabelac
7edf61186b tests: vgrename duplicate rename
Test for rename of duplicated vgname (with different UUID)
2013-10-08 13:42:09 +02:00
Jonathan Brassow
098896fb29 mirror/RAID: Honor mirror_segtype_default when converting from linear
1) When converting from an x-way mirror/raid1 to a y-way mirror/raid1,
the default behaviour should be to stay the same segment type.

2) When converting from linear to mirror or raid1, the default behaviour
should honor the mirror_segtype_default.

3) When converting and the '--type' argument is specified, the '--type'
argument should be honored.

catch such conditions, but errors in the tests caused the issue to go
unnoticed.  The code has been fixed to perform #2 properly, the tests
have been corrected to properly test for #2, and a few other tests
were changed to explicitly specify the '--type mirror' when necessary.
2013-09-25 22:25:43 -05:00
Jonathan Brassow
c37c59e155 Test/clean-up: Indent clean-up and additional RAID resize test
Better indenting and a test for bug 1005434 (parity RAID should
extend in a contiguous fashion).
2013-09-24 21:32:53 -05:00
Zdenek Kabelac
9658032cba tests: drop extra loop
Loop was added as a result of unworking singlenode locking, since
this should be now fixed - remove this workaround.
2013-09-23 12:14:21 +02:00
Zdenek Kabelac
151f4ba64e tests: drop pointeless test
Writing directly to thin-pool and reading it is not a good idea.
2013-09-23 12:14:21 +02:00
Jonathan Brassow
cafde60890 test: Blacklist fedora-19 kernel for RAID4/5/6 dev replace tests
A know issue with kmem_cach is causing failures while testing
RAID 4/5/6 device replacement.  Blacklist the offending kernel
so that these tests are not performed there.
2013-09-20 11:33:29 -05:00
Zdenek Kabelac
61427af377 tests: no activate LV
Since our current vgcfgbackup/restore doesn't deal
with difference of active volumes between current and
restored set of volumes -  run test with inactive LVs.
2013-09-16 15:38:42 +02:00
Zdenek Kabelac
2abaf87a9b tests: update vgcfgrestore test
Test vgcfgrestore when seqno of restored mda is smaller then current
metadata on device.
2013-09-16 13:48:44 +02:00
Zdenek Kabelac
fbb732bd8e tests: enhance pvmove testing
Rewrite check lv_on  and add new  lv_tree_on
Move more pvmove test unrelated code out to check & get sections
(so they do not obfuscate trace output unnecesserily)

Use new lv_tree_on()
NOTE: unsure how the snapshot origin should be accounted here.

Split pmove-all-segments into separate tests for raid and thins
(so the test output properly shows what has been skipped in test)
2013-09-16 11:22:04 +02:00
Zdenek Kabelac
47b7cc6850 tests: use check for raid test
Use test-suite built-in check command for this test
(creates better logs, and reduces amount of valgrind-ed commands)
2013-09-16 11:22:04 +02:00
Jonathan Brassow
1d06868240 TEST: Unaccounted possible output causing failure
lvchange-raid.sh checks to ensure that the 'p'artial flag takes
precedence over the 'w'ritemostly flag by disabling and reenabling
a device in the array.  Most of the time this works fine, but
sometimes the kernel can notice the device failure before it is
reenabled.  In that case, the attr flag will not return to 'w', but
to 'r'efresh.  This is because 'r'efresh also takes precedence over
the 'w'ritemostly flag.  So, we also do a quick check for 'r' and
not just 'w'.
2013-09-12 13:23:53 -05:00
Jonathan Brassow
82228acfc9 Mirror/Thin: Disallow thinpools on mirror logical volumes
The same corner cases that exist for snapshots on mirrors exist for
any logical volume layered on top of mirror.  (One example is when
a mirror image fails and a non-repair LVM command is the first to
detect it via label reading.  In this case, the LVM command will hang
and prevent the necessary LVM repair command from running.)  When
a better alternative exists, it makes no sense to allow a new target
to stack on mirrors as a new feature.  Since, RAID is now capable of
running EX in a cluster and thin is not active-active aware, it makes
sense to pair these two rather than mirror+thinpool.

As further background, here are some additional comments that I made
when addressing a bug related to mirror+thinpool:
(https://bugzilla.redhat.com/show_bug.cgi?id=919604#c9)
I am going to disallow thin* on top of mirror logical volumes.
Users will have to use the "raid1" segment type if they want this.

This bug has come down to a choice between:
1) Disallowing thin-LVs from being used as PVs.
2) Disallowing thinpools on top of mirrors.

The problem is that the code in dev_manager.c:device_is_usable() is unable
to tell whether there is a mirror device lower in the stack from the device
being checked.  Pretty much anything layered on top of a mirror will suffer
from this problem.  (Snapshots are a good example of this; and option #1
above has been chosen to deal with them.  This can also be seen in
dev_manager.c:device_is_usable().)  When a mirror failure occurs, the
kernel blocks all I/O to it.  If there is an LVM command that comes along
to do the repair (or a different operation that requires label reading), it
would normally avoid the mirror when it sees that it is blocked.  However,
if there is a snapshot or a thin-LV that is on a mirror, the above code
will not detect the mirror underneath and will issue label reading I/O.
This causes the command to hang.

Choosing #1 would mean that thin-LVs could never be used as PVs - even if
they are stacked on something other than mirrors.

Choosing #2 means that thinpools can never be placed on mirrors.  This is
probably better than we think, since it is preferred that people use the
"raid1" segment type in the first place.  However, RAID* cannot currently
be used in a cluster volume group - even in EX-only mode.  Thus, a complete
solution for option #2 must include the ability to activate RAID logical
volumes (and perform RAID operations) in a cluster volume group.  I've
already begun working on this.
2013-09-11 15:58:44 -05:00
Jonathan Brassow
2691f1d764 RAID: Make RAID single-machine-exclusive capable in a cluster
Creation, deletion, [de]activation, repair, conversion, scrubbing
and changing operations are all now available for RAID LVs in a
cluster - provided that they are activated exclusively.

The code has been changed to ensure that no LV or sub-LV activation
is attempted cluster-wide.  This includes the often overlooked
operations of activating metadata areas for the brief time it takes
to clear them.  Additionally, some 'resume_lv' operations were
replaced with 'activate_lv_excl_local' when sub-LVs were promoted
to top-level LVs for removal, clearing or extraction.  This was
necessary because it forces the appropriate renaming actions the
occur via resume in the single-machine case, but won't happen in
a cluster due to the necessity of acquiring a lock first.

The *raid* tests have been updated to allow testing in a cluster.
For the most part, this meant creating devices with '-aey' if they
were to be converted to RAID.  (RAID requires the converting LV to
be EX because it is a condition of activation for the RAID LV in
a cluster.)
2013-09-10 16:33:22 -05:00
Jonathan Brassow
848e8026d6 TEST: pvmove-all-segtypes.sh should not be run in a cluster 2013-09-03 10:54:42 -05:00
Petr Rockai
ea1e8166d5 test: Skip tests involving mirror recovery on known bad kernels. 2013-09-03 16:24:32 +02:00
Zdenek Kabelac
039585bb0d tests: test pvmove behavior after restart
Simulate crash of the system and restarted pvmove after next VG
activation.

Test is catching regression introduced in 2.02.99 for partial tree
creation changes.
2013-08-31 21:40:51 +02:00
David Teigland
eee3aeeb61 test: fix process-each-duplicate-vgnames
After enable_dev, the following commands were not
consistently seeing the pv on it.

Alasdair explained, "whenever enabling/disabling devs
outside the tools (and you aren't trying to test how
the tools cope with suddenly appearing/disappering
devices) use "vgscan""
2013-08-30 11:53:10 -05:00
Jonathan Brassow
e72b2d047d TEST: Add tests for lvchange actions of RAID under thin
Patch includes RAID1,4,5,6,10 tests for:
- setting writemostly/writebehind
* syncaction changes (i.e. scrubbing operations)
- refresh (i.e. reviving devices after transient failures)
- setting recovery rate (sync I/O throttling)
while the RAID LVs are under a thin-pool (both data and metadata)

* not fully tested because I haven't found a way to force bad
  blocks to be noticed in the testsuite yet.  Works just fine
  when dealing with "real" devices.
2013-08-27 16:46:40 -05:00
Jonathan Brassow
0799e81ee0 test: pvmove tests for all the different segment types.
Test moving linear, mirror, snapshot, RAID1,5,10, thinpool, thin
and thin on RAID.  Perform the moves along with a dummy LV and
also without the dummy LV by specifying a logical volume name as
an argument to pvmove.
2013-08-26 16:38:54 -05:00
David Teigland
7d6a125e97 test: add process-each-vg and process-each-lv
These test the toollib functions that select
vgs/lvs to process based on command line args:
empty, vg name(s), lv names(s), vg tag(s),
lv tags(s), and combinations of all.
2013-08-23 14:38:48 -05:00
David Teigland
506bc045b5 test: add process-each-duplicate-vgnames
Test that vgs shows both vgs when two vgs
exist with the same name but different uuids.
2013-08-23 14:19:59 -05:00
David Teigland
8c511122f4 test: add vg-name-from-env
vg name should come from env var LVM_VG_NAME
for commands that take vg name and lv name,
but vg name is not specified on command line.
2013-08-23 14:10:29 -05:00
Petr Rockai
0da72743ca vgck: Fix #894136, notice on-disk corruption in spite of lvmetad. 2013-08-13 23:25:49 +02:00
Jonathan Brassow
8615234c0f RAID: Fix bug making lvchange unable to change recovery rate for RAID
1) Since the min|maxrecoveryrate args are size_kb_ARGs and they
   are recorded (and sent to the kernel) in terms of kB/sec/disk,
   we must back out the factor multiple done by size_kb_arg.  This
   is already performed by 'lvcreate' for these arguments.
2) Allow all RAID types, not just RAID1, to change these values.
3) Add min|maxrecoveryrate_ARG to the list of 'update_partial_unsafe'
   commands so that lvchange will not complain about needing at
   least one of a certain set of arguments and failing.
4) Add tests that check that these values can be set via lvchange
   and lvcreate and that 'lvs' reports back the proper results.
2013-08-09 17:09:47 -05:00
Zdenek Kabelac
a1dc585fa6 test: can convert pool to external origin
Test for http://bugzilla.redhat.com/show_bug.cgi?id=983743
2013-08-09 23:17:15 +02:00
Jonathan Brassow
ea4c0ea34f TEST: Be explicit about which mirror segment type to use.
In those places where mirrors were being created while assuming
a default segment type of "mirror", we include the '--type mirror'
argument to explicitly set the segment type.  This will preserve
the mirror testing that is performed even though the default
mirroring segment type is now "raid1".
2013-08-07 15:48:31 -05:00
Peter Rajnoha
f50e8fb9b9 tests: add profiles.sh test 2013-08-07 12:17:36 +02:00
Zdenek Kabelac
ea605d1ec7 thin: metadata resize needs 1.9 version
Version 1.8 is not yet fully usable for metadata resize.
2013-07-31 15:29:27 +02:00
Zdenek Kabelac
da5284a500 thin: lvconvert cannot convert pool to mirror
Suggest to use _tdata and _tmeta devices for that.
This fixes regression from too relaxed change in
f1d5f6ae81

Without this patch there are some empty LVs created before
mirror code recognizes it cannot continue.

(in release fix)
2013-07-24 17:17:19 +02:00
Zdenek Kabelac
5597dc3652 thin: not zeroing for non-zeroed thin pool snaps
Do not zero initial 4KB of thin snapshot volume for thin pool with
disabled zeroing.
2013-07-24 01:15:31 +02:00
Zdenek Kabelac
f6ded62291 snapshot: fix merging
When the merging of snapshot is finished, we need to clean dm table
intries for snapshot and -cow device. So for merging snapshot
we have to activate_lv plain 'cow' LV and let the table
resolver to its work - shortly deactivation_lv() request
will follow - in cluster this needs LV lock to be held by clvmd.

Also update a test - add small wait - if lvremove is not 'fast enough'
and merging process has not been stopped and $lv1 removed in background.
Ortherwise the following lvcreate occasionally finds name $lv1 still in use.

(in release fix)
2013-07-22 16:26:00 +02:00
Peter Rajnoha
6ca81a091c tests: comment about pvscan --cache return value 2013-07-22 15:57:18 +02:00
Jonathan Brassow
081308af30 TEST: Support testing new RAID features in RHEL6 kernels
We check the version number of dm-raid before testing certain
features to make sure they are present.  However, this has
become somewhat complicated by the fact that the version #'s
in the upstream kernel and the REHL6 kernel have been diverging.
This has been a necessity because the upstream kernel has
undergone ABI changes that have necessitated a bump in the
'Y' component of the version #, while the RHEL6 kernel has not.
Thus, we need to know that the ABI has not changed but the
features have been added.  So, the current version #'ing stands
as follows:

RHEL6   Upstream   Comment
======|==========|========
** Same until version 1.3.1 **
------|----------|--------
 N/A  |   1.4.0  | Non-functional change.
      |          | Removes arg from mapping function.
------|----------|--------
1.3.2 |   1.4.1  | RAID10 fix redundancy validation checks.
------|----------|--------
1.3.5 |   1.4.2  | Add RAID10 "far" and "offset" algorithm support.
      |          | Note this feature came later in RHEL6 as part of
      |          | a separate update/feature.
------|----------|--------
1.3.3 |   1.5.0  | Add message interface to allow manipulation of
      |          | the sync_action.
      |          | New status (STATUSTYPE_INFO) fields: sync_action
      |          | and mismatch_cnt.
------|----------|--------
1.3.4 |   1.5.1  | Add ability to restore transiently failed devices
      |          | on resume.
------|----------|--------
1.3.5 |   1.5.2  | 'mismatch_cnt' is zero unless [last_]sync_action
      |          | is "check".
------|----------|--------

To simplify, writemostly/writebehind, scrubbing, and transient device
failure restoration are all tested based on the same version
requirements: (1.3.5 < V < 1.4.0) || (V > 1.5.2).  Since kernel
support for writemostly/writebehind has been around for some time,
this could mean a reduction in the scope of kernels tested for this
feature.  I don't view this as much of a problem, since support for
this feature was only recently added to LVM.  Thus, the user would
have to be using a very recent LVM version with an older kernel.
2013-07-22 08:50:27 -05:00
Petr Rockai
3fdb45d040 pvscan: Respect lvmetad (global) filter in --cache w/ a device. 2013-07-22 15:05:39 +02:00
Petr Rockai
bd60232d74 TEST: Add a regression test for the ondisk/orphan bug. 2013-07-22 11:57:23 +02:00
Jonathan Brassow
6aeb54c77c TEST: Update syncaction test to match latest kernel updates
The mismatch count reported by a dm-raid kernel target used
to be effectively random, unless it was checked after a
"check" scrubbing action had been performed.  Updates to the
kernel now mean that the mismatch count will be 0 unless a
check has been performed and discrepancies had been found.
This has been the intended behaviour all along.

This patch updates the test suite to handle the change.
2013-07-19 15:24:34 -05:00
Alasdair G Kergon
da79fe4c1d reporting: tidy recent new fields
Add underscores and prefixes to recently-added fields.
(Might add more alias functionality in future.)
2013-07-19 01:30:02 +01:00
Zdenek Kabelac
4e724f5f52 thin: for thin volumes properly list modules
thin volume needs   thin-pool and  thin kernel modules so print them
both for   lvs -o+modules
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
63d09b75f8 tests: one missed automatic name
Avoid depending on auto-names lvol%d.
2013-07-15 16:38:55 +02:00
Zdenek Kabelac
255db4c4e4 tests: thin lvol0 updates 2013-07-15 16:01:29 +02:00
Zdenek Kabelac
3498575b20 tests: more thin external origin tests 2013-07-15 16:01:28 +02:00
Peter Rajnoha
4e680ff3ab tests: use lvcreate -s -K for thin snapshots
Thin snapshots are not activated now by default so this needs
to be explicitly overridden with -K now.
2013-07-12 20:54:17 +02:00