Zdenek Kabelac [Wed, 24 Mar 2021 11:08:40 +0000 (12:08 +0100)]
tests: ignore incosistent raid status
Just like lvm command ignores 0/xxxx report from judging the status.
Avoid using infinite loop and limit report checking to 100 checks.
If it would need more - something is not right.
Zdenek Kabelac [Mon, 22 Mar 2021 17:55:07 +0000 (18:55 +0100)]
tests: use mdadm support
Use for testing new mdadm_create aux wrapper.
Place functionality into a 2 pass loop - one for 'auto' other for 'start'.
Share same tests between raid level 0 and level 1 version of raid.
Zdenek Kabelac [Mon, 22 Mar 2021 17:54:54 +0000 (18:54 +0100)]
tests: new aux mdadm_create
Add generic wrapper for mdadm --create which takes
normal 'mdadm' args - but allows us to handle differences of
mdadm usage across various version of mdadm tool.
Resulting MD device is availalble in $(< MD_DEV).
Automatic cleaning is made through cleanup_md_dev
Calling of mdadm_create cleans previous MD dev if it exists.
Zdenek Kabelac [Sat, 20 Mar 2021 09:39:02 +0000 (10:39 +0100)]
tests: add FIXME to raid test
We have here some kind of catch-22 - since older kernels do
use 'resync' while new 'recover' for initial raid synchronization.
So now - how do we recognize in which state of raid we are.
ATM seems to be simplest to simply keep disabled droping of primary raid
leg unless we are in sync.
FIXME: we should add a target version check and enable removal
Zdenek Kabelac [Sat, 20 Mar 2021 09:35:53 +0000 (10:35 +0100)]
raid: restore mirror handling in _raid_in_sync
Function is not having the best name since it does check
no just raid LVs to be in sync.
Restore the mirror percentage checking - although without retries,
since only raid target is currently known to need it - for other
types it would be ATM a bug to get inconsistent result.
Zdenek Kabelac [Fri, 19 Mar 2021 13:47:21 +0000 (14:47 +0100)]
make: restore buildir != srcdir support
Our new faster deps generation missed support for
buildirs != srcdir - as it can be usable to have
several builds from unchanged directory with sources.
Zdenek Kabelac [Wed, 17 Mar 2021 18:09:58 +0000 (19:09 +0100)]
thinpool: support lvconvert without zeroing
Since lvm does support external users of thin-pool when thin devices
are managed outside it can be useful to support conversion to
thin pool from data and metadata LV without zeroing.
TransactionID will be 0 in lvm2 metadata.
Zdenek Kabelac [Wed, 17 Mar 2021 17:26:08 +0000 (18:26 +0100)]
pool: allow data on zero and error segtypes
Renables usage of --type zero and --type error LVs to serve as
backend for _tdata device. Clearly not very useful in practice,
as it can't store any real data, but usable for some testing
and some sort of perfomance checking.
lvcreate --type zero -L1T -n pool vg
lvconvert --thinpool vg/pool
Zdenek Kabelac [Thu, 18 Mar 2021 12:19:45 +0000 (13:19 +0100)]
lvresize: allow mixing striped with errors or zero
Enabled extension/mixing of stripes/linears, error and zero
segtype LVs with stripes/linear, error and zero segtypes.
It is not very useful in practice, as the user cannot store any real
data on error or zero segtypes, but it may get some uses in
some scenarios where i.e. some portion of the device should not be
readable. Mixing of types happens on 'extent_size' level:
Note: when the type is not specified, the last segment type is
automatically selected.
It's also a small 'can of worms' since we can't tell LVs if
the LV is linear/error/zero or their mixtures. So the meaning behind
them may need some updates.
We already have this types of LV created i.e by:
vgreduce --removemissing --force
where missing LV segments have been replaced by either
error or zero segtype (lvm.conf).
TODO: it might be worth adding a message while such device is activated.
Zdenek Kabelac [Thu, 18 Mar 2021 12:15:44 +0000 (13:15 +0100)]
lvremove: extra code for handling thinpool data
Add some extra code to handle differently sized thin-pool
from thin-pool data volume.
ATM this can't really happen, but once we start to use multiple
commits while resizing stacked LV, we may actually get into
the position, where data LV has been already resized,
but thin-pool stayed with old size.
But for now - report difference as internal error.
Zdenek Kabelac [Thu, 18 Mar 2021 16:17:21 +0000 (17:17 +0100)]
dev_manager: skip also zero targets
Devices made only from 'error' target cannot be used,
but if the device is also combined from 'zero' target
the same rule can be applied as such device cannot be used.
Zdenek Kabelac [Sun, 14 Mar 2021 21:03:41 +0000 (22:03 +0100)]
lvpoll: improve merge polling
When multiple polling tasks are watching for same LV, clearly
when some of them wins the game - other polling tasks will fail.
Improve the logic and report success if the merged LV is
actually not a merging origin anymore (since likely someone
else has already finished merging).
Zdenek Kabelac [Sun, 14 Mar 2021 12:18:45 +0000 (13:18 +0100)]
lvremove: use to_remove for snapshot removal
Reuse similar 'acceleration' as used for dependent volumes also
for snapshot - so when origin is being removed with all thick
snapshots, don't bother with individual 'COW' detachments
and write&commits, and when possible handle this all within
a single commit.
Zdenek Kabelac [Sun, 14 Mar 2021 12:17:03 +0000 (13:17 +0100)]
lvremove: use common routine for prompting
Move code for prompting about removed LV to a single function
and use it also to prompt for removal of origin and all its thick
snapshots and also when removing merging origin.
Function does handle postponed write_and_commit so there is
no 'in-flight' operation while waiting on [y|n] answer.
Zdenek Kabelac [Sun, 14 Mar 2021 10:44:54 +0000 (11:44 +0100)]
vg_validate: fix validation of merging thin origin
Compat code and handle unusual case, where
thin snapshot is also a 'thick snapshot origin' and such
snapshot gets merged into a thin origin.
However since now lv_is_visible() (which is complex function)
replaced &VISIBLE_LV check, the whole this check seems to be
no longer useful as sum of all 3 will always match??