summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceAzure.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-09-09 20:31:30 -0400
committerScott Moser <smoser@ubuntu.com>2013-09-09 20:31:30 -0400
commit2a07fcd6444c7deb09063dff6b2f2d6e5385f355 (patch)
tree7cde52630c3fb03ad6b53b5339a527b1a86c278f /cloudinit/sources/DataSourceAzure.py
parent0f84bfe5e0f06872a866432178a5f19d04195d30 (diff)
parentc74d928cc681ee98d0a3893dbe1ee8ff5fe361de (diff)
downloadvyos-cloud-init-2a07fcd6444c7deb09063dff6b2f2d6e5385f355.tar.gz
vyos-cloud-init-2a07fcd6444c7deb09063dff6b2f2d6e5385f355.zip
Add support for reading 'random_seed' from data source.
A new field in the metadata has emerged on openstack config drive, one that provides a way to seed the linux random generator. This adds a 'random_seed' config module that writes and that it to /dev/urandom. Also added is support for reading that data on azure via the hyper-v acpi table data. In config drive datasource, it rewrites parts of the on_boot code to use a little helper class.
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r--cloudinit/sources/DataSourceAzure.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 66d7728b..a77c3d9a 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -106,6 +106,11 @@ class DataSourceAzureNet(sources.DataSource):
if found == ddir:
LOG.debug("using files cached in %s", ddir)
+ # azure / hyper-v provides random data here
+ seed = util.load_file("/sys/firmware/acpi/tables/OEM0", quiet=True)
+ 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])