Skip to contentSkip to conversation

master - lvconvert: add startpoll command using command def

PATCH David Teigland 1 participant 1 message Feb 13, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d71aaca07b2c14049130ab368221510c65236af7
Commit:        d71aaca07b2c14049130ab368221510c65236af7
Parent:        fa2a728a395639a32707bb75e6bb4197b02769de
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Dec 19 15:38:03 2016 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Feb 13 08:20:10 2017 -0600

lvconvert: add startpoll command using command def

This is a new explicit version of 'lvconvert LV' which has been an obscure way of triggering polling to be restarted on an LV that was previously converted.

---
 test/shell/lvconvert-mirror.sh |   21 ++++++--------
 tools/args.h                   |    1 +
 tools/command-lines.in         |   17 +++++++++---
 tools/lvconvert.c              |   57 ++++++++++++++++++++++++++++++++++++++++
 tools/lvmcmdline.c             |    6 +++-
 tools/tools.h                  |    2 +
 6 files changed, 86 insertions(+), 18 deletions(-)
test/shell/lvconvert-mirror.sh +9 -12
index 1d4fb08..5008f15 100644
@@ -85,12 +85,9 @@ offset=$(( offset + 2 ))
 # update in case  mirror ever gets faster and allows parallel read
 aux delay_dev "$dev2" 0 2000 ${offset}:1
 lvcreate -aey -l5 -Zn -Wn --type mirror --regionsize 16K -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE"
-# FIXME: add a new explicit option to define the polling behavior
-# done here with 'lvconvert vg/lv'.  That option can specify
-# that the command succeeds even if the LV doesn't need polling.
 should not lvconvert -m-1 $vg/$lv1 "$dev1"
 aux enable_dev "$dev2"
-should lvconvert $vg/$lv1 # wait
+lvconvert --startpoll $vg/$lv1 || true # wait
 lvconvert -m2 $vg/$lv1 "$dev1" "$dev2" "$dev4" "$dev3:0" # If the above "should" failed...
 
 aux wait_for_sync $vg $lv1
@@ -116,7 +113,7 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
 # Next convert should fail b/c we can't have 2 at once
 should not lvconvert -m+1 $vg/$lv1 "$dev5"
 aux enable_dev "$dev4"
-should lvconvert $vg/$lv1 # wait
+lvconvert --startpoll $vg/$lv1 || true # wait
 lvconvert -m2 $vg/$lv1 # In case the above "should" actually failed
 
 check mirror $vg $lv1 "$dev3"
@@ -159,7 +156,7 @@ lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE
 lvchange -an $vg/$lv1
 lvconvert -m+1 $vg/$lv1 "$dev4"
 lvchange -aey $vg/$lv1
-should lvconvert $vg/$lv1 # wait
+lvconvert --startpoll $vg/$lv1 || true # wait
 check mirror $vg $lv1 "$dev3"
 check mirror_no_temporaries $vg $lv1
 lvremove -ff $vg
@@ -171,7 +168,7 @@ lvremove -ff $vg
 lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
 LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
 lvconvert -m-1 $vg/$lv1 "$dev4"
-should lvconvert $vg/$lv1 # wait
+lvconvert --startpoll $vg/$lv1 || true # wait
 
 check mirror $vg $lv1 "$dev3"
 check mirror_no_temporaries $vg $lv1
@@ -182,7 +179,7 @@ lvremove -ff $vg
 lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
 LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+2 -b $vg/$lv1 "$dev4" "$dev5"
 lvconvert -m-1 $vg/$lv1 "$dev4"
-should lvconvert $vg/$lv1 # wait
+lvconvert --startpoll $vg/$lv1 || true # wait
 
 check mirror $vg $lv1 "$dev3"
 check mirror_no_temporaries $vg $lv1
@@ -195,9 +192,9 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
 # FIXME: Extra wait here for mirror upconvert synchronization
 # otherwise we may fail her on parallel upconvert and downconvert
 # lvconvert-mirror-updown.sh tests this errornous case separately
-should lvconvert $vg/$lv1
+lvconvert --startpoll $vg/$lv1 || true
 lvconvert -m-1 $vg/$lv1 "$dev2"
-should lvconvert $vg/$lv1
+lvconvert --startpoll $vg/$lv1 || true
 
 check mirror $vg $lv1 "$dev3"
 check mirror_no_temporaries $vg $lv1
@@ -210,9 +207,9 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
 # FIXME: Extra wait here for mirror upconvert synchronization
 # otherwise we may fail her on parallel upconvert and downconvert
 # lvconvert-mirror-updown.sh tests this errornous case separately
-should lvconvert $vg/$lv1
+lvconvert --startpoll $vg/$lv1 || true
 lvconvert -m-1 $vg/$lv1 "$dev2"
-should lvconvert $vg/$lv1
+lvconvert --startpoll $vg/$lv1 || true
 
 check mirror $vg $lv1 "$dev3"
 check mirror_no_temporaries $vg $lv1
tools/args.h +1 -0
index a015318..3560c9c 100644
@@ -118,6 +118,7 @@ arg(splitmirrors_ARG, '\0', "splitmirrors", number_VAL, 0, 0)
 arg(splitsnapshot_ARG, '\0', "splitsnapshot", 0, 0, 0)
 arg(showdeprecated_ARG, '\0', "showdeprecated", 0, 0, 0)
 arg(showunsupported_ARG, '\0', "showunsupported", 0, 0, 0)
+arg(startpoll_ARG, '\0', "startpoll", 0, 0, 0)
 arg(stripes_long_ARG, '\0', "stripes", number_VAL, 0, 0)
 arg(syncaction_ARG, '\0', "syncaction", syncaction_VAL, 0, 0)
 arg(sysinit_ARG, '\0', "sysinit", 0, 0, 0)
tools/command-lines.in +13 -4
index 98623a1..4704747 100644
@@ -592,13 +592,22 @@ RULE: all not lv_is_locked lv_is_pvmove
 
 ---
 
-# FIXME: add a new option defining this operation, e.g. --poll-mirror
-# The purpose of this command is not entirely clear.
+# This command just (re)starts the polling process on the LV
+# to continue a previous conversion.
 
+lvconvert --startpoll LV_mirror
+OO: OO_LVCONVERT
+ID: lvconvert_start_poll
+DESC: Poll LV to continue conversion.
+RULE: all and lv_is_converting
+
+# alternate form of lvconvert --startpoll, this is only kept
+# for compat since this was how it used to be done.
 lvconvert LV_mirror
 OO: OO_LVCONVERT
-ID: lvconvert_poll_start
-DESC: Poll mirror LV to collapse resync layers.
+ID: lvconvert_start_poll
+DESC: Poll LV to continue conversion.
+RULE: all and lv_is_converting
 FLAGS: SECONDARY_SYNTAX
 
 ---
tools/lvconvert.c +57 -0

60 lines not on this page · raw message

tools/lvmcmdline.c +4 -2
index e3904d6..83deaf1 100644
@@ -131,7 +131,11 @@ struct command_function command_functions[COMMAND_ID_COUNT] = {
 	{ lvconvert_split_cow_snapshot_CMD, lvconvert_split_snapshot_cmd },
 	{ lvconvert_merge_snapshot_CMD, lvconvert_merge_snapshot_cmd },
 	{ lvconvert_combine_split_snapshot_CMD, lvconvert_combine_split_snapshot_cmd },
+
+	/* lvconvert utility to trigger polling on an LV. */
+	{ lvconvert_start_poll_CMD, lvconvert_start_poll_cmd },
 };
+
 #if 0
 	/* all raid-related type conversions */
 
@@ -155,8 +159,6 @@ struct command_function command_functions[COMMAND_ID_COUNT] = {
 	/* other misc. */
 
 	{ lvconvert_merge_CMD,				lvconvert_merge_fn },
-	{ lvconvert_poll_start_CMD,			lvconvert_poll_start_fn },
-
 #endif
 
 /* Command line args */
tools/tools.h +2 -0
index 8ac98e8..a152fcf 100644
@@ -258,4 +258,6 @@ int lvconvert_merge_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv)
 int lvconvert_split_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv);
 int lvconvert_combine_split_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv);
 
+int lvconvert_start_poll_cmd(struct cmd_context *cmd, int argc, char **argv);
+
 #endif