Skip to contentSkip to conversation

master - separate code for setting devices from metadata parsing

PATCH David Teigland 1 participant 1 message May 23, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=645dd276049e8dbab37b169b27cf6af29a8bd8e5
Commit:        645dd276049e8dbab37b169b27cf6af29a8bd8e5
Parent:        ef2d61fea81dbae3d1a32d20ee22d2afae7701af
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Feb 5 11:32:54 2019 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Thu May 23 11:57:38 2019 -0500

separate code for setting devices from metadata parsing

Pull the code that sets devs for PVs out of the metadata parsing code and call it separately.

---
 lib/format_text/archiver.c    |    3 ++
 lib/format_text/import.c      |    8 +++--
 lib/format_text/import_vsn1.c |   51 ----------------------------
 lib/metadata/metadata.c       |   75 +++++++++++++++++++++++++++++++++++++++++
 lib/metadata/metadata.h       |    2 +
 tools/pvscan.c                |    2 +
 6 files changed, 87 insertions(+), 54 deletions(-)
lib/format_text/archiver.c +3 -0
index 34eff55..052c2bd 100644
@@ -320,6 +320,9 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd,
 		break;
 	}
 
+	if (vg)
+		set_pv_devices(tf, vg);
+
 	if (!vg)
 		tf->fmt->ops->destroy_instance(tf);
 
lib/format_text/import.c +5 -3
index d487100..64fbb08 100644
@@ -229,9 +229,11 @@ static struct volume_group *_import_vg_from_config_tree(const struct dm_config_t
 		 */
 		if (!(vg = (*vsn)->read_vg(fid, cft, allow_lvmetad_extensions)))
 			stack;
-		else if ((vg_missing = vg_missing_pv_count(vg))) {
-			log_verbose("There are %d physical volumes missing.",
-				    vg_missing);
+		else {
+			set_pv_devices(fid, vg);
+
+			if ((vg_missing = vg_missing_pv_count(vg)))
+				log_verbose("There are %d physical volumes missing.", vg_missing);
 			vg_mark_partial_lvs(vg, 1);
 			/* FIXME: move this code inside read_vg() */
 		}
lib/format_text/import_vsn1.c +0 -51

69 lines not on this page · raw message

lib/metadata/metadata.c +75 -0

93 lines not on this page · raw message

lib/metadata/metadata.h +2 -0
index 8e9c18a..a140c29 100644
@@ -502,4 +502,6 @@ struct id pv_vgid(const struct physical_volume *pv);
 uint64_t find_min_mda_size(struct dm_list *mdas);
 char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl);
 
+void set_pv_devices(struct format_instance *fid, struct volume_group *vg);
+
 #endif
tools/pvscan.c +2 -0
index 6d89426..d41345f 100644
@@ -617,6 +617,8 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
 		if (pvid_without_metadata)
 			*pvid_without_metadata = dm_pool_strdup(cmd->mem, dev->pvid);
 		fmt->ops->destroy_instance(baton.fid);
+	} else {
+		set_pv_devices(baton.fid, baton.vg);
 	}
 
 	if (baton.vg && vg_is_shared(baton.vg)) {