Skip to contentSkip to conversation

master - system_id: detect an lvm1 system id

PATCH David Teigland 1 participant 1 message Mar 9, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e9a233ee8ef362fccc5537125a19c28e5d596168
Commit:        e9a233ee8ef362fccc5537125a19c28e5d596168
Parent:        08371a8b8031b43394d80612d24029cfd4c710d4
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Mar 9 13:27:34 2015 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Mar 9 13:27:34 2015 -0500

system_id: detect an lvm1 system id

Detect an lvm1 system id by looking at the WRITE_LOCKED flag. Don't copy this lvm1 system id into vg->system_id so that the restrictions associated with the new system id are not applied to the old VG with the inherited lvm1 system id.

---
 lib/format_text/import_vsn1.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
lib/format_text/import_vsn1.c +8 -0
index 6afe71d..837af6b 100644
@@ -812,6 +812,14 @@ static struct volume_group *_read_vg(struct format_instance *fid,
 		goto bad;
 	}
 
+	/*
+	 * A system id without WRITE_LOCKED is an old lvm1 system id.
+	 */
+	if (!(vg->status & LVM_WRITE_LOCKED) && system_id[0]) {
+		memcpy(vg->lvm1_system_id, system_id, NAME_LEN + 1);
+		memset(system_id, 0, NAME_LEN + 1);
+	}
+
 	if (vg->status & LVM_WRITE_LOCKED) {
 		vg->status |= LVM_WRITE;
 		vg->status &= ~LVM_WRITE_LOCKED;