1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

558 Commits

Author SHA1 Message Date
Jonathan Earl Brassow
f60175c308 Add the ability to convert LVs of "mirror" segtype to "raid1" segtype.
Example:
~> lvconvert --type raid1 vg/mirror_lv

Steps to convert "mirror" to "raid1"
1) Allocate a RAID metadata LV for each mirror image from the same PVs
   on which they are located.
2) Clear the metadata LVs.  This involves writing LVM metadata, so we don't
   change any aspects of the mirror LV before this so that the user can easily
   remove LVs from the failed convert attempt while retaining the original
   mirror.
3) Remove the mirror log, if it exists.
4) Add metadata LVs to mirror LV
5) Rename mirror sub-lvs (s/mimage/rimage/)
6) Change flags and segtype from mirror to raid1
2011-10-07 14:56:01 +00:00
Jonathan Earl Brassow
d3582e0252 Add the ability to convert linear LVs to RAID1
Example:
~> lvconvert --type raid1 -m 1 vg/lv

The following steps are performed to convert linear to RAID1:
1) Allocate a metadata device from the same PV as the linear device
   to provide the metadata/data LV pair required for all RAID components.
2) Allocate the required number of metadata/data LV pairs for the
   remaining additional images.
3) Clear the metadata LVs.  This performs a LVM metadata update.
4) Create the top-level RAID LV and add the component devices.

We want to make any failure easy to unwind.  This is why we don't create the
top-level LV and add the components until the last step.  Should anything
happen before that, the user could simply remove the unnecessary images.  Also,
we want to ensure that the metadata LVs are cleared before forming the array to
prevent stale information from polluting the new array.

A new macro 'seg_is_linear' was added to allow us to distinguish linear LVs
from striped LVs.
2011-10-07 14:52:26 +00:00
Jonathan Earl Brassow
a391248427 Fix vgsplit when there are mirrors that have mirrored logs.
The problem as reported by "ben <benscott@nwlink.com>" on lvm-devel:

vgsplit fails with mirrored mirror log

#lvs --all -o lv_name,lv_attr,devices
LV                       Attr   Devices
MyMirror                 mwi--
[MyMirror_mimage_0]      Iwi--- /dev/sdq(0)
[MyMirror_mimage_1]      Iwi--- /dev/sdo(0)
[MyMirror_mimage_2]      Iwi--- /dev/sdi(0)
[MyMirror_mlog]          mwi---
[MyMirror_mlog_mimage_0] Iwi--- /dev/sds(0)
[MyMirror_mlog_mimage_1] Iwi--- /dev/sde(0)

#vgsplit -v "TestA" "TestB" "/dev/sdq" "/dev/sdo" "/dev/sdi" "/dev/sds"
"/dev/sde"
  Checking for volume group "TestA"
  Checking for new volume group "TestB"
  Archiving volume group "TestA" metadata (seqno 213).
Can't split mirror MyMirror between two Volume Groups

AFTER FIX:

[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  Volume group "new" not found
  Skipping volume group new
  LV                 VG   Devices
  lv                 vg   lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      vg   /dev/sdb1(0)
  [lv_mimage_1]      vg   /dev/sdc1(0)
  [lv_mlog]          vg   lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] vg   /dev/sdh1(0)
  [lv_mlog_mimage_1] vg   /dev/sdi1(0)
[root@bp-01 ~]# vgsplit vg new /dev/sd[bchi]1
  New volume group "new" successfully split from "vg"
[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  LV                 VG   Devices
  lv                 new  lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      new  /dev/sdb1(0)
  [lv_mimage_1]      new  /dev/sdc1(0)
  [lv_mlog]          new  lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] new  /dev/sdh1(0)
  [lv_mlog_mimage_1] new  /dev/sdi1(0)
2011-10-06 14:17:45 +00:00
Zdenek Kabelac
643d3e8134 Let the utils to prepare PVs 2011-09-29 08:58:27 +00:00
Zdenek Kabelac
7ae124743e Use execvp for clvmd restart
Since execve passed only NULL as environ, we had lost all environment vars on
restart - thus actually running  'different' clvmd then the one at start.

Preserving environ allows to restart clvmd with the same settings
(i.e. LD_LIBRARY_PATH)

Add test for second restart.
2011-09-26 07:51:23 +00:00
Zdenek Kabelac
90d106ef19 Restart CLVMD with same cluster manager
Add named cluster_ops to easily learn the name of the active cluster manager,
so we are able to restart singlenode manager in testing.

Add simple test for clvmd -S  (restart) and -R (refresh)
(though it needs some extensions).
2011-09-25 19:37:00 +00:00
Zdenek Kabelac
102dd99ca4 Allow overwrite for VERIFY_UDEV
When running tests it might be useful to have an override option when
testing on real /dev  and some broken system (i.e. Debian and its rules).

So one can use:

LVM_TEST_DEVDIR=/dev LVM_VERIFY_UDEV=1 make check
2011-09-24 21:15:13 +00:00
Zdenek Kabelac
d040c17000 Avoid sending garbage to terminal in verbose mode.
When read in drain returned <0 value, terminal content has been trashed.
Remove unneeded  memset() and use whole buffer.
Free  readbuf before exit (valgrind).
2011-09-24 21:12:35 +00:00
Zdenek Kabelac
a4b6b51757 Improvements
Simplify RUN_BASE

Put .tests-stamp deps only for check target and fix its cleanup.
Fix abs_top_srcdir.
vgimportclone needs  srcdir.
Clean  api subdir.
2011-09-24 21:10:19 +00:00
Zdenek Kabelac
518164ce96 Detect unusable nodes on fs
Test whether nodes could be used on given filesystem where TMP
dir is being used and skip teardown quicker in fail case.
(makes the problem quickly obvious if you try to such fs).

Skip teardown_dev if we have not created any devs yet.

and do not mkdir /dev/mapper dir  when LVM_TEST_DEVDIR is set.

Drop this test from t-000-basic.sh.
2011-09-24 20:54:35 +00:00
Zdenek Kabelac
da1350d420 Add missing log_error() to lvresize command when fsadm tool fails
Also add test case
2011-09-21 10:39:47 +00:00
Zdenek Kabelac
bfcaa5a4ed Unmount works with -y 2011-09-19 19:37:26 +00:00
Zdenek Kabelac
b28088f0e4 Another vgremove for speedup
It seems like test-suite is significantly slowed down on removal phase.

Maybe it should be part of generic teardown - though the reason of slowdown
should be also discovered -  probably related to retry loop ?
2011-09-19 18:40:51 +00:00
Zdenek Kabelac
08885c4b92 Ensure fsadm.sh is executable
When the srcdir == builddir we get the link on non-exectable file.
So make always sure fsadm.sh is executable script file.

Add cleanup target for lib/fsadm.
2011-09-19 15:54:15 +00:00
Zdenek Kabelac
967f2d4510 Enable t-fsadm test
Now all commands are executed from preffered directory.
2011-09-19 13:52:22 +00:00
Zdenek Kabelac
438f53af63 Add link for fsadm script
Prepare to enabling t-fsadm.sh test
2011-09-19 12:50:17 +00:00
Zdenek Kabelac
8122e7caab Test speed up
Removing vg  reduces time execution of this test.
Teardown has some wait states here...
2011-09-19 12:49:14 +00:00
Milan Broz
5170efd1ee Disable t-lvcreate-large.sh for now with cluster. 2011-09-16 14:32:47 +00:00
Zdenek Kabelac
c89f44ed85 Add inital thin testing
Currently test is skipped by default (since it needs code hack to work)
Check command line options to create & remove thin pools and thin volumes.

Activation code for thin LV support is missing, thus it only works without
driver loaded.
2011-09-16 12:23:59 +00:00
Zdenek Kabelac
e377b78095 Remove vg at the test's end
Speedup this test by removing mirrored vg when it's not longer needed.
teardown() seems to be waiting here for too long.
2011-09-16 11:52:33 +00:00
Petr Rockai
fd7d4adc57 Fix the divisibility check in the allocator for the mirror+stripe case (require
divisibility by stripe count alone, not by (mirror*stripe)).
2011-09-16 09:59:42 +00:00
Petr Rockai
44dfb51f2a When resizing LVs, always round in the safe direction, regardless of whether we
were called as lvresize or lvreduce.
2011-09-15 18:51:11 +00:00
Milan Broz
b18e1fd50e Fix possible overflow of size if %FREE or %VG is used.
https://bugzilla.redhat.com/show_bug.cgi?id=737087
2011-09-15 15:26:40 +00:00
Zdenek Kabelac
eeef355887 Updated testing script
Since attrs were extended by 2 new fields update check functions.
2011-09-09 13:19:19 +00:00
Zdenek Kabelac
77f771ebc3 Replace char class :space: with explicit chars
Some major distributions are still using 'mawk' and they are not using
the latest version - we end here with hidden dependency on the latest
version of mawk (1.3.4) while i.e. Debian Lenny seems to stay with 1.3.3.
So we end with completely broken  vgimportclone script on such system.

We would need to check for proper support of :space: and abort build if
it doesn't work or simplier replace [:space:] with [ \t] which seems
sufficient to make it work (as can be seen in this patch)

A better fix would be to use command line parameter override - leaving
as FIXME comment.

This patch makes t-vgimportclone.sh test passing on Lenny.
2011-09-07 08:31:16 +00:00
Petr Rockai
a53037f2c5 Do not call prepare_lvmetad just yet in tests. 2011-08-31 12:42:55 +00:00
Petr Rockai
615534d305 A compromise integration of LVMetaD into the build: I have kept all the
daemon/common code in a single libdaemon.a, which is completely private. This
is currently linked into the lvmetad binary, and will be linked into LVM (the
client part, since static linking only picks up only symbols that are actually
used). I have also added --enable/disable-lvmetad to ./configure; although the
current default is off, I expect this to be flipped to on shortly. There's no
LVM-side support yet, but when there is, even when built, it'll still need to
be enabled by an lvm.conf option.
2011-08-31 11:31:57 +00:00
Jonathan Earl Brassow
97db301ad4 Move RAID convert tests to new file, t-lvconvert-raid.sh
There is duplicate code in t-lvconvert-raid.sh and t-lvcreate-raid.sh.
This should be moved into a common file which is then sourced by these two
files.  I'll wait to move the duplicate code until I can talk to mornfall.
2011-08-18 19:56:17 +00:00
Jonathan Earl Brassow
4aebd52c4c Add ability to down-convert RAID1 arrays.
Also, add some simple RAID tests to testsuite.
2011-08-11 18:24:40 +00:00
Zdenek Kabelac
cf98c05082 Add detect_internal_vg_cache_corruption to lvm.conf
Add config option to enable crc checking of VG structures.
Currently it's disabled by default.

For the internal test-suite this check it is enabled.

Note: In the case the internal error is detected, debug build with
compile option DEBUG_ENFORCE_POOL_LOCKING helps to catch the source
of the problem.
2011-08-11 17:46:13 +00:00
Zdenek Kabelac
600dbd3b27 Add simple test for read-only table reload suppression
Just a small test for previous libdm commit.
2011-07-25 08:41:52 +00:00
Zdenek Kabelac
80869133f2 Better version of failing 'should' test
where the naming is left completely on lvm.
(Commited code has been different version of test).
So here it should be able to figure out new free name and create a new LV.
2011-07-18 12:12:41 +00:00
Zdenek Kabelac
8e97096fa2 Adding test for repair when confusing metadata are found 2011-07-18 12:04:42 +00:00
Petr Rockai
4ded6393df Fix t-vgreduce-usage to stop relying on the persistent cache not seeing a
device that has been brought back from the dead: this sometimes fails with
clvmd (the cache is updated "too soon"). Instead, force a pvscan and rely on an
up-to-date cache as usual.
2011-07-11 12:13:07 +00:00
Zdenek Kabelac
a6fc6250e0 Increase timeout for udev settle
For some unknown reason (atm) udev settle takes longer time on recent rawhide.
To pass the test - inrease the settle timeout.
2011-07-08 10:05:43 +00:00
Alasdair Kergon
67d60b0365 first attempt to fix test 2011-07-04 16:27:27 +00:00
Alasdair Kergon
2243718fae Add framework for validation of ioctls. Doesn't do any checks yet.
dmsetup --checks
libdevmapper: dm_task_enable_checks()
lvm.conf: activation/checks=1
2011-07-01 14:09:19 +00:00
Alasdair Kergon
b3c42d7cc1 update pv_attr check for new missing attr 2011-06-30 19:32:51 +00:00
Alasdair Kergon
e04640b421 use remove -f 2011-06-30 09:17:49 +00:00
Alasdair Kergon
181b1f9fec teardown stray filesystems too 2011-06-30 09:15:53 +00:00
Zdenek Kabelac
e21ef74f11 Use -f to remove device
Since some test may leave devices in suspend mode which would require
carefull order of resume operation - use '-f' to replace them with
error targets

For disable_dev  - when  'error' target is used for open count - treat
return code as ok (|| true) to avoid breaking futher test processing.
2011-06-30 09:08:22 +00:00
Milan Broz
afc438a5ab Try to force remove dm devices in after test fails. 2011-06-30 08:50:10 +00:00
Alasdair Kergon
5f30b9f4c8 Try to remove any stray loop devices left behind by earlier aborted tests. 2011-06-30 01:17:37 +00:00
Alasdair Kergon
1a3d96757e test attempt to remove stray loop devs 2011-06-30 00:57:29 +00:00
Alasdair Kergon
f96cf55d36 Add age filter to dmsetup udevcomplete_all to minimise concurrency problems. 2011-06-29 21:56:46 +00:00
Alasdair Kergon
5ffa914c59 make udev teardown conditional on using udev 2011-06-29 18:18:18 +00:00
Alasdair Kergon
10e002742b teardown aborts if it hits an error, so better teardown semaphores earlier
as we need them later in the teardown process
2011-06-29 18:14:08 +00:00
Alasdair Kergon
456d357692 print any loop devs that weren't torn down 2011-06-29 17:37:30 +00:00
Alasdair Kergon
23ad430648 remove any stray semaphores after tearing down devs 2011-06-29 17:33:39 +00:00
Alasdair Kergon
174ccd3561 Add uuids to dmsetup create cmds. 2011-06-29 12:37:51 +00:00