diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-10-04 16:16:12 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-10-04 16:16:12 -0400 |
commit | 4846bff62e1a5e8f4edd216f900c27c55a319c5b (patch) | |
tree | da010c9059b07c03bafe5e02b4c0887cfcd9339b /cloudinit/config | |
parent | 7b5480e46e14c6e31492e0a1e9ef4eb05a9d746d (diff) | |
download | vyos-cloud-init-4846bff62e1a5e8f4edd216f900c27c55a319c5b.tar.gz vyos-cloud-init-4846bff62e1a5e8f4edd216f900c27c55a319c5b.zip |
simplifications and some function renames
Diffstat (limited to 'cloudinit/config')
-rw-r--r-- | cloudinit/config/cc_disk_setup.py | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py index 5faffefc..e903dd4d 100644 --- a/cloudinit/config/cc_disk_setup.py +++ b/cloudinit/config/cc_disk_setup.py @@ -94,15 +94,6 @@ def update_disk_setup_devices(disk_setup, tformer): LOG.debug("updated disk_setup device entry '%s' to '%s'", origname, transformed) -def reset_part_definition(definition, value): - if not value and 'partition' in definition: - definition['opartition'] = definition['partition'] - del definition['partition'] - - else: - definition['partition'] = value - - return definition def update_fs_setup_devices(disk_setup, tformer): # update 'fs_setup' dictionary anywhere were a device may occur @@ -117,38 +108,19 @@ def update_fs_setup_devices(disk_setup, tformer): if origname is None: continue - transformed = None - if len(origname.split('.')) == 2: - # this maps ephemeralX.Y to a proper disk name. For example, - # if the origname is 'ephemeral0.1' and transformed is /dev/sdb - # then the returned device will be /dev/sdb1 _if_ /dev/sdb1 exists - # otherwise NONE - base_name, partition = origname.split('.') - tformed = tformer(base_name) - LOG.info("base device for %s is %s" % (origname, tformed)) + (dev, part) = util.expand_dotted_devname(origname) - if partition == "0": - transformed = tformed - definition = reset_part_definition(definition, None) - - elif partition in ("auto", "any"): - definition = reset_part_definition(definition, partition) - transformed = tformed - - else: - definition = reset_part_definition(definition, None) - transformed = util.map_device_alias(tformed, alias=origname) - LOG.info("%s is mapped to %s" % (origname, transformed)) - - else: - transformed = tformer(origname) - - if transformed is None or transformed == origname: - continue + tformed = tformer(dev) + if tformed is not None: + dev = tformed + LOG.debug("%s is mapped to disk=%s part=%s", + origname, tformed, part) + definition['_origname'] = origname + definition['device'] = tformed - LOG.info("Mapped %s to physical device %s" % (origname, transformed)) - definition['_origname'] = origname - definition['device'] = transformed + if part and 'partition' in definition: + definition['_partition'] = definition['partition'] + definition['partition'] = part def value_splitter(values, start=None): |