Skip to contentSkip to conversation

master - pvmove: require LV name in a shared VG

PATCH David Teigland 1 participant 1 message Sep 20, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2ee0e7aca6020cf273f22dc5bca20bfa3c89051
Commit:        f2ee0e7aca6020cf273f22dc5bca20bfa3c89051
Parent:        518a8e8cfbb672c2bf5e3455f1fe7cd8d94eb5b0
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Sep 19 13:08:41 2017 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Sep 20 09:56:51 2017 -0500

pvmove: require LV name in a shared VG

In a shared VG, only allow pvmove with a named LV, so that only PE's used by the LV will be moved. The LV is then activated exclusively, ensuring that the PE's being moved are not used from another host.

Previously, pvmove was mistakenly allowed on a full PV. This won't work when LVs using that PV are active on other hosts.

---
 WHATS_NEW             |    1 +
 lib/metadata/mirror.c |    2 +-
 man/lvmlockd.8_main   |    3 +++
 tools/pvmove.c        |   42 ++++++++++++++++++++++++------------------
 4 files changed, 29 insertions(+), 19 deletions(-)
WHATS_NEW +1 -0
index 6d820bd..6b88fc4 100644
@@ -1,5 +1,6 @@
 Version 2.02.175 - 
 ======================================
+  Require LV name with pvmove in a shared VG.
   Allow shared active mirror LVs with lvmlockd, dlm, and cmirrord.
   Support lvconvert --repair with cache and cachepool volumes.
   lvconvert --repair respects --poolmetadataspare option.
lib/metadata/mirror.c +1 -1
index e775495..238ce37 100644
@@ -2145,7 +2145,7 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
 		}
 	}
 
-	if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "dlm")) {
+	if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "dlm") && cmd->lockd_lv_sh) {
 		if (!cluster_mirror_is_available(cmd)) {
 			log_error("Shared cluster mirrors are not available.");
 			return 0;
man/lvmlockd.8_main +3 -0
index 067c60d..b7eba1a 100644
@@ -826,6 +826,9 @@ using external origins for thin LVs
 splitting mirrors and snapshots from LVs
 .br
 \[bu]
+pvmove of entire PVs, or under LVs activated with shared locks
+.br
+\[bu]
 vgsplit
 .br
 \[bu]
tools/pvmove.c +24 -18

64 lines not on this page · raw message