summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py6
-rw-r--r--tests/unittests/test_datasource/test_configdrive.py5
3 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 32f2a8d0..665557dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,8 @@
'Recommends' in the debian/control.in [Vlastimil Holer]
- if mount_info reports /dev/root is a device path for /, then convert
that to a device via help of kernel cmdline.
+ - configdrive: consider partitions as possible datasources if they have
+ theh correct filesystem label. [Paul Querna]
0.7.4:
- fix issue mounting 'ephemeral0' if ephemeral0 was an alias for a
partitioned block device with target filesystem on ephemeral0.1.
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 4f437244..2a244496 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -284,8 +284,10 @@ def find_candidate_devs():
# 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
diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py
index d5935294..3c1e8add 100644
--- a/tests/unittests/test_datasource/test_configdrive.py
+++ b/tests/unittests/test_datasource/test_configdrive.py
@@ -285,10 +285,11 @@ class TestConfigDriveDataSource(MockerTestCase):
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