From 8e5b1fef27fa715e9ff8ef0130ada4869f8258e6 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 9 Sep 2013 17:09:43 -0400 Subject: add support for reading random_seed on azure also. --- cloudinit/sources/DataSourceAzure.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cloudinit/sources/DataSourceAzure.py') diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 66d7728b..7c50de4c 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -106,6 +106,14 @@ class DataSourceAzureNet(sources.DataSource): if found == ddir: LOG.debug("using files cached in %s", ddir) + rseedf = "/sys/firmware/acpi/tables/OEM0" + if os.path.isfile(rseedf): + try: + with open(rseedf, "rb") as fp: + self.metadata['random_seed'] = fp.read() + except: + LOG.warn("random seed '%s' existed but read failed", rseedf) + # 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]) -- cgit v1.2.3 From c74d928cc681ee98d0a3893dbe1ee8ff5fe361de Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 9 Sep 2013 19:44:50 -0400 Subject: populate random_seed in azure data source Azure provides a random bit of data at '/sys/firmware/acpi/tables/OEM0'. The walinux calls this "Entropy in ACPI table provided by Hyper-V". --- cloudinit/sources/DataSourceAzure.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'cloudinit/sources/DataSourceAzure.py') diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 7c50de4c..a77c3d9a 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -106,13 +106,10 @@ class DataSourceAzureNet(sources.DataSource): if found == ddir: LOG.debug("using files cached in %s", ddir) - rseedf = "/sys/firmware/acpi/tables/OEM0" - if os.path.isfile(rseedf): - try: - with open(rseedf, "rb") as fp: - self.metadata['random_seed'] = fp.read() - except: - LOG.warn("random seed '%s' existed but read failed", rseedf) + # 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, {}) -- cgit v1.2.3