curtin block-meta selects first entry in unordered list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Cloud Archive |
Fix Released
|
High
|
Unassigned | ||
curtin |
Fix Released
|
High
|
Unassigned | ||
curtin (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Saucy |
Fix Released
|
High
|
Unassigned |
Bug Description
== Begin SRU Info ==
[Description]
Very stupidly, curtin obtained a list of unused devices in a dict where the key was the device shortname, and then selected the first device in that list to install to:
devices = {'sda': {'entry1': 'value1'}, 'sdb': {'entry2': 'value2'}}
selected = [f for f in devices][0]
The problem there is that the dict is not sorted.
The solution to correctly implement this simplistic heuristic is:
devices = {'sda': {'entry1': 'value1'}, 'sdb': {'entry2': 'value2'}}
selected = sorted([f for f in devices])[0]
[Impact]
By default, installs via curtin to a system with more than one disk were not reliably selecting the first disk for installation as intended. Selecting the wrong disk resulted in system not booting on reboot after installation.
[Test Case]
Deploy a system with curtin via MAAS and see it fail because it installs to /dev/sdd or /dev/sde (in the case there were 4 or 5 disks).
After fix, the install will be done to /dev/sda.
[Regression Potential]
Very low. curtin would correctly install the target device only randomly with the chance going down with each additional disk on the system. This correctly implements the simplistic behavior of "pick the first available device".
== End SRU Info ==
curtin block-meta gets a list of unused devices as a dict.
turns the dict to a list
and then takes [0]
but that is unsorted.
=== modified file 'curtin/
--- curtin/
+++ curtin/
@@ -57,7 +57,7 @@
available = [f for f in devices
- target = available[0]
+ target = sorted(
else:
Changed in curtin: | |
status: | New → Confirmed |
Changed in cloud-archive: | |
status: | New → Confirmed |
Changed in curtin (Ubuntu Saucy): | |
status: | New → In Progress |
description: | updated |
Changed in curtin: | |
importance: | Undecided → High |
Changed in cloud-archive: | |
importance: | Undecided → High |
Changed in curtin (Ubuntu): | |
importance: | Undecided → High |
Changed in curtin (Ubuntu Saucy): | |
importance: | Undecided → High |
Changed in curtin: | |
status: | Fix Committed → Fix Released |
Changed in cloud-archive: | |
status: | Fix Committed → Fix Released |
This bug was fixed in the package curtin - 0.1.0~bzr95- 0ubuntu1
--------------- bzr95-0ubuntu1) trusty; urgency=low
curtin (0.1.0~
* New upstream snapshot.
* fix bug in block-meta resulting in first disk not always being used
(LP: #1244026)
-- Scott Moser <email address hidden> Thu, 24 Oct 2013 01:41:47 -0400