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
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-05-06 01:37:22 +0000
3+++ debian/changelog 2012-01-10 23:17:25 +0000
4@@ -1,3 +1,16 @@
5+dmraid (1.0.0.rc16-4.1ubuntu5) precise; urgency=low
6+
7+ * Switch to using kpartx to activate partitions. This
8+ allows dmraid to work on gpt formatted disks. Change
9+ priority of udev rule so it runs after kpartx.
10+ * Add 25_change-uuid.patch: Change the UUID set on partitions
11+ and internal subset devices ( each half of a raid10 ) to
12+ differentiate them from the main disk so that parted will
13+ not show the internal subset devices and kpartx will not
14+ probe them for partitions.
15+
16+ -- Phillip Susi <psusi@ubuntu.com> Sun, 08 Jan 2012 16:28:52 -0500
17+
18 dmraid (1.0.0.rc16-4.1ubuntu4) oneiric; urgency=low
19
20 * Drop 22_add_pdc_64bit_addressing.patch: breaks some
21
22=== modified file 'debian/control'
23--- debian/control 2011-03-24 00:37:47 +0000
24+++ debian/control 2012-01-10 23:17:25 +0000
25@@ -12,7 +12,7 @@
26
27 Package: dmraid
28 Architecture: any
29-Depends: ${shlibs:Depends}, ${misc:Depends}, udev, dmsetup
30+Depends: ${shlibs:Depends}, ${misc:Depends}, udev, dmsetup, kpartx
31 Description: Device-Mapper Software RAID support tool
32 dmraid discovers, activates, deactivates and displays properties
33 of software RAID sets (eg, ATARAID) and contained DOS partitions.
34@@ -36,7 +36,7 @@
35 Architecture: any
36 Section: debian-installer
37 XC-Package-Type: udeb
38-Depends: ${shlibs:Depends}, dmsetup-udeb
39+Depends: ${shlibs:Depends}, dmsetup-udeb, kpartx-udeb
40 Description: Device-Mapper Software RAID support tool (udeb)
41 dmraid discovers, activates, deactivates and displays properties
42 of software RAID sets (eg, ATARAID) and contained DOS partitions.
43
44=== modified file 'debian/dmraid-activate'
45--- debian/dmraid-activate 2011-01-26 16:30:29 +0000
46+++ debian/dmraid-activate 2012-01-10 23:17:25 +0000
47@@ -68,7 +68,7 @@
48 # At this point we have the required number of devs, or the user wants the
49 # array brought up in degraded mode, except in the case of striped arrays.
50
51- dmraid -i -ay -Z "$1"
52+ dmraid -p -i -ay -Z "$1"
53 return $Return_Val
54 }
55
56
57=== modified file 'debian/dmraid.udev'
58--- debian/dmraid.udev 2010-04-07 15:05:37 +0000
59+++ debian/dmraid.udev 2012-01-10 23:17:25 +0000
60@@ -4,3 +4,5 @@
61
62 SUBSYSTEM=="block", ACTION=="add", ENV{ID_TYPE}=="disk", ENV{ID_FS_USAGE}=="raid", KERNEL=="hd[a-z]|sd[a-z]", \
63 RUN+="/sbin/dmraid-activate %k"
64+ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="DMRAID-*", \
65+ RUN+="/sbin/kpartx -a /dev/$kernel"
66\ No newline at end of file
67
68=== added file 'debian/patches/25_change-uuid.patch'
69--- debian/patches/25_change-uuid.patch 1970-01-01 00:00:00 +0000
70+++ debian/patches/25_change-uuid.patch 2012-01-10 23:17:25 +0000
71@@ -0,0 +1,77 @@
72+From: Phillip Susi <psusi@ubuntu.com>
73+Subject: Change uuid for partitions and internal devices
74+Description: Change the uuid for internal devices ( like
75+ each half of a raid10 ) so that the rest of the system
76+ can recognize that the internal device should not be
77+ probed for partitions or filesystems or mounted. Also
78+ change partition's uuid to have the same "partNN-"
79+ prefix that kpartx gives them.
80+
81+Index: b/1.0.0.rc16/lib/activate/devmapper.c
82+===================================================================
83+--- a/1.0.0.rc16/lib/activate/devmapper.c
84++++ b/1.0.0.rc16/lib/activate/devmapper.c
85+@@ -171,8 +171,18 @@ dmraid_uuid(struct lib_context *lc, stru
86+ /* Clear garbage data from uuid string */
87+ memset(uuid, 0, uuid_len);
88+
89+- /* Create UUID string from subsystem prefix and RAID set name. */
90+- r = snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
91++ /* Create UUID string from subsystem prefix and RAID set name. *
92++ * Prefix partitions with "partNN-" and add an 'I' for internal *
93++ * for stacked devices ( each half of a raid10 ) */
94++
95++ if (rs->type & t_partition) {
96++ char *part;
97++ for (part = name + strlen(name) - 1; isdigit(*part); part--);
98++ part++;
99++ r = snprintf(uuid, uuid_len, "part%s-DMRAID-%S", part, name) < uuid_len;
100++ } else if (rs->flags & f_subset)
101++ r = snprintf(uuid, uuid_len, "DMRAIDI-%s", name) < uuid_len;
102++ else r = snprintf(uuid, uuid_len, "DMRAID-%s", name) < uuid_len;
103+ return r < 0 ? 0 : (r < uuid_len);
104+ }
105+
106+Index: b/1.0.0.rc16/include/dmraid/metadata.h
107+===================================================================
108+--- a/1.0.0.rc16/include/dmraid/metadata.h
109++++ b/1.0.0.rc16/include/dmraid/metadata.h
110+@@ -177,6 +177,7 @@ enum flags {
111+ f_maximize = 0x01, /* If set, maximize set capacity,
112+ if not set, limit to smallest device. */
113+ f_partitions = 0x02, /* Set has partitions. */
114++ f_subset = 0x04, /* Set is an internal subset ( half of raid10 ) */
115+ };
116+
117+ #define F_MAXIMIZE(rs) ((rs)->flags & f_maximize)
118+Index: b/1.0.0.rc16/lib/format/ataraid/isw.c
119+===================================================================
120+--- a/1.0.0.rc16/lib/format/ataraid/isw.c
121++++ b/1.0.0.rc16/lib/format/ataraid/isw.c
122+@@ -877,7 +877,8 @@ group_rd(struct lib_context *lc,
123+ free_raid_dev(lc, &rd);
124+ return NULL;
125+ }
126+-
127++ if (is_raid10(dev))
128++ rs->flags |= f_subset;
129+ rs->status = s_ok;
130+
131+ /* Save and set to enable dev_sort(). */
132+Index: b/1.0.0.rc16/lib/format/format.c
133+===================================================================
134+--- a/1.0.0.rc16/lib/format/format.c
135++++ b/1.0.0.rc16/lib/format/format.c
136+@@ -649,9 +649,10 @@ join_superset(struct lib_context *lc,
137+ if ((n = f_name(lc, rd, 0))) {
138+ if ((ret = find_or_alloc_raid_set(lc, n, FIND_TOP, NO_RD,
139+ LC_RS(lc), f_create, rd)) &&
140+- !find_set(lc, &ret->sets, rs->name, FIND_TOP))
141++ !find_set(lc, &ret->sets, rs->name, FIND_TOP)) {
142+ list_add_sorted(lc, &ret->sets, &rs->list, f_set_sort);
143+-
144++ rs->flags |= f_subset;
145++ }
146+ dbg_free(n);
147+ }
148+
149
150=== modified file 'debian/patches/series'
151--- debian/patches/series 2011-05-06 01:37:22 +0000
152+++ debian/patches/series 2012-01-10 23:17:25 +0000
153@@ -14,3 +14,4 @@
154 #22_add_pdc_64bit_addressing.patch
155 23_pdc_dump_extended_metadata.patch
156 24_drop_p_for_partition_conditional.patch
157+25_change-uuid.patch
158
159=== modified file 'debian/rules'
160--- debian/rules 2010-02-04 21:34:22 +0000
161+++ debian/rules 2012-01-10 23:17:25 +0000
162@@ -69,7 +69,7 @@
163 dh_testroot
164 dh_install
165 dh_installdirs
166- dh_installudev --priority=85
167+ dh_installudev --priority=97
168 dh_installdocs ${version}/CREDITS ${version}/KNOWN_BUGS ${version}/README ${version}/TODO
169 dh_installchangelogs ${version}/CHANGELOG
170 install -m0755 debian/dmraid.bug debian/dmraid/usr/share/bug/dmraid/script

Subscribers

People subscribed via source and target branches

to all changes: