summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_disk_setup.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-22 15:17:10 -0400
committerScott Moser <smoser@ubuntu.com>2015-07-22 15:17:10 -0400
commitd68b340f8a6abf40f4d5cb546c91122c8856aa83 (patch)
tree8b617c3adcb7afaa6f535918429e6a064fccd5e1 /cloudinit/config/cc_disk_setup.py
parentde18aa66ad5cfdff5e0e25ae4f8f7a0328021b5b (diff)
parent452ea086beb8b28b41f5ccc610f4e5433010e35b (diff)
downloadvyos-cloud-init-d68b340f8a6abf40f4d5cb546c91122c8856aa83.tar.gz
vyos-cloud-init-d68b340f8a6abf40f4d5cb546c91122c8856aa83.zip
mounts: support reliably detecting and using Azure ephemeral disks
Azure's ephemeral disks are not guaranteed to be assigned the same name by the kernel every boot. This causes problems on ~2% of Azure instances, and can be fixed by using udev rules to give us a deterministic path to mount; this patch introduces those udev rules and modifies the Azure data source to use them. Changes to a couple of config modules were also required. In some places, they just needed to learn to dereference symlinks. In cc_mounts this wasn't sufficient because the dereferenced device would have been put in /etc/fstab (rather defeating the point of using the udev rules in the first place). A fairly hefty refactor was required to separate "is this a valid block device?" from "what shall I put in fstab?". LP: #1411582
Diffstat (limited to 'cloudinit/config/cc_disk_setup.py')
-rw-r--r--cloudinit/config/cc_disk_setup.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py
index e2ce6db4..d5b0d1d7 100644
--- a/cloudinit/config/cc_disk_setup.py
+++ b/cloudinit/config/cc_disk_setup.py
@@ -648,6 +648,8 @@ def mkpart(device, definition):
table_type: Which partition table to use, defaults to MBR
device: the device to work on.
"""
+ # ensure that we get a real device rather than a symbolic link
+ device = os.path.realpath(device)
LOG.debug("Checking values for %s definition" % device)
overwrite = definition.get('overwrite', False)
@@ -745,6 +747,9 @@ def mkfs(fs_cfg):
fs_replace = fs_cfg.get('replace_fs', False)
overwrite = fs_cfg.get('overwrite', False)
+ # ensure that we get a real device rather than a symbolic link
+ device = os.path.realpath(device)
+
# This allows you to define the default ephemeral or swap
LOG.debug("Checking %s against default devices", device)