Merge lp:~psusi/ubuntu/precise/dmraid/fix-gpt into lp:ubuntu/precise/dmraid

Proposed by Phillip Susi
Status: Merged
Merged at revision: 61
Proposed branch: lp:~psusi/ubuntu/precise/dmraid/fix-gpt
Merge into: lp:ubuntu/precise/dmraid
Diff against target: 170 lines (+97/-4)
7 files modified
debian/changelog (+13/-0)
debian/control (+2/-2)
debian/dmraid-activate (+1/-1)
debian/dmraid.udev (+2/-0)
debian/patches/25_change-uuid.patch (+77/-0)
debian/patches/series (+1/-0)
debian/rules (+1/-1)
To merge this branch: bzr merge lp:~psusi/ubuntu/precise/dmraid/fix-gpt
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+87892@code.launchpad.net

Description of the change

Changed dmraid-activate script and udev rule to let kpartx handle activating the partitions, because it understands gpt.

To post a comment you must log in.
61. By Phillip Susi

* Switch to using kpartx to activate partitions. This
  allows dmraid to work on gpt formatted disks. Change
  priority of udev rule so it runs after kpartx.
* Add 25_change-uuid.patch: Change the UUID set on partitions
  and internal subset devices ( each half of a raid10 ) to
  differentiate them from the main disk so that parted will
  not show the internal subset devices and kpartx will not
  probe them for partitions.

Revision history for this message
Colin Watson (cjwatson) wrote :

We don't have a kpartx-udeb. I'll change this to multipath-udeb.

Otherwise this looks good to me. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2011-05-06 01:37:22 +0000
+++ debian/changelog 2012-01-10 23:17:25 +0000
@@ -1,3 +1,16 @@
1dmraid (1.0.0.rc16-4.1ubuntu5) precise; urgency=low
2
3 * Switch to using kpartx to activate partitions. This
4 allows dmraid to work on gpt formatted disks. Change
5 priority of udev rule so it runs after kpartx.
6 * Add 25_change-uuid.patch: Change the UUID set on partitions
7 and internal subset devices ( each half of a raid10 ) to
8 differentiate them from the main disk so that parted will
9 not show the internal subset devices and kpartx will not
10 probe them for partitions.
11
12 -- Phillip Susi <psusi@ubuntu.com> Sun, 08 Jan 2012 16:28:52 -0500
13
1dmraid (1.0.0.rc16-4.1ubuntu4) oneiric; urgency=low14dmraid (1.0.0.rc16-4.1ubuntu4) oneiric; urgency=low
215
3 * Drop 22_add_pdc_64bit_addressing.patch: breaks some16 * Drop 22_add_pdc_64bit_addressing.patch: breaks some
417
=== modified file 'debian/control'
--- debian/control 2011-03-24 00:37:47 +0000
+++ debian/control 2012-01-10 23:17:25 +0000
@@ -12,7 +12,7 @@
1212
13Package: dmraid13Package: dmraid
14Architecture: any14Architecture: any
15Depends: ${shlibs:Depends}, ${misc:Depends}, udev, dmsetup15Depends: ${shlibs:Depends}, ${misc:Depends}, udev, dmsetup, kpartx
16Description: Device-Mapper Software RAID support tool16Description: Device-Mapper Software RAID support tool
17 dmraid discovers, activates, deactivates and displays properties17 dmraid discovers, activates, deactivates and displays properties
18 of software RAID sets (eg, ATARAID) and contained DOS partitions.18 of software RAID sets (eg, ATARAID) and contained DOS partitions.
@@ -36,7 +36,7 @@
36Architecture: any36Architecture: any
37Section: debian-installer37Section: debian-installer
38XC-Package-Type: udeb38XC-Package-Type: udeb
39Depends: ${shlibs:Depends}, dmsetup-udeb39Depends: ${shlibs:Depends}, dmsetup-udeb, kpartx-udeb
40Description: Device-Mapper Software RAID support tool (udeb)40Description: Device-Mapper Software RAID support tool (udeb)
41 dmraid discovers, activates, deactivates and displays properties41 dmraid discovers, activates, deactivates and displays properties
42 of software RAID sets (eg, ATARAID) and contained DOS partitions.42 of software RAID sets (eg, ATARAID) and contained DOS partitions.
4343
=== modified file 'debian/dmraid-activate'
--- debian/dmraid-activate 2011-01-26 16:30:29 +0000
+++ debian/dmraid-activate 2012-01-10 23:17:25 +0000
@@ -68,7 +68,7 @@
68 # At this point we have the required number of devs, or the user wants the68 # At this point we have the required number of devs, or the user wants the
69 # array brought up in degraded mode, except in the case of striped arrays.69 # array brought up in degraded mode, except in the case of striped arrays.
7070
71 dmraid -i -ay -Z "$1"71 dmraid -p -i -ay -Z "$1"
72 return $Return_Val72 return $Return_Val
73}73}
7474
7575
=== modified file 'debian/dmraid.udev'
--- debian/dmraid.udev 2010-04-07 15:05:37 +0000
+++ debian/dmraid.udev 2012-01-10 23:17:25 +0000
@@ -4,3 +4,5 @@
44
5SUBSYSTEM=="block", ACTION=="add", ENV{ID_TYPE}=="disk", ENV{ID_FS_USAGE}=="raid", KERNEL=="hd[a-z]|sd[a-z]", \5SUBSYSTEM=="block", ACTION=="add", ENV{ID_TYPE}=="disk", ENV{ID_FS_USAGE}=="raid", KERNEL=="hd[a-z]|sd[a-z]", \
6 RUN+="/sbin/dmraid-activate %k"6 RUN+="/sbin/dmraid-activate %k"
7ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="DMRAID-*", \
8 RUN+="/sbin/kpartx -a /dev/$kernel"
7\ No newline at end of file9\ No newline at end of file
810
=== added file 'debian/patches/25_change-uuid.patch'
--- debian/patches/25_change-uuid.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/25_change-uuid.patch 2012-01-10 23:17:25 +0000
@@ -0,0 +1,77 @@
1From: Phillip Susi <psusi@ubuntu.com>
2Subject: Change uuid for partitions and internal devices
3Description: Change the uuid for internal devices ( like
4 each half of a raid10 ) so that the rest of the system
5 can recognize that the internal device should not be
6 probed for partitions or filesystems or mounted. Also
7 change partition's uuid to have the same "partNN-"
8 prefix that kpartx gives them.
9
10Index: b/1.0.0.rc16/lib/activate/devmapper.c
11===================================================================
12--- a/1.0.0.rc16/lib/activate/devmapper.c
13+++ b/1.0.0.rc16/lib/activate/devmapper.c
14@@ -171,8 +171,18 @@ dmraid_uuid(struct lib_context *lc, stru
15 /* Clear garbage data from uuid string */
16 memset(uuid, 0, uuid_len);
17
18- /* Create UUID string from subsystem prefix and RAID set name. */
19- r = snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
20+ /* Create UUID string from subsystem prefix and RAID set name. *
21+ * Prefix partitions with "partNN-" and add an 'I' for internal *
22+ * for stacked devices ( each half of a raid10 ) */
23+
24+ if (rs->type & t_partition) {
25+ char *part;
26+ for (part = name + strlen(name) - 1; isdigit(*part); part--);
27+ part++;
28+ r = snprintf(uuid, uuid_len, "part%s-DMRAID-%S", part, name) < uuid_len;
29+ } else if (rs->flags & f_subset)
30+ r = snprintf(uuid, uuid_len, "DMRAIDI-%s", name) < uuid_len;
31+ else r = snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
32 return r < 0 ? 0 : (r < uuid_len);
33 }
34
35Index: b/1.0.0.rc16/include/dmraid/metadata.h
36===================================================================
37--- a/1.0.0.rc16/include/dmraid/metadata.h
38+++ b/1.0.0.rc16/include/dmraid/metadata.h
39@@ -177,6 +177,7 @@ enum flags {
40 f_maximize = 0x01, /* If set, maximize set capacity,
41 if not set, limit to smallest device. */
42 f_partitions = 0x02, /* Set has partitions. */
43+ f_subset = 0x04, /* Set is an internal subset ( half of raid10 ) */
44 };
45
46 #define F_MAXIMIZE(rs) ((rs)->flags & f_maximize)
47Index: b/1.0.0.rc16/lib/format/ataraid/isw.c
48===================================================================
49--- a/1.0.0.rc16/lib/format/ataraid/isw.c
50+++ b/1.0.0.rc16/lib/format/ataraid/isw.c
51@@ -877,7 +877,8 @@ group_rd(struct lib_context *lc,
52 free_raid_dev(lc, &rd);
53 return NULL;
54 }
55-
56+ if (is_raid10(dev))
57+ rs->flags |= f_subset;
58 rs->status = s_ok;
59
60 /* Save and set to enable dev_sort(). */
61Index: b/1.0.0.rc16/lib/format/format.c
62===================================================================
63--- a/1.0.0.rc16/lib/format/format.c
64+++ b/1.0.0.rc16/lib/format/format.c
65@@ -649,9 +649,10 @@ join_superset(struct lib_context *lc,
66 if ((n = f_name(lc, rd, 0))) {
67 if ((ret = find_or_alloc_raid_set(lc, n, FIND_TOP, NO_RD,
68 LC_RS(lc), f_create, rd)) &&
69- !find_set(lc, &ret->sets, rs->name, FIND_TOP))
70+ !find_set(lc, &ret->sets, rs->name, FIND_TOP)) {
71 list_add_sorted(lc, &ret->sets, &rs->list, f_set_sort);
72-
73+ rs->flags |= f_subset;
74+ }
75 dbg_free(n);
76 }
77
078
=== modified file 'debian/patches/series'
--- debian/patches/series 2011-05-06 01:37:22 +0000
+++ debian/patches/series 2012-01-10 23:17:25 +0000
@@ -14,3 +14,4 @@
14#22_add_pdc_64bit_addressing.patch14#22_add_pdc_64bit_addressing.patch
1523_pdc_dump_extended_metadata.patch1523_pdc_dump_extended_metadata.patch
1624_drop_p_for_partition_conditional.patch1624_drop_p_for_partition_conditional.patch
1725_change-uuid.patch
1718
=== modified file 'debian/rules'
--- debian/rules 2010-02-04 21:34:22 +0000
+++ debian/rules 2012-01-10 23:17:25 +0000
@@ -69,7 +69,7 @@
69 dh_testroot69 dh_testroot
70 dh_install70 dh_install
71 dh_installdirs71 dh_installdirs
72 dh_installudev --priority=8572 dh_installudev --priority=97
73 dh_installdocs ${version}/CREDITS ${version}/KNOWN_BUGS ${version}/README ${version}/TODO73 dh_installdocs ${version}/CREDITS ${version}/KNOWN_BUGS ${version}/README ${version}/TODO
74 dh_installchangelogs ${version}/CHANGELOG74 dh_installchangelogs ${version}/CHANGELOG
75 install -m0755 debian/dmraid.bug debian/dmraid/usr/share/bug/dmraid/script75 install -m0755 debian/dmraid.bug debian/dmraid/usr/share/bug/dmraid/script

Subscribers

People subscribed via source and target branches

to all changes: