master - Revert "lvconvert: preserve region size on raid1 image count changes"
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=af47ec9f515402e6932...
Commit: af47ec9f515402e69328fb73a73172845ff05b2f
Parent: 813bcb24f0cfd664e539d4508ab3586c9b927ab3
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 27 15:29:03 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 27 15:29:03 2017 +0200
Revert "lvconvert: preserve region size on raid1 image count changes"
This reverts commit 8333d5a969042a321f00656271bd55a37c1ea179.
---
WHATS_NEW | 3 +--
tools/lvconvert.c | 11 +++--------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f8efd87..199b1dc 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,8 +1,7 @@
Version 2.02.171 -
==================================
Adjust pvresize messages and add prompt if underlying dev size differs.
- lvconvert - preserve region size on raid1 image count changes
- raid - sanely handle insufficient space on takeover
+ raid - sanely handle insufficient space on takeover.
Fix configure --enable-notify-dbus status message.
Change configure option name prefix from --enable-lockd to --enable-lvmlockd.
lvcreate - raise mirror/raid default regionsize to 2MiB
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 22555f3..04201d0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -60,7 +60,6 @@ struct lvconvert_params {
int need_polling;
uint32_t region_size;
- unsigned region_size_supplied;
uint32_t mirrors;
sign_t mirrors_sign;
@@ -248,13 +247,10 @@ static int _read_params(struct cmd_context *cmd, struct lvconvert_params *lp)
return 0;
}
- if (arg_is_set(cmd, regionsize_ARG)) {
+ if (arg_is_set(cmd, regionsize_ARG))
lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0);
- lp->region_size_supplied = 1;
- } else {
+ else
lp->region_size = get_default_region_size(cmd);
- lp->region_size_supplied = 0;
- }
/* FIXME man page says in one place that --type and --mirrors can't be mixed */
if (lp->mirrors_supplied && !lp->mirrors)
@@ -1364,8 +1360,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
DEFAULT_RAID1_MAX_IMAGES, lp->segtype->name, display_lvname(lv));
return 0;
}
- if (!lv_raid_change_image_count(lv, lp->yes, image_count,
- lp->region_size_supplied ? lp->region_size : seg->region_size , lp->pvh))
+ if (!lv_raid_change_image_count(lv, lp->yes, image_count, lp->region_size, lp->pvh))
return_0;
log_print_unless_silent("Logical volume %s successfully converted.",
6 years, 12 months
master - test: Add -y to pvresize --setphysicalvolumesize
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=813bcb24f0cfd664e53...
Commit: 813bcb24f0cfd664e539d4508ab3586c9b927ab3
Parent: cbc69f8c693edf0d1307c9447e2e66d07a04bfe9
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 27 02:57:59 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 27 02:57:59 2017 +0100
test: Add -y to pvresize --setphysicalvolumesize
---
test/shell/covercmd.sh | 6 +-
test/shell/process-each-duplicate-pvs.sh | 4 +-
test/shell/process-each-pvresize.sh | 138 +++++++++++++++---------------
test/shell/pvresize-mdas.sh | 2 +-
4 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/test/shell/covercmd.sh b/test/shell/covercmd.sh
index 69ff8d6..00b1781 100644
--- a/test/shell/covercmd.sh
+++ b/test/shell/covercmd.sh
@@ -58,10 +58,10 @@ vgremove -f $vg
# missing params
not pvresize
# negative size
-not pvresize --setphysicalvolumesize -10M "$dev1"
+not pvresize --setphysicalvolumesize -10M -y "$dev1"
# not existing device
-not pvresize --setphysicalvolumesize 10M "$dev7"
-pvresize --setphysicalvolumesize 10M "$dev1"
+not pvresize --setphysicalvolumesize 10M -y "$dev7"
+pvresize --setphysicalvolumesize 10M -y "$dev1"
pvresize "$dev1"
diff --git a/test/shell/process-each-duplicate-pvs.sh b/test/shell/process-each-duplicate-pvs.sh
index 9ab98dc..270fc52 100644
--- a/test/shell/process-each-duplicate-pvs.sh
+++ b/test/shell/process-each-duplicate-pvs.sh
@@ -26,7 +26,7 @@ pvcreate "$dev1"
pvcreate "$dev2"
vgcreate $vg1 "$dev1"
vgcreate $vg2 "$dev2"
-pvresize --setphysicalvolumesize 8m "$dev2"
+pvresize --setphysicalvolumesize 8m -y "$dev2"
lvcreate -an -l1 -n $lv1 $vg1
# Both devs are shown and used by the VG
@@ -275,7 +275,7 @@ pvremove -ff -y "$dev2"
pvcreate "$dev3"
pvcreate "$dev4"
-pvresize --setphysicalvolumesize 8m "$dev4"
+pvresize --setphysicalvolumesize 8m -y "$dev4"
UUID3=$(pvs --noheadings -o uuid $dev3 | xargs)
UUID4=$(pvs --noheadings -o uuid $dev4 | xargs)
diff --git a/test/shell/process-each-pvresize.sh b/test/shell/process-each-pvresize.sh
index 86c2a7d..e1e4af3 100644
--- a/test/shell/process-each-pvresize.sh
+++ b/test/shell/process-each-pvresize.sh
@@ -78,7 +78,7 @@ old_reduced="28.00m"
new_request="20.00m"
new_reduced="16.00m"
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
check pv_field "$dev10" pv_size $old_reduced
check pv_field "$dev2" pv_size $old_reduced
check pv_field "$dev3" pv_size $old_reduced
@@ -90,7 +90,7 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# one pv
-pvresize --setphysicalvolumesize $new_request "$dev10"
+pvresize --setphysicalvolumesize $new_request -y "$dev10"
check pv_field "$dev10" pv_size $new_reduced
# unchanged
check pv_field "$dev2" pv_size $old_reduced
@@ -102,10 +102,10 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# two pvs in separate vgs
-pvresize --setphysicalvolumesize $new_request "$dev2" "$dev6"
+pvresize --setphysicalvolumesize $new_request -y "$dev2" "$dev6"
check pv_field "$dev2" pv_size $new_reduced
check pv_field "$dev6" pv_size $new_reduced
# unchanged
@@ -117,10 +117,10 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# one tag on one pv
-pvresize --setphysicalvolumesize $new_request @V2D4
+pvresize --setphysicalvolumesize $new_request -y @V2D4
check pv_field "$dev4" pv_size $new_reduced
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -132,10 +132,10 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# one tag on all pvs in one vg
-pvresize --setphysicalvolumesize $new_request @V3
+pvresize --setphysicalvolumesize $new_request -y @V3
check pv_field "$dev6" pv_size $new_reduced
check pv_field "$dev7" pv_size $new_reduced
check pv_field "$dev8" pv_size $new_reduced
@@ -147,10 +147,10 @@ check pv_field "$dev3" pv_size $old_reduced
check pv_field "$dev4" pv_size $old_reduced
check pv_field "$dev5" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# one tag on some pvs in one vg
-pvresize --setphysicalvolumesize $new_request @V2D45
+pvresize --setphysicalvolumesize $new_request -y @V2D45
check pv_field "$dev4" pv_size $new_reduced
check pv_field "$dev5" pv_size $new_reduced
# unchanged
@@ -162,11 +162,11 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# one tag on multiple pvs in separate vgs
pvchange --addtag V12 "$dev10" "$dev2" "$dev3" "$dev4" "$dev5"
-pvresize --setphysicalvolumesize $new_request @V12
+pvresize --setphysicalvolumesize $new_request -y @V12
check pv_field "$dev10" pv_size $new_reduced
check pv_field "$dev2" pv_size $new_reduced
check pv_field "$dev3" pv_size $new_reduced
@@ -178,10 +178,10 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# one pv and one tag on different pv
-pvresize --setphysicalvolumesize $new_request "$dev10" @V3D9
+pvresize --setphysicalvolumesize $new_request -y "$dev10" @V3D9
check pv_field "$dev10" pv_size $new_reduced
check pv_field "$dev9" pv_size $new_reduced
# unchanged
@@ -193,10 +193,10 @@ check pv_field "$dev6" pv_size $old_reduced
check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# redundant pv and tag
-pvresize --setphysicalvolumesize $new_request "$dev9" @V3D9
+pvresize --setphysicalvolumesize $new_request -y "$dev9" @V3D9
check pv_field "$dev9" pv_size $new_reduced
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -208,10 +208,10 @@ check pv_field "$dev6" pv_size $old_reduced
check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
# two tags on pvs in separate vgs
-pvresize --setphysicalvolumesize $new_request @V3D9 @V2D3
+pvresize --setphysicalvolumesize $new_request -y @V3D9 @V2D3
check pv_field "$dev9" pv_size $new_reduced
check pv_field "$dev3" pv_size $new_reduced
# unchanged
@@ -223,7 +223,7 @@ check pv_field "$dev6" pv_size $old_reduced
check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
#
@@ -237,8 +237,8 @@ new_request="20.00m"
new_reduced="16.00m"
new_orphan="20.00m"
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
check pv_field "$dev10" pv_size $old_reduced
check pv_field "$dev2" pv_size $old_reduced
check pv_field "$dev3" pv_size $old_reduced
@@ -252,7 +252,7 @@ check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# one orphan
-pvresize --setphysicalvolumesize $new_request "$dev11"
+pvresize --setphysicalvolumesize $new_request -y "$dev11"
check pv_field "$dev11" pv_size $new_orphan
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -266,11 +266,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# two orphans
-pvresize --setphysicalvolumesize $new_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $new_request -y "$dev11" "$dev14"
check pv_field "$dev11" pv_size $new_orphan
check pv_field "$dev14" pv_size $new_orphan
# unchanged
@@ -284,11 +284,11 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one orphan, one tag
-pvresize --setphysicalvolumesize $new_request @V3D9 "$dev14"
+pvresize --setphysicalvolumesize $new_request -y @V3D9 "$dev14"
check pv_field "$dev9" pv_size $new_reduced
check pv_field "$dev14" pv_size $new_orphan
# unchanged
@@ -302,11 +302,11 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one pv, one orphan, one tag
-pvresize --setphysicalvolumesize $new_request @V3D9 "$dev14" "$dev10"
+pvresize --setphysicalvolumesize $new_request -y @V3D9 "$dev14" "$dev10"
check pv_field "$dev9" pv_size $new_reduced
check pv_field "$dev10" pv_size $new_reduced
check pv_field "$dev14" pv_size $new_orphan
@@ -320,8 +320,8 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
#
@@ -329,7 +329,7 @@ pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
#
# one dev (non-pv)
-not pvresize --setphysicalvolumesize $new_request "$dev13"
+not pvresize --setphysicalvolumesize $new_request -y "$dev13"
# unchanged
check pv_field "$dev10" pv_size $old_reduced
check pv_field "$dev2" pv_size $old_reduced
@@ -344,7 +344,7 @@ check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# one orphan and one dev (non-pv)
-not pvresize --setphysicalvolumesize $new_request "$dev14" "$dev13"
+not pvresize --setphysicalvolumesize $new_request -y "$dev14" "$dev13"
check pv_field "$dev14" pv_size $new_orphan
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -358,11 +358,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one pv and one dev (non-pv)
-not pvresize --setphysicalvolumesize $new_request "$dev9" "$dev13"
+not pvresize --setphysicalvolumesize $new_request -y "$dev9" "$dev13"
check pv_field "$dev9" pv_size $new_reduced
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -376,11 +376,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one tag and one dev (non-pv)
-not pvresize --setphysicalvolumesize $new_request @V3D9 "$dev13"
+not pvresize --setphysicalvolumesize $new_request -y @V3D9 "$dev13"
check pv_field "$dev9" pv_size $new_reduced
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -394,11 +394,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one pv, one orphan, one tag, one dev
-not pvresize --setphysicalvolumesize $new_request @V3D9 "$dev13" "$dev14" "$dev10"
+not pvresize --setphysicalvolumesize $new_request -y @V3D9 "$dev13" "$dev14" "$dev10"
check pv_field "$dev9" pv_size $new_reduced
check pv_field "$dev10" pv_size $new_reduced
check pv_field "$dev14" pv_size $new_orphan
@@ -412,16 +412,16 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
#
# pvresize including pvs without mdas
#
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
check pv_field "$dev10" pv_size $old_reduced
check pv_field "$dev2" pv_size $old_reduced
check pv_field "$dev3" pv_size $old_reduced
@@ -435,7 +435,7 @@ check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# one pv without mda
-pvresize --setphysicalvolumesize $new_request "$dev2"
+pvresize --setphysicalvolumesize $new_request -y "$dev2"
check pv_field "$dev2" pv_size $new_reduced
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -449,11 +449,11 @@ check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# two pvs without mdas
-pvresize --setphysicalvolumesize $new_request "$dev6" "$dev7"
+pvresize --setphysicalvolumesize $new_request -y "$dev6" "$dev7"
check pv_field "$dev6" pv_size $new_reduced
check pv_field "$dev7" pv_size $new_reduced
# unchanged
@@ -467,11 +467,11 @@ check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one pv with mda and one pv without mda
-pvresize --setphysicalvolumesize $new_request "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $new_request -y "$dev8" "$dev9"
check pv_field "$dev8" pv_size $new_reduced
check pv_field "$dev9" pv_size $new_reduced
# unchanged
@@ -485,11 +485,11 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one orphan with mda
-pvresize --setphysicalvolumesize $new_request "$dev11"
+pvresize --setphysicalvolumesize $new_request -y "$dev11"
check pv_field "$dev11" pv_size $new_orphan
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -503,11 +503,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev14" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one orphan without mda
-pvresize --setphysicalvolumesize $new_request "$dev14"
+pvresize --setphysicalvolumesize $new_request -y "$dev14"
check pv_field "$dev14" pv_size $new_orphan
# unchanged
check pv_field "$dev10" pv_size $old_reduced
@@ -521,11 +521,11 @@ check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
check pv_field "$dev11" pv_size $old_orphan
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one orphan with mda and one orphan without mda
-pvresize --setphysicalvolumesize $new_request "$dev14" "$dev11"
+pvresize --setphysicalvolumesize $new_request -y "$dev14" "$dev11"
check pv_field "$dev11" pv_size $new_orphan
check pv_field "$dev14" pv_size $new_orphan
# unchanged
@@ -539,12 +539,12 @@ check pv_field "$dev7" pv_size $old_reduced
check pv_field "$dev8" pv_size $old_reduced
check pv_field "$dev9" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
# one pv with mda and one pv without mda, and
# one orphan with mda and one orphan without mda
-pvresize --setphysicalvolumesize $new_request "$dev8" "$dev9" "$dev14" "$dev11"
+pvresize --setphysicalvolumesize $new_request -y "$dev8" "$dev9" "$dev14" "$dev11"
check pv_field "$dev8" pv_size $new_reduced
check pv_field "$dev9" pv_size $new_reduced
check pv_field "$dev11" pv_size $new_orphan
@@ -558,5 +558,5 @@ check pv_field "$dev5" pv_size $old_reduced
check pv_field "$dev6" pv_size $old_reduced
check pv_field "$dev7" pv_size $old_reduced
# reset back to old size
-pvresize --setphysicalvolumesize $old_request "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
-pvresize --setphysicalvolumesize $old_request "$dev11" "$dev14"
+pvresize --setphysicalvolumesize $old_request -y "$dev10" "$dev2" "$dev3" "$dev4" "$dev5" "$dev6" "$dev7" "$dev8" "$dev9"
+pvresize --setphysicalvolumesize $old_request -y "$dev11" "$dev14"
diff --git a/test/shell/pvresize-mdas.sh b/test/shell/pvresize-mdas.sh
index f7fdfc2..c2571f1 100644
--- a/test/shell/pvresize-mdas.sh
+++ b/test/shell/pvresize-mdas.sh
@@ -21,7 +21,7 @@ check pv_field "$dev1" pv_size 8.00m
check pv_field "$dev1" pv_mda_count 2
pvs "$dev1"
-pvresize --setphysicalvolumesize 4m "$dev1"
+pvresize --setphysicalvolumesize 4m -y "$dev1"
check pv_field "$dev1" pv_size 4.00m
check pv_field "$dev1" pv_mda_count 2
pvs "$dev1"
6 years, 12 months
master - pvresize: Prompt when non-default size supplied.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cbc69f8c693edf0d130...
Commit: cbc69f8c693edf0d1307c9447e2e66d07a04bfe9
Parent: 78a0b4a08a7178250b9d0b3be7f975440975d9d4
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 27 02:36:34 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 27 02:36:34 2017 +0100
pvresize: Prompt when non-default size supplied.
Seek confirmation before changing the PV size to one that differs
from the underlying block device.
---
WHATS_NEW | 1 +
lib/metadata/metadata-exported.h | 3 ++-
lib/metadata/pv_manip.c | 30 +++++++++++++++++++++++-------
liblvm/lvm_pv.c | 2 +-
tools/pvresize.c | 2 +-
5 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index efcddd5..f8efd87 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.171 -
==================================
+ Adjust pvresize messages and add prompt if underlying dev size differs.
lvconvert - preserve region size on raid1 image count changes
raid - sanely handle insufficient space on takeover
Fix configure --enable-notify-dbus status message.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 8e03e20..8b4310b 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -748,7 +748,8 @@ int pvremove_many(struct cmd_context *cmd, struct dm_list *pv_names,
int pv_resize_single(struct cmd_context *cmd,
struct volume_group *vg,
struct physical_volume *pv,
- const uint64_t new_size);
+ const uint64_t new_size,
+ int yes);
int pv_analyze(struct cmd_context *cmd, const char *pv_name,
uint64_t label_sector);
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index 5689a11..6ee4828 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -604,7 +604,7 @@ static int pv_resize(struct physical_volume *pv,
log_verbose("Resizing physical volume %s from %" PRIu32
" to %" PRIu32 " extents.",
- pv_dev_name(pv), pv->pe_count, new_pe_count);
+ pv_dev_name(pv), old_pe_count, new_pe_count);
if (new_pe_count > old_pe_count)
return _extend_pv(pv, vg, old_pe_count, new_pe_count);
@@ -618,7 +618,8 @@ static int pv_resize(struct physical_volume *pv,
int pv_resize_single(struct cmd_context *cmd,
struct volume_group *vg,
struct physical_volume *pv,
- const uint64_t new_size)
+ const uint64_t new_size,
+ int yes)
{
uint64_t size = 0;
int r = 0;
@@ -642,11 +643,26 @@ int pv_resize_single(struct cmd_context *cmd,
}
if (new_size) {
- if (new_size > size)
- log_warn("WARNING: %s: Overriding real size. "
- "You could lose data.", pv_name);
- log_verbose("%s: Pretending size is %" PRIu64 " not %" PRIu64
- " sectors.", pv_name, new_size, pv_size(pv));
+ if (new_size > size) {
+ log_warn("WARNING: %s: Overriding real size %s. You could lose data.",
+ pv_name, display_size(cmd, (uint64_t) size));
+ if (!yes && yes_no_prompt("%s: Requested size %s exceeds real size %s. Proceed? [y/n]: ",
+ pv_name, display_size(cmd, (uint64_t) new_size),
+ display_size(cmd, (uint64_t) size)) == 'n')
+ goto_out;
+
+ } else if (new_size < size)
+ if (!yes && yes_no_prompt("%s: Requested size %s is less than real size %s. Proceed? [y/n]: ",
+ pv_name, display_size(cmd, (uint64_t) new_size),
+ display_size(cmd, (uint64_t) size)) == 'n')
+ goto_out;
+
+ if (new_size == size)
+ log_verbose("%s: Size is already %s (%" PRIu64 " sectors).",
+ pv_name, display_size(cmd, (uint64_t) new_size), new_size);
+ else
+ log_warn("WARNING: %s: Pretending size is %" PRIu64 " not %" PRIu64 " sectors.",
+ pv_name, new_size, size);
size = new_size;
}
diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c
index 3dd8433..26e3cf1 100644
--- a/liblvm/lvm_pv.c
+++ b/liblvm/lvm_pv.c
@@ -312,7 +312,7 @@ static int _lvm_pv_resize(const pv_t pv, uint64_t new_size)
if (!vg_check_write_mode(pv->vg))
return -1;
- if (!pv_resize_single(pv->vg->cmd, pv->vg, pv, size)) {
+ if (!pv_resize_single(pv->vg->cmd, pv->vg, pv, size, 1)) {
log_error("PV re-size failed!");
return -1;
}
diff --git a/tools/pvresize.c b/tools/pvresize.c
index ddff520..1de1709 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -52,7 +52,7 @@ static int _pvresize_single(struct cmd_context *cmd,
cmd->lockd_gl_disable = 1;
}
- if (!pv_resize_single(cmd, vg, pv, params->new_size))
+ if (!pv_resize_single(cmd, vg, pv, params->new_size, arg_is_set(cmd, yes_ARG)))
return_ECMD_FAILED;
params->done++;
6 years, 12 months
master - typo: s/extends/extents/ in lvmthin man page
by Jonathan Brassow
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=78a0b4a08a7178250b9...
Commit: 78a0b4a08a7178250b9d0b3be7f975440975d9d4
Parent: 0f31f10ac5881b2780b0083f5e45fed59aeb8013
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Apr 26 15:49:28 2017 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Apr 26 15:49:28 2017 -0500
typo: s/extends/extents/ in lvmthin man page
bug 1439905
---
man/lvmthin.7_main | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/lvmthin.7_main b/man/lvmthin.7_main
index a6c8123..c5efa9c 100644
--- a/man/lvmthin.7_main
+++ b/man/lvmthin.7_main
@@ -1016,7 +1016,7 @@ Possible discard behaviors:
ignore: Ignore any discards that are received.
nopassdown: Process any discards in the thin pool itself and allow
-the no longer needed extends to be overwritten by new data.
+the no longer needed extents to be overwritten by new data.
passdown: Process discards in the thin pool (as with nopassdown), and
pass the discards down the the underlying device. This is the default
6 years, 12 months
master - lvmdbusd: Improve error msg to include PV
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0f31f10ac5881b2780b...
Commit: 0f31f10ac5881b2780b0083f5e45fed59aeb8013
Parent: e50fb06792518ff9a5a299172b77e9d22105d372
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Sat Apr 22 00:07:52 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Apr 26 07:31:08 2017 -0500
lvmdbusd: Improve error msg to include PV
Include PV device path when we believe it already exists.
---
daemons/lvmdbusd/manager.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmdbusd/manager.py b/daemons/lvmdbusd/manager.py
index 5bcdbb8..1ae9c8b 100644
--- a/daemons/lvmdbusd/manager.py
+++ b/daemons/lvmdbusd/manager.py
@@ -48,7 +48,7 @@ class Manager(AutomatedProperties):
pv = cfg.om.get_object_path_by_uuid_lvm_id(device, device)
if pv:
raise dbus.exceptions.DBusException(
- MANAGER_INTERFACE, "PV Already exists!")
+ MANAGER_INTERFACE, "PV %s Already exists!" % device)
rc, out, err = cmdhandler.pv_create(create_options, [device])
Manager.handle_execute(rc, out, err)
6 years, 12 months
master - lvmdbustest.py: Add nested testing
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e50fb06792518ff9a5a...
Commit: e50fb06792518ff9a5a299172b77e9d22105d372
Parent: 6de3a9b4d060d65f4ecf9a20adc0665b301ec14e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Sat Apr 22 00:06:59 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Apr 26 07:30:45 2017 -0500
lvmdbustest.py: Add nested testing
Make sure when a LV is used as a PV the dbus service works correctly.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
test/dbus/lvmdbustest.py | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d88a774..50f6ad4 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -75,7 +75,7 @@ def is_nested_pv(pv_name):
def _root_pv_name(res, pv_name):
if not is_nested_pv(pv_name):
return pv_name
- vg_name = pv_name.split('/')[2:3][0]
+ vg_name = pv_name.split('/')[2]
for v in res[VG_INT]:
if v.Vg.Name == vg_name:
pv = ClientProxy(bus, v.Vg.Pvs[0], interfaces=(PV_INT, ))
@@ -120,7 +120,7 @@ def get_objects():
for object_path, v in objects.items():
proxy = ClientProxy(bus, object_path, v)
- for interface, prop in v.items():
+ for interface in v.keys():
rc[interface].append(proxy)
# At this point we have a full population of everything, we now need to
@@ -1832,6 +1832,39 @@ class TestDbusService(unittest.TestCase):
cmd = ['pvcreate', target.Pv.Name]
self._verify_existence(cmd, cmd[0], target.Pv.Name)
+ def _create_nested(self, pv_object_path):
+ vg = self._vg_create([pv_object_path])
+ pv = ClientProxy(self.bus, pv_object_path, interfaces=(PV_INT,))
+
+ self.assertEqual(pv.Pv.Vg, vg.object_path)
+ self.assertIn(pv_object_path, vg.Vg.Pvs,
+ "Expecting PV object path in Vg.Pvs")
+
+ lv = self._create_lv(vg=vg.Vg, size=vg.Vg.FreeBytes)
+ device_path = '/dev/%s/%s' % (vg.Vg.Name, lv.LvCommon.Name)
+ new_pv_object_path = self._pv_create(device_path)
+
+ vg.update()
+
+ self.assertEqual(lv.LvCommon.Vg, vg.object_path)
+ self.assertIn(lv.object_path, vg.Vg.Lvs,
+ "Expecting LV object path in Vg.Lvs")
+
+ new_pv_proxy = ClientProxy(self.bus,
+ new_pv_object_path,
+ interfaces=(PV_INT, ))
+ self.assertEqual(new_pv_proxy.Pv.Name, device_path)
+
+ return new_pv_object_path
+
+ def test_nesting(self):
+ # check to see if we handle an LV becoming a PV which has it's own
+ # LV
+ pv_object_path = self.objs[PV_INT][0].object_path
+
+ for i in range(0, 5):
+ pv_object_path = self._create_nested(pv_object_path)
+
class AggregateResults(object):
6 years, 12 months
master - lvmdbustest.py: Handle nested setUp & tearDown
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6de3a9b4d060d65f4ec...
Commit: 6de3a9b4d060d65f4ecf9a20adc0665b301ec14e
Parent: e78329e281db780cc4a9acce20b0f58dc9221fab
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Sat Apr 22 00:06:16 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Apr 26 07:10:18 2017 -0500
lvmdbustest.py: Handle nested setUp & tearDown
Handle cleaning up correctly if a LV is used as a PV.
---
test/dbus/lvmdbustest.py | 109 ++++++++++++++++++++++++++++++++++------------
1 files changed, 81 insertions(+), 28 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index f8a1918..d88a774 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -68,6 +68,42 @@ def lv_n(suffix=None):
return g_prefix + rs(8, s)
+def is_nested_pv(pv_name):
+ return pv_name.count('/') == 3
+
+
+def _root_pv_name(res, pv_name):
+ if not is_nested_pv(pv_name):
+ return pv_name
+ vg_name = pv_name.split('/')[2:3][0]
+ for v in res[VG_INT]:
+ if v.Vg.Name == vg_name:
+ pv = ClientProxy(bus, v.Vg.Pvs[0], interfaces=(PV_INT, ))
+ return _root_pv_name(res, pv.Pv.Name)
+
+
+def _prune(res, pv_filter):
+ if pv_filter:
+ pv_lookup = {}
+
+ pv_list = []
+ for p in res[PV_INT]:
+ if _root_pv_name(res, p.Pv.Name) in pv_filter:
+ pv_list.append(p)
+ pv_lookup[p.object_path] = p
+
+ res[PV_INT] = pv_list
+
+ vg_list = []
+ for v in res[VG_INT]:
+ # Only need to validate one of the PVs is in the selection set
+ if v.Vg.Pvs[0] in pv_lookup:
+ vg_list.append(v)
+
+ res[VG_INT] = vg_list
+ return res
+
+
def get_objects():
rc = {
MANAGER_INT: [], PV_INT: [], VG_INT: [], LV_INT: [],
@@ -85,15 +121,11 @@ def get_objects():
for object_path, v in objects.items():
proxy = ClientProxy(bus, object_path, v)
for interface, prop in v.items():
- if interface == PV_INT:
- # If we have a list of PVs to use, lets only use those in
- # the list
- # noinspection PyUnresolvedReferences
- if pv_device_list and not (proxy.Pv.Name in pv_device_list):
- continue
rc[interface].append(proxy)
- return rc, bus
+ # At this point we have a full population of everything, we now need to
+ # prune the PV list and the VG list if we are using a sub selection
+ return _prune(rc, pv_device_list), bus
def set_execution(lvmshell, test_result):
@@ -151,38 +183,59 @@ class TestDbusService(unittest.TestCase):
std_err_print('Expecting a manager object!')
sys.exit(1)
- # We will skip the vg device number check if the test user
- # has specified a PV list
- if pv_device_list is None:
- if len(self.objs[VG_INT]) != 0:
- std_err_print('Expecting no VGs to exist!')
- sys.exit(1)
+ if len(self.objs[VG_INT]) != 0:
+ std_err_print('Expecting no VGs to exist!')
+ sys.exit(1)
self.pvs = []
for p in self.objs[PV_INT]:
self.pvs.append(p.Pv.Name)
+ def _recurse_vg_delete(self, vg_proxy, pv_proxy, nested_pv_hash):
+
+ for pv_device_name, t in nested_pv_hash.items():
+ vg_name = str(vg_proxy.Vg.Name)
+ if vg_name in pv_device_name:
+ self._recurse_vg_delete(t[0], t[1], nested_pv_hash)
+ break
+
+ vg_proxy.update()
+
+ self.handle_return(vg_proxy.Vg.Remove(dbus.Int32(g_tmo), EOD))
+ if is_nested_pv(pv_proxy.Pv.Name):
+ rc = self._pv_remove(pv_proxy)
+ self.assertTrue(rc == '/')
+
def tearDown(self):
# If we get here it means we passed setUp, so lets remove anything
# and everything that remains, besides the PVs themselves
self.objs, self.bus = get_objects()
- if pv_device_list is None:
- for v in self.objs[VG_INT]:
- self.handle_return(
- v.Vg.Remove(
- dbus.Int32(g_tmo),
- EOD))
- else:
- for p in self.objs[PV_INT]:
- # When we remove a VG for a PV it could ripple across multiple
- # VGs, so update each PV while removing each VG, to ensure
- # the properties are current and correct.
- p.update()
+ # The self.objs[PV_INT] list only contains those which we should be
+ # mucking with, lets remove any embedded/nested PVs first, then proceed
+ # to walk the base PVs and remove the VGs
+ nested_pvs = {}
+ non_nested = []
+
+ for p in self.objs[PV_INT]:
+ if is_nested_pv(p.Pv.Name):
if p.Pv.Vg != '/':
- v = ClientProxy(self.bus, p.Pv.Vg, interfaces=(VG_INT, ))
- self.handle_return(
- v.Vg.Remove(dbus.Int32(g_tmo), EOD))
+ v = ClientProxy(self.bus, p.Pv.Vg, interfaces=(VG_INT,))
+ nested_pvs[p.Pv.Name] = (v, p)
+ else:
+ # Nested PV with no VG, so just simply remove it!
+ self._pv_remove(p)
+ else:
+ non_nested.append(p)
+
+ for p in non_nested:
+ # When we remove a VG for a PV it could ripple across multiple
+ # PVs, so update each PV while removing each VG, to ensure
+ # the properties are current and correct.
+ p.update()
+ if p.Pv.Vg != '/':
+ v = ClientProxy(self.bus, p.Pv.Vg, interfaces=(VG_INT, ))
+ self._recurse_vg_delete(v, p, nested_pvs)
# Check to make sure the PVs we had to start exist, else re-create
# them
6 years, 12 months
master - lvmdbusd: Make sure we don't hang on lvcreate
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e78329e281db780cc4a...
Commit: e78329e281db780cc4a9acce20b0f58dc9221fab
Parent: a3fdc966b51336fa7b77a26890539c26a0427199
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Sat Apr 22 00:03:46 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Apr 26 07:10:18 2017 -0500
lvmdbusd: Make sure we don't hang on lvcreate
If we happen to create a lv that has a previous signature we hang on y/n
prompt, add '--yes'.
---
daemons/lvmdbusd/cmdhandler.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index cbf6036..94c3f59 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -279,7 +279,7 @@ def vg_lv_create(vg_name, create_options, name, size_bytes, pv_dests):
cmd = ['lvcreate']
cmd.extend(options_to_cli_args(create_options))
cmd.extend(['--size', str(size_bytes) + 'B'])
- cmd.extend(['--name', name, vg_name])
+ cmd.extend(['--name', name, vg_name, '--yes'])
pv_dest_ranges(cmd, pv_dests)
return call(cmd)
@@ -304,6 +304,8 @@ def _vg_lv_create_common_cmd(create_options, size_bytes, thin_pool):
cmd.extend(['--size', str(size_bytes) + 'B'])
else:
cmd.extend(['--thin', '--size', str(size_bytes) + 'B'])
+
+ cmd.extend(['--yes'])
return cmd
@@ -340,7 +342,7 @@ def _vg_lv_create_raid(vg_name, create_options, name, raid_type, size_bytes,
if stripe_size_kb != 0:
cmd.extend(['--stripesize', str(stripe_size_kb)])
- cmd.extend(['--name', name, vg_name])
+ cmd.extend(['--name', name, vg_name, '--yes'])
return call(cmd)
@@ -361,7 +363,7 @@ def vg_lv_create_mirror(
cmd.extend(['--type', 'mirror'])
cmd.extend(['--mirrors', str(num_copies)])
cmd.extend(['--size', str(size_bytes) + 'B'])
- cmd.extend(['--name', name, vg_name])
+ cmd.extend(['--name', name, vg_name, '--yes'])
return call(cmd)
@@ -415,7 +417,7 @@ def lv_lv_create(lv_full_name, create_options, name, size_bytes):
cmd = ['lvcreate']
cmd.extend(options_to_cli_args(create_options))
cmd.extend(['--virtualsize', str(size_bytes) + 'B', '-T'])
- cmd.extend(['--name', name, lv_full_name])
+ cmd.extend(['--name', name, lv_full_name, '--yes'])
return call(cmd)
6 years, 12 months
master - commands: improve error messages for rules
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a3fdc966b51336fa7b7...
Commit: a3fdc966b51336fa7b77a26890539c26a0427199
Parent: c534a7bcc98e936a456601e4be749a828d978e9e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 25 12:19:11 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 25 15:49:58 2017 -0500
commands: improve error messages for rules
Make the error messages more consistent,
and use less code-centric wording.
---
tools/lvmcmdline.c | 12 ++++++------
tools/toollib.c | 20 +++++++++++---------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4f66f7e..37e9ef8 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1700,7 +1700,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
if (!best_required) {
/* cmd did not have all the required opt/pos args of any command */
- log_error("Incorrect syntax. Run '%s --help' for more information.", name);
+ log_error("No command with matching syntax recognised. Run '%s --help' for more information.", name);
if (close_ro) {
log_warn("Nearest similar command has syntax:");
print_usage(&_cmdline.commands[close_i], 0, 0);
@@ -1722,7 +1722,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
opt_enum = best_unused_options[i];
opt_val = arg_value(cmd, opt_enum);
- log_error("Invalid option for command: %s%s%s.",
+ log_error("Command does not accept option: %s%s%s.",
arg_long_option_name(opt_enum),
opt_val ? " " : "", opt_val ?: "");
}
@@ -1753,7 +1753,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
break;
if (count >= (commands[best_i].rp_count + commands[best_i].op_count)) {
- log_error("Invalid positional argument for command: %s.", argv[count]);
+ log_error("Command does not accept argument: %s.", argv[count]);
/* FIXME: to warn/ignore, clear so it can't be used when processing. */
/*
@@ -1803,16 +1803,16 @@ out:
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, check_opts_msg, sizeof(check_opts_msg));
if (rule->opts_count)
- log_error("Invalid option combination: %s with %s", opts_msg, check_opts_msg);
+ log_error("Command does not accept option combination: %s with %s", opts_msg, check_opts_msg);
else
- log_error("Invalid options: %s", check_opts_msg);
+ log_error("Command does not accept options: %s", check_opts_msg);
return NULL;
}
if (opts_unmatch_count && (rule->rule == RULE_REQUIRE)) {
memset(check_opts_msg, 0, sizeof(check_opts_msg));
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, check_opts_msg, sizeof(check_opts_msg));
- log_error("Required options for command: %s", check_opts_msg);
+ log_error("Command requires options: %s", check_opts_msg);
return NULL;
}
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 1d7b01d..838765b 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2701,7 +2701,7 @@ static int _check_lv_types(struct cmd_context *cmd, struct logical_volume *lv, i
if (!ret) {
int lvt_enum = get_lvt_enum(lv);
struct lv_type *type = get_lv_type(lvt_enum);
- log_warn("Operation on LV %s which has invalid type %s.",
+ log_warn("Command on LV %s does not accept LV type %s.",
display_lvname(lv), type ? type->name : "unknown");
}
@@ -2811,7 +2811,8 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
if (rule->check_opts && (rule->rule == RULE_INVALID) && opts_match_count) {
memset(buf, 0, sizeof(buf));
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_warn("An invalid option is set: %s", buf);
+ log_warn("Command on LV %s does not accept option %s.",
+ display_lvname(lv), buf);
ret = 0;
}
@@ -2820,14 +2821,15 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
if (rule->check_opts && (rule->rule == RULE_REQUIRE) && opts_unmatch_count) {
memset(buf, 0, sizeof(buf));
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_warn("A required option is not set: %s", buf);
+ log_warn("Command on LV %s requires option %s.",
+ display_lvname(lv), buf);
ret = 0;
}
/* Fail if the LV matches any of the invalid LV types. */
if (rule->check_lvt_bits && (rule->rule == RULE_INVALID) && lv_types_match_bits) {
- log_warn("Command on LV %s with invalid type: %s",
+ log_warn("Command on LV %s does not accept LV type %s.",
display_lvname(lv), lvtype ? lvtype->name : "unknown");
ret = 0;
}
@@ -2837,7 +2839,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
if (rule->check_lvt_bits && (rule->rule == RULE_REQUIRE) && !lv_types_match_bits) {
memset(buf, 0, sizeof(buf));
lvt_bits_to_str(rule->check_lvt_bits, buf, sizeof(buf));
- log_warn("Command on LV %s with type %s does not match required type: %s",
+ log_warn("Command on LV %s does not accept LV type %s. Required LV types are %s.",
display_lvname(lv), lvtype ? lvtype->name : "unknown", buf);
ret = 0;
}
@@ -2847,7 +2849,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
if (rule->check_lvp_bits && (rule->rule == RULE_INVALID) && lv_props_match_bits) {
memset(buf, 0, sizeof(buf));
lvp_bits_to_str(lv_props_match_bits, buf, sizeof(buf));
- log_warn("Command on LV %s with invalid properties: %s",
+ log_warn("Command on LV %s does not accept LV with properties: %s.",
display_lvname(lv), buf);
ret = 0;
}
@@ -2857,7 +2859,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
if (rule->check_lvp_bits && (rule->rule == RULE_REQUIRE) && lv_props_unmatch_bits) {
memset(buf, 0, sizeof(buf));
lvp_bits_to_str(lv_props_unmatch_bits, buf, sizeof(buf));
- log_warn("Command on LV %s requires properties: %s",
+ log_warn("Command on LV %s requires LV with properties: %s.",
display_lvname(lv), buf);
ret = 0;
}
@@ -3108,7 +3110,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!_check_lv_types(cmd, lvl->lv, lv_arg_pos)) {
/* FIXME: include this result in report log? */
if (lv_is_named_arg) {
- log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
+ log_error("Command not permitted on LV %s.", display_lvname(lvl->lv));
ret_max = ECMD_FAILED;
}
continue;
@@ -3117,7 +3119,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!_check_lv_rules(cmd, lvl->lv)) {
/* FIXME: include this result in report log? */
if (lv_is_named_arg) {
- log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
+ log_error("Command not permitted on LV %s.", display_lvname(lvl->lv));
ret_max = ECMD_FAILED;
}
continue;
7 years
master - lvconvert: FIXME
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c534a7bcc98e936a456...
Commit: c534a7bcc98e936a456601e4be749a828d978e9e
Parent: aa1d5d5c89873c0002628142fd9b2c7c4cc1da55
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Apr 24 18:56:36 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Apr 24 18:56:36 2017 +0200
lvconvert: FIXME
Add FIXME to move error path processing out of tool into library.
Related: rhbz1437653
---
tools/lvconvert.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 22967e8..22555f3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -917,6 +917,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
lp->stripes, lp->stripe_size,
region_size, 0U, operable_pvs, lp->alloc,
MIRROR_BY_LV)) {
+ /* FIXME: failure inside library -> move error path processing into library. */
layer_lv = seg_lv(first_seg(lv), 0);
if (!remove_layer_from_lv(lv, layer_lv) ||
(lv_is_active(lv) && !deactivate_lv(cmd, layer_lv)) ||
7 years