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

17496 Commits

Author SHA1 Message Date
Zdenek Kabelac
1880b573f3 tests: aux always shift emulated devices by 1MiB
Always shift created virtual PVs on backing device by 1MiB
and leave 1MiB free space at the end of device.

This way the system doesn't see same PV headers at multiple devices.
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
8e7690b798 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.

  lvconvert -Zn --thinpool vg/data --poolmetadata vg/meta
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
1c3774c7a8 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

Will create a thin-pool with zero device backend.
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
7a9efc5fae 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:

  lvcreate -L1 -n lv vg
  lvextend --type error  -L+1 vg/lv
  lvextend --type zero   -L+1 vg/lv
  lvextend --type linear -L+1 vg/lv
  lvextend --type striped -L+1 vg/lv

  lvs -o+segtype,seg_size vg

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.
2021-03-18 18:56:49 +01:00
Zdenek Kabelac
b35ef9d67c segtypes: macros for error and zero segtypes 2021-03-18 18:34:57 +01:00
Zdenek Kabelac
22554c3ff0 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.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
5a73399b73 lvresize: support resize of stacked virtual LV
Update the LV stack with the size also for virtual LVs.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
adc238062d 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.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
a9b4acd511 dev_manager: add lv_raid_status
Just like with other segtype use this function to get whole
raid status info available per a single ioctl call.

Also it nicely simplifies read of percentage info about
in_sync portion of raid volume.

TODO: drop use of other calls then lv_raid_status call,
since all such calls could already use status - so it just
adds unnecessary duplication.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
e5a600860c dev_manager: status check with info check included
Reduce ioctl count and avoid separate info check,
when we can get the same info from status ioctl.

When devmanager calls return 0, then the exists value 0
means the reason of failure is missing device in table.
In such case we avoid stack trace.

Swap the flush parameter for the vdo status function
to match thin pool status.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
a60c8748ea thin: ignore parallel merge while polling
If the thin volume has no merging snapshot,
(being already merged) there is nothing to check.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
8cbe4a171e thin: add extra protection
Check explicitely created LV already has thin segment.
As currenlty it's the only user - this patch should have no impact.
2021-03-18 18:34:57 +01:00
Zdenek Kabelac
d682ad619a cleanup: simplier check first 2021-03-18 18:34:57 +01:00
David Teigland
a481fdaa35 man: lvmlockd use of lvmlockctl_kill_command 2021-03-17 13:02:51 -05:00
Zdenek Kabelac
583cf413d5 tests: avoid leaking unkilled commands
Between each new test here we want to kill previous commands,
otherwise they will influence results of next test.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
fda7bc1297 tests: wait for Aa status 2021-03-17 00:59:50 +01:00
Zdenek Kabelac
80d0f200d0 tests: increase version of targets for progress 2021-03-17 00:59:50 +01:00
Zdenek Kabelac
e793ff1e18 tests: workaround for some raid targets
Problem with some target is that shortly after initialization it
returns incorrect status letters.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
db37905d7f tests: no further fixes likely to be expected
Skip tests for these kernels.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
87659256f0 tests: require newer version of raid target 2021-03-17 00:59:50 +01:00
Zdenek Kabelac
92ee16f7c0 tests: update mirror test
Log results of uniq.
Remove few unneeded lvs calls.
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
53bad89a7b tests: added check for kernel version
With older kernels this test can't work reliable,
since 'suspend' used to clean all dirty blocks
(taking even several seconds).
2021-03-17 00:59:50 +01:00
Zdenek Kabelac
8b2cdd8d3a debug: start with upper case
Use upper case letter to start sentence.
Also drop unneded check for vg as it's already non-null.
2021-03-17 00:50:40 +01:00
Zdenek Kabelac
94701b700b cleanup: use dm_strncpy
Use own function.
2021-03-17 00:50:22 +01:00
Zdenek Kabelac
4d75c4f597 device_is_usable: minor improve
Replace allocated buffer with local vg_name which doesn't
pass pointer to allocation.

Join some conditions together.
2021-03-17 00:49:11 +01:00
Zdenek Kabelac
0363e4de70 cleanup: typo 2021-03-15 18:59:15 +01:00
Zdenek Kabelac
e6912cc61c WHATS_NEW: updates 2021-03-15 11:13:24 +01:00
Zdenek Kabelac
b4a74d1008 tests: add test for merging
Check we handle mething of thin snapshot that is itself thick snapshot
origin.
Also use  lvpoll to better wait for finish of merging.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
800a93d4ac tests: wait till fs is synchronized
Adding full filesystem sync, trying to fight with strange error from losetup:

losetup: loopa: failed to set up loop device: Resource temporarily unavailable

loop0: detected capacity change from 0 to 4096
loop_set_block_size: loop0 () has still dirty pages (nrpages=13)

Also reuse internal aux wipefs_a
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
78406ef617 tests: update handling of thin-pool removal
We shall no longer activate thin-pool, when
it's going away together with all thin volumes.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
e5e957e330 shellcheck: avoid assign warnings
Shellcheck seems to be happier when assigning variables with quotes.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
8a92f70709 cov: void unused result 2021-03-15 11:13:24 +01:00
Zdenek Kabelac
f69ff4b84a debug: update message 2021-03-15 11:13:24 +01:00
Zdenek Kabelac
6e9ccf7b6f debug: keep microseconds aligned 2021-03-15 11:13:24 +01:00
Zdenek Kabelac
bc1bc4cffc debug: drop stack from regular code flow 2021-03-15 11:13:24 +01:00
Zdenek Kabelac
eadd58a97d 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).
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
1a451207b8 pooldaemon: increase min polling interval
Although we support '0' interval - it's highly inefficent to
do so many scans in busy-loop.

So ATM raise minimal rescan time to 100ms.

TODO: revisit whole timing logic here as it does have some sideeffect
hiddent impact and can considerably eat CPU in some cases.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
5edb353062 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.
2021-03-15 11:11:35 +01:00
Zdenek Kabelac
0a2d7c57a1 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.
2021-03-15 11:08:47 +01:00
Zdenek Kabelac
a18409b6d1 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??
2021-03-15 10:59:09 +01:00
Zdenek Kabelac
ff712987a5 config: correct option name 2021-03-14 16:59:24 +01:00
Zdenek Kabelac
b4dfe026dd config: keep issue_discards in config struct
Avoid quering for this config option and keep it for removing in struct.
Also drop unused cache_vgmetadata variable.
2021-03-14 16:59:24 +01:00
Zdenek Kabelac
fab9987ad7 cleanup: move common condition 2021-03-14 16:34:38 +01:00
Zdenek Kabelac
b563c926ba cleanup: simplify 2021-03-14 16:34:38 +01:00
Zdenek Kabelac
664d3b0f22 lvremove: drop flushing dm cache before remove
Since cached LV is going to be removed together with its cache,
there is not much to gain if we try to flush cache first.
User may use 'vgcfgrestore' to get back origin + cache.
Assuming user is not using issue_discards.
When data are discarded after remove there is nothing to restore!

This change allows to futher reduce number of commits
during lvremove/vgremove.
2021-03-14 16:34:38 +01:00
Zdenek Kabelac
5141a510bd lv_info: missing check for info.exists
When &info is passed in, user needs to check for exists.
When there is NULL, return value includes check for exists.
2021-03-14 16:34:38 +01:00
Zdenek Kabelac
3608e8aee7 cache: use interruptible_usleep
Reuse code for interruptible sleeping.
2021-03-14 16:34:38 +01:00
Zdenek Kabelac
a3bb8f2ec1 activation: use interruptible_usleep
Support interruption while waiting on device close.
2021-03-14 16:34:38 +01:00
Zdenek Kabelac
941f67ed09 signals: add interruptible usleep
Add small wrapper that temporarily enables signal handling during
usleep() and return  '0' when interrupted.
2021-03-14 16:34:38 +01:00
Zdenek Kabelac
bbac843268 thinpool: correct condition
Actually we do want to flush thin-pool message for particular LV first.
Existing condition evaluated to noop.
2021-03-12 12:59:55 +01:00