summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_mounts.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-07-21 13:06:11 +0100
committerDaniel Watkins <daniel.watkins@canonical.com>2015-07-21 13:06:11 +0100
commitedc46ee7192376af65640a81c39335ebdfd196b6 (patch)
treeceeeff30704dbc3f07f0b2a072e22a3825e0c33f /cloudinit/config/cc_mounts.py
parent55487d9eb52343bd72271b072734740b52b25c1d (diff)
downloadvyos-cloud-init-edc46ee7192376af65640a81c39335ebdfd196b6.tar.gz
vyos-cloud-init-edc46ee7192376af65640a81c39335ebdfd196b6.zip
Extend disk_setup and mounts to handle /dev/disk symlinks.
Diffstat (limited to 'cloudinit/config/cc_mounts.py')
-rw-r--r--cloudinit/config/cc_mounts.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index f970c2ca..73b42f91 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -49,7 +49,8 @@ def is_meta_device_name(name):
def _get_nth_partition_for_device(device_path, partition_number):
- potential_suffixes = [str(partition_number), 'p%s' % (partition_number,)]
+ potential_suffixes = [str(partition_number), 'p%s' % (partition_number,),
+ '-part%s' % (partition_number,)]
for suffix in potential_suffixes:
potential_partition_device = '%s%s' % (device_path, suffix)
if os.path.exists(potential_partition_device):
@@ -58,10 +59,11 @@ def _get_nth_partition_for_device(device_path, partition_number):
def _is_block_device(device_path, partition_path=None):
- device_name = device_path.split('/')[-1]
+ device_name = os.path.realpath(device_path).split('/')[-1]
sys_path = os.path.join('/sys/block/', device_name)
if partition_path is not None:
- sys_path = os.path.join(sys_path, partition_path.split('/')[-1])
+ sys_path = os.path.join(
+ sys_path, os.path.realpath(partition_path).split('/')[-1])
return os.path.exists(sys_path)