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

2642 Commits

Author SHA1 Message Date
Jonathan Earl Brassow
d098140177 Add policy based automated repair of RAID logical volumes
The RAID plug-in for dmeventd now calls 'lvconvert --repair' to address failures
of devices in a RAID logical volume.  The action taken can be either to "warn"
or "allocate" a new device from any spares that may be available in the
volume group.  The action is designated by setting 'raid_fault_policy' in
lvm.conf - the default being "warn".
2011-12-06 19:30:15 +00:00
Milan Broz
707c49ab77 Fix FIXME and comment :-) 2011-12-03 11:36:10 +00:00
Milan Broz
a8402e1978 Switch locking bits to match RHEL5 version.
FIXME:
There is a problem with overloaded bit 0x80 in locking flag,
the bit flags array must be extended or changed.
2011-12-03 11:34:35 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
74e53e8bc0 Thin disable pool create without activation 2011-11-10 12:39:01 +00:00
Alasdair Kergon
3da4ed712e Must not override alloc policy specified by user. 2011-11-07 13:54:54 +00:00
Zdenek Kabelac
65e88e6b3c Thin add error message for double delete
Add few more internal error messages.
2011-11-07 11:04:45 +00:00
Zdenek Kabelac
97d7e5aedb Thin supports snapshots
Full support for thin snapshots.
Create and remove is supported.

TODO: lvconvert support is not yes available.
2011-11-07 11:03:47 +00:00
Zdenek Kabelac
11721819a7 Thin reindent code
Drop indention level
Add extra internal error.
2011-11-07 10:59:07 +00:00
Zdenek Kabelac
87371d48cc Thin revert code for exclusive pool activation
There are no limits on thin-pool activation now.
Revert code that is no longer needed.
2011-11-07 10:58:13 +00:00
Zdenek Kabelac
4079a8f298 Avoid lvextend to overflow
Add extra check to extent_count overflow.
Use internal define MAX_EXTENT_COUNT instead UINT32_MAX.
2011-11-04 22:49:53 +00:00
Zdenek Kabelac
83baa0b778 Thin pool allocation simplified
Support allocation of metadata from the same PV, if the VG
is build only from one PV.

As thinp is not mirror - we do not require 2 PVs
for basic thin usage as user is losing only perfomance.
2011-11-04 22:45:52 +00:00
Zdenek Kabelac
bd15208cd7 Thin add thin_pool_metadata_require_separate_pvs
Allow to set different policy for pool from mirrors.
2011-11-04 22:44:21 +00:00
Zdenek Kabelac
b8cac455bd Thin supports poolmetadatasize setting
Add option to set pool metadatasize.
For passing size parameter reuse region_size.
2011-11-04 22:43:10 +00:00
Alasdair Kergon
13dc67cda7 Add missing lvrename mirrored log recursion in for_each_sub_lv. 2011-11-04 01:31:23 +00:00
Zdenek Kabelac
1cae10a36c Thin keep pool device in the same state
Leave the optimalisation to be done differently and preserve
availability state of the pool device.
2011-11-03 15:58:20 +00:00