From ea88f3e1208ba501b50d1f41187b83cf11f15785 Mon Sep 17 00:00:00 2001 From: Ben Howard Date: Wed, 2 Oct 2013 15:05:15 -0600 Subject: Added ability to define disks via 'ephemeralX.Y'. Modified cc_mounts to identify whether ephermalX is partitioned. Changed datasources for Azure and SmartOS to use 'ephemeralX.Y' format. Added disk remove functionally --- doc/examples/cloud-config-disk-setup.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/examples/cloud-config-disk-setup.txt b/doc/examples/cloud-config-disk-setup.txt index 3fc47699..bc6e1923 100644 --- a/doc/examples/cloud-config-disk-setup.txt +++ b/doc/examples/cloud-config-disk-setup.txt @@ -30,8 +30,8 @@ disk_setup: fs_setup: - label: ephemeral0 filesystem: ext4 - device: ephemeral0 - partition: auto + device: ephemeral0.1 + replace_fs: ntfs Default disk definitions for SmartOS @@ -47,8 +47,7 @@ disk_setup: fs_setup: - label: ephemeral0 filesystem: ext3 - device: ephemeral0 - partition: auto + device: ephemeral0.0 Cavaut for SmartOS: if ephemeral disk is not defined, then the disk will not be automatically added to the mounts. @@ -187,6 +186,9 @@ Where: label as 'ephemeralX' otherwise there may be issues with the mounting of the ephemeral storage layer. + If you define the device as 'ephemeralX.Y' then Y will be interpetted + as a partition value. However, ephermalX.0 is the _same_ as ephemeralX. + : The valid options are: "auto|any": tell cloud-init not to care whether there is a partition or not. Auto will use the first partition that does not contain a -- cgit v1.2.3 From 7b5480e46e14c6e31492e0a1e9ef4eb05a9d746d Mon Sep 17 00:00:00 2001 From: Ben Howard Date: Thu, 3 Oct 2013 17:30:57 -0600 Subject: Added support for 'ephmeral0.' for device mappings in disk formating support. --- cloudinit/config/cc_disk_setup.py | 27 +++++++++++++++++++++++---- doc/examples/cloud-config-disk-setup.txt | 11 ++++++++++- 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py index 127b5879..5faffefc 100644 --- a/cloudinit/config/cc_disk_setup.py +++ b/cloudinit/config/cc_disk_setup.py @@ -94,6 +94,15 @@ 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 @@ -109,17 +118,27 @@ def update_fs_setup_devices(disk_setup, tformer): continue transformed = None - if len(origname.split('.')) > 1: + 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 = origname.split('.')[0] + base_name, partition = origname.split('.') tformed = tformer(base_name) LOG.info("base device for %s is %s" % (origname, tformed)) - transformed = util.map_device_alias(tformed, alias=origname) - LOG.info("%s is mapped to %s" % (origname, transformed)) + 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) diff --git a/doc/examples/cloud-config-disk-setup.txt b/doc/examples/cloud-config-disk-setup.txt index bc6e1923..6ad61c33 100644 --- a/doc/examples/cloud-config-disk-setup.txt +++ b/doc/examples/cloud-config-disk-setup.txt @@ -170,6 +170,7 @@ The general format is: device: partition: overwrite: + replace_fs: Where: