1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00
Commit Graph

6339 Commits

Author SHA1 Message Date
Jonathan Earl Brassow
9711057499 Don't allow two images to be split and tracked from a RAID LV at one time
Also, don't allow a splitmirror operation on a RAID LV that is already tracking
a split, unless the operation is to stop the tracking and complete the split.
Example:
~> lvconvert --splitmirrors 1 --trackchanges vg/lv /dev/sdc1
# Now tracking changes - image can be merged back or split-off for good
~> lvconvert --splitmirrors 1 -n new_name vg/lv /dev/sdc1
# ^ Completes split ^

If a split is performed on a RAID that is tracking an already split image and
PVs are provided, we must ensure that
 1) the already split LV is represented in the PVs
 2) we are careful to split only the tracked image
2011-12-01 00:21:04 +00:00
Jonathan Earl Brassow
d34991ed97 Don't allow size change of RAID LV that is tracking changes for a split image
Don't allow size change of RAID sub-LVs independently
2011-12-01 00:13:16 +00:00
Jonathan Earl Brassow
a927e401f1 Do not allow users to change the name of RAID sub-LVs or the name of the
RAID LV if it is tracking changes for a split image.
2011-12-01 00:09:34 +00:00
Jonathan Earl Brassow
9981b8be03 WHATS_NEW for previous commit. 2011-12-01 00:05:40 +00:00
Jonathan Earl Brassow
73d6bf290e Do not allow users to change permissions on RAID sub-LVs. 2011-12-01 00:04:21 +00:00
Alasdair Kergon
8de2ef4f3b refer to kernel docs for target info
FIXME thin still missing
2011-11-30 22:32:37 +00:00
Petr Rockai
485922fe20 Update comment on LCK_*DMEVENTD*. 2011-11-30 17:02:37 +00:00
Petr Rockai
9a4b04139d Fix clvmd to respect DMEVENTD_MONITOR_IGNORE. Fixes a bug where dmeventd
actions caused clvmd to turn off monitoring of the volume causing the action.
2011-11-30 17:00:57 +00:00
Jonathan Earl Brassow
2ba1e8fccc The LV_REBUILD flag is not internal - bad comments in metadata-exported.h updated 2011-11-30 02:20:13 +00:00
Jonathan Earl Brassow
0c506d9a40 Support the ability to replace specific devices in a RAID array.
RAID is not like traditional LVM mirroring.  LVM mirroring required failed
devices to be removed or the logical volume would simply hang.  RAID arrays can
keep on running with failed devices.  In fact, for RAID types other than RAID1,
removing a device would mean substituting an error target or converting to a
lower level RAID (e.g. RAID6 -> RAID5, or RAID4/5 to RAID0).  Therefore, rather
than removing a failed device unconditionally and potentially allocating a
replacement, RAID allows the user to "replace" a device with a new one.  This
approach is a 1-step solution vs the current 2-step solution.

example> lvconvert --replace <dev_to_remove> vg/lv [possible_replacement_PVs]

'--replace' can be specified more than once.

example> lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lv
2011-11-30 02:02:10 +00:00
Peter Rajnoha
910440212b Fix last checkin for replicator. 2011-11-29 12:10:38 +00:00
Alasdair Kergon
8dd6036da4 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.
2011-11-28 20:37:51 +00:00
Zdenek Kabelac
b4a39a569a Try longer sleep
Seems like testing machine could be busy - so 10s might not be enough
for rechecking status.
2011-11-23 15:27:14 +00:00
Zdenek Kabelac
8d7da8864e 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.
2011-11-23 14:56:47 +00:00
Zdenek Kabelac
9fb16c608d Swap condition order
Swap condtion so the make line does not return 'false'.
Remove cleanup of lvm2api.sh since it is not created anymore.
2011-11-23 13:03:57 +00:00
Zdenek Kabelac
5a036adb32 Put back devmapper-event linkage
Older systems are not able to get this library from lvm2api library and need
this library to be passed to the linker (i.e. Debian Lenny).
2011-11-23 13:02:17 +00:00
Zdenek Kabelac
4b42d7ae98 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.
2011-11-23 12:21:41 +00:00
Zdenek Kabelac
4b795cc3a0 Split gcc warning options
Use gcc warning options only for .c -> .o compilation
So it makes the output more clear.

Do not use INCLUDES and DEFS for .o -> .so.

Do not use CFLAGS for deps .d generation.
2011-11-23 12:19:23 +00:00
Zdenek Kabelac
a532faa7b7 Use 3 digits for chmod
Use same sized chmod params (0 are filled from left on its own)
and we use just 3 digits elsewhere.
2011-11-23 12:18:42 +00:00
Alasdair Kergon
c122e5e7a3 Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
(Note that in a future release we might make this stricter and insist
on exactly 'y' or 'n'.)
2011-11-23 01:34:38 +00:00
Peter Rajnoha
fe456c33a4 --addtag instead of --tag 2011-11-22 13:54:05 +00:00
Zdenek Kabelac
c571aeae6f Cleanup gcc warning
bitset_t.c:39: warning: 'last' may be used uninitialized in this function

Compiler is not smart enough to see the code path which avoid using
unitialized 'last'.
2011-11-21 13:15:40 +00:00
Zdenek Kabelac
d6a05ea5e6 Add some cflags to ldflags
Things like gcov needs the compilation flags for linker as well.
TODO: cleanup compilation flags usage
2011-11-21 13:11:03 +00:00
Petr Rockai
c2bd285160 More of WHATS_NEW. 2011-11-21 12:44:38 +00:00
Petr Rockai
c6856ef42b Update WHATS_NEW. 2011-11-21 12:33:56 +00:00
Petr Rockai
58ea7af08c Fix a bug in dmeventd snapshot monitoring code where the monitoring threshold
would grow with subsequent snapshot extensions (RHBZ 754198).
2011-11-21 12:31:18 +00:00
Petr Rockai
8e4a96dcb1 Fix the last fix (t-XXX -> shell/XXX). 2011-11-21 11:36:53 +00:00
Petr Rockai
12494fd3e5 Fix the fallout in shell tests from the t-XXX -> shell/XXX move. 2011-11-21 11:25:35 +00:00
Zdenek Kabelac
9493f1df09 Add CUnit testing support
Regenerate configure for unit test support.
2011-11-21 10:40:21 +00:00
Petr Rockai
f2a3f0fe3d 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
2011-11-21 00:15:42 +00:00
Petr Rockai
cfe1ec8d1f Fix a syntax error. 2011-11-20 21:55:24 +00:00
Petr Rockai
d4fed28523 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).
2011-11-20 21:43:20 +00:00
Alasdair Kergon
bf75c30493 Don't ignore configure --mandir and --infodir. 2011-11-20 20:52:09 +00:00
Zdenek Kabelac
647c8edf82 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.
2011-11-18 19:42:03 +00:00
Zdenek Kabelac
749c2dc4ab 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.
2011-11-18 19:36:10 +00:00
Zdenek Kabelac
5392675f4c 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.)

Before patch:

$> dmsetup create long
0 1000 looooooooooooooooooooooooooong
^D
device-mapper: reload ioctl failed: Invalid argument

After patch:

$> dmsetup create xxx
0 1000 looooooooooooooooooooooooooong
Target type name looooooooooooooooooooooooooong is too long.
Command failed
2011-11-18 19:34:02 +00:00
Zdenek Kabelac
900f5f8187 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.
2011-11-18 19:31:09 +00:00
Zdenek Kabelac
8deeeb07ea 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.
2011-11-18 19:28:00 +00:00
Zdenek Kabelac
37f274ced9 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.

lvremove -f will skip the prompt.
2011-11-18 19:25:20 +00:00
Zdenek Kabelac
e8a40f6571 Allow to activate snapshot
Add extra code to active and deactivate related
snapshots and origin when user specifies snapshot
logical volume as lvchange parameter.

Before patch:

$> lvs -a
  LV    VG   Attr     LSize  Pool Origin Snap%  Move Log Copy%  Convert
  lvol0 mvg  owi-a-s-  1.00k
  lvol1 mvg  swi-a-s- 16.00k      lvol0    0.00
  lvol2 mvg  swi-a-s- 16.00k      lvol0    0.00

$> lvchange -an mvg/lvol2; echo $?
  Can't change snapshot logical volume "lvol2".
5

After patch:

$> 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.

$> lvchange -y -an mvg/lvol2; echo $?
0

$> lvs -a
  LV    VG   Attr     LSize  Pool Origin Snap%  Move Log Copy%  Convert
  lvol0 mvg  owi---s-  1.00k
  lvol1 mvg  swi---s- 16.00k      lvol0
  lvol2 mvg  swi---s- 16.00k      lvol0
2011-11-18 19:22:49 +00:00
Zdenek Kabelac
e858ac1546 Skip non-virtual snapshots for availability
Change the behavior of availability change.
With this patch the lvgchange returns success
when VG is properly changed.

It skips non-virtual origins from being changes when
only 'vg' is specified as lvchange -a parameter.

Before this change we had this:

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

$> lvchange -an mvg ; echo $?
  Can't change snapshot logical volume "lvol2".
  Can't change snapshot logical volume "lvol3".
5

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi---s- 128.00k
  lvol1 mvg  owi---s- 128.00k
  lvol2 mvg  swi---s-   1.25m      lvol0
  lvol3 mvg  swi---s-   1.25m      lvol1

$> lvchange -ay mvg ; echo $?
  Can't change snapshot logical volume "lvol2".
  Can't change snapshot logical volume "lvol3".
5

$> lvs
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

After commit:

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

$> lvchange -an mvg ; echo $?
0

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi---s- 128.00k
  lvol1 mvg  owi---s- 128.00k
  lvol2 mvg  swi---s-   1.25m      lvol0
  lvol3 mvg  swi---s-   1.25m      lvol1

$> lvchange -ay mvg ; echo $?
0

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1
2011-11-18 19:19:22 +00:00
Zdenek Kabelac
91e4512619 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
2011-11-15 17:32:12 +00:00
Zdenek Kabelac
5f129d15b1 Thin update prompt message
Enhance message with info about how many thin volumes are going to
be removed with thin pool removal.
2011-11-15 17:29:52 +00:00
Zdenek Kabelac
8542953f74 Reorder AND test condition
Take the easiest condition for checking first since they must
apply all together, check local conditions first before doing
more expensive tests.
2011-11-15 17:27:41 +00:00
Zdenek Kabelac
3de08fc9de Thin clean
Reuse seg pointer already set in _add_lv_to_dtree to have the
value of first_seg(lv) (and is used in other parts of this function).
2011-11-15 17:25:05 +00:00
Zdenek Kabelac
25de8ca372 Thin supports only thin volumes as snapshot origins
It's currently of the scope to properly solve the snapshoting
of internal thin devs so prevent non-toplevel snapshots here.
2011-11-15 17:23:51 +00:00
Zdenek Kabelac
ed2368538a Simplify iteration
Since nothing is removed in dm_list snapshot_segs during the loop,
there is no reason to use _safe iteration, so switch to simplier
dm_list_iterate().
2011-11-15 17:21:02 +00:00
Zdenek Kabelac
8ec016236a Thin fix tpool layer
Since we support snapshots of thin volumes, we could have more layers,
so we have to check whether tpool layer is going to be inserted.

As the _add_segment_to_dtree() is the only place that adds tpool
segment, we may just check pointer (no strcmp for layer).

Switch to use  seg_is_  function instead of lv_is_.
2011-11-15 17:15:03 +00:00
Alasdair Kergon
fb7817fe7c Include a copy of kernel DM documentation in doc/kernel 2011-11-15 13:54:20 +00:00
Peter Rajnoha
5680d14ecd 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
2011-11-15 11:54:15 +00:00