** Description changed:

+ == 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/commands/block_meta.py'
  --- curtin/commands/block_meta.py       2013-09-17 00:46:22 +0000
  +++ curtin/commands/block_meta.py       2013-10-24 03:07:37 +0000
  @@ -57,7 +57,7 @@
-                       "using first found")
-          available = [f for f in devices
-                       if block.is_valid_device(f)]
+                       "using first found")
+          available = [f for f in devices
+                       if block.is_valid_device(f)]
  -        target = available[0]
  +        target = sorted(available)[0]
-          LOG.warn("mode is 'simple'. multiple devices given. using '%s' "
-                   "(first available)", target)
-      else:
+          LOG.warn("mode is 'simple'. multiple devices given. using '%s' "
+                   "(first available)", target)
+      else:

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1244026

Title:
  curtin block-meta selects first entry in unordered list

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1244026/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to