Alasdair Kergon [Mon, 28 Nov 2011 20:37:51 +0000 (20:37 +0000)]
Add activation/use_linear_target enabled by default. (prajnoha)
LVM metadata knows only of striped segments - not linear ones.
The activation code detects segments with a single stripe and switches
them to use the linear target.
If the new lvm.conf setting is set to 0 (e.g. in a test script), this
'optimisation' is turned off.
Zdenek Kabelac [Wed, 23 Nov 2011 14:56:47 +0000 (14:56 +0000)]
Cleanup files from testing
Cleanup generated files from coverage testing.
Do not skip standard .o compilation for lib/not and lib/harness.
Make a bit longer string in harness to fit new shell/ in.
Zdenek Kabelac [Wed, 23 Nov 2011 12:21:41 +0000 (12:21 +0000)]
Cleanup test makefiles
Simplify /api makefile and use SUBDIRS target for test dir.
Properly cleanup Makefiles with distclean in /test.
Use symbolic links for shell scripts for non-srcdir compilation.
Petr Rockai [Mon, 21 Nov 2011 00:15:42 +0000 (00:15 +0000)]
Tidy the shell tests into their own subdir. We now have:
- test/lib -- infrastructure and helper code
- test/api -- liblvm2app API tests
- test/unit -- C-based unit tests
- test/shell -- shell-based functional tests
Petr Rockai [Sun, 20 Nov 2011 21:43:20 +0000 (21:43 +0000)]
Implement a CUnit-based runner for unit tests. Copy and adapt (actual unit)
tests from unit-tests/*/*_t.c (now under test/unit). The valgrind/pool test is
missing, since it's not really a unit test and probably not too valuable
either. Available via "make unit" (and if --enable-testing was passed to
configure, also executed by make check).
Zdenek Kabelac [Fri, 18 Nov 2011 19:42:03 +0000 (19:42 +0000)]
Drop pool memory allocated in lv_has_target_type
Remove FIXMES - there should not be any pool free call since
the memory pool is from device manager, and pool is detroyed
after the operation, so doing extra free here would not help here.
However lv_has_target_type() is using cmd mempool so here the extra
call for dm_pool_free makes sence.
Zdenek Kabelac [Fri, 18 Nov 2011 19:36:10 +0000 (19:36 +0000)]
Remove constant expression check
"result_independent_of_operands: ((dev->dev & 0xfff00UL) >> 8) ==
18446744073709551615UL /* -1 */ is always false regardless of the values
of its operands (logical operand of if)."
'dev->dev' is set in dev-cache.c _insert() and it's not expectable
st_rdev would have '-1'
This code has been introduced with drbd support commit and code never
worked - so eliminated.
Zdenek Kabelac [Fri, 18 Nov 2011 19:34:02 +0000 (19:34 +0000)]
Check target type name for DM_MAX_TYPE_NAME length
Avoid creation of target type name when it's longer then
DM_MAX_TYPE_NAME (noticed by static analyzer where the
sp.target_type might be missing '\0' at the end.)
Zdenek Kabelac [Fri, 18 Nov 2011 19:31:09 +0000 (19:31 +0000)]
Replace dynamic buffer allocations for PATH_MAX
Use static buffer instead of stack allocated buffer.
This reduces stack size usage of lvm tool and the
change is very simple.
Since the whole library is not thread safe - it should not
add any new problems - and if there will be some conversion
it's easy to convert this to use some preallocated buffer.
Zdenek Kabelac [Fri, 18 Nov 2011 19:28:00 +0000 (19:28 +0000)]
Unlock memory for vg_write
For write we do not need to hold memory locked.
This relaxes many conditions and avoid problems when allocating
a lot of memory for writting metadata buffers.
(In case of huge MDA size this would lead to mismatch between
locked and unlocked memory region size).
Add also internal check we are not writing in critical section.
Zdenek Kabelac [Fri, 18 Nov 2011 19:25:20 +0000 (19:25 +0000)]
Query before removing inactive snapshots
Removal of an inactive origin removes also all related snapshots.
When we now support 'old' external snapshots with thin volumes,
removal of pool will not only drop all thin volumes, but as
a consequence also all snapshots - which might be seen a bit
unexpected for the user - so add a query to confirm such action.
$> lvchange -an mvg/lvol2
Change of snapshot lvol2 will also change its origin lvol0 and 1 other
snapshot(s). Proceed? [y/n]: n
Logical volume lvol2 not changed.
Zdenek Kabelac [Tue, 15 Nov 2011 17:32:12 +0000 (17:32 +0000)]
Adjusted mirror region size only for mirrors and raids
Update region_size only for mirror and raid targets.
This fixes warning messages when vg is using small
extent size like 1KiB and no mirror/raid is created,
but the user still got the message:
$> vgcreate -s 1K vg <pvs>
$> lvcreate -L10K vg
Using reduced mirror region size of 4 sectors
Peter Rajnoha [Tue, 15 Nov 2011 11:54:15 +0000 (11:54 +0000)]
Avoid 'mda inconsistency' by properly registering UNLABELLED_PV flag (2.02.86).
When a PV label write is deferred to a vg_write call (as introduced by a patch
in 2.02.86), the PV is flagged with the internal UNLABELLED_PV flag. However,
when calling vg_archive before vg_write, we still have the PV labelled with the
UNLABELLED_PV flag which was not recognised as a proper flag while exporting
VG metadata:
# vgcreate vg /dev/sda
No physical volume label read from /dev/sda
Metadata inconsistency: Not all flags successfully exported.
Metadata inconsistency: Not all flags successfully exported.
Writing physical volume data to disk "/dev/sda"
Physical volume "/dev/sda" successfully created
Volume group "vg" successfully created
Alasdair Kergon [Mon, 14 Nov 2011 21:30:35 +0000 (21:30 +0000)]
Make dmsetup.static and lvm.static build when dmeventd is disabled.
udev may also need to be disabled if you didn't build it statically too.
dmeventd.static could be fixed with some more work but I don't really see the
point: without dlopen() it's useless, and if you have dlopen(), why not support
normal shared libraries too?
Alasdair Kergon [Sun, 13 Nov 2011 01:41:57 +0000 (01:41 +0000)]
Incomplete documentation is worse than no documentation.
Any documentation less-detailed than Documentation/device-mapper is
dangerous for the non-trivial ctr lines. And anyway, this should be in s4
not here.
Zdenek Kabelac [Sat, 12 Nov 2011 22:48:44 +0000 (22:48 +0000)]
Update dmsetup man page
Use standard manpage style.
Keep options and commands in alphabetic order.
Added at least a very simply info about some other targets.
TODO: documenting targest needs far more work...
Zdenek Kabelac [Sat, 12 Nov 2011 22:44:10 +0000 (22:44 +0000)]
Thin remove unused define
Remove DM_THIN_ERROR_DEVICE_ID from API.
Remove API warning.
Drop code that was using DM_THIN_ERROR_DEVICE_ID (already commented)
Remove debug message which slipped in through some previous commit.
Zdenek Kabelac [Thu, 10 Nov 2011 12:40:29 +0000 (12:40 +0000)]
Thin move _read_activation_params check
Since we finaly recognize thin creation only after
_determine_snapshot_type() - move _read_activation_params()
after it - so we can support lvcreate -an thin snapshot.
Petr Rockai [Mon, 7 Nov 2011 17:11:23 +0000 (17:11 +0000)]
Correctly handle concurrent read (CR) locks in singlenode clvmd. This means
that we can also test clustered volume groups (vgcreate -c y) in the test
suite. Unfortunately we can't make this the testing default since cluster
mirrors require further infrastructure, and snapshots probably don't work at
all. I'll eventually add a few test cases that create clustered VGs
specifically.
Zdenek Kabelac [Thu, 3 Nov 2011 14:59:20 +0000 (14:59 +0000)]
Thin removing limitation on activation of pool device.
Since activation of pool is now independent on thin activation,
user may do whatever he needs - thought preferable thin should stay alive,
but it it will be found inactivate, update_pool will bring the pool up.
Zdenek Kabelac [Thu, 3 Nov 2011 14:56:20 +0000 (14:56 +0000)]
Thin using update_pool_lv
Replace detach_pool_messages with update_pool_lv.
Move creation code from to 'if' condition into 1.
Ensure creation has finished all previous message operations.
Zdenek Kabelac [Thu, 3 Nov 2011 14:52:09 +0000 (14:52 +0000)]
Add -tpool layer in activation tree
Let's put the overlay device over real thin pool device.
So we can get the proper locking on cluster.
Overwise the pool LV would be activate once implicitely
and in other case explicitely, confusing locking mechanism.
This patch make the activation of pool LV independent on
activation of thin LV since they will both implicitely use
real -thin pool device.
Zdenek Kabelac [Thu, 3 Nov 2011 14:43:21 +0000 (14:43 +0000)]
Thin api change for dm_tree_node_add_thin_target
A little code shuffling and adding support for
DM_THIN_ERROR_DEVICE_ID which might be eventually be used
for activation of thin which is going to be deleted.
For now we do not need it lvm.
Peter Rajnoha [Mon, 31 Oct 2011 12:22:49 +0000 (12:22 +0000)]
Add "ExecReload" to dm-event.service for systemd to reload dmeventd properly.
Normally, restart simply means "stop and start" for systemd. However, if
we're installing new versions of the dmeventd binary/libdevmapper, we need
to restart dmeventd. This fails if we have some devices monitored - we need
to call "dmeventd -R" instead.
The "ExecReload" did not work quite well in some old versions of systemd,
systemd assumed that only the configuration is reloaded on "ExecReload",
not the whole binary itself so it lost track of dmeventd daemon (it lost new
dmeventd PID). This is fixed and seems to be working fine now with recent
versions of dmeventd.