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

6167 Commits

Author SHA1 Message Date
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
Alasdair Kergon
bf09a32006 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?
2011-11-14 21:30:35 +00:00
Alasdair Kergon
2ce5ca4375 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.
2011-11-13 01:41:57 +00:00
Zdenek Kabelac
dd0c58c69b Add missing stack reporting
also remove unneeded {}
2011-11-12 22:53:23 +00:00
Zdenek Kabelac
3af072cc63 Thin use items iterator and stack reporting 2011-11-12 22:52:18 +00:00
Zdenek Kabelac
651ef6be82 Missing stack printing 2011-11-12 22:51:20 +00:00
Zdenek Kabelac
5e62f7038f 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...
2011-11-12 22:48:44 +00:00
Zdenek Kabelac
6744c143a5 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.
2011-11-12 22:44:10 +00:00
Alasdair Kergon
630b4c2111 Move gentoo MAKEDEV to /sbin in lvm2create_initrd. (James Le Cuirot) 2011-11-12 17:03:53 +00:00
Milan Broz
64f1fd749f Fix major number filter structure boundary test. 2011-11-11 16:59:30 +00:00
Milan Broz
a3390bb507 Remove unneeded parameter. 2011-11-11 16:41:37 +00:00
Milan Broz
0abb3d7c11 And now add files for real. 2011-11-11 15:24:48 +00:00
Milan Broz
d1b36fbe7f Fix function name in previous patch. 2011-11-11 15:14:05 +00:00
Milan Broz
07113beea3 Do not scan device if it is part of active multipath.
Add filter which tries to check if scanned device is part
of active multipath.

Firstly, only SCSI major number devices are handled in filter.

Then it checks if device has exactly one holder (in sysfs) and
if it is device-mapper device and DM-UUID is prefixed by "MPATH-".

If so, this device is filtered out.

The whole filter can be switched off by setting
mpath_component_detection in lvm.conf.

https://bugzilla.redhat.com/show_bug.cgi?id=597010

Signed-off-by: Milan Broz <mbroz@redhat.com>
2011-11-11 15:11:08 +00:00
Zdenek Kabelac
7891cead11 Thin send create_snap message
Start creating snapshots for real.
Update test suite to check it happens.
2011-11-10 15:30:59 +00:00
Zdenek Kabelac
54feef9366 Thin update testing script 2011-11-10 12:44:33 +00:00
Zdenek Kabelac
0641b3883d Add generic function to check for target version
So the test script may use a simple line like i.e.:

aux target_at_least dm-thin-pool 1 0 0 || skip
aux target_at_least snapshot-origin 1 6 || skip
2011-11-10 12:44:00 +00:00
Zdenek Kabelac
6e89eb9a52 Small comment and indent updates 2011-11-10 12:43:05 +00:00
Zdenek Kabelac
f201498f99 Thin test min thin_pool size for at least 1 chunk 2011-11-10 12:42:36 +00:00
Zdenek Kabelac
39fc633957 Thin align volume size on chunk boundary size
If the extent_size is smaller then the chunk_size we may try
to find better aligment (wasting less space).

i.e. using  4KB extent_size and  64KB chunk size will
lead to creation of 64KB aligned thin volume.
2011-11-10 12:42:15 +00:00
Zdenek Kabelac
3d9513ced4 Thin lvcreate manpage
Merge thin creation into standard 1st. lvcreate.
Update snapshot for thin support.
2011-11-10 12:41:39 +00:00
Zdenek Kabelac
a538e369db 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.
2011-11-10 12:40:29 +00:00
Zdenek Kabelac
95308c5f58 Thin create normal (old) snapshot when size is specified 2011-11-10 12:39:46 +00:00