Skip to contentSkip to conversation

master - pvremove: allow clearing a duplicate PV

PATCH David Teigland 1 participant 1 message May 16, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba9b7b69d9200d9d977089a0b813f508961fcbee
Commit:        ba9b7b69d9200d9d977089a0b813f508961fcbee
Parent:        e0c22df5c41a8658dab953a413a679ceb5acd663
Author:        David Teigland <[email protected]>
AuthorDate:    Thu May 12 16:19:57 2016 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon May 16 14:40:43 2016 -0500

pvremove: allow clearing a duplicate PV

Add a special case to allow modifying a duplicate PV to erase it with pvremove -ff.

---
 lib/cache/lvmcache.c |   13 +++++++++++++
 lib/cache/lvmcache.h |    2 ++
 tools/toollib.c      |   45 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 58 insertions(+), 2 deletions(-)
lib/cache/lvmcache.c +13 -0
index fe2ad07..0934b20 100644
@@ -459,6 +459,19 @@ int lvmcache_get_unused_duplicate_devs(struct cmd_context *cmd, struct dm_list *
 	return 1;
 }
 
+void lvmcache_remove_unchosen_duplicate(struct device *dev)
+{
+	struct device_list *devl;
+
+	dm_list_iterate_items(devl, &_unused_duplicate_devs) {
+		if (devl->dev == dev) {
+			dm_list_del(&devl->list);
+			return;
+		}
+	}
+}
+
+
 static void _vginfo_attach_info(struct lvmcache_vginfo *vginfo,
 				struct lvmcache_info *info)
 {
lib/cache/lvmcache.h +2 -0
index 45318b9..4fb74db 100644
@@ -211,4 +211,6 @@ void lvmcache_lock_ordering(int enable);
 
 int lvmcache_dev_is_unchosen_duplicate(struct device *dev);
 
+void lvmcache_remove_unchosen_duplicate(struct device *dev);
+
 #endif
tools/toollib.c +43 -2

76 lines not on this page · raw message