diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-09-27 19:38:05 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-09-27 19:38:05 -0400 |
commit | cafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1 (patch) | |
tree | 25596b8dc52d4e355805dfdff2032763e57d73cc /cloudinit/sources/DataSourceAzure.py | |
parent | 4063358ec2f20bcff4328fb659cecbed668a9a48 (diff) | |
parent | fdf5a48420b670b4b07c745b2b80c1cb23f253db (diff) | |
download | vyos-cloud-init-cafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1.tar.gz vyos-cloud-init-cafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1.zip |
Enable filesystem creation on Azure, many disk_setup cleanups
There are a lot of cleanups here around Azure, SmartOS and disk_setup.
disk_setup correctly identifies disk "aliases" (block device mappings
from ec2), anywhere where you would use a device name.
You can also specify these mappings to the Azure or SmartOS datasource
in their datasource config (device_aliases).
Also, stop Azure from calling blkid repeatedly in its tests, which
really pounded my laptop.
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index a77c3d9a..7ba6cea8 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -44,8 +44,20 @@ BUILTIN_DS_CONFIG = { 'policy': True, 'command': BOUNCE_COMMAND, 'hostname_command': 'hostname', - } + }, + 'disk_aliases': {'ephemeral0': '/dev/sdb'}, } + +BUILTIN_CLOUD_CONFIG = { + 'disk_setup': { + 'ephemeral0': {'table_type': 'mbr', + 'layout': True, + 'overwrite': False} + }, + 'fs_setup': [{'filesystem': 'ext4', 'device': 'ephemeral0', + 'partition': 'auto'}], +} + DS_CFG_PATH = ['datasource', DS_NAME] @@ -94,7 +106,7 @@ class DataSourceAzureNet(sources.DataSource): (md, self.userdata_raw, cfg, files) = ret self.seed = cdev self.metadata = util.mergemanydict([md, DEFAULT_METADATA]) - self.cfg = cfg + self.cfg = util.mergemanydict([cfg, BUILTIN_CLOUD_CONFIG]) found = cdev LOG.debug("found datasource in %s", cdev) @@ -112,8 +124,8 @@ class DataSourceAzureNet(sources.DataSource): self.metadata['random_seed'] = seed # now update ds_cfg to reflect contents pass in config - usercfg = util.get_cfg_by_path(self.cfg, DS_CFG_PATH, {}) - self.ds_cfg = util.mergemanydict([usercfg, self.ds_cfg]) + user_ds_cfg = util.get_cfg_by_path(self.cfg, DS_CFG_PATH, {}) + self.ds_cfg = util.mergemanydict([user_ds_cfg, self.ds_cfg]) mycfg = self.ds_cfg # walinux agent writes files world readable, but expects @@ -161,9 +173,11 @@ class DataSourceAzureNet(sources.DataSource): pubkeys = pubkeys_from_crt_files(fp_files) self.metadata['public-keys'] = pubkeys - return True + def device_name_to_device(self, name): + return self.ds_cfg['disk_aliases'].get(name) + def get_config_obj(self): return self.cfg @@ -349,7 +363,7 @@ def read_azure_ovf(contents): try: dom = minidom.parseString(contents) except Exception as e: - raise NonAzureDataSource("invalid xml: %s" % e) + raise BrokenAzureDataSource("invalid xml: %s" % e) results = find_child(dom.documentElement, lambda n: n.localName == "ProvisioningSection") |