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

14283 Commits

Author SHA1 Message Date
Zdenek Kabelac
19cc03fa52 thin: restore conversion to raid
Since commit  1bc546269a we've disabled
coversion of raid. This however already got fixed, so reenable
commands like:  'lvconvert --type raid1 vg/pool_tdata'.
2017-06-19 23:30:08 +02:00
Heinz Mauelshagen
9e9163618a lvconvert: disable reshaping of open RAID LV
Disable until we have a proper fix for reshape space allocation,
switching it to begin/end of rimages and activation.

Related: rhbz1447812
2017-06-19 22:25:54 +02:00
Heinz Mauelshagen
e1a1c20e95 lvconvert: enhance message
Enhance message introduced by last
commit f342e803ba.

Related: rhbz1439399
2017-06-19 21:40:38 +02:00
Heinz Mauelshagen
f342e803ba lvconvert: disable conversion of RAID LV under snapshot
Disable until we have a proper fix for reshape space allocation,
switching it to begin/end of rimages and activation.

Related: rhbz1439399
2017-06-19 21:08:52 +02:00
Heinz Mauelshagen
fb46175ce7 lvconvert: disable reshaping of RAID LVs in the cluster
Disable until we have a proper fix for reshape space allocation,
switching it to begin/end of rimages and activation in the cluster.

Related: rhbz1448116
Related: rhbz1461526
Related: rhbz1448123
2017-06-19 21:06:53 +02:00
Zdenek Kabelac
1c212b8a43 fsadm: restore no answer
Commit 1fe4f80e45 in current version
introduced regression for a terminal user, as he could not enter 'n'
as answer. Add missing break for this case (No whats_new).
2017-06-19 12:40:03 +02:00
Jonathan Brassow
915d20d0e6 test: New test file for validating kernel status during sync ops
New tests to add checking for '100%' in-sync at start of "recover"
process (it shouldn't happen, but I've seen it before).  Also,
check status over the whole cycle of various sync processes ("resync"
and "recover").
2017-06-16 10:16:07 -05:00
Zdenek Kabelac
dd866a67f4 tests: use exclusive activation
Conversion needs exlusively active LV for clustered testing.
2017-06-16 17:04:02 +02:00
Zdenek Kabelac
fbb3bffb22 debug: passing non-raid seg would be internal error 2017-06-16 17:04:02 +02:00
Zdenek Kabelac
9e96f96a41 cleanup: drop unused parameter 2017-06-16 17:04:02 +02:00
Zdenek Kabelac
cdb55c19cd cleanup: show what happens when passed prompt
When we show prompt and user passes --yes - we still
do tell user which action is going to happen.
2017-06-16 17:04:02 +02:00
Zdenek Kabelac
14816222a1 cleanup: improve debug tracing 2017-06-16 17:04:02 +02:00
Zdenek Kabelac
b7c9ec8a24 cleanup: use 'dm_get_status_raid'
Use single 'dm' call to parse raid status.
(Avoiding multiple parsers - even when we know it's slighly
less efficient).
2017-06-16 17:04:01 +02:00
Zdenek Kabelac
59d646167f raid: report percent with segtype info
Enhance reporting code, so it does not need to do 'extra' ioctl to
get 'status' of normal raid and provide percentage directly.

When we have 'merging' snapshot into raid origin, we still need to get
this secondary number with extra status call - however, since  'raid'
is always a single segment LV - we may skip 'copy_percent' call as
we directly know the percent and also with better precision.

NOTE: for mirror we still base reported number on the percetage of
transferred extents which might get quite imprecisse if big size
of extent is used while volume itself is smaller as reporting jump
steps are much bigger the actual reported number provides.

2nd.NOTE: raid lvs line report already requires quite a few extra status
calls for the same device - but fix will be need slight code improval.
2017-06-16 17:04:01 +02:00
Zdenek Kabelac
529dcaf6a3 libdm: workarounds reported raid status info
Current existing kernels reports status sometimes in weird form.

Instead of showing what is the exact progress, we need to estimate
this in-sync state from several surrounding states.

Main reason here is to never report 100% sync state for a raid device
which will be undergoing i.e. recovery.
2017-06-16 17:04:00 +02:00
Heinz Mauelshagen
40e0dcf70d raid: adjust reshape feature flag check
Relative to last comit ddf2a1d656:

adjust the dm-raid target version to 1.12.0 which shows
mandatory kernel MD deadlock fixes related to reshaping
are presant in the kernel.

Related: rhbz1443999
2017-06-16 15:58:47 +02:00
Heinz Mauelshagen
ddf2a1d656 Revert "lvconvert: reject changing number of stripes on single core
This reverts commit 3719f4bc54
to allow for single core testing on kernels with deadlock
fixes relative to rhbz1443999."
2017-06-16 15:43:23 +02:00
Jonathan Brassow
3592243afb test: New test file for validating kernel status during sync ops
First test in this file checks whether 'aa' is ever spotted during
a "recover" operation (it should not be).  More tests should follow
in this file to look for oddities in status output - especially as
it relates to the sync_ratio, dev_health, and sync_action fields.
2017-06-15 11:06:08 -05:00
Jonathan Brassow
6c4b2a6aa1 clean-up: Very picky update to comment - hopefully making it clearer 2017-06-14 15:22:04 -05:00
Jonathan Brassow
1f57a5263e clean-ups: remove unused var, add 'static' for local fn, adjust test
For the test clean-up, I was providing too many devices to the first
command - possibly allowing it to allocate in the wrong place.  I was
also not providing a device for the second command - virtually ensuring
the test was not performing correctly at times.
2017-06-14 14:49:42 -05:00
Jonathan Brassow
ddb14b6b05 lvconvert: Disallow removal of primary when up-converting (recovering)
This patch ensures that under normal conditions (i.e. not during repair
operations) that users are prevented from removing devices that would
cause data loss.

When a RAID1 is undergoing its initial sync, it is ok to remove all but
one of the images because they have all existed since creation and
contain all the data written since the array was created.  OTOH, if the
RAID1 was created as a result of an up-convert from linear, it is very
important not to let the user remove the primary image (the source of
all the data).  They should be allowed to remove any devices they want
and as many as they want as long as one original (primary) device is left
during a "recover" (aka up-convert).

This fixes bug 1461187 and includes the necessary regression tests.
2017-06-14 08:41:05 -05:00
Jonathan Brassow
4c0e908b0a RAID (lvconvert/dmeventd): Cleanly handle primary failure during 'recover' op
Add the checks necessary to distiguish the state of a RAID when the primary
source for syncing fails during the "recover" process.

It has been possible to hit this condition before (like when converting from
2-way RAID1 to 3-way and having the first two devices die during the "recover"
process).  However, this condition is now more likely since we treat linear ->
RAID1 conversions as "recover" now - so it is especially important we cleanly
handle this condition.
2017-06-14 08:39:50 -05:00
Jonathan Brassow
d34d2068dd lvconvert: Don't require a 'force' option during RAID repair.
Previously, we were treating non-RAID to RAID up-converts as a "resync"
operation.  (The most common example being 'linear -> RAID1'.)  RAID to
RAID up-converts or rebuilds of specific RAID images are properly treated
as a "recover" operation.

Since we were treating some up-convert operations as "resync", it was
possible to have scenarios where data corruption or data loss were
possibilities if the RAID hadn't been able to sync completely before a
loss of the primary source devices.  In order to ensure that the user took
the proper precautions in such scenarios, we required a '--force' option
to be present.  Unfortuneately, the force option was rendered useless
because there was no way to distiguish the failure state of a potentially
destructive repair from a nominal one - making the '--force' option a
requirement for any RAID1 repair!

We now treat non-RAID to RAID up-converts properly as "recover" operations.
This eliminates the scenarios that can potentially cause data loss or
data corruption; and this eliminates the need for the '--force' requirement.
This patch removes the requirement to specify '--force' for RAID repairs.
2017-06-14 08:39:07 -05:00
Jonathan Brassow
c87907dcd5 lvconvert: linear -> raid1 upconvert should cause "recover" not "resync"
Two of the sync actions performed by the kernel (aka MD runtime) are
"resync" and "recover".  The "resync" refers to when an entirely new array
is going through the process of initializing (or resynchronizing after an
unexpected shutdown).  The "recover" is the process of initializing a new
member device to the array.  So, a brand new array with all new devices
will undergo "resync".  An array with replaced or added sub-LVs will undergo
"recover".

These two states are treated very differently when failures happen.  If any
device is lost or replaced while "resync", there are no worries.  This is
because any writes created from the inception of the array have occurred to
all the devices and can be safely recovered.  Even though non-initialized
portions will still be resync'ed with uninitialized data, it is ok.  However,
if a pre-existing device is lost (aka, the original linear device in a
linear -> raid1 convert) during a "recover", data loss can be the result.
Thus, writes are errored by the kernel and recovery is halted.  The failed
device must be restored or removed.  This is the correct behavior.

Unfortunately, we were treating an up-convert from linear as a "resync"
when we should have been treating it as a "recover".  This patch
removes the special case for linear upconvert.  It allows each new image
sub-LV to be marked with a rebuild flag and treats the array as 'in-sync'.
This has the correct effect of causing the upconvert to be treated as a
"recover" rather than a "resync".  There is no need to flag these two states
differently in LVM metadata, because they are already considered differently
by the kernel RAID metadata.  (Any activation/deactivation will properly
resume the "recover" process and not a "resync" process.)

We make this behavior change based on the presense of dm-raid target
version 1.9.0+.
2017-06-14 08:35:22 -05:00
Heinz Mauelshagen
14d563accc raid: change reshape segtype flags
Commit 1c916ec5ff
missed new reshape flags.
2017-06-14 15:01:19 +02:00
Heinz Mauelshagen
08079ec420 lvconvert: fix detached SubLV deactivation in cluster
On conversion from raid10 to raid0 (takeover), all rmeta
devices and the rimage devices of mirrored stripes are
detached from the raid10 LV. The remaining rimage areas
are being shifted down into the slots of the detached
ones hence requiring renames to show proper _N suffix
sequences (e.g. 0,1,2,3 instead of 0,2,4,6).  Only the
top-level raid10 LV has a cluster lock, not the detached
SubLVs thus their deactivation is impossible and e.g the
rename from *_rimage_6 to *_rimage_3 will fail.  Fix by
activating exclusively before deactivating and removing.

Resolves: rhbz1448123
2017-06-13 23:15:51 +02:00
Bryn M. Reeves
9a094350e0 dmfilemapd: do not wait if file has been truncated 2017-06-13 19:46:41 +01:00
Bryn M. Reeves
0cb628dfe2 dmfilemapd: update file block count at daemon start
The file block count stored in the filemap_monitor was lazily
initialised at the time of the first check. This causes problems
in the case that the file has been truncated between this time and
the time the daemon started: the initial block count and current
block count match and the daemon fails to detect a change.

Separate the setting of the block count from the check and make a
call to update the value at the start of _dmfilemapd().
2017-06-13 19:46:41 +01:00
Bryn M. Reeves
744f2920db libdm: allow truncated files in dm_stats_update_regions_from_fd()
It's not an error to attempt to update regions from an fd that has
been truncated (or otherwise no longer has any allocated extents):
in this case, the call should remove all regions corresponding to
the group, and return an empty region table.
2017-06-13 19:45:50 +01:00
Zdenek Kabelac
37cd8f9678 configure: update 2017-06-09 22:52:19 +02:00
Heiko Becker
4b4a210e83 configure: search for (a possibly prefixed) ar
e.g. when cross compiling.

Signed-off-by: Heiko Becker <heirecka@exherbo.org>
2017-06-09 22:49:39 +02:00
Zdenek Kabelac
5ef20d2168 configure: improve reporting about readline
Report real 'readline' supporting state instead of 'maybe'.
Really check for 'readline' headers.
2017-06-09 22:40:27 +02:00
Zdenek Kabelac
358eee15f3 configure: warn about older version of cache_check
For proper usage of Cache kernel metadata format V2,
new cache_check tool is basically mandatory.

Print warning during configure time about this problem.
2017-06-09 22:32:12 +02:00
Heinz Mauelshagen
1c916ec5ff raid: add reshape segtype flag support
Prohibit activation of reshaping RaidLVs on incompatible
lvm2 runtime by storing e.g. 'raid5+RESHAPE' segment type
strings in the lvm2 metadata.  Incompatible runtime not
supporting reshaping won't be able to activate those thus
avoiding potential data corruption.

Any new non-reshaping lvconvert command will reset the
segment type string from 'raid5+RESHAPE' to 'raid5'.

See commits
0299a7af1e and
4141409eb0
for segtype flag support.
2017-06-09 22:23:04 +02:00
Zdenek Kabelac
3055131784 indent: properly indent goto 2017-06-09 21:49:19 +02:00
Zdenek Kabelac
57379157f4 cleanup: update message 2017-06-09 21:49:19 +02:00
Zdenek Kabelac
db5938a4f8 cleanup: define really uses KB
Cleanup also units for DEFAULT_THIN_POOL_OPTIMAL_METADATA_SIZE define
(128MB) and update calcs for it.
2017-06-09 21:49:19 +02:00
Zdenek Kabelac
5e7db7d85d snapshot: fix reporting for merged old snapshot
When old snapshot is merged, lvm2 still can report some data about
merged 'snapshot' - i.e. it occupied space in VG.

This patch fixes regression from commit:
6fd20be629

and resolved RHBZ: 1460161
2017-06-09 21:03:20 +02:00
Zdenek Kabelac
b6945b8510 tests: no longer allowed too big thin-pools for small chunks 2017-06-09 13:03:42 +02:00
Zdenek Kabelac
5017284709 configure: report yes or no for wiping and system
Avoid reporting 'checking result' as maybe - it should
clearly tell 'yes' or 'no'.

Just shuffle printed message to the place, where we
already know the 'maybe' answer.

So instead of printing 'unclear':

checking whether to enable libblkid detection of signatures when wiping... maybe
checking for BLKID... yes
checking whether to use udev-systemd protocol for jobs in background... maybe
checking for SYSTEMD... yes

show this:

checking for BLKID... yes
checking whether to enable libblkid detection of signatures when wiping... yes
checking for SYSTEMD... yes
checking whether to use udev-systemd protocol for jobs in background... yes
2017-06-09 13:02:18 +02:00
Zdenek Kabelac
b3ef051e06 cache: lvcreate --cachepool checks for cache pool
Code path missed validation of lvcreate --cachepool argument.
If the non cache-pool LV was passed in, code has still continued
further work and failed later on internal error.  Validate this
condition at right place now.
2017-06-09 10:59:37 +02:00
Zdenek Kabelac
f91ea96b4f tests: fix compilation of unit tests
Rule for TARGET compiling got missing and needs to be explicitely
expressed, otherwise default unsuitable rule is applied.
2017-06-08 11:59:02 +02:00
Zdenek Kabelac
ee5ecde35e tests: check thin-pool boundary sizes 2017-06-08 11:58:36 +02:00
Zdenek Kabelac
48ffb996c5 thin: disallow creation of too big thin pools
When a combination of thin-pool chunk size and thin-pool data size
goes beyond addressable limit, such volume creation is directly
prohibited.

Maximum usable thin-pool size is calculated with use of maximal support
metadata size (even when it's created smaller) and given chunk-size.
If the value data size is found to be too big, the command reports
error and operation fails.

Previously thin-pool was created however lots of thin-pool data LV was
not usable and this space in VG has been wasted.
2017-06-08 11:58:36 +02:00
Zdenek Kabelac
ba3d3210d7 cleanup: use DM limit define
For calculation use already defined size in libdm, which give better
estimation of maximal size of thin pool metadata.
2017-06-08 11:07:58 +02:00
Zdenek Kabelac
719d099693 cleanup: rename internal define
More descriptive name of #define.
2017-06-08 11:07:18 +02:00
Heinz Mauelshagen
39703cb485 lvconvert: reject RAID conversions on inactive LVs
Only support RAID conversions on active LVs.

If we'd accept e.g. upconverting linear -> raid1 on inactive
linear LVs, any LV flags passed to the kernel aren't properly
cleared thus errouneously passing them on every activation.

Add respective check to lv_raid_change_image_count() and
move existing one in lv_raid_convert() for better messages.
2017-06-07 18:37:04 +02:00
Tony Asleson
61420309ee lvmdbusd: Prevent stall when update thread gets exception
If during the process of fetching current lvm state we experience an
exception we fail to call set_result on the queued_requests we were
processing.  When this happens those threads block forever which causes
the service to stall infinitely.  Only clear the queued_requests after
we have called set_result.
2017-06-02 12:39:04 -05:00
Tony Asleson
699ccc05ca lvmdbusd: Add background command to flight recorder
We were not adding background tasks to flight recorder.  Add the meta
data to the flight recorder when we start the command and update the meta
data when the command is finished.  Locking was added to meta data to
prevent concurrent update and returning string representation as these can
happen in two different threads.
2017-06-02 12:32:51 -05:00
Tony Asleson
192d142e1c lvmdbusd: cmdhandler.py vg_reduce, remove extranous '--all'
vgreduce previously allowed --all and --removemissing together even though
it only actual did the remove missing.  The lvm dbus daemon was passing
--all anytime there was no entries in pv_object_paths.  This change supplies
--all if and only if we are not removing missing and the pv_object_paths
is empty.

Vgreduce has and continues to enforce the invalid combination of supplying a
device list when you specify --all or --removemissing so we do not need
to check for that invalid combination explicitly in the lvm dbus service as
it's already covered.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1455471
2017-06-02 12:32:43 -05:00