Merge ~chad.smith/cloud-init:bug/1784685-oracle-detect-openstack-local into cloud-init:master

Proposed by Chad Smith
Status: Merged
Approved by: Scott Moser
Approved revision: 150cbf8d2a687c3689ccfb2aac95f461b949ef54
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~chad.smith/cloud-init:bug/1784685-oracle-detect-openstack-local
Merge into: cloud-init:master
Diff against target: 43 lines (+20/-1)
2 files modified
cloudinit/sources/DataSourceOpenStack.py (+2/-1)
tests/unittests/test_datasource/test_openstack.py (+18/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Approve
Review via email: mp+351920@code.launchpad.net

Commit message

oracle: fix detect_openstack to report True on OracleCloud.com DMI data

The OpenStack datasource in 18.3 changed to detect data in the
init-local stage instead of init-network and attempted to redetect
OpenStackLocal datasource on Oracle across reboots. The function
detect_openstack was added to quickly detect whether a platform is
OpenStack based on dmi product_name or chassis_asset_tag and it was
a bit too strict for Oracle in checking for 'OpenStack Nova'/'Compute'
DMI product_name.

Oracle's DMI product_name reports 'SAtandard PC (i440FX + PIIX, 1996)'
and DMI chassis_asset_tag is 'OracleCloud.com'.

detect_openstack function now adds 'OracleCloud.com' as a supported value
'OracleCloud.com' to valid chassis-asset-tags for the OpenStack
datasource.

LP: #1784685

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:150cbf8d2a687c3689ccfb2aac95f461b949ef54
https://jenkins.ubuntu.com/server/job/cloud-init-ci/177/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/177/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
2index 365af96..b9ade90 100644
3--- a/cloudinit/sources/DataSourceOpenStack.py
4+++ b/cloudinit/sources/DataSourceOpenStack.py
5@@ -28,7 +28,8 @@ DMI_PRODUCT_NOVA = 'OpenStack Nova'
6 DMI_PRODUCT_COMPUTE = 'OpenStack Compute'
7 VALID_DMI_PRODUCT_NAMES = [DMI_PRODUCT_NOVA, DMI_PRODUCT_COMPUTE]
8 DMI_ASSET_TAG_OPENTELEKOM = 'OpenTelekomCloud'
9-VALID_DMI_ASSET_TAGS = [DMI_ASSET_TAG_OPENTELEKOM]
10+DMI_ASSET_TAG_ORACLE_CLOUD = 'OracleCloud.com'
11+VALID_DMI_ASSET_TAGS = [DMI_ASSET_TAG_OPENTELEKOM, DMI_ASSET_TAG_ORACLE_CLOUD]
12
13
14 class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
15diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py
16index 585acc3..d862f4b 100644
17--- a/tests/unittests/test_datasource/test_openstack.py
18+++ b/tests/unittests/test_datasource/test_openstack.py
19@@ -510,6 +510,24 @@ class TestDetectOpenStack(test_helpers.CiTestCase):
20 ds.detect_openstack(),
21 'Expected detect_openstack == True on OpenTelekomCloud')
22
23+ @test_helpers.mock.patch(MOCK_PATH + 'util.read_dmi_data')
24+ def test_detect_openstack_oraclecloud_chassis_asset_tag(self, m_dmi,
25+ m_is_x86):
26+ """Return True on OpenStack reporting Oracle cloud asset-tag."""
27+ m_is_x86.return_value = True
28+
29+ def fake_dmi_read(dmi_key):
30+ if dmi_key == 'system-product-name':
31+ return 'Standard PC (i440FX + PIIX, 1996)' # No match
32+ if dmi_key == 'chassis-asset-tag':
33+ return 'OracleCloud.com'
34+ assert False, 'Unexpected dmi read of %s' % dmi_key
35+
36+ m_dmi.side_effect = fake_dmi_read
37+ self.assertTrue(
38+ ds.detect_openstack(),
39+ 'Expected detect_openstack == True on OracleCloud.com')
40+
41 @test_helpers.mock.patch(MOCK_PATH + 'util.get_proc_env')
42 @test_helpers.mock.patch(MOCK_PATH + 'util.read_dmi_data')
43 def test_detect_openstack_by_proc_1_environ(self, m_dmi, m_proc_env,

Subscribers

People subscribed via source and target branches