1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-25 01:34:38 +03:00
Commit Graph

15808 Commits

Author SHA1 Message Date
Zdenek Kabelac
796efef15e WHATS_NEW: update 2019-10-31 13:16:58 +01:00
Zdenek Kabelac
50ab7b3ceb tests: reduce space requirements
Test well runs on smaller test machines.
2019-10-31 13:14:50 +01:00
Zdenek Kabelac
719ab4da05 raid: drop internal error
Fix some internal error reports and debug trace returns
2019-10-31 13:00:01 +01:00
Zdenek Kabelac
2c46c60155 manip: optimize lvs_using_lv
Instead of checking all LVs in a VG - do just a direct copy of LVs
from the existing list ->segs_using_thin_lv.

TODO: maybe it could be better to expose seg_list to /tools...
2019-10-31 13:00:01 +01:00
Zdenek Kabelac
4b7bcf3ed4 mirror: remove unused code 2019-10-31 13:00:01 +01:00
Zdenek Kabelac
cf426744ae mirror: directly activate updated mirror 2019-10-31 13:00:01 +01:00
Zdenek Kabelac
f1be01c7ef mirror: fix leg splitting
Enhance lv_info with lv_info_with_name_check.
This 'variant' not only check existance if UUID in DM table
but also compares its  DM name  whether it's matching expected LV name.
Otherwise activation may 'skip' activation with rename in case the
DM UUID already exists, just device is different name.

This change make fairly easier manipulation with i.e. detached mirror
leg which ATM is using same UUID - just the LV name have been changed.

Used code was not able to run 'activation' (and do a rename) and just
skipped the call. So the code used to do a workaround and 'tried'
to deactivate such LV firts - this however work only in non-clvmd case,
as cluster was not having the lock for deactivated LV.

With this extended lv_info code will run 'activation' and will
synchronize the name to match expected LV name.

Patch extends _lv_info() with new paramter 'with_name_check',
which is later translated into 'name_check' argument for
_info_run() which in case of name mismatch evaluates the
check as if device does not exists.

Such call is only used in one place _lv_activate() which then
let activation run.  All other invocation of _info() calls
are left intact.

TODO: fix mirror table manipulation (and raid)....
2019-10-31 12:56:24 +01:00
Zdenek Kabelac
8b741b3bba tests: needs exclusive activation for conversion
For online convertion LVs must be activated localy exclusive as
cache can only work for exclusive activation.
2019-10-30 09:36:10 +01:00
Zdenek Kabelac
5ee3d6dbdf WHATS_NEW 2019-10-26 00:48:00 +02:00
Zdenek Kabelac
9a8bff003b tests: explicit testing of thin snapshot
Check merging of old snapshot of thin LV.
2019-10-26 00:46:33 +02:00
Zdenek Kabelac
963af243bf snapshot: use single merging sequence
The resume of 'released' 'COW' should preceed the resume of origin.
The fact we need to do the sequence differently for merge was
cause by bugs fixed in 2 previous commits - so we no longer need
to recognize 'merging' and we should always go with single
sequence.

The importance of this order is - to properly remove  '-real' device
from origin LV. When COW is activated as 2nd. '-real' device is
kept in table as it cannot be removed during 1st. resume of origin,
and later activation of COW LV no longer builds tree associated
with origin LV.
2019-10-26 00:42:50 +02:00
Zdenek Kabelac
8be8b994c6 snapshot: fix checking of merged thin volume
When merging of thin snapshot is taking place, the origin target will
be of thin type.
2019-10-26 00:41:40 +02:00
Zdenek Kabelac
20d94e4072 snapshot: correctly check device id of merged thin
When checking device id of a thin device that is just being
merged - the snapshot actually could have been already finished
which means  '-real' suffix for the LV is already gone and just LV
is there - so check explicitely for this condition and use
correct UUID for this case.
2019-10-26 00:39:20 +02:00
Zdenek Kabelac
bc200e0b16 tests: really check disabling of lvmetad
Since lvconvert validated LV types that can be repaired,
the test was not working properly for longer time...
2019-10-26 00:29:44 +02:00
Zdenek Kabelac
36b8b9ed5c debug: avoid to slashes in debug message 2019-10-26 00:29:44 +02:00
Zdenek Kabelac
cd39b67b7e pvmove: detect exclusively active LVs
Before pvmove start, it need to decide if exlusive mode of pvmove
must be used - this mode needs to be used if some move LV is
already exclusively activated.
2019-10-26 00:29:44 +02:00
David Teigland
96fd312e85 config: allow_mixed_block_sizes set version 2.02.187 2019-10-24 10:26:33 -05:00
David Teigland
f53cce1804 config: allow_mixed_block_sizes set default to 1
to use the old behavior by default, which allows
using mixed block sizes.  The user will need to
set it to 0 in lvm.conf to turn on the new restrictions.
2019-10-24 10:26:28 -05:00
David Teigland
e298a87f71 Revert "tests: remove allow-mixed-block-sizes"
This reverts commit 4e99308b7c.
2019-10-24 10:26:28 -05:00
David Teigland
c285314763 Revert "Revert "vgcreate/vgextend: restrict PVs with mixed block sizes""
This reverts commit c37aa7881d.

Put back the setting again, but the next commit will just
turn off the new behavior by default.
2019-10-24 10:01:12 -05:00
David Teigland
4e99308b7c tests: remove allow-mixed-block-sizes 2019-10-23 13:26:19 -05:00
David Teigland
c37aa7881d Revert "vgcreate/vgextend: restrict PVs with mixed block sizes"
This reverts commit a57b92dec3.

This can break existing usage, so it's not suitable for the
stable branch.
2019-10-23 13:25:25 -05:00
Marian Csontos
c65f3fd8df dm: Fix compilation of dmsetup
Fix: 889c88e9da
2019-10-22 10:37:40 +02:00
Marian Csontos
c24fa7b7b7 cov: Clarify the control flow
Return need a clean up but it is not bailing out due to an error.

Fix: 402b41f58d
2019-10-21 15:32:09 +02:00
Zdenek Kabelac
3fe2610cff debug: drop some unneeded backtraces
(cherry picked from commit 88faf5a53b)

Conflicts:
	lib/format_text/export.c
	tools/lvconvert.c
2019-10-21 15:26:11 +02:00
Mikulas Patocka
889c88e9da dm: introduce DM_GET_TARGET_VERSION
Adds support for the DM_GET_TARGET_VERSION to dmsetup.
It introduces a new comman "target-version" that will accept list
of targets and print their version.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
(cherry picked from commit 667b33dd3b)

Conflicts:
	device_mapper/all.h
	device_mapper/ioctl/libdm-iface.c
	device_mapper/misc/dm-ioctl.h
2019-10-21 15:21:29 +02:00
David Teigland
f50af80199 devs: check for no dev when dropping aliases
When scanning fails to find a device path and
looks for device aliases, check if the device
itself still exists to avoid a potential segfault.
2019-10-16 13:32:28 -05:00
Marian Csontos
219c4c2ce2 spec: Fix lvm2-activation-generator man page handling
lvm2-activation-generator is not installed when systemd is not in the
system.

(cherry picked from commit b20b23dfc6)

Conflicts:
	spec/packages.inc
2019-10-04 16:32:52 +02:00
Heinz Mauelshagen
45ee63ede9 WHATS_NEW: new lvextend-raid.sh test 2019-10-02 17:06:22 +02:00
Heinz Mauelshagen
8632aa5fd3 test: increase size of raid10 LV allowing tests to succeed on fast storage
Also add health char check.
2019-10-02 17:03:52 +02:00
Heinz Mauelshagen
a0b30eadd1 test: add RAID lvextend resynchronization test
Due to a dm-raid target flaw fixed in target version 1.15.0,
extents of raid sets don't get resynchronized when new MD bitmp
pages have to be allocated due to the extension.

Introduce lvextend-raid.sh to test this flaw.

Related: rhbz1671964
2019-10-02 17:03:51 +02:00
Heinz Mauelshagen
a087da2f51 test: add checks for not 100% sync ratio after initiation of check/repair
Related: rhbz1640630
2019-10-02 17:03:49 +02:00
Bryn M. Reeves
1f970f590f dmsetup: do not treat no groups as an error in dmstats list --group
Analogous to the case of a device with no regions, it is not an
error to attempt to list the stats groups on a device that has no
configured groups: just return success and continue.
2019-09-30 17:12:21 +01:00
Zdenek Kabelac
61358d92cb lvmetad: fix timeout on shutdown
When lvmetad is going to be shutdown - there were 2 issue:
If there was endless stream of command contacting lvmetad - the process
would never finish - so now when we recieved  SIGTERM - we are no longer
accepting new connections and we just wait till the existing ones are
finished.

2nd. issue is that actually when we are waiting for finish of all client
threads - we basically want an usleep() and check if all threads
are already finished -  proper solution would be to singal from a thread
there is some work to do for master thread - but that would be a bigger
change and since lvmetad is no longer developed - keep the change
minimal and just use pselect() as our '1sec.' sleeping call once
we are in 'shutdown' mode.

Reported-by: wangjufeng@huawei.com
2019-09-30 13:39:44 +02:00
David Teigland
5d6bf1efb2 lvmetad: fix sync cache to lvmetad
error could be reproduced follow those steps:
    #!/bin/bash
    vgcreate vgtest /dev/sdb
    lvcreate -L 100M -n lv1 vgtest
    while :
    do
        service lvm2-lvmetad restart
        vgs &
        pvscan &
        lvcreate -L 100M -n lv2 vgtest &
        lvchange /dev/vgtest/lv1 --addtag xxxxx &
        wait
        if ! lvs|grep lv2;then
            echo "err create"
            break
        fi
        sleep 1
        lvremove -y /dev/vgtest/lv2
        lvchange /dev/vgtest/lv1 --deltag xxxxx
    done

and then fail to create vgtest/lv2, actually lv2 was created, while
the metadata written on disk is replaced by lvchange. It could look
up lv2 by calling dmsetup table, while lvs could not.

This is because, when lvmetad restarted, several lvm commands update
token concurrently, when lvcreate recieve "token_mismatch", it cancle
communicating with lvmetad, which leads to that lvmetad cache is not
sync with the metadata on disk, then lv2 is not committed to lvmetad
cache. The metadata of vgtest which lvchange query from lvmetad is
out of date. After lvchange, it use the old metadata cover the new one.

This patch let lvm process update token synchronously, only one command
update lvmetad token at a time.

lvmetad_pvscan_single send the metadata on a pv by sending "pv_found"
to lvmetad, while the metadata maybe out of date after waiting for the
chance to update lvmetad token. Call label_read to read metadata again.

Token mismatch may lead to problems, increase log level.

Signed-off-by: wangjufeng<wangjufeng@huawei.com>
2019-09-25 14:31:08 -05:00
David Teigland
2327f3997b tests: allow-mixed-block-sizes skip with older losetup
(cherry picked from commit 69b7c00a77)
2019-09-24 14:08:23 +02:00
David Teigland
9fcda0d975 WHATS_NEW: vgcreate/vgextend logical block size
(cherry picked from commit 3a0d493d91)

Conflicts:
	WHATS_NEW
2019-09-24 10:51:50 +02:00
David Teigland
f758d16b30 tests: allow-mixed-block-sizes
(cherry picked from commit cd8a0133fa)
2019-09-24 10:48:39 +02:00
Marian Csontos
444dedea23 build: make generate 2019-09-24 10:38:22 +02:00
Marian Csontos
92f1c888e0 lvmetad: Fix function prototype when not configured
Fixes: 6b129308
2019-09-24 10:34:44 +02:00
David Teigland
a57b92dec3 vgcreate/vgextend: restrict PVs with mixed block sizes
Avoid having PVs with different logical block sizes in the same VG.
This prevents LVs from having mixed block sizes, which can produce
file system errors.

The new config setting devices/allow_mixed_block_sizes (default 0)
can be changed to 1 to return to the unrestricted mode.

(cherry picked from commit 0404539edb)

Conflicts:
	tools/lvmcmdline.c
	tools/toollib.c
2019-09-24 10:14:30 +02:00
Heinz Mauelshagen
8d3e01ff4f dmeventd: avoid bail out preventing repair in raid plugin but keep message
Followup patch mentioned in previous commit 0585754593.

Problem:
  even though dead raid component devices are detected, the
  raid plugin is bailing out thus preventing a repair attempt.

Rational:
  in case of component device errors, the MD resynchronization
  thread runs in parallel with the thrown event being processed
  by the raid plugin.  The plugin retrieves the raid device status
  but that still reflects insync regions as 0 (when it should
  already be total regions) because the MD thread didn't update it yet.

Solution:
  Remove the insync regions check but keep the informal message
  "waiting for resynchronization"  and let lvconvert carry out its
  pre-repair checks and optionally carry out a repair attempt.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1560739
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1468590
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1654860
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1729303
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1741016
2019-09-20 17:52:02 +02:00
Heinz Mauelshagen
0585754593 Revert "dmeventd: avoid bail out preventing repair in raid plugin"
This reverts commit 9e438b4bc6.

The reverted patch also removed the warning which we realized we need
to keep as valuable process information (see related bugzilla below).

In a followup patch, we'll keep the message and avoid bailing out thus
always allowing lvconvert to try repairing if 'allocate' fault policy set.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
2019-09-20 17:48:48 +02:00
Marian Csontos
6cad4eba9b spec: Move blkdeactivate to device-mapper 2019-09-20 10:56:46 +02:00
David Teigland
44b98d77ec tests: add test for pvscan activation of incomplete vg 2019-09-18 13:29:17 -05:00
Zdenek Kabelac
1349b61bb7 pvmove: check if participating LV is already exlcusively active
When running pvmove, we need to decide whether pvmove has to be doing
exlusive or non-exclusive activations for LV.

Whenever LV that requires exlusive activation is present, it makes
pvmove exlusive. But when there is already activate i.e. linear LV
in exclusive mode it also needs to switch pvmove into 'exlusively
activating' pvmove.
2019-09-18 12:46:22 +02:00
Zdenek Kabelac
2e51535b18 thin: activate layer pool aas read-only LV
When lvm2 is activating layered pool LV (to basically keep pool opened,
the other function used to be 'locking' be in sync with DM table)
use this LV in read-only mode - this prevents 'write' access into
data volume content of thin-pool.

Note: since EMPTY/unused thin-pool is created as 'public LV' for generic
use by any user who i.e. wish to maintain thin-pool and thins himself.
At this moment, thin-pool appears as writable LV.  As soon as the 1st.
thinLV is created, layer volume will appear is 'read-only' LV from this moment.
2019-09-17 15:29:11 +02:00
Zdenek Kabelac
2caae8a572 devices: crypto skip
Devices with UUID signature CRYPT-SUBDEV are internal crypto devices.
2019-09-17 15:29:11 +02:00
Zdenek Kabelac
2694f93bb4 tests: pool conversion
Test conversion of cached LV.
2019-09-17 11:33:55 +02:00
Zdenek Kabelac
e147786bac lvconvert: improve validation thin and cache pool conversion
Limit convertible LVs to thin-pool and cache-pools.
Also fix return code on  interal error path to return ECMD_FAILED.
2019-09-17 11:33:53 +02:00