← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~pquerna/cloud-init/allow-configdrive-in-partitions-v2 into lp:cloud-init

 

Paul Querna has proposed merging lp:~pquerna/cloud-init/allow-configdrive-in-partitions-v2 into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~pquerna/cloud-init/allow-configdrive-in-partitions-v2/+merge/201104

This change removes the filtering of partitions from potential ConfigDrive sources, if the LABEL of the partition is set to "config-2".

This is useful for a bare metal device. It may not have a separate device for ConfigDrive, but instead have a ConfigDrive available on a partition.
-- 
https://code.launchpad.net/~pquerna/cloud-init/allow-configdrive-in-partitions-v2/+merge/201104
Your team cloud init development team is requested to review the proposed merge of lp:~pquerna/cloud-init/allow-configdrive-in-partitions-v2 into lp:cloud-init.
=== modified file 'cloudinit/sources/DataSourceConfigDrive.py'
--- cloudinit/sources/DataSourceConfigDrive.py	2013-09-04 06:51:51 +0000
+++ cloudinit/sources/DataSourceConfigDrive.py	2014-01-09 21:21:06 +0000
@@ -284,8 +284,10 @@
     # followed by fstype items, but with dupes removed
     combined = (by_label + [d for d in by_fstype if d not in by_label])
 
-    # We are looking for block device (sda, not sda1), ignore partitions
-    combined = [d for d in combined if not util.is_partition(d)]
+    # We are looking for a block device or partition with necessary label or
+    # an unpartitioned block device.
+    combined = [d for d in combined
+                    if d in by_label or not util.is_partition(d)]
 
     return combined
 

=== modified file 'tests/unittests/test_datasource/test_configdrive.py'
--- tests/unittests/test_datasource/test_configdrive.py	2013-03-26 21:48:40 +0000
+++ tests/unittests/test_datasource/test_configdrive.py	2014-01-09 21:21:06 +0000
@@ -285,10 +285,11 @@
             self.assertEqual(["/dev/vdb", "/dev/zdd"],
                              ds.find_candidate_devs())
 
-            # verify that partitions are not considered
+            # verify that partitions are considered, but only if they have a label.
             devs_with_answers = {"TYPE=vfat": ["/dev/sda1"],
                 "TYPE=iso9660": [], "LABEL=config-2": ["/dev/vdb3"]}
-            self.assertEqual([], ds.find_candidate_devs())
+            self.assertEqual(["/dev/vdb3"],
+                              ds.find_candidate_devs())
 
         finally:
             util.find_devs_with = orig_find_devs_with


Follow ups