[PATCH] Change uuid for partitions and internal devices

Phillip Susi <[email protected]> Tue, 10 Jan 2012 17:55:57 -0500
Newsgroups gmane.linux.ataraid
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============0401261357113501688==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig9E4997B1C24510DB6FECC5A3"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig9E4997B1C24510DB6FECC5A3
Content-Type: multipart/mixed; boundary="------------040802090004010200030406"

This is a multi-part message in MIME format.
--------------040802090004010200030406
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable


--------------040802090004010200030406
Content-Type: text/x-patch;
 name="change-uuid.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="change-uuid.patch"

From: Phillip Susi <[email protected]>
Subject: Change uuid for partitions and internal devices
Description: Change the uuid for internal devices ( like
 each half of a raid10 ) so that the rest of the system
 can recognize that the internal device should not be
 probed for partitions or filesystems or mounted.  Also
 change partition's uuid to have the same "partNN-"
 prefix that kpartx gives them.

Index: b/1.0.0.rc16/lib/activate/devmapper.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/1.0.0.rc16/lib/activate/devmapper.c
+++ b/1.0.0.rc16/lib/activate/devmapper.c
@@ -171,8 +171,18 @@ dmraid_uuid(struct lib_context *lc, stru
 	/* Clear garbage data from uuid string */
 	memset(uuid, 0, uuid_len);
=20
-	/* Create UUID string from subsystem prefix and RAID set name. */
-	r =3D snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
+	/* Create UUID string from subsystem prefix and RAID set name.  *
+	 * Prefix partitions with "partNN-" and add an 'I' for internal *
+	 * for stacked devices ( each half of a raid10 )                */
+
+	if (rs->type & t_partition) {
+		char *part;
+		for (part =3D name + strlen(name) - 1; isdigit(*part); part--);
+		part++;
+		r =3D snprintf(uuid, uuid_len, "part%s-DMRAID-%S", part, name) < uuid_=
len;
+	} else if (rs->flags & f_subset)
+		r =3D snprintf(uuid, uuid_len, "DMRAIDI-%s", name) < uuid_len;
+	else r =3D snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
 	return r < 0 ? 0 : (r < uuid_len);
 }
=20
Index: b/1.0.0.rc16/include/dmraid/metadata.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/1.0.0.rc16/include/dmraid/metadata.h
+++ b/1.0.0.rc16/include/dmraid/metadata.h
@@ -177,6 +177,7 @@ enum flags {
 	f_maximize =3D 0x01,	/* If set, maximize set capacity,
 				   if not set, limit to smallest device. */
 	f_partitions =3D 0x02,	/* Set has partitions. */
+	f_subset =3D 0x04,	/* Set is an internal subset ( half of raid10 ) */
 };
=20
 #define	F_MAXIMIZE(rs)		((rs)->flags & f_maximize)
Index: b/1.0.0.rc16/lib/format/ataraid/isw.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/1.0.0.rc16/lib/format/ataraid/isw.c
+++ b/1.0.0.rc16/lib/format/ataraid/isw.c
@@ -877,7 +877,8 @@ group_rd(struct lib_context *lc,
 				free_raid_dev(lc, &rd);
 				return NULL;
 			}
-
+			if (is_raid10(dev))
+				rs->flags |=3D f_subset;
 			rs->status =3D s_ok;
=20
 			/* Save and set to enable dev_sort(). */
Index: b/1.0.0.rc16/lib/format/format.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/1.0.0.rc16/lib/format/format.c
+++ b/1.0.0.rc16/lib/format/format.c
@@ -649,9 +649,10 @@ join_superset(struct lib_context *lc,
 	if ((n =3D f_name(lc, rd, 0))) {
 		if ((ret =3D find_or_alloc_raid_set(lc, n, FIND_TOP, NO_RD,
 						  LC_RS(lc), f_create, rd)) &&
-		    !find_set(lc, &ret->sets, rs->name, FIND_TOP))
+		    !find_set(lc, &ret->sets, rs->name, FIND_TOP)) {
 			list_add_sorted(lc, &ret->sets, &rs->list, f_set_sort);
-
+			rs->flags |=3D f_subset;
+		}
 		dbg_free(n);
 	}
=20

--------------040802090004010200030406--

--------------enig9E4997B1C24510DB6FECC5A3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPDMH9AAoJEJrBOlT6nu75CpEIAMe3kPHxwlp86ThEsc414mXP
2JqpVJ3n2Q5de6/muA/XaT6dp3nNj/bigMIfKkzSz8mSYTrkCSAmVHU9AIWWSHMS
Y2kJPcfUNQULEmRy8GnEM0Q8WE8nIpzGytmX6WBVrddGLnYHP3HDMz0tPR9YZ+4K
HQ8pOawlBnrPC6XMDOpff9fiLrglMU5WLiPb4UF9QdjvwWKiiDuJevQailE1inoi
FCGqHJuiJTGfVVaDa3Or8kOwiwX43iN8LcGQmfLx3XnglVvUm4fLOnHFl+IemGkj
kLgX6UcJEEC5hui5TU6N/XB4GI4BzfRwWq4PoqmCCRTbP/0jqT+bLodCvTlSnEA=
=Pr2O
-----END PGP SIGNATURE-----

--------------enig9E4997B1C24510DB6FECC5A3--


--===============0401261357113501688==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ataraid-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ataraid-list
--===============0401261357113501688==--