Merge ~raharper/curtin:fix/partition-verify-flags-msdos-primary-types into curtin:master
- Git
- lp:~raharper/curtin
- fix/partition-verify-flags-msdos-primary-types
- Merge into master
Status: | Merged |
---|---|
Approved by: | Ryan Harper |
Approved revision: | 669b5cf73d4cf15e1bccfb9913f15125fbb4b9c1 |
Merge reported by: | Server Team CI bot |
Merged at revision: | not available |
Proposed branch: | ~raharper/curtin:fix/partition-verify-flags-msdos-primary-types |
Merge into: | curtin:master |
Diff against target: |
771 lines (+699/-10) 5 files modified
curtin/commands/block_meta.py (+3/-1) curtin/storage_config.py (+14/-9) tests/data/probert_storage_msdos_mbr_extended_v2.json (+537/-0) tests/unittests/test_commands_block_meta.py (+111/-0) tests/unittests/test_storage_config.py (+34/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chad Smith | Approve | ||
Lucas Albuquerque Medeiros de Moura (community) | Approve | ||
Server Team CI bot | continuous-integration | Approve | |
Ryan Harper (community) | Needs Fixing | ||
Review via email: mp+384133@code.launchpad.net |
Commit message
verify_ptable_flag: dos primary partitions use ptable_uuid map for flag
Curtin currently special-cases verifying MSDOS 'boot', 'extended'
and 'logical' flags. This ignored primary DOS partitions. When
verifying partition flags on a MSDOS primary partition use
ptable_
LP: #1878890
Description of the change
Server Team CI bot (server-team-bot) wrote : | # |
Lucas Albuquerque Medeiros de Moura (lamoura) wrote : | # |
I don't know if this is a possible scenario, but is it possible to have a boot type partition that is not marked as bootable ?
For example, suppose we have this type of configuration:
sfdisk_info_dos = {
"id": "0xb0dbdde1",
"unit": "sectors",
}
In that scenario the boot check would fail, because we will not have the bootable key, but the MBR_TYPE_
But do we want to have a boot partition that is not marked as bootable ? I think this scenario can happen if we provide a custom sfdisk_info dict to the function, but I don't know if that can actually happen, or if it does, if it is a problem.
Ryan Harper (raharper) wrote : | # |
Good catch, and actually I need to remove the 0x80 from the MBR table, as it's a flag, not a table type. I'll add a unittest covering this scenario.
Ryan Harper (raharper) wrote : | # |
Marking Needs Fixing so we don't land until I fix.
- 6f37807... by Ryan Harper
-
Drop 0x80 boot flag from MBR_TYPE map, it's a PART_ENTRY_FLAGS value only.
- 3368f31... by Ryan Harper
-
Ensure boot flag is captured even on logical partitions
- 7e0fb61... by Ryan Harper
-
Add unittest for logical partition with boot flag
Server Team CI bot (server-team-bot) wrote : | # |
FAILED: Continuous integration, rev:7e0fb61b9b9
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 669b5cf... by Ryan Harper
-
Add unittest data file
Server Team CI bot (server-team-bot) wrote : | # |
PASSED: Continuous integration, rev:669b5cf73d4
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Lucas Albuquerque Medeiros de Moura (lamoura) wrote : | # |
To the best of knowledge, I could not find any issue with the code
Chad Smith (chad.smith) wrote : | # |
Nice one Ryan, this looks good. one minor question/suggestion about whether we can always expect a 'type' key from block.get_
Otherwise +1
Chad Smith (chad.smith) : | # |
Ryan Harper (raharper) wrote : | # |
@Chad
Yes, each partition entry has a type.
Ryan Harper (raharper) : | # |
Ryan Harper (raharper) wrote : | # |
Kicking off a few vmtests
Ryan Harper (raharper) wrote : | # |
vmtest says yes
Preview Diff
1 | diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py | |||
2 | index f2bb8da..ff0f2e9 100644 | |||
3 | --- a/curtin/commands/block_meta.py | |||
4 | +++ b/curtin/commands/block_meta.py | |||
5 | @@ -760,7 +760,9 @@ def verify_ptable_flag(devpath, expected_flag, sfdisk_info=None): | |||
6 | 760 | elif expected_flag == 'logical': | 760 | elif expected_flag == 'logical': |
7 | 761 | (_parent, partnumber) = block.get_blockdev_for_partition(devpath) | 761 | (_parent, partnumber) = block.get_blockdev_for_partition(devpath) |
8 | 762 | found_flag = 'logical' if int(partnumber) > 4 else None | 762 | found_flag = 'logical' if int(partnumber) > 4 else None |
10 | 763 | else: | 763 | |
11 | 764 | # gpt and msdos primary partitions look up flag by entry['type'] | ||
12 | 765 | if found_flag is None: | ||
13 | 764 | (found_flag, _code) = ptable_uuid_to_flag_entry(entry['type']) | 766 | (found_flag, _code) = ptable_uuid_to_flag_entry(entry['type']) |
14 | 765 | msg = ( | 767 | msg = ( |
15 | 766 | 'Verifying %s partition flag, expecting %s, found %s' % ( | 768 | 'Verifying %s partition flag, expecting %s, found %s' % ( |
16 | diff --git a/curtin/storage_config.py b/curtin/storage_config.py | |||
17 | index e285f98..494b142 100644 | |||
18 | --- a/curtin/storage_config.py | |||
19 | +++ b/curtin/storage_config.py | |||
20 | @@ -34,12 +34,13 @@ GPT_GUID_TO_CURTIN_MAP = { | |||
21 | 34 | MBR_TYPE_TO_CURTIN_MAP = { | 34 | MBR_TYPE_TO_CURTIN_MAP = { |
22 | 35 | '0XF': ('extended', 'f'), | 35 | '0XF': ('extended', 'f'), |
23 | 36 | '0X5': ('extended', 'f'), | 36 | '0X5': ('extended', 'f'), |
24 | 37 | '0X80': ('boot', '80'), | ||
25 | 38 | '0X83': ('linux', '83'), | 37 | '0X83': ('linux', '83'), |
26 | 39 | '0X85': ('extended', 'f'), | 38 | '0X85': ('extended', 'f'), |
27 | 40 | '0XC5': ('extended', 'f'), | 39 | '0XC5': ('extended', 'f'), |
28 | 41 | } | 40 | } |
29 | 42 | 41 | ||
30 | 42 | MBR_BOOT_FLAG = '0x80' | ||
31 | 43 | |||
32 | 43 | PTABLE_TYPE_MAP = dict(GPT_GUID_TO_CURTIN_MAP, **MBR_TYPE_TO_CURTIN_MAP) | 44 | PTABLE_TYPE_MAP = dict(GPT_GUID_TO_CURTIN_MAP, **MBR_TYPE_TO_CURTIN_MAP) |
33 | 44 | 45 | ||
34 | 45 | StorageConfig = namedtuple('StorageConfig', ('type', 'schema')) | 46 | StorageConfig = namedtuple('StorageConfig', ('type', 'schema')) |
35 | @@ -820,16 +821,20 @@ class BlockdevParser(ProbertParser): | |||
36 | 820 | entry['size'] *= 512 | 821 | entry['size'] *= 512 |
37 | 821 | 822 | ||
38 | 822 | ptype = blockdev_data.get('ID_PART_ENTRY_TYPE') | 823 | ptype = blockdev_data.get('ID_PART_ENTRY_TYPE') |
39 | 823 | # use PART_ENTRY_FLAGS if set, msdos | ||
40 | 824 | ptype_flag = blockdev_data.get('ID_PART_ENTRY_FLAGS') | ||
41 | 825 | if ptype_flag: | ||
42 | 826 | ptype = ptype_flag | ||
43 | 827 | flag_name, _flag_code = ptable_uuid_to_flag_entry(ptype) | 824 | flag_name, _flag_code = ptable_uuid_to_flag_entry(ptype) |
44 | 828 | 825 | ||
49 | 829 | # logical partitions are not tagged in data, however | 826 | if ptable and ptable.get('label') == 'dos': |
50 | 830 | # the partition number > 4 (ie, not primary nor extended) | 827 | # if the boot flag is set, use this as the flag, logical |
51 | 831 | if ptable and ptable.get('label') == 'dos' and entry['number'] > 4: | 828 | # flag is not required as we can determine logical via |
52 | 832 | flag_name = 'logical' | 829 | # partition number |
53 | 830 | ptype_flag = blockdev_data.get('ID_PART_ENTRY_FLAGS') | ||
54 | 831 | if ptype_flag in [MBR_BOOT_FLAG]: | ||
55 | 832 | flag_name = 'boot' | ||
56 | 833 | else: | ||
57 | 834 | # logical partitions are not tagged in data, however | ||
58 | 835 | # the partition number > 4 (ie, not primary nor extended) | ||
59 | 836 | if entry['number'] > 4: | ||
60 | 837 | flag_name = 'logical' | ||
61 | 833 | 838 | ||
62 | 834 | if flag_name: | 839 | if flag_name: |
63 | 835 | entry['flag'] = flag_name | 840 | entry['flag'] = flag_name |
64 | diff --git a/tests/data/probert_storage_msdos_mbr_extended_v2.json b/tests/data/probert_storage_msdos_mbr_extended_v2.json | |||
65 | 836 | new file mode 100644 | 841 | new file mode 100644 |
66 | index 0000000..4719f44 | |||
67 | --- /dev/null | |||
68 | +++ b/tests/data/probert_storage_msdos_mbr_extended_v2.json | |||
69 | @@ -0,0 +1,537 @@ | |||
70 | 1 | { | ||
71 | 2 | "dasd": {}, | ||
72 | 3 | "raid": {}, | ||
73 | 4 | "zfs": { | ||
74 | 5 | "zpools": {} | ||
75 | 6 | }, | ||
76 | 7 | "bcache": { | ||
77 | 8 | "backing": {}, | ||
78 | 9 | "caching": {} | ||
79 | 10 | }, | ||
80 | 11 | "filesystem": { | ||
81 | 12 | "/dev/vdb1": { | ||
82 | 13 | "TYPE": "vfat", | ||
83 | 14 | "USAGE": "filesystem", | ||
84 | 15 | "UUID": "5EB4-6065", | ||
85 | 16 | "UUID_ENC": "5EB4-6065", | ||
86 | 17 | "VERSION": "FAT32" | ||
87 | 18 | }, | ||
88 | 19 | "/dev/vdb5": { | ||
89 | 20 | "TYPE": "ext4", | ||
90 | 21 | "USAGE": "filesystem", | ||
91 | 22 | "UUID": "a55d4dc5-dacb-48af-b589-828ee55f5208", | ||
92 | 23 | "UUID_ENC": "a55d4dc5-dacb-48af-b589-828ee55f5208", | ||
93 | 24 | "VERSION": "1.0" | ||
94 | 25 | } | ||
95 | 26 | }, | ||
96 | 27 | "dmcrypt": {}, | ||
97 | 28 | "multipath": {}, | ||
98 | 29 | "blockdev": { | ||
99 | 30 | "/dev/vda": { | ||
100 | 31 | "DEVLINKS": "/dev/disk/by-path/virtio-pci-0000:00:08.0 /dev/disk/by-path/pci-0000:00:08.0", | ||
101 | 32 | "DEVNAME": "/dev/vda", | ||
102 | 33 | "DEVPATH": "/devices/pci0000:00/0000:00:08.0/virtio2/block/vda", | ||
103 | 34 | "DEVTYPE": "disk", | ||
104 | 35 | "ID_PATH": "pci-0000:00:08.0", | ||
105 | 36 | "ID_PATH_TAG": "pci-0000_00_08_0", | ||
106 | 37 | "MAJOR": "252", | ||
107 | 38 | "MINOR": "0", | ||
108 | 39 | "SUBSYSTEM": "block", | ||
109 | 40 | "TAGS": ":systemd:", | ||
110 | 41 | "USEC_INITIALIZED": "1159634", | ||
111 | 42 | "attrs": { | ||
112 | 43 | "alignment_offset": "0", | ||
113 | 44 | "bdi": null, | ||
114 | 45 | "cache_type": "write back", | ||
115 | 46 | "capability": "50", | ||
116 | 47 | "dev": "252:0", | ||
117 | 48 | "device": null, | ||
118 | 49 | "discard_alignment": "0", | ||
119 | 50 | "events": "", | ||
120 | 51 | "events_async": "", | ||
121 | 52 | "events_poll_msecs": "-1", | ||
122 | 53 | "ext_range": "256", | ||
123 | 54 | "hidden": "0", | ||
124 | 55 | "inflight": " 0 0", | ||
125 | 56 | "range": "16", | ||
126 | 57 | "removable": "0", | ||
127 | 58 | "ro": "0", | ||
128 | 59 | "serial": "", | ||
129 | 60 | "size": "21474836480", | ||
130 | 61 | "stat": " 490 0 22696 179 0 0 0 0 0 176 64 0 0 0 0", | ||
131 | 62 | "subsystem": "block", | ||
132 | 63 | "uevent": "MAJOR=252\nMINOR=0\nDEVNAME=vda\nDEVTYPE=disk" | ||
133 | 64 | } | ||
134 | 65 | }, | ||
135 | 66 | "/dev/vdb": { | ||
136 | 67 | "DEVLINKS": "/dev/disk/by-path/pci-0000:00:09.0 /dev/disk/by-path/virtio-pci-0000:00:09.0", | ||
137 | 68 | "DEVNAME": "/dev/vdb", | ||
138 | 69 | "DEVPATH": "/devices/pci0000:00/0000:00:09.0/virtio3/block/vdb", | ||
139 | 70 | "DEVTYPE": "disk", | ||
140 | 71 | "ID_PART_TABLE_TYPE": "dos", | ||
141 | 72 | "ID_PART_TABLE_UUID": "c72f0a19", | ||
142 | 73 | "ID_PATH": "pci-0000:00:09.0", | ||
143 | 74 | "ID_PATH_TAG": "pci-0000_00_09_0", | ||
144 | 75 | "MAJOR": "252", | ||
145 | 76 | "MINOR": "16", | ||
146 | 77 | "SUBSYSTEM": "block", | ||
147 | 78 | "TAGS": ":systemd:", | ||
148 | 79 | "USEC_INITIALIZED": "1133535", | ||
149 | 80 | "attrs": { | ||
150 | 81 | "alignment_offset": "0", | ||
151 | 82 | "bdi": null, | ||
152 | 83 | "cache_type": "write back", | ||
153 | 84 | "capability": "50", | ||
154 | 85 | "dev": "252:16", | ||
155 | 86 | "device": null, | ||
156 | 87 | "discard_alignment": "0", | ||
157 | 88 | "events": "", | ||
158 | 89 | "events_async": "", | ||
159 | 90 | "events_poll_msecs": "-1", | ||
160 | 91 | "ext_range": "256", | ||
161 | 92 | "hidden": "0", | ||
162 | 93 | "inflight": " 0 0", | ||
163 | 94 | "range": "16", | ||
164 | 95 | "removable": "0", | ||
165 | 96 | "ro": "0", | ||
166 | 97 | "serial": "", | ||
167 | 98 | "size": "10737418240", | ||
168 | 99 | "stat": " 609 0 39218 164 0 0 0 0 0 212 68 0 0 0 0", | ||
169 | 100 | "subsystem": "block", | ||
170 | 101 | "uevent": "MAJOR=252\nMINOR=16\nDEVNAME=vdb\nDEVTYPE=disk" | ||
171 | 102 | }, | ||
172 | 103 | "partitiontable": { | ||
173 | 104 | "label": "dos", | ||
174 | 105 | "id": "0xc72f0a19", | ||
175 | 106 | "device": "/dev/vdb", | ||
176 | 107 | "unit": "sectors", | ||
177 | 108 | "partitions": [ | ||
178 | 109 | { | ||
179 | 110 | "node": "/dev/vdb1", | ||
180 | 111 | "start": 2048, | ||
181 | 112 | "size": 1048576, | ||
182 | 113 | "type": "b", | ||
183 | 114 | "bootable": true | ||
184 | 115 | }, | ||
185 | 116 | { | ||
186 | 117 | "node": "/dev/vdb2", | ||
187 | 118 | "start": 1052670, | ||
188 | 119 | "size": 19916802, | ||
189 | 120 | "type": "5" | ||
190 | 121 | }, | ||
191 | 122 | { | ||
192 | 123 | "node": "/dev/vdb5", | ||
193 | 124 | "start": 1052672, | ||
194 | 125 | "size": 19916800, | ||
195 | 126 | "type": "83" | ||
196 | 127 | } | ||
197 | 128 | ] | ||
198 | 129 | } | ||
199 | 130 | }, | ||
200 | 131 | "/dev/vdb1": { | ||
201 | 132 | "DEVLINKS": "/dev/disk/by-partuuid/c72f0a19-01 /dev/disk/by-uuid/5EB4-6065 /dev/disk/by-path/virtio-pci-0000:00:09.0-part1 /dev/disk/by-path/pci-0000:00:09.0-part1", | ||
202 | 133 | "DEVNAME": "/dev/vdb1", | ||
203 | 134 | "DEVPATH": "/devices/pci0000:00/0000:00:09.0/virtio3/block/vdb/vdb1", | ||
204 | 135 | "DEVTYPE": "partition", | ||
205 | 136 | "ID_FS_TYPE": "vfat", | ||
206 | 137 | "ID_FS_USAGE": "filesystem", | ||
207 | 138 | "ID_FS_UUID": "5EB4-6065", | ||
208 | 139 | "ID_FS_UUID_ENC": "5EB4-6065", | ||
209 | 140 | "ID_FS_VERSION": "FAT32", | ||
210 | 141 | "ID_PART_ENTRY_DISK": "252:16", | ||
211 | 142 | "ID_PART_ENTRY_FLAGS": "0x80", | ||
212 | 143 | "ID_PART_ENTRY_NUMBER": "1", | ||
213 | 144 | "ID_PART_ENTRY_OFFSET": "2048", | ||
214 | 145 | "ID_PART_ENTRY_SCHEME": "dos", | ||
215 | 146 | "ID_PART_ENTRY_SIZE": "1048576", | ||
216 | 147 | "ID_PART_ENTRY_TYPE": "0xb", | ||
217 | 148 | "ID_PART_ENTRY_UUID": "c72f0a19-01", | ||
218 | 149 | "ID_PART_TABLE_TYPE": "dos", | ||
219 | 150 | "ID_PART_TABLE_UUID": "c72f0a19", | ||
220 | 151 | "ID_PATH": "pci-0000:00:09.0", | ||
221 | 152 | "ID_PATH_TAG": "pci-0000_00_09_0", | ||
222 | 153 | "ID_SCSI": "1", | ||
223 | 154 | "MAJOR": "252", | ||
224 | 155 | "MINOR": "17", | ||
225 | 156 | "PARTN": "1", | ||
226 | 157 | "SUBSYSTEM": "block", | ||
227 | 158 | "TAGS": ":systemd:", | ||
228 | 159 | "USEC_INITIALIZED": "1161634", | ||
229 | 160 | "attrs": { | ||
230 | 161 | "alignment_offset": "0", | ||
231 | 162 | "dev": "252:17", | ||
232 | 163 | "discard_alignment": "0", | ||
233 | 164 | "inflight": " 0 0", | ||
234 | 165 | "partition": "1", | ||
235 | 166 | "ro": "0", | ||
236 | 167 | "size": "536870912", | ||
237 | 168 | "start": "2048", | ||
238 | 169 | "stat": " 200 0 14424 72 0 0 0 0 0 104 44 0 0 0 0", | ||
239 | 170 | "subsystem": "block", | ||
240 | 171 | "uevent": "MAJOR=252\nMINOR=17\nDEVNAME=vdb1\nDEVTYPE=partition\nPARTN=1" | ||
241 | 172 | }, | ||
242 | 173 | "partitiontable": { | ||
243 | 174 | "label": "dos", | ||
244 | 175 | "id": "0x00000000", | ||
245 | 176 | "device": "/dev/vdb1", | ||
246 | 177 | "unit": "sectors", | ||
247 | 178 | "partitions": [] | ||
248 | 179 | } | ||
249 | 180 | }, | ||
250 | 181 | "/dev/vdb2": { | ||
251 | 182 | "DEVLINKS": "/dev/disk/by-path/pci-0000:00:09.0-part2 /dev/disk/by-path/virtio-pci-0000:00:09.0-part2 /dev/disk/by-partuuid/c72f0a19-02", | ||
252 | 183 | "DEVNAME": "/dev/vdb2", | ||
253 | 184 | "DEVPATH": "/devices/pci0000:00/0000:00:09.0/virtio3/block/vdb/vdb2", | ||
254 | 185 | "DEVTYPE": "partition", | ||
255 | 186 | "ID_PART_ENTRY_DISK": "252:16", | ||
256 | 187 | "ID_PART_ENTRY_NUMBER": "2", | ||
257 | 188 | "ID_PART_ENTRY_OFFSET": "1052670", | ||
258 | 189 | "ID_PART_ENTRY_SCHEME": "dos", | ||
259 | 190 | "ID_PART_ENTRY_SIZE": "19916802", | ||
260 | 191 | "ID_PART_ENTRY_TYPE": "0x5", | ||
261 | 192 | "ID_PART_ENTRY_UUID": "c72f0a19-02", | ||
262 | 193 | "ID_PART_TABLE_TYPE": "dos", | ||
263 | 194 | "ID_PART_TABLE_UUID": "e7ad4c09", | ||
264 | 195 | "ID_PATH": "pci-0000:00:09.0", | ||
265 | 196 | "ID_PATH_TAG": "pci-0000_00_09_0", | ||
266 | 197 | "ID_SCSI": "1", | ||
267 | 198 | "MAJOR": "252", | ||
268 | 199 | "MINOR": "18", | ||
269 | 200 | "PARTN": "2", | ||
270 | 201 | "SUBSYSTEM": "block", | ||
271 | 202 | "TAGS": ":systemd:", | ||
272 | 203 | "USEC_INITIALIZED": "1149403", | ||
273 | 204 | "attrs": { | ||
274 | 205 | "alignment_offset": "0", | ||
275 | 206 | "dev": "252:18", | ||
276 | 207 | "discard_alignment": "0", | ||
277 | 208 | "inflight": " 0 0", | ||
278 | 209 | "partition": "2", | ||
279 | 210 | "ro": "0", | ||
280 | 211 | "size": "1024", | ||
281 | 212 | "start": "1052670", | ||
282 | 213 | "stat": " 9 0 18 10 0 0 0 0 0 44 8 0 0 0 0", | ||
283 | 214 | "subsystem": "block", | ||
284 | 215 | "uevent": "MAJOR=252\nMINOR=18\nDEVNAME=vdb2\nDEVTYPE=partition\nPARTN=2" | ||
285 | 216 | }, | ||
286 | 217 | "partitiontable": { | ||
287 | 218 | "label": "dos", | ||
288 | 219 | "id": "0xe7ad4c09", | ||
289 | 220 | "device": "/dev/vdb2", | ||
290 | 221 | "unit": "sectors", | ||
291 | 222 | "grain": "512", | ||
292 | 223 | "partitions": [ | ||
293 | 224 | { | ||
294 | 225 | "node": "/dev/vdb2p1", | ||
295 | 226 | "start": 2, | ||
296 | 227 | "size": 19916800, | ||
297 | 228 | "type": "83" | ||
298 | 229 | } | ||
299 | 230 | ] | ||
300 | 231 | } | ||
301 | 232 | }, | ||
302 | 233 | "/dev/vdb5": { | ||
303 | 234 | "DEVLINKS": "/dev/disk/by-uuid/a55d4dc5-dacb-48af-b589-828ee55f5208 /dev/disk/by-path/pci-0000:00:09.0-part5 /dev/disk/by-partuuid/c72f0a19-05 /dev/disk/by-path/virtio-pci-0000:00:09.0-part5", | ||
304 | 235 | "DEVNAME": "/dev/vdb5", | ||
305 | 236 | "DEVPATH": "/devices/pci0000:00/0000:00:09.0/virtio3/block/vdb/vdb5", | ||
306 | 237 | "DEVTYPE": "partition", | ||
307 | 238 | "ID_FS_TYPE": "ext4", | ||
308 | 239 | "ID_FS_USAGE": "filesystem", | ||
309 | 240 | "ID_FS_UUID": "a55d4dc5-dacb-48af-b589-828ee55f5208", | ||
310 | 241 | "ID_FS_UUID_ENC": "a55d4dc5-dacb-48af-b589-828ee55f5208", | ||
311 | 242 | "ID_FS_VERSION": "1.0", | ||
312 | 243 | "ID_PART_ENTRY_DISK": "252:16", | ||
313 | 244 | "ID_PART_ENTRY_NUMBER": "5", | ||
314 | 245 | "ID_PART_ENTRY_OFFSET": "1052672", | ||
315 | 246 | "ID_PART_ENTRY_SCHEME": "dos", | ||
316 | 247 | "ID_PART_ENTRY_SIZE": "19916800", | ||
317 | 248 | "ID_PART_ENTRY_TYPE": "0x83", | ||
318 | 249 | "ID_PART_ENTRY_UUID": "c72f0a19-05", | ||
319 | 250 | "ID_PART_TABLE_TYPE": "dos", | ||
320 | 251 | "ID_PART_TABLE_UUID": "c72f0a19", | ||
321 | 252 | "ID_PATH": "pci-0000:00:09.0", | ||
322 | 253 | "ID_PATH_TAG": "pci-0000_00_09_0", | ||
323 | 254 | "ID_SCSI": "1", | ||
324 | 255 | "MAJOR": "252", | ||
325 | 256 | "MINOR": "21", | ||
326 | 257 | "PARTN": "5", | ||
327 | 258 | "SUBSYSTEM": "block", | ||
328 | 259 | "TAGS": ":systemd:", | ||
329 | 260 | "USEC_INITIALIZED": "1155916", | ||
330 | 261 | "attrs": { | ||
331 | 262 | "alignment_offset": "0", | ||
332 | 263 | "dev": "252:21", | ||
333 | 264 | "discard_alignment": "0", | ||
334 | 265 | "inflight": " 0 0", | ||
335 | 266 | "partition": "5", | ||
336 | 267 | "ro": "0", | ||
337 | 268 | "size": "10197401600", | ||
338 | 269 | "start": "1052672", | ||
339 | 270 | "stat": " 202 0 14888 36 0 0 0 0 0 108 8 0 0 0 0", | ||
340 | 271 | "subsystem": "block", | ||
341 | 272 | "uevent": "MAJOR=252\nMINOR=21\nDEVNAME=vdb5\nDEVTYPE=partition\nPARTN=5" | ||
342 | 273 | } | ||
343 | 274 | } | ||
344 | 275 | }, | ||
345 | 276 | "lvm": {}, | ||
346 | 277 | "mount": [ | ||
347 | 278 | { | ||
348 | 279 | "target": "/", | ||
349 | 280 | "source": "/cow", | ||
350 | 281 | "fstype": "overlay", | ||
351 | 282 | "options": "rw,relatime,lowerdir=/installer.squashfs:/filesystem.squashfs,upperdir=/cow/upper,workdir=/cow/work", | ||
352 | 283 | "children": [ | ||
353 | 284 | { | ||
354 | 285 | "target": "/sys", | ||
355 | 286 | "source": "sysfs", | ||
356 | 287 | "fstype": "sysfs", | ||
357 | 288 | "options": "rw,nosuid,nodev,noexec,relatime", | ||
358 | 289 | "children": [ | ||
359 | 290 | { | ||
360 | 291 | "target": "/sys/kernel/security", | ||
361 | 292 | "source": "securityfs", | ||
362 | 293 | "fstype": "securityfs", | ||
363 | 294 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
364 | 295 | }, | ||
365 | 296 | { | ||
366 | 297 | "target": "/sys/fs/cgroup", | ||
367 | 298 | "source": "tmpfs", | ||
368 | 299 | "fstype": "tmpfs", | ||
369 | 300 | "options": "ro,nosuid,nodev,noexec,mode=755", | ||
370 | 301 | "children": [ | ||
371 | 302 | { | ||
372 | 303 | "target": "/sys/fs/cgroup/unified", | ||
373 | 304 | "source": "cgroup2", | ||
374 | 305 | "fstype": "cgroup2", | ||
375 | 306 | "options": "rw,nosuid,nodev,noexec,relatime,nsdelegate" | ||
376 | 307 | }, | ||
377 | 308 | { | ||
378 | 309 | "target": "/sys/fs/cgroup/systemd", | ||
379 | 310 | "source": "cgroup", | ||
380 | 311 | "fstype": "cgroup", | ||
381 | 312 | "options": "rw,nosuid,nodev,noexec,relatime,xattr,name=systemd" | ||
382 | 313 | }, | ||
383 | 314 | { | ||
384 | 315 | "target": "/sys/fs/cgroup/rdma", | ||
385 | 316 | "source": "cgroup", | ||
386 | 317 | "fstype": "cgroup", | ||
387 | 318 | "options": "rw,nosuid,nodev,noexec,relatime,rdma" | ||
388 | 319 | }, | ||
389 | 320 | { | ||
390 | 321 | "target": "/sys/fs/cgroup/cpu,cpuacct", | ||
391 | 322 | "source": "cgroup", | ||
392 | 323 | "fstype": "cgroup", | ||
393 | 324 | "options": "rw,nosuid,nodev,noexec,relatime,cpu,cpuacct" | ||
394 | 325 | }, | ||
395 | 326 | { | ||
396 | 327 | "target": "/sys/fs/cgroup/net_cls,net_prio", | ||
397 | 328 | "source": "cgroup", | ||
398 | 329 | "fstype": "cgroup", | ||
399 | 330 | "options": "rw,nosuid,nodev,noexec,relatime,net_cls,net_prio" | ||
400 | 331 | }, | ||
401 | 332 | { | ||
402 | 333 | "target": "/sys/fs/cgroup/hugetlb", | ||
403 | 334 | "source": "cgroup", | ||
404 | 335 | "fstype": "cgroup", | ||
405 | 336 | "options": "rw,nosuid,nodev,noexec,relatime,hugetlb" | ||
406 | 337 | }, | ||
407 | 338 | { | ||
408 | 339 | "target": "/sys/fs/cgroup/pids", | ||
409 | 340 | "source": "cgroup", | ||
410 | 341 | "fstype": "cgroup", | ||
411 | 342 | "options": "rw,nosuid,nodev,noexec,relatime,pids" | ||
412 | 343 | }, | ||
413 | 344 | { | ||
414 | 345 | "target": "/sys/fs/cgroup/blkio", | ||
415 | 346 | "source": "cgroup", | ||
416 | 347 | "fstype": "cgroup", | ||
417 | 348 | "options": "rw,nosuid,nodev,noexec,relatime,blkio" | ||
418 | 349 | }, | ||
419 | 350 | { | ||
420 | 351 | "target": "/sys/fs/cgroup/memory", | ||
421 | 352 | "source": "cgroup", | ||
422 | 353 | "fstype": "cgroup", | ||
423 | 354 | "options": "rw,nosuid,nodev,noexec,relatime,memory" | ||
424 | 355 | }, | ||
425 | 356 | { | ||
426 | 357 | "target": "/sys/fs/cgroup/cpuset", | ||
427 | 358 | "source": "cgroup", | ||
428 | 359 | "fstype": "cgroup", | ||
429 | 360 | "options": "rw,nosuid,nodev,noexec,relatime,cpuset" | ||
430 | 361 | }, | ||
431 | 362 | { | ||
432 | 363 | "target": "/sys/fs/cgroup/freezer", | ||
433 | 364 | "source": "cgroup", | ||
434 | 365 | "fstype": "cgroup", | ||
435 | 366 | "options": "rw,nosuid,nodev,noexec,relatime,freezer" | ||
436 | 367 | }, | ||
437 | 368 | { | ||
438 | 369 | "target": "/sys/fs/cgroup/devices", | ||
439 | 370 | "source": "cgroup", | ||
440 | 371 | "fstype": "cgroup", | ||
441 | 372 | "options": "rw,nosuid,nodev,noexec,relatime,devices" | ||
442 | 373 | }, | ||
443 | 374 | { | ||
444 | 375 | "target": "/sys/fs/cgroup/perf_event", | ||
445 | 376 | "source": "cgroup", | ||
446 | 377 | "fstype": "cgroup", | ||
447 | 378 | "options": "rw,nosuid,nodev,noexec,relatime,perf_event" | ||
448 | 379 | } | ||
449 | 380 | ] | ||
450 | 381 | }, | ||
451 | 382 | { | ||
452 | 383 | "target": "/sys/fs/pstore", | ||
453 | 384 | "source": "pstore", | ||
454 | 385 | "fstype": "pstore", | ||
455 | 386 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
456 | 387 | }, | ||
457 | 388 | { | ||
458 | 389 | "target": "/sys/firmware/efi/efivars", | ||
459 | 390 | "source": "efivarfs", | ||
460 | 391 | "fstype": "efivarfs", | ||
461 | 392 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
462 | 393 | }, | ||
463 | 394 | { | ||
464 | 395 | "target": "/sys/fs/bpf", | ||
465 | 396 | "source": "none", | ||
466 | 397 | "fstype": "bpf", | ||
467 | 398 | "options": "rw,nosuid,nodev,noexec,relatime,mode=700" | ||
468 | 399 | }, | ||
469 | 400 | { | ||
470 | 401 | "target": "/sys/kernel/debug", | ||
471 | 402 | "source": "debugfs", | ||
472 | 403 | "fstype": "debugfs", | ||
473 | 404 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
474 | 405 | }, | ||
475 | 406 | { | ||
476 | 407 | "target": "/sys/kernel/tracing", | ||
477 | 408 | "source": "tracefs", | ||
478 | 409 | "fstype": "tracefs", | ||
479 | 410 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
480 | 411 | }, | ||
481 | 412 | { | ||
482 | 413 | "target": "/sys/fs/fuse/connections", | ||
483 | 414 | "source": "fusectl", | ||
484 | 415 | "fstype": "fusectl", | ||
485 | 416 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
486 | 417 | }, | ||
487 | 418 | { | ||
488 | 419 | "target": "/sys/kernel/config", | ||
489 | 420 | "source": "configfs", | ||
490 | 421 | "fstype": "configfs", | ||
491 | 422 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
492 | 423 | } | ||
493 | 424 | ] | ||
494 | 425 | }, | ||
495 | 426 | { | ||
496 | 427 | "target": "/proc", | ||
497 | 428 | "source": "proc", | ||
498 | 429 | "fstype": "proc", | ||
499 | 430 | "options": "rw,nosuid,nodev,noexec,relatime", | ||
500 | 431 | "children": [ | ||
501 | 432 | { | ||
502 | 433 | "target": "/proc/sys/fs/binfmt_misc", | ||
503 | 434 | "source": "systemd-1", | ||
504 | 435 | "fstype": "autofs", | ||
505 | 436 | "options": "rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18206" | ||
506 | 437 | } | ||
507 | 438 | ] | ||
508 | 439 | }, | ||
509 | 440 | { | ||
510 | 441 | "target": "/dev", | ||
511 | 442 | "source": "udev", | ||
512 | 443 | "fstype": "devtmpfs", | ||
513 | 444 | "options": "rw,nosuid,noexec,relatime,size=1969872k,nr_inodes=492468,mode=755", | ||
514 | 445 | "children": [ | ||
515 | 446 | { | ||
516 | 447 | "target": "/dev/pts", | ||
517 | 448 | "source": "devpts", | ||
518 | 449 | "fstype": "devpts", | ||
519 | 450 | "options": "rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000" | ||
520 | 451 | }, | ||
521 | 452 | { | ||
522 | 453 | "target": "/dev/shm", | ||
523 | 454 | "source": "tmpfs", | ||
524 | 455 | "fstype": "tmpfs", | ||
525 | 456 | "options": "rw,nosuid,nodev" | ||
526 | 457 | }, | ||
527 | 458 | { | ||
528 | 459 | "target": "/dev/mqueue", | ||
529 | 460 | "source": "mqueue", | ||
530 | 461 | "fstype": "mqueue", | ||
531 | 462 | "options": "rw,nosuid,nodev,noexec,relatime" | ||
532 | 463 | }, | ||
533 | 464 | { | ||
534 | 465 | "target": "/dev/hugepages", | ||
535 | 466 | "source": "hugetlbfs", | ||
536 | 467 | "fstype": "hugetlbfs", | ||
537 | 468 | "options": "rw,relatime,pagesize=2M" | ||
538 | 469 | } | ||
539 | 470 | ] | ||
540 | 471 | }, | ||
541 | 472 | { | ||
542 | 473 | "target": "/run", | ||
543 | 474 | "source": "tmpfs", | ||
544 | 475 | "fstype": "tmpfs", | ||
545 | 476 | "options": "rw,nosuid,nodev,noexec,relatime,size=402820k,mode=755", | ||
546 | 477 | "children": [ | ||
547 | 478 | { | ||
548 | 479 | "target": "/run/lock", | ||
549 | 480 | "source": "tmpfs", | ||
550 | 481 | "fstype": "tmpfs", | ||
551 | 482 | "options": "rw,nosuid,nodev,noexec,relatime,size=5120k" | ||
552 | 483 | } | ||
553 | 484 | ] | ||
554 | 485 | }, | ||
555 | 486 | { | ||
556 | 487 | "target": "/cdrom", | ||
557 | 488 | "source": "/dev/loop0", | ||
558 | 489 | "fstype": "iso9660", | ||
559 | 490 | "options": "ro,relatime,nojoliet,check=s,map=n,blocksize=2048" | ||
560 | 491 | }, | ||
561 | 492 | { | ||
562 | 493 | "target": "/rofs", | ||
563 | 494 | "source": "/dev/loop1", | ||
564 | 495 | "fstype": "squashfs", | ||
565 | 496 | "options": "ro,noatime" | ||
566 | 497 | }, | ||
567 | 498 | { | ||
568 | 499 | "target": "/usr/lib/modules", | ||
569 | 500 | "source": "/dev/loop3", | ||
570 | 501 | "fstype": "squashfs", | ||
571 | 502 | "options": "ro,relatime" | ||
572 | 503 | }, | ||
573 | 504 | { | ||
574 | 505 | "target": "/media/filesystem", | ||
575 | 506 | "source": "/dev/loop1", | ||
576 | 507 | "fstype": "squashfs", | ||
577 | 508 | "options": "ro,relatime" | ||
578 | 509 | }, | ||
579 | 510 | { | ||
580 | 511 | "target": "/tmp", | ||
581 | 512 | "source": "tmpfs", | ||
582 | 513 | "fstype": "tmpfs", | ||
583 | 514 | "options": "rw,nosuid,nodev,relatime" | ||
584 | 515 | }, | ||
585 | 516 | { | ||
586 | 517 | "target": "/snap/core/8935", | ||
587 | 518 | "source": "/dev/loop4", | ||
588 | 519 | "fstype": "squashfs", | ||
589 | 520 | "options": "ro,nodev,relatime" | ||
590 | 521 | }, | ||
591 | 522 | { | ||
592 | 523 | "target": "/snap/subiquity/1626", | ||
593 | 524 | "source": "/dev/loop5", | ||
594 | 525 | "fstype": "squashfs", | ||
595 | 526 | "options": "ro,nodev,relatime" | ||
596 | 527 | }, | ||
597 | 528 | { | ||
598 | 529 | "target": "/snap/subiquity/1632", | ||
599 | 530 | "source": "/dev/loop6", | ||
600 | 531 | "fstype": "squashfs", | ||
601 | 532 | "options": "ro,nodev,relatime" | ||
602 | 533 | } | ||
603 | 534 | ] | ||
604 | 535 | } | ||
605 | 536 | ] | ||
606 | 537 | } | ||
607 | diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py | |||
608 | index 4cc9299..b768cdc 100644 | |||
609 | --- a/tests/unittests/test_commands_block_meta.py | |||
610 | +++ b/tests/unittests/test_commands_block_meta.py | |||
611 | @@ -2446,4 +2446,115 @@ class TestVerifySize(CiTestCase): | |||
612 | 2446 | self.devpath = self.random_string() | 2446 | self.devpath = self.random_string() |
613 | 2447 | 2447 | ||
614 | 2448 | 2448 | ||
615 | 2449 | class TestVerifyPtableFlag(CiTestCase): | ||
616 | 2450 | |||
617 | 2451 | def setUp(self): | ||
618 | 2452 | super(TestVerifyPtableFlag, self).setUp() | ||
619 | 2453 | base = 'curtin.commands.block_meta.' | ||
620 | 2454 | self.add_patch(base + 'block.sfdisk_info', 'm_block_sfdisk_info') | ||
621 | 2455 | self.add_patch(base + 'block.get_blockdev_for_partition', | ||
622 | 2456 | 'm_block_get_blockdev_for_partition') | ||
623 | 2457 | self.sfdisk_info_dos = { | ||
624 | 2458 | "label": "dos", | ||
625 | 2459 | "id": "0xb0dbdde1", | ||
626 | 2460 | "device": "/dev/vdb", | ||
627 | 2461 | "unit": "sectors", | ||
628 | 2462 | "partitions": [ | ||
629 | 2463 | {"node": "/dev/vdb1", "start": 2048, "size": 8388608, | ||
630 | 2464 | "type": "83", "bootable": True}, | ||
631 | 2465 | {"node": "/dev/vdb2", "start": 8390656, "size": 8388608, | ||
632 | 2466 | "type": "83"}, | ||
633 | 2467 | {"node": "/dev/vdb3", "start": 16779264, "size": 62914560, | ||
634 | 2468 | "type": "85"}, | ||
635 | 2469 | {"node": "/dev/vdb5", "start": 16781312, "size": 31457280, | ||
636 | 2470 | "type": "83"}, | ||
637 | 2471 | {"node": "/dev/vdb6", "start": 48240640, "size": 10485760, | ||
638 | 2472 | "type": "83"}, | ||
639 | 2473 | {"node": "/dev/vdb7", "start": 58728448, "size": 20965376, | ||
640 | 2474 | "type": "83"}]} | ||
641 | 2475 | self.sfdisk_info_gpt = { | ||
642 | 2476 | "label": "gpt", | ||
643 | 2477 | "id": "AEA37E20-8E52-4B37-BDFD-9946A352A37B", | ||
644 | 2478 | "device": "/dev/vda", | ||
645 | 2479 | "unit": "sectors", | ||
646 | 2480 | "firstlba": 34, | ||
647 | 2481 | "lastlba": 41943006, | ||
648 | 2482 | "partitions": [ | ||
649 | 2483 | {"node": "/dev/vda1", "start": 227328, "size": 41715679, | ||
650 | 2484 | "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", | ||
651 | 2485 | "uuid": "42C72DE9-FF5E-4CD6-A4C8-283685DEB1D5"}, | ||
652 | 2486 | {"node": "/dev/vda14", "start": 2048, "size": 8192, | ||
653 | 2487 | "type": "21686148-6449-6E6F-744E-656564454649", | ||
654 | 2488 | "uuid": "762F070A-122A-4EB8-90BF-2CA6E9171B01"}, | ||
655 | 2489 | {"node": "/dev/vda15", "start": 10240, "size": 217088, | ||
656 | 2490 | "type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", | ||
657 | 2491 | "uuid": "789133C6-8579-4792-9D61-FC9A7BEC2A15"}]} | ||
658 | 2492 | |||
659 | 2493 | def test_verify_ptable_flag_finds_boot_on_gpt(self): | ||
660 | 2494 | devpath = '/dev/vda15' | ||
661 | 2495 | expected_flag = 'boot' | ||
662 | 2496 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
663 | 2497 | sfdisk_info=self.sfdisk_info_gpt) | ||
664 | 2498 | |||
665 | 2499 | def test_verify_ptable_flag_raises_exception_missing_flag(self): | ||
666 | 2500 | devpath = '/dev/vda1' | ||
667 | 2501 | expected_flag = 'boot' | ||
668 | 2502 | with self.assertRaises(RuntimeError): | ||
669 | 2503 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
670 | 2504 | sfdisk_info=self.sfdisk_info_gpt) | ||
671 | 2505 | |||
672 | 2506 | def test_verify_ptable_flag_raises_exception_invalid_flag(self): | ||
673 | 2507 | devpath = '/dev/vda1' | ||
674 | 2508 | expected_flag = self.random_string() | ||
675 | 2509 | self.assertNotIn(expected_flag, block_meta.SGDISK_FLAGS.keys()) | ||
676 | 2510 | self.assertNotIn(expected_flag, block_meta.MSDOS_FLAGS.keys()) | ||
677 | 2511 | with self.assertRaises(RuntimeError): | ||
678 | 2512 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
679 | 2513 | sfdisk_info=self.sfdisk_info_gpt) | ||
680 | 2514 | |||
681 | 2515 | def test_verify_ptable_flag_checks_bootable_not_table_type(self): | ||
682 | 2516 | devpath = '/dev/vdb1' | ||
683 | 2517 | expected_flag = 'boot' | ||
684 | 2518 | del self.sfdisk_info_dos['partitions'][0]['bootable'] | ||
685 | 2519 | self.sfdisk_info_dos['partitions'][0]['type'] = '0x80' | ||
686 | 2520 | with self.assertRaises(RuntimeError): | ||
687 | 2521 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
688 | 2522 | sfdisk_info=self.sfdisk_info_dos) | ||
689 | 2523 | |||
690 | 2524 | def test_verify_ptable_flag_calls_block_sfdisk_if_info_none(self): | ||
691 | 2525 | devpath = '/dev/vda15' | ||
692 | 2526 | expected_flag = 'boot' | ||
693 | 2527 | self.m_block_sfdisk_info.return_value = self.sfdisk_info_gpt | ||
694 | 2528 | block_meta.verify_ptable_flag(devpath, expected_flag, sfdisk_info=None) | ||
695 | 2529 | self.assertEqual( | ||
696 | 2530 | [call(devpath)], | ||
697 | 2531 | self.m_block_sfdisk_info.call_args_list) | ||
698 | 2532 | |||
699 | 2533 | def test_verify_ptable_flag_finds_boot_on_msdos(self): | ||
700 | 2534 | devpath = '/dev/vdb1' | ||
701 | 2535 | expected_flag = 'boot' | ||
702 | 2536 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
703 | 2537 | sfdisk_info=self.sfdisk_info_dos) | ||
704 | 2538 | |||
705 | 2539 | def test_verify_ptable_flag_finds_linux_on_dos_primary_partition(self): | ||
706 | 2540 | devpath = '/dev/vdb2' | ||
707 | 2541 | expected_flag = 'linux' | ||
708 | 2542 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
709 | 2543 | sfdisk_info=self.sfdisk_info_dos) | ||
710 | 2544 | |||
711 | 2545 | def test_verify_ptable_flag_finds_dos_extended_partition(self): | ||
712 | 2546 | devpath = '/dev/vdb3' | ||
713 | 2547 | expected_flag = 'extended' | ||
714 | 2548 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
715 | 2549 | sfdisk_info=self.sfdisk_info_dos) | ||
716 | 2550 | |||
717 | 2551 | def test_verify_ptable_flag_finds_dos_logical_partition(self): | ||
718 | 2552 | devpath = '/dev/vdb5' | ||
719 | 2553 | expected_flag = 'logical' | ||
720 | 2554 | self.m_block_get_blockdev_for_partition.return_value = ( | ||
721 | 2555 | ('/dev/vdb', '5')) | ||
722 | 2556 | block_meta.verify_ptable_flag(devpath, expected_flag, | ||
723 | 2557 | sfdisk_info=self.sfdisk_info_dos) | ||
724 | 2558 | |||
725 | 2559 | |||
726 | 2449 | # vi: ts=4 expandtab syntax=python | 2560 | # vi: ts=4 expandtab syntax=python |
727 | diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py | |||
728 | index ecdc565..a38f9cd 100644 | |||
729 | --- a/tests/unittests/test_storage_config.py | |||
730 | +++ b/tests/unittests/test_storage_config.py | |||
731 | @@ -405,6 +405,40 @@ class TestBlockdevParser(CiTestCase): | |||
732 | 405 | self.assertDictEqual(expected_dict, | 405 | self.assertDictEqual(expected_dict, |
733 | 406 | self.bdevp.asdict(blockdev)) | 406 | self.bdevp.asdict(blockdev)) |
734 | 407 | 407 | ||
735 | 408 | def test_blockdev_detects_dos_bootable_flag(self): | ||
736 | 409 | self.probe_data = _get_data( | ||
737 | 410 | 'probert_storage_msdos_mbr_extended_v2.json') | ||
738 | 411 | self.bdevp = BlockdevParser(self.probe_data) | ||
739 | 412 | blockdev = self.bdevp.blockdev_data['/dev/vdb1'] | ||
740 | 413 | expected_dict = { | ||
741 | 414 | 'id': 'partition-vdb1', | ||
742 | 415 | 'type': 'partition', | ||
743 | 416 | 'device': 'disk-vdb', | ||
744 | 417 | 'number': 1, | ||
745 | 418 | 'offset': 1048576, | ||
746 | 419 | 'size': 536870912, | ||
747 | 420 | 'flag': 'boot', | ||
748 | 421 | } | ||
749 | 422 | self.assertDictEqual(expected_dict, | ||
750 | 423 | self.bdevp.asdict(blockdev)) | ||
751 | 424 | |||
752 | 425 | def test_blockdev_detects_dos_bootable_flag_on_logical_partitions(self): | ||
753 | 426 | self.probe_data = _get_data('probert_storage_lvm.json') | ||
754 | 427 | self.bdevp = BlockdevParser(self.probe_data) | ||
755 | 428 | blockdev = self.bdevp.blockdev_data['/dev/vda5'] | ||
756 | 429 | blockdev['ID_PART_ENTRY_FLAGS'] = '0x80' | ||
757 | 430 | expected_dict = { | ||
758 | 431 | 'id': 'partition-vda5', | ||
759 | 432 | 'type': 'partition', | ||
760 | 433 | 'device': 'disk-vda', | ||
761 | 434 | 'number': 5, | ||
762 | 435 | 'offset': 3223322624, | ||
763 | 436 | 'size': 2147483648, | ||
764 | 437 | 'flag': 'boot', | ||
765 | 438 | } | ||
766 | 439 | self.assertDictEqual(expected_dict, | ||
767 | 440 | self.bdevp.asdict(blockdev)) | ||
768 | 441 | |||
769 | 408 | def test_blockdev_asdict_disk_omits_ptable_if_none_present(self): | 442 | def test_blockdev_asdict_disk_omits_ptable_if_none_present(self): |
770 | 409 | blockdev = self.bdevp.blockdev_data['/dev/sda'] | 443 | blockdev = self.bdevp.blockdev_data['/dev/sda'] |
771 | 410 | del blockdev['ID_PART_TABLE_TYPE'] | 444 | del blockdev['ID_PART_TABLE_TYPE'] |
PASSED: Continuous integration, rev:92d0d6b367d 8c1d97051cda34c 929e7d71a0295f /jenkins. ubuntu. com/server/ job/curtin- ci/111/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-amd64/ 111/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-arm64/ 111/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-ppc64el/ 111/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-s390x/ 111/
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/curtin- ci/111/ /rebuild
https:/