master - tests: change lvcreate syntax to allow lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2beb3009bd7e34604db...
Commit: 2beb3009bd7e34604dbd4f03c95fb7cd85eb98a6
Parent: 214235367b3500a586fc42232af34bd04ad14078
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 16:40:03 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 16:40:03 2018 -0500
tests: change lvcreate syntax to allow lvmlockd
Using the less ambiguous lvcreate syntax for creating a
cache LV allows more tests to run with lvmlockd.
---
test/shell/lvchange-cache-old.sh | 4 ++--
test/shell/lvconvert-cache-raid.sh | 3 +--
test/shell/lvcreate-cache-snapshot.sh | 3 +--
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/test/shell/lvchange-cache-old.sh b/test/shell/lvchange-cache-old.sh
index cb7915d..992249c 100644
--- a/test/shell/lvchange-cache-old.sh
+++ b/test/shell/lvchange-cache-old.sh
@@ -12,7 +12,7 @@
# Exercise usage of older metadata which are missing some new settings
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
@@ -24,7 +24,7 @@ aux prepare_vg 5 80
lvcreate -l 10 --type cache-pool $vg/cpool
-lvcreate -l 20 -H -n $lv1 $vg/cpool
+lvcreate -l 20 -H -n $lv1 --cachepool $vg/cpool $vg
vgcfgbackup -f backup $vg
diff --git a/test/shell/lvconvert-cache-raid.sh b/test/shell/lvconvert-cache-raid.sh
index ec9b1e4..fa49163 100644
--- a/test/shell/lvconvert-cache-raid.sh
+++ b/test/shell/lvconvert-cache-raid.sh
@@ -12,7 +12,6 @@
# Exercise usage of stacked cache volume using raid volume
-SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
@@ -86,7 +85,7 @@ lvremove -f $vg
# Test up/down raid conversion of cache pool data and metadata
lvcreate --type cache-pool $vg/cpool -l 10
-lvcreate -n corigin -H $vg/cpool -l 20
+lvcreate -H -n corigin --cachepool $vg/cpool -l 20 $vg
lvconvert -y -m +1 --type raid1 $vg/cpool_cmeta
check lv_field $vg/cpool_cmeta layout "raid,raid1"
diff --git a/test/shell/lvcreate-cache-snapshot.sh b/test/shell/lvcreate-cache-snapshot.sh
index c1be6a2..5d1c5a7 100644
--- a/test/shell/lvcreate-cache-snapshot.sh
+++ b/test/shell/lvcreate-cache-snapshot.sh
@@ -12,7 +12,6 @@
# Exercise creation of snapshot of cached LV
-SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
@@ -25,7 +24,7 @@ aux have_cache 1 5 0 || skip
aux prepare_vg 2
lvcreate --type cache-pool -L1 $vg/cpool
-lvcreate -H -L4 -n $lv1 $vg/cpool
+lvcreate -H -L4 -n $lv1 --cachepool $vg/cpool $vg
lvcreate -s -L2 -n $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype cache
5 years, 11 months
master - tests: enable lvcreate cache tests with lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=214235367b3500a586f...
Commit: 214235367b3500a586fc42232af34bd04ad14078
Parent: c516321325f41f6b1f9d9342e2b0d0507b5a30fd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 15:56:08 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 15:56:08 2018 -0500
tests: enable lvcreate cache tests with lvmlockd
Tests that want to use lvcreate to create a new
origin LV and then combine it with an existing
cache pool to create a cache LV.
---
test/shell/cache-metadata2.sh | 2 +-
test/shell/component-cache.sh | 2 +-
test/shell/lvchange-cache-mode.sh | 2 +-
test/shell/lvchange-cache.sh | 2 +-
test/shell/lvconvert-cache-abort.sh | 2 +-
test/shell/lvconvert-cache-smq.sh | 2 +-
test/shell/profiles-cache.sh | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/shell/cache-metadata2.sh b/test/shell/cache-metadata2.sh
index a7586f7..684ae67 100644
--- a/test/shell/cache-metadata2.sh
+++ b/test/shell/cache-metadata2.sh
@@ -12,7 +12,7 @@
# Exercise usage of metadata2 cache metadata format
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
# Until new version of cache_check tools - no integrity validation
diff --git a/test/shell/component-cache.sh b/test/shell/component-cache.sh
index 2060b31..87ca958 100644
--- a/test/shell/component-cache.sh
+++ b/test/shell/component-cache.sh
@@ -12,7 +12,7 @@
# Exercise activation of cache component devices
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvchange-cache-mode.sh b/test/shell/lvchange-cache-mode.sh
index 2bb8641..a34e517 100644
--- a/test/shell/lvchange-cache-mode.sh
+++ b/test/shell/lvchange-cache-mode.sh
@@ -12,7 +12,7 @@
# Exercise changing of caching mode on both cache pool and cached LV.
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 73ad6c0..7e95f61 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-cache-abort.sh b/test/shell/lvconvert-cache-abort.sh
index e771947..404f442 100644
--- a/test/shell/lvconvert-cache-abort.sh
+++ b/test/shell/lvconvert-cache-abort.sh
@@ -12,7 +12,7 @@
# Exercise cache flushing is abortable
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-cache-smq.sh b/test/shell/lvconvert-cache-smq.sh
index e329aee..67710fa 100644
--- a/test/shell/lvconvert-cache-smq.sh
+++ b/test/shell/lvconvert-cache-smq.sh
@@ -12,7 +12,7 @@
# Exercise conversion of cache and cache pool
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/profiles-cache.sh b/test/shell/profiles-cache.sh
index dd4affb..9e17ebf 100644
--- a/test/shell/profiles-cache.sh
+++ b/test/shell/profiles-cache.sh
@@ -13,7 +13,7 @@
# Exercise obtaining cache parameter from various sources
# Either commmand line or metadata profile or implicit default...
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
5 years, 11 months
master - lvmlockd: enable lvcreate of new LV plus existing cache pool
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c516321325f41f6b1f9...
Commit: c516321325f41f6b1f9d9342e2b0d0507b5a30fd
Parent: 27495a355536360404c8b8ee254ccaebb054debc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 15:24:24 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 15:24:24 2018 -0500
lvmlockd: enable lvcreate of new LV plus existing cache pool
In this command, lvcreate creates a new LV and then combines
it with an existing cache pool, producing a cache LV. This
command was previously not allowed in in a shared VG.
---
lib/locking/lvmlockd.c | 8 --------
lib/metadata/lv_manip.c | 14 ++++++++++++--
tools/lvcreate.c | 3 +--
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index be37dc2..0af2b38 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2454,14 +2454,6 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
lv->lock_args = NULL;
return 1;
- } else if (seg_is_cache(lp)) {
- /*
- * This should not happen because the command defs are
- * checked and excluded for shared VGs early in lvcreate.
- */
- log_error("Use lvconvert for cache with lock type %s", vg->lock_type);
- return 0;
-
} else if (!seg_is_thin_volume(lp) && lp->snapshot) {
struct logical_volume *origin_lv;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 4aefea0..c1bba03 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7801,10 +7801,20 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lv->status |= LV_TEMPORARY;
if (seg_is_cache(lp)) {
+ if (is_lockd_type(lv->vg->lock_type)) {
+ if (is_change_activating(lp->activate)) {
+ if (!lv_active_change(cmd, lv, CHANGE_AEY, 0)) {
+ log_error("Aborting. Failed to activate LV %s.",
+ display_lvname(lv));
+ goto revert_new_lv;
+ }
+ }
+ }
+
/* FIXME Support remote exclusive activation? */
/* Not yet 'cache' LV, it is stripe volume for wiping */
- if (is_change_activating(lp->activate) &&
- !activate_lv_excl_local(cmd, lv)) {
+
+ else if (is_change_activating(lp->activate) && !activate_lv_excl_local(cmd, lv)) {
log_error("Aborting. Failed to activate LV %s locally exclusively.",
display_lvname(lv));
goto revert_new_lv;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index ee6df02..7f97ebd 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -1638,8 +1638,7 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
lp->snapshot ? lp->origin_name : "", lp->segtype->name);
if (is_lockd_type(vg->lock_type)) {
- if (cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_CMD ||
- cmd->command->command_enum == lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD ||
+ if (cmd->command->command_enum == lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD ||
cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_or_convert_to_cache_vol_with_cachepool_CMD) {
log_error("Use lvconvert to create thin pools and cache pools in a shared VG.");
goto out;
5 years, 11 months
master - tests: enable vg repair tests with lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05ee83579be1f7aa110...
Commit: 05ee83579be1f7aa1107de438762d039e0424edf
Parent: 6cd052333719e4ae23bfaaa03011ed1a2f384f69
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 12:55:49 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 12:57:46 2018 -0500
tests: enable vg repair tests with lvmlockd
---
test/shell/inconsistent-metadata.sh | 4 ++--
test/shell/lvchange-partial.sh | 2 +-
test/shell/lvconvert-repair-dmeventd.sh | 2 +-
test/shell/lvconvert-repair-mirror.sh | 2 +-
test/shell/lvconvert-repair-policy.sh | 2 +-
test/shell/lvconvert-repair-raid-dmeventd.sh | 2 +-
test/shell/lvconvert-repair-replace.sh | 12 ++++++------
test/shell/lvconvert-repair-snapshot.sh | 2 +-
test/shell/lvconvert-repair-transient-dmeventd.sh | 2 +-
test/shell/lvconvert-repair-transient.sh | 2 +-
test/shell/mda-rollback.sh | 4 ++--
test/shell/unlost-pv.sh | 2 +-
test/shell/vgextend-restoremissing.sh | 2 +-
test/shell/vgreduce-removemissing-snapshot.sh | 2 +-
test/shell/vgreduce-usage.sh | 14 +++++++-------
15 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/test/shell/inconsistent-metadata.sh b/test/shell/inconsistent-metadata.sh
index 358ffcb..f5ccd13 100644
--- a/test/shell/inconsistent-metadata.sh
+++ b/test/shell/inconsistent-metadata.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
@@ -74,7 +74,7 @@ vgremove -f $vg
pvremove -ff "${DEVICES[@]}"
pvcreate "${DEVICES[@]}"
aux backup_dev "$dev2"
-vgcreate $vg "$dev1"
+vgcreate $SHARED $vg "$dev1"
vgextend $vg "$dev2"
aux restore_dev "$dev2"
vgscan $cache
diff --git a/test/shell/lvchange-partial.sh b/test/shell/lvchange-partial.sh
index 60b2b50..7913811 100644
--- a/test/shell/lvchange-partial.sh
+++ b/test/shell/lvchange-partial.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-dmeventd.sh b/test/shell/lvconvert-repair-dmeventd.sh
index b7efda2..9e0dd8c 100644
--- a/test/shell/lvconvert-repair-dmeventd.sh
+++ b/test/shell/lvconvert-repair-dmeventd.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-mirror.sh b/test/shell/lvconvert-repair-mirror.sh
index b0c199d..a37dec9 100644
--- a/test/shell/lvconvert-repair-mirror.sh
+++ b/test/shell/lvconvert-repair-mirror.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-policy.sh b/test/shell/lvconvert-repair-policy.sh
index 15d4e7c..f9fca00 100644
--- a/test/shell/lvconvert-repair-policy.sh
+++ b/test/shell/lvconvert-repair-policy.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
. lib/inittest
diff --git a/test/shell/lvconvert-repair-raid-dmeventd.sh b/test/shell/lvconvert-repair-raid-dmeventd.sh
index f08b3da..5519c4e 100644
--- a/test/shell/lvconvert-repair-raid-dmeventd.sh
+++ b/test/shell/lvconvert-repair-raid-dmeventd.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-replace.sh b/test/shell/lvconvert-repair-replace.sh
index 4a55969..1fe7965 100644
--- a/test/shell/lvconvert-repair-replace.sh
+++ b/test/shell/lvconvert-repair-replace.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
. lib/inittest
@@ -32,7 +32,7 @@ vgremove -ff $vg
# 3-way, disk log
# multiple failures, partial replace
-vgcreate $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
lvcreate -aey --mirrorlog disk --type mirror -m 2 --ignoremonitoring --nosync -L 1 -n 3way $vg "$dev1" "$dev2" "$dev3" "$dev4"
aux disable_dev "$dev1" "$dev2"
lvconvert -y --repair $vg/3way 2>&1 | tee 3way.out
@@ -43,7 +43,7 @@ check mirror $vg 3way
aux enable_dev "$dev1" "$dev2"
vgremove -ff $vg
-vgcreate $vg "$dev1" "$dev2" "$dev3"
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
lvcreate -aey --mirrorlog disk --type mirror -m 1 --ignoremonitoring --nosync -l 1 -n 2way $vg "$dev1" "$dev2" "$dev3"
aux disable_dev "$dev1"
lvconvert -y --repair $vg/2way 2>&1 | tee 2way.out
@@ -61,7 +61,7 @@ test -e LOCAL_CLVMD && exit 0
# Test repair of inactive mirror with log failure
# Replacement should fail, but convert should succeed (switch to corelog)
-vgcreate $vg "$dev1" "$dev2" "$dev3" "$dev4"
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4"
lvcreate -aey --type mirror -m 2 --ignoremonitoring -l 2 -n mirror2 $vg "$dev1" "$dev2" "$dev3" "$dev4":0
vgchange -a n $vg
pvremove -ff -y "$dev4"
@@ -73,7 +73,7 @@ vgremove -ff $vg
if aux kernel_at_least 3 0 0; then
# 2-way, mirrored log
# Double log failure, full replace
- vgcreate $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6"
+ vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6"
lvcreate -aey --mirrorlog mirrored --type mirror -m 1 --ignoremonitoring --nosync -L 1 -n 2way $vg \
"$dev1" "$dev2" "$dev3":0 "$dev4":0
aux disable_dev "$dev3" "$dev4"
@@ -88,7 +88,7 @@ fi
# 3-way, mirrored log
# Single log failure, replace
-vgcreate $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6"
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6"
lvcreate -aey --mirrorlog mirrored --type mirror -m 2 --ignoremonitoring --nosync -L 1 -n 3way $vg \
"$dev1" "$dev2" "$dev3" "$dev4":0 "$dev5":0
aux disable_dev "$dev4"
diff --git a/test/shell/lvconvert-repair-snapshot.sh b/test/shell/lvconvert-repair-snapshot.sh
index 8e66664..0e9b2a3 100644
--- a/test/shell/lvconvert-repair-snapshot.sh
+++ b/test/shell/lvconvert-repair-snapshot.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-transient-dmeventd.sh b/test/shell/lvconvert-repair-transient-dmeventd.sh
index 7b2dd3f..6679dd6 100644
--- a/test/shell/lvconvert-repair-transient-dmeventd.sh
+++ b/test/shell/lvconvert-repair-transient-dmeventd.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/lvconvert-repair-transient.sh b/test/shell/lvconvert-repair-transient.sh
index 082f7f2..aa697f9 100644
--- a/test/shell/lvconvert-repair-transient.sh
+++ b/test/shell/lvconvert-repair-transient.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/mda-rollback.sh b/test/shell/mda-rollback.sh
index 34080fa..adfc110 100644
--- a/test/shell/mda-rollback.sh
+++ b/test/shell/mda-rollback.sh
@@ -10,14 +10,14 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_devs 3
-vgcreate --metadatasize 128k $vg1 "$dev1" "$dev2" "$dev3"
+vgcreate $SHARED --metadatasize 128k $vg1 "$dev1" "$dev2" "$dev3"
vgreduce $vg1 "$dev1"
dd if="$dev1" of=badmda bs=256K count=1
diff --git a/test/shell/unlost-pv.sh b/test/shell/unlost-pv.sh
index ffc22b8..edf7f31 100644
--- a/test/shell/unlost-pv.sh
+++ b/test/shell/unlost-pv.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/vgextend-restoremissing.sh b/test/shell/vgextend-restoremissing.sh
index 969140a..afbe5ba 100644
--- a/test/shell/vgextend-restoremissing.sh
+++ b/test/shell/vgextend-restoremissing.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
diff --git a/test/shell/vgreduce-removemissing-snapshot.sh b/test/shell/vgreduce-removemissing-snapshot.sh
index 8ddb3d9..a74ff34 100644
--- a/test/shell/vgreduce-removemissing-snapshot.sh
+++ b/test/shell/vgreduce-removemissing-snapshot.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_CLVMD=1
SKIP_WITH_LVMPOLLD=1
diff --git a/test/shell/vgreduce-usage.sh b/test/shell/vgreduce-usage.sh
index e24be36..e6f10f0 100644
--- a/test/shell/vgreduce-usage.sh
+++ b/test/shell/vgreduce-usage.sh
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
+
SKIP_WITH_LVMPOLLD=1
. lib/inittest
@@ -30,18 +30,18 @@ do
pvcreate -M$mdatype "$dev1" "$dev2"
# (lvm$mdatype) vgreduce removes only the specified pv from vg (bz427382)" '
- vgcreate -M$mdatype $vg1 "$dev1" "$dev2"
+ vgcreate $SHARED -M$mdatype $vg1 "$dev1" "$dev2"
vgreduce $vg1 "$dev1"
check pv_field "$dev2" vg_name $vg1
vgremove -f $vg1
# (lvm$mdatype) vgreduce rejects removing the last pv (--all)
- vgcreate -M$mdatype $vg1 "$dev1" "$dev2"
+ vgcreate $SHARED -M$mdatype $vg1 "$dev1" "$dev2"
not vgreduce --all $vg1
vgremove -f $vg1
# (lvm$mdatype) vgreduce rejects removing the last pv
- vgcreate -M$mdatype $vg1 "$dev1" "$dev2"
+ vgcreate $SHARED -M$mdatype $vg1 "$dev1" "$dev2"
not vgreduce $vg1 "$dev1" "$dev2"
vgremove -f $vg1
@@ -55,13 +55,13 @@ pvcreate -M$mdatype "$dev1" "$dev2"
pvcreate --metadatacopies 0 -M$mdatype "$dev3" "$dev4"
# (lvm$mdatype) vgreduce rejects removing pv with the last mda copy (bz247448)
-vgcreate -M$mdatype $vg1 "$dev1" "$dev3"
+vgcreate $SHARED -M$mdatype $vg1 "$dev1" "$dev3"
not vgreduce $vg1 "$dev1"
vgremove -f $vg1
#COMM "(lvm$mdatype) vgreduce --removemissing --force repares to linear (bz221921)"
# (lvm$mdatype) setup: create mirror & damage one pv
-vgcreate -M$mdatype $vg1 "$dev1" "$dev2" "$dev3"
+vgcreate $SHARED -M$mdatype $vg1 "$dev1" "$dev2" "$dev3"
lvcreate -aey -n $lv1 --type mirror -m1 -l 4 $vg1
lvcreate -n $lv2 -l 4 $vg1 "$dev2"
lvcreate -n $lv3 -l 4 $vg1 "$dev3"
@@ -79,7 +79,7 @@ not vgs $vg1 # just double-check it's really gone
#COMM "vgreduce rejects --removemissing --mirrorsonly --force when nonmirror lv lost too"
# (lvm$mdatype) setup: create mirror + linear lvs
-vgcreate -M$mdatype "$vg1" "${DEVICES[@]}"
+vgcreate $SHARED -M$mdatype "$vg1" "${DEVICES[@]}"
lvcreate -n $lv2 -l 4 $vg1
lvcreate -aey --type mirror -m1 -n $lv1 -l 4 $vg1 "$dev1" "$dev2" "$dev3"
lvcreate -n $lv3 -l 4 $vg1 "$dev3"
5 years, 11 months
master - tests: enable pvmove-restart with lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=27495a355536360404c...
Commit: 27495a355536360404c8b8ee254ccaebb054debc
Parent: 05ee83579be1f7aa1107de438762d039e0424edf
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 13:56:06 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 13:56:06 2018 -0500
tests: enable pvmove-restart with lvmlockd
---
test/shell/pvmove-restart.sh | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index abdcd86..dcf4c37 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -12,13 +12,11 @@
# Check pvmove behavior when it's progress and machine is rebooted
-SKIP_WITH_LVMLOCKD=1
-
. lib/inittest
aux prepare_pvs 3 60
-vgcreate -s 128k $vg "$dev1" "$dev2"
+vgcreate $SHARED -s 128k $vg "$dev1" "$dev2"
pvcreate --metadatacopies 0 "$dev3"
vgextend $vg "$dev3"
@@ -94,7 +92,7 @@ LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10
aux wait_pvmove_lv_ready "$vg-pvmove0"
dmsetup table
-pvmove --abort
+pvmove --abort "$dev1"
lvs -a -o+devices $vg
5 years, 11 months
master - lvmlockd: enable repairing shared VG while reading it
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6cd052333719e4ae23b...
Commit: 6cd052333719e4ae23bfaaa03011ed1a2f384f69
Parent: 063d065388b6437b77815cb1d13a72395a46fd45
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 30 12:48:18 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 12:56:46 2018 -0500
lvmlockd: enable repairing shared VG while reading it
When the lvmlockd lock is shared, upgrade it to ex
when repair (writing) is needed during vg_read.
Pass the lockd state through additional read-related
functions so the instances of repair scattered through
vg_read can be handled.
(Temporary solution until the ad hoc repairs can be
pulled out of vg_read into a top level, centralized
repair function.)
---
daemons/clvmd/lvm-functions.c | 2 +-
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/metadata.c | 75 +++++++++++++++++++++-----------------
tools/toollib.c | 2 +-
4 files changed, 45 insertions(+), 36 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 34da66d..24ed7a0 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -832,7 +832,7 @@ void lvm_do_backup(const char *vgname)
pthread_mutex_lock(&lvm_lock);
- vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, WARN_PV_READ, &consistent);
+ vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, 0, WARN_PV_READ, &consistent);
if (vg && consistent)
check_current_backup(vg);
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 97184ed..ccf6004 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -652,7 +652,7 @@ int vg_write(struct volume_group *vg);
int vg_commit(struct volume_group *vg);
void vg_revert(struct volume_group *vg);
struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
- const char *vgid, uint32_t warn_flags, int *consistent);
+ const char *vgid, uint32_t lockd_state, uint32_t warn_flags, int *consistent);
#define get_pvs( cmd ) get_pvs_internal((cmd), NULL, NULL)
#define get_pvs_perserve_vg( cmd, pv_list, vg_list ) get_pvs_internal((cmd), (pv_list), (vg_list))
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 3f6c2e4..da66e15 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3541,7 +3541,7 @@ static int _is_foreign_vg(struct volume_group *vg)
return vg->cmd->system_id && strcmp(vg->system_id, vg->cmd->system_id);
}
-static int _repair_inconsistent_vg(struct volume_group *vg)
+static int _repair_inconsistent_vg(struct volume_group *vg, uint32_t lockd_state)
{
unsigned saved_handles_missing_pvs = vg->cmd->handles_missing_pvs;
@@ -3556,9 +3556,8 @@ static int _repair_inconsistent_vg(struct volume_group *vg)
return 0;
}
- /* FIXME: do this at higher level where lvmlockd lock can be changed. */
- if (is_lockd_type(vg->lock_type)) {
- log_verbose("Skip metadata repair for shared VG.");
+ if (is_lockd_type(vg->lock_type) && !(lockd_state & LDST_EX)) {
+ log_verbose("Skip metadata repair for shared VG without exclusive lock.");
return 0;
}
@@ -3581,7 +3580,7 @@ static int _repair_inconsistent_vg(struct volume_group *vg)
return 1;
}
-static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg, struct dm_list *to_check)
+static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg, struct dm_list *to_check, uint32_t lockd_state)
{
struct pv_list *pvl, *pvl2;
char uuid[64] __attribute__((aligned(8)));
@@ -3603,14 +3602,8 @@ static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- /*
- * FIXME: do this at higher level where lvmlockd lock can be changed.
- * Also if we're reading the VG with the --shared option (not using
- * lvmlockd), we can see a VG while it's being written by another
- * host, same as the foreign VG case.
- */
- if (is_lockd_type(vg->lock_type)) {
- log_debug_metadata("Skip wiping outdated PVs for shared VG.");
+ if (is_lockd_type(vg->lock_type) && !(lockd_state & LDST_EX)) {
+ log_verbose("Skip wiping outdated PVs for shared VG without exclusive lock.");
return 0;
}
@@ -3619,6 +3612,8 @@ static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg,
if (pvl->pv->dev == pvl2->pv->dev)
goto next_pv;
}
+
+
if (!id_write_format(&pvl->pv->id, uuid, sizeof(uuid)))
return_0;
log_warn("WARNING: Removing PV %s (%s) that no longer belongs to VG %s",
@@ -3639,6 +3634,7 @@ next_pv:
static int _check_or_repair_pv_ext(struct cmd_context *cmd,
struct volume_group *vg,
+ uint32_t lockd_state,
int repair, int *inconsistent_pvs)
{
char uuid[64] __attribute__((aligned(8)));
@@ -3688,10 +3684,7 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd,
"VG %s but not marked as used.",
pv_dev_name(pvl->pv), vg->name);
*inconsistent_pvs = 1;
- } else if (is_lockd_type(vg->lock_type)) {
- /*
- * FIXME: decide how to handle repair for shared VGs.
- */
+ } else if (is_lockd_type(vg->lock_type) && !(lockd_state & LDST_EX)) {
log_warn("Skip repair of PV %s that is in shared "
"VG %s but not marked as used.",
pv_dev_name(pvl->pv), vg->name);
@@ -3715,7 +3708,7 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd,
r = 1;
out:
- if ((pvs_fixed > 0) && !_repair_inconsistent_vg(vg))
+ if ((pvs_fixed > 0) && !_repair_inconsistent_vg(vg, lockd_state))
return_0;
return r;
@@ -3738,6 +3731,7 @@ out:
static struct volume_group *_vg_read(struct cmd_context *cmd,
const char *vgname,
const char *vgid,
+ uint32_t lockd_state,
uint32_t warn_flags,
int *consistent, unsigned precommitted)
{
@@ -3787,10 +3781,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
dm_list_iterate_items(pvl, &correct_vg->pvs)
reappeared += _check_reappeared_pv(correct_vg, pvl->pv, *consistent);
if (reappeared && *consistent)
- *consistent = _repair_inconsistent_vg(correct_vg);
+ *consistent = _repair_inconsistent_vg(correct_vg, lockd_state);
else
*consistent = !reappeared;
- if (_wipe_outdated_pvs(cmd, correct_vg, &correct_vg->pvs_outdated)) {
+ if (_wipe_outdated_pvs(cmd, correct_vg, &correct_vg->pvs_outdated, lockd_state)) {
/* clear the list */
dm_list_init(&correct_vg->pvs_outdated);
lvmetad_vg_clear_outdated_pvs(correct_vg);
@@ -4310,13 +4304,13 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
dm_list_iterate_items(pvl, &all_pvs)
_check_reappeared_pv(correct_vg, pvl->pv, 1);
- if (!_repair_inconsistent_vg(correct_vg)) {
+ if (!_repair_inconsistent_vg(correct_vg, lockd_state)) {
_free_pv_list(&all_pvs);
release_vg(correct_vg);
return NULL;
}
- if (!_wipe_outdated_pvs(cmd, correct_vg, &all_pvs)) {
+ if (!_wipe_outdated_pvs(cmd, correct_vg, &all_pvs, lockd_state)) {
_free_pv_list(&all_pvs);
release_vg(correct_vg);
return_NULL;
@@ -4340,7 +4334,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
/* We have the VG now finally, check if PV ext info is in sync with VG metadata. */
- if (!cmd->is_clvmd && !_check_or_repair_pv_ext(cmd, correct_vg,
+ if (!cmd->is_clvmd && !_check_or_repair_pv_ext(cmd, correct_vg, lockd_state,
skipped_rescan ? 0 : *consistent,
&inconsistent_pvs)) {
release_vg(correct_vg);
@@ -4502,13 +4496,15 @@ static int _check_devs_used_correspond_with_vg(struct volume_group *vg)
return 1;
}
-struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname,
- const char *vgid, uint32_t warn_flags, int *consistent)
+struct volume_group *vg_read_internal(struct cmd_context *cmd,
+ const char *vgname, const char *vgid,
+ uint32_t lockd_state, uint32_t warn_flags,
+ int *consistent)
{
struct volume_group *vg;
struct lv_list *lvl;
- if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, consistent, 0)))
+ if (!(vg = _vg_read(cmd, vgname, vgid, lockd_state, warn_flags, consistent, 0)))
goto_out;
if (!check_pv_dev_sizes(vg))
@@ -4616,7 +4612,7 @@ struct volume_group *vg_read_by_vgid(struct cmd_context *cmd,
label_scan_setup_bcache();
- if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted))) {
+ if (!(vg = _vg_read(cmd, vgname, vgid, 0, warn_flags, &consistent, precommitted))) {
log_error("Rescan devices to look for missing VG.");
goto scan;
}
@@ -4637,7 +4633,7 @@ struct volume_group *vg_read_by_vgid(struct cmd_context *cmd,
lvmcache_label_scan(cmd);
warn_flags |= SKIP_RESCAN;
- if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted)))
+ if (!(vg = _vg_read(cmd, vgname, vgid, 0, warn_flags, &consistent, precommitted)))
goto fail;
label_scan_destroy(cmd); /* drop bcache to close devs, keep lvmcache */
@@ -4876,7 +4872,7 @@ static int _get_pvs(struct cmd_context *cmd, uint32_t warn_flags,
warn_flags |= WARN_INCONSISTENT;
- if (!(vg = vg_read_internal(cmd, vgname, (!vgslist) ? vgid : NULL, warn_flags, &consistent))) {
+ if (!(vg = vg_read_internal(cmd, vgname, (!vgslist) ? vgid : NULL, 0, warn_flags, &consistent))) {
stack;
continue;
}
@@ -5189,17 +5185,30 @@ int vg_check_status(const struct volume_group *vg, uint64_t status)
* VG is left unlocked on failure
*/
static struct volume_group *_recover_vg(struct cmd_context *cmd,
- const char *vg_name, const char *vgid)
+ const char *vg_name, const char *vgid, uint32_t lockd_state)
{
int consistent = 1;
struct volume_group *vg;
+ uint32_t state = 0;
unlock_vg(cmd, NULL, vg_name);
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL))
return_NULL;
- if (!(vg = vg_read_internal(cmd, vg_name, vgid, WARN_PV_READ, &consistent))) {
+ /*
+ * Convert vg lock in lvmlockd from sh to ex.
+ */
+ if (!(lockd_state & LDST_FAIL) && !(lockd_state & LDST_EX)) {
+ log_debug("Upgrade lvmlockd lock to repair vg %s.", vg_name);
+ if (!lockd_vg(cmd, vg_name, "ex", 0, &state)) {
+ log_warn("Skip repair for shared VG without exclusive lock.");
+ return NULL;
+ }
+ lockd_state |= LDST_EX;
+ }
+
+ if (!(vg = vg_read_internal(cmd, vg_name, vgid, lockd_state, WARN_PV_READ, &consistent))) {
unlock_vg(cmd, NULL, vg_name);
return_NULL;
}
@@ -5473,7 +5482,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
warn_flags |= WARN_INCONSISTENT;
/* If consistent == 1, we get NULL here if correction fails. */
- if (!(vg = vg_read_internal(cmd, vg_name, vgid, warn_flags, &consistent))) {
+ if (!(vg = vg_read_internal(cmd, vg_name, vgid, lockd_state, warn_flags, &consistent))) {
if (consistent_in && !consistent) {
failure |= FAILED_INCONSISTENT;
goto bad;
@@ -5490,7 +5499,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
/* consistent == 0 when VG is not found, but failed == FAILED_NOTFOUND */
if (!consistent && !failure) {
release_vg(vg);
- if (!(vg = _recover_vg(cmd, vg_name, vgid))) {
+ if (!(vg = _recover_vg(cmd, vg_name, vgid, lockd_state))) {
if (is_orphan_vg(vg_name))
log_error("Recovery of standalone physical volumes failed.");
else
diff --git a/tools/toollib.c b/tools/toollib.c
index 0fc86cf..19f4c33 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5730,7 +5730,7 @@ do_command:
if (pp->preserve_existing && pp->orphan_vg_name) {
log_debug("Using existing orphan PVs in %s.", pp->orphan_vg_name);
- if (!(orphan_vg = vg_read_internal(cmd, pp->orphan_vg_name, NULL, 0, &consistent))) {
+ if (!(orphan_vg = vg_read_internal(cmd, pp->orphan_vg_name, NULL, 0, 0, &consistent))) {
log_error("Cannot read orphans VG %s.", pp->orphan_vg_name);
goto bad;
}
5 years, 11 months
master - tests: add missing file
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=063d065388b6437b778...
Commit: 063d065388b6437b77815cb1d13a72395a46fd45
Parent: abba06fb3b3b813e55ab7f27c6ac8274115083e4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 25 17:02:25 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 09:25:45 2018 -0500
tests: add missing file
---
test/lib/flavour-udev-lvmlockd-test-lvmetad.sh | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/test/lib/flavour-udev-lvmlockd-test-lvmetad.sh b/test/lib/flavour-udev-lvmlockd-test-lvmetad.sh
new file mode 100644
index 0000000..d2a7b4a
--- /dev/null
+++ b/test/lib/flavour-udev-lvmlockd-test-lvmetad.sh
@@ -0,0 +1,9 @@
+export LVM_TEST_LOCKING=1
+export LVM_TEST_LVMETAD=1
+export LVM_TEST_LVMPOLLD=1
+export LVM_TEST_LVMLOCKD=1
+export LVM_TEST_LVMLOCKD_TEST=1
+export LVM_TEST_DEVDIR=/dev
+
+# FIXME:dct: add option to allow --test with sanlock
+export LVM_TEST_LVMLOCKD_TEST_DLM=1
5 years, 11 months
master - tests: process-each-duplicate-pvs update for lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=abba06fb3b3b813e55a...
Commit: abba06fb3b3b813e55ab7f27c6ac8274115083e4
Parent: 3759a1f62bf314fbe2f25b2365c1aebca8071e31
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 25 15:59:17 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 09:25:45 2018 -0500
tests: process-each-duplicate-pvs update for lvmlockd
---
test/shell/process-each-duplicate-pvs.sh | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/test/shell/process-each-duplicate-pvs.sh b/test/shell/process-each-duplicate-pvs.sh
index 9ce4e14..b8a8774 100644
--- a/test/shell/process-each-duplicate-pvs.sh
+++ b/test/shell/process-each-duplicate-pvs.sh
@@ -8,7 +8,6 @@
test_description='Test duplicate PVs'
-SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
SKIP_WITH_CLVMD=1
@@ -25,8 +24,8 @@ aux lvmconf 'devices/allow_changes_with_duplicate_pvs = 0'
pvcreate "$dev1"
pvcreate "$dev2"
-vgcreate $vg1 "$dev1"
-vgcreate $vg2 "$dev2"
+vgcreate $SHARED $vg1 "$dev1"
+vgcreate $SHARED $vg2 "$dev2"
pvresize --setphysicalvolumesize 8m -y "$dev2"
lvcreate -an -l1 -n $lv1 $vg1
@@ -378,7 +377,16 @@ dd if=/dev/zero of="$dev3" bs=1M oflag=direct,sync || true
dd if=/dev/zero of="$dev4" bs=1M oflag=direct,sync || true
pvscan --cache
-vgcreate "$vg2" "$dev3" "$dev4"
+# The previous steps prevent us from nicely cleaning up
+# the vg lockspace in lvmlockd, so just restart it;
+# what follows could also just be split into a separate test.
+if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then
+ killall -9 lvmlockd
+ sleep 2
+ aux prepare_lvmlockd
+fi
+
+vgcreate $SHARED "$vg2" "$dev3" "$dev4"
lvcreate -l1 -n $lv1 $vg2 "$dev3"
lvcreate -l1 -n $lv2 $vg2 "$dev4"
@@ -457,7 +465,7 @@ pvscan --cache
# Reverse devs in the previous in case dev3/dev4 would be
# preferred even without an active LV using them.
-vgcreate $vg2 "$dev5" "$dev6"
+vgcreate $SHARED $vg2 "$dev5" "$dev6"
lvcreate -l1 -n $lv1 $vg2 "$dev5"
lvcreate -l1 -n $lv2 $vg2 "$dev6"
5 years, 11 months
master - pvremove: skip lvmlockd locks for forced clearing
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3759a1f62bf314fbe2f...
Commit: 3759a1f62bf314fbe2f25b2365c1aebca8071e31
Parent: 5c5e449dc5f955481f9409ff0e7ed39cf7b2e87d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 25 15:57:17 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 09:25:45 2018 -0500
pvremove: skip lvmlockd locks for forced clearing
pvremove -ff to force clear a PV shouldn't care if
lvmlockd locks fail.
---
tools/pvremove.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/pvremove.c b/tools/pvremove.c
index 28c7b83..06a7e73 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -39,10 +39,19 @@ int pvremove(struct cmd_context *cmd, int argc, char **argv)
* (disable afterward to prevent process_each_pv from doing
* a shared global lock since it's already acquired it ex.)
*/
- if (!lockd_gl(cmd, "ex", 0))
- return_ECMD_FAILED;
+ if (!lockd_gl(cmd, "ex", 0)) {
+ /* Let pvremove -ff skip locks */
+ if (pp.force == DONT_PROMPT_OVERRIDE)
+ log_warn("WARNING: skipping global lock in lvmlockd for force.");
+ else
+ return_ECMD_FAILED;
+ }
cmd->lockd_gl_disable = 1;
+ /* When forcibly clearing a PV we don't care about a VG lock. */
+ if (pp.force == DONT_PROMPT_OVERRIDE)
+ cmd->lockd_vg_disable = 1;
+
if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle.");
return ECMD_FAILED;
5 years, 11 months
master - lvmlockd: fix vgimportclone of a shared VG
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5c5e449dc5f955481f9...
Commit: 5c5e449dc5f955481f9409ff0e7ed39cf7b2e87d
Parent: a40d447a02521820c23422fdd43f795c32d402a7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 25 15:26:30 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 30 09:25:45 2018 -0500
lvmlockd: fix vgimportclone of a shared VG
The new VG from the duplicate PV is imported
as a local VG.
---
test/shell/vgimportclone.sh | 5 ++---
tools/vgimportclone.c | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index f97c6df..48a666e 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -10,14 +10,13 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_devs 2
-vgcreate --metadatasize 128k $vg1 "$dev1"
+vgcreate $SHARED --metadatasize 128k $vg1 "$dev1"
lvcreate -l100%FREE -n $lv1 $vg1
# Test plain vgexport vgimport tools
@@ -76,7 +75,7 @@ vgremove -ff $vg1 $vg2
# Verify that if we provide the -n|--basevgname,
# the number suffix is not added unnecessarily.
-vgcreate --metadatasize 128k A${vg1}B "$dev1"
+vgcreate $SHARED --metadatasize 128k A${vg1}B "$dev1"
# vg1B is not the same as Avg1B - we don't need number suffix
dd if="$dev1" of="$dev2" bs=256K count=1
diff --git a/tools/vgimportclone.c b/tools/vgimportclone.c
index 224d0b5..c4c5d4c 100644
--- a/tools/vgimportclone.c
+++ b/tools/vgimportclone.c
@@ -153,6 +153,11 @@ static int _vgimportclone_vg_single(struct cmd_context *cmd, const char *vg_name
if (!(vg->name = dm_pool_strdup(vg->vgmem, vp->new_vgname)))
goto_bad;
+ /* A duplicate of a shared VG is imported as a new local VG. */
+ vg->lock_type = NULL;
+ vg->lock_args = NULL;
+ vg->system_id = cmd->system_id ? dm_pool_strdup(vg->vgmem, cmd->system_id) : NULL;
+
dm_list_iterate_items(pvl, &vg->pvs) {
if (!(new_pvl = dm_pool_zalloc(vg->vgmem, sizeof(*new_pvl))))
goto_bad;
@@ -174,8 +179,10 @@ static int _vgimportclone_vg_single(struct cmd_context *cmd, const char *vg_name
dm_list_add(&vg->pv_write_list, &new_pvl->list);
}
- dm_list_iterate_items(lvl, &vg->lvs)
+ dm_list_iterate_items(lvl, &vg->lvs) {
memcpy(&lvl->lv->lvid, &vg->id, sizeof(vg->id));
+ lvl->lv->lock_args = NULL;
+ }
if (!vg_write(vg) || !vg_commit(vg))
goto_bad;
@@ -343,6 +350,12 @@ retry_name:
goto out;
}
+ /*
+ * Trying to lock the duplicated VG would conflict with the original,
+ * and it's not needed because the new VG will be imported as a local VG.
+ */
+ cmd->lockd_vg_disable = 1;
+
ret = process_each_vg(cmd, 0, NULL, vp.old_vgname, NULL, READ_FOR_UPDATE | READ_ALLOW_EXPORTED, 0, handle, _vgimportclone_vg_single);
unlock_vg(cmd, NULL, vp.new_vgname);
5 years, 11 months