[parted-devel] [PATCH 4/6] libparted: set dmraid partition uuid
Phillip Susi
psusi at ubuntu.com
Mon Oct 15 04:00:01 UTC 2012
When dmraid creates the partition devices, it assigns them a UUID in the
form of "DMRAID-XXXXX". When kpartx creates the partitions, it assigns
them a UUID of the form "partN-DMRAID-XXXX". This patch has parted use
the kpartx style.
---
NEWS | 10 ++++++++++
libparted/arch/linux.c | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/NEWS b/NEWS
index d8fefc8..ea3b302 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ GNU parted NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug Fixes
+
libparted: Don't fail to manipulate partitions on dmraid disks that
have other partitions in use.
@@ -21,6 +22,12 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ libparted: set dmraid partition uuid. When dmraid creates the
+ partition devices, it assigns them a UUID in the form of
+ "DMRAID-XXXXX". When kpartx creates the partitions, it assigns
+ them a UUID of the form "partN-DMRAID-XXXX". Parted will now
+ set the UUID and use the kpartx style.
+
Device-mapper devices other than dmraid whole disks will no longer be
shown by parted -l.
@@ -64,6 +71,9 @@ GNU parted NEWS -*- outline -*-
** Bug fixes
+ libparted: Don't fail to manipulate partitions on dmraid disks that
+ have other partitions in use.
+
libparted: avoid an invalid free when creating many partitions in
a GPT partition table. [bug introduced in parted-1.9.0]
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 5e5b527..5eb66ac 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2743,6 +2743,14 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
dm_task_set_name (task, vol_name);
dm_task_add_target (task, 0, part->geom.length,
"linear", params);
+ char *dm_uuid;
+ int uuid_len;
+ if (_is_dmraid_device (disk->dev->path)) {
+ uuid_len = (strlen (vol_name) + 8);
+ dm_uuid = (char*) ped_malloc (uuid_len);
+ snprintf (dm_uuid, uuid_len, "part%d-DMRAID-%s", part->num, vol_name);
+ dm_task_set_uuid (task, dm_uuid);
+ }
if (dm_task_run (task)) {
dm_task_update_nodes();
dm_task_destroy(task);
--
1.7.10.4
More information about the parted-devel
mailing list