diff options
author | Ben Howard <ben.howard@canonical.com> | 2013-09-26 08:18:29 -0600 |
---|---|---|
committer | Ben Howard <ben.howard@canonical.com> | 2013-09-26 08:18:29 -0600 |
commit | b55a9606e9455056a4280b06ef3785964af6d3df (patch) | |
tree | e7f76449f5f1b26d2ced7afe8ef16610c6544bf8 /cloudinit | |
parent | 35469c11703b1df66b3b14ad06b583d672f39ff5 (diff) | |
download | vyos-cloud-init-b55a9606e9455056a4280b06ef3785964af6d3df.tar.gz vyos-cloud-init-b55a9606e9455056a4280b06ef3785964af6d3df.zip |
Added support for formating the ephemeral disk on Windows Azure.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index a77c3d9a..3f96a0a5 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -44,8 +44,17 @@ BUILTIN_DS_CONFIG = { 'policy': True, 'command': BOUNCE_COMMAND, 'hostname_command': 'hostname', - } + }, + 'ephemeral_disk': '/dev/sdb1', + 'disk_setup': { + 'ephemeral0': {'table_type': 'mbr', + 'layout': True, + 'overwrite': False} + }, + 'fs_setup': [{'filesystem': 'ext4', 'device': '/dev/sdb', + 'partition': 'auto'}], } + DS_CFG_PATH = ['datasource', DS_NAME] @@ -111,11 +120,22 @@ class DataSourceAzureNet(sources.DataSource): if seed: 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]) mycfg = self.ds_cfg + # Put the disk format elements into the config object + if 'disk_setup' in mycfg: + self.cfg['disk_setup'] = mycfg['disk_setup'] + + if 'fs_setup' in mycfg: + self.cfg['fs_setup'] = mycfg['fs_setup'] + + if 'ephemeral_disk' in mycfg: + self.cfg['ephemeral_disk'] = mycfg['ephemeral_disk'] + # walinux agent writes files world readable, but expects # the directory to be protected. write_files(mycfg['data_dir'], files, dirmode=0700) @@ -161,9 +181,12 @@ 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): + if 'ephemeral0' in name and 'ephemeral_disk' in self.cfg: + return self.cfg['ephemeral_disk'] + def get_config_obj(self): return self.cfg |