diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-05 16:19:14 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-05 16:19:14 -0700 |
commit | 8ff6ba4aaef8fc9a6b5c522cf26854e93f9107f0 (patch) | |
tree | b105fcb9b00ececdaee1cf56969783c91dbcd491 /cloudinit/sources/__init__.py | |
parent | cb30e7ed56e2c26e654d1703d3f44495a160c6eb (diff) | |
parent | 40a54a4f4a486bc196ee0eac53ef630c828aef8e (diff) | |
download | vyos-cloud-init-8ff6ba4aaef8fc9a6b5c522cf26854e93f9107f0.tar.gz vyos-cloud-init-8ff6ba4aaef8fc9a6b5c522cf26854e93f9107f0.zip |
Bring in the config drive fixes so that
it adjusts the fstab correctly and adds
tests in that verify the actions that
should happen (also tested on a real
system).
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r-- | cloudinit/sources/__init__.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py index 04083d0c..b22369a8 100644 --- a/cloudinit/sources/__init__.py +++ b/cloudinit/sources/__init__.py @@ -23,6 +23,7 @@ from email.mime.multipart import MIMEMultipart import abc +import os from cloudinit import importer from cloudinit import log as logging @@ -128,6 +129,22 @@ class DataSource(object): return keys + def _remap_device(self, short_name): + # LP: #611137 + # the metadata service may believe that devices are named 'sda' + # when the kernel named them 'vda' or 'xvda' + # we want to return the correct value for what will actually + # exist in this instance + mappings = {"sd": ("vd", "xvd")} + for (nfrom, tlist) in mappings.iteritems(): + if not short_name.startswith(nfrom): + continue + for nto in tlist: + cand = "/dev/%s%s" % (nto, short_name[len(nfrom):]) + if os.path.exists(cand): + return cand + return None + def device_name_to_device(self, _name): # translate a 'name' to a device # the primary function at this point is on ec2 |