summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-04-18 22:44:30 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-04-18 23:05:51 +0200
commit88c19d5d7200b4193693f88f42e05646a52b4563 (patch)
tree1db3b241c9cebf05ccc6130eac8f4042ca0084a4
parent7e5881dd131e6f521f8f419edc3bb42e575d693a (diff)
downloadlvm2-88c19d5d7200b4193693f88f42e05646a52b4563.tar.gz
lvchange: improve refresh for merging thin volume
When running lvchange --refresh on merging thin volume, try to deactivate snapshot thinLV in case it's preventing startup of merge process.
-rw-r--r--WHATS_NEW1
-rw-r--r--tools/toollib.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 863fe30d9..4a435bbf0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.151 -
=================================
+ lvchange --refresh for merging thin origin will retry to deactivate snapshot.
Recognize in-progress snapshot merge for thin volumes from dm table.
Avoid deciding to initiate a pending snapshot merge during resume.
Improve retrying lvmetad requests while lvmetad is being updated.
diff --git a/tools/toollib.c b/tools/toollib.c
index 5e9b4d832..b9db9cb31 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1080,6 +1080,16 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
{
+ struct logical_volume *snapshot_lv;
+
+ if (lv_is_merging_origin(lv)) {
+ snapshot_lv = find_snapshot(lv)->lv;
+ if (lv_is_thin_type(snapshot_lv) && !deactivate_lv(cmd, snapshot_lv))
+ log_print_unless_silent("Delaying merge for origin volume %s since "
+ "snapshot volume %s is still active.",
+ display_lvname(lv), display_lvname(snapshot_lv));
+ }
+
if (!lv_refresh_suspend_resume(cmd, lv))
return_0;