Merge ~mvoelker/cloud-init:id_vmware_openstack into cloud-init:master

Proposed by Mark T. Voelker
Status: Merged
Approved by: Ryan Harper
Approved revision: a79dc3374ab7681f344f2a74762b7924830df09f
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mvoelker/cloud-init:id_vmware_openstack
Merge into: cloud-init:master
Diff against target: 57 lines (+28/-0)
2 files modified
tests/unittests/test_ds_identify.py (+20/-0)
tools/ds-identify (+8/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Needs Fixing
Review via email: mp+367129@code.launchpad.net

Commit message

Allow identification of OpenStack by Asset Tag

When OpenStack is deployed on some hypervisors (such as VMware
vSphere), cloud-init doesn't detect that it needs to probe the
metadata service because the DMI product name field can't be set
to a field that is recognized by cloud-init. However, the asset
tag field can be set via flavor extra specs or image metadata.
A similar approach is already used to identify Open Telekom Cloud.

This patch allows cloud init to recognize "OpenStack Nova" or
"OpenStack Compute" in the asset tag field as an indication that
the instance being configured is running on an OpenStack platform.

LP: #1669875

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for putting up a patch for this.

I've added a comment below and I'd like to have you
add the following unittests for this change to your branch.

http://paste.ubuntu.com/p/ybhFdggWZY/

review: Needs Fixing
Revision history for this message
Mark T. Voelker (mvoelker) wrote :

Thanks for the suggestions Ryan! I'll touch it up once I get back to my
desk (I'm unfortunately traveling this week).

a79dc33... by Mark T. Voelker

Merge branch 'id_vmware_openstack' of ssh://git.launchpad.net/~mvoelker/cloud-init into id_vmware_openstack

Revision history for this message
Robert Schweikert (rjschwei) wrote :

We've also run into this with SLES in VMWare, can this be moved forward?

Revision history for this message
Ryan Harper (raharper) wrote :

I've pointed CI at this branch. Otherwise looks good to go.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

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

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/731/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/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
2index 8c18aa1..7575223 100644
3--- a/tests/unittests/test_ds_identify.py
4+++ b/tests/unittests/test_ds_identify.py
5@@ -435,6 +435,14 @@ class TestDsIdentify(DsIdentifyBase):
6 """Open Telecom identification."""
7 self._test_ds_found('OpenStack-OpenTelekom')
8
9+ def test_openstack_asset_tag_nova(self):
10+ """OpenStack identification via asset tag OpenStack Nova."""
11+ self._test_ds_found('OpenStack-AssetTag-Nova')
12+
13+ def test_openstack_asset_tag_copute(self):
14+ """OpenStack identification via asset tag OpenStack Compute."""
15+ self._test_ds_found('OpenStack-AssetTag-Compute')
16+
17 def test_openstack_on_non_intel_is_maybe(self):
18 """On non-Intel, openstack without dmi info is maybe.
19
20@@ -759,6 +767,18 @@ VALID_CFG = {
21 'files': {P_CHASSIS_ASSET_TAG: 'OpenTelekomCloud\n'},
22 'mocks': [MOCK_VIRT_IS_XEN],
23 },
24+ 'OpenStack-AssetTag-Nova': {
25+ # VMware vSphere can't modify product-name, LP: #1669875
26+ 'ds': 'OpenStack',
27+ 'files': {P_CHASSIS_ASSET_TAG: 'OpenStack Nova\n'},
28+ 'mocks': [MOCK_VIRT_IS_XEN],
29+ },
30+ 'OpenStack-AssetTag-Compute': {
31+ # VMware vSphere can't modify product-name, LP: #1669875
32+ 'ds': 'OpenStack',
33+ 'files': {P_CHASSIS_ASSET_TAG: 'OpenStack Compute\n'},
34+ 'mocks': [MOCK_VIRT_IS_XEN],
35+ },
36 'OVF-seed': {
37 'ds': 'OVF',
38 'files': {
39diff --git a/tools/ds-identify b/tools/ds-identify
40index 6518901..e16708f 100755
41--- a/tools/ds-identify
42+++ b/tools/ds-identify
43@@ -979,6 +979,14 @@ dscheck_OpenStack() {
44 return ${DS_FOUND}
45 fi
46
47+ # LP: #1669875 : allow identification of OpenStack by asset tag
48+ if dmi_chassis_asset_tag_matches "$nova"; then
49+ return ${DS_FOUND}
50+ fi
51+ if dmi_chassis_asset_tag_matches "$compute"; then
52+ return ${DS_FOUND}
53+ fi
54+
55 # LP: #1715241 : arch other than intel are not identified properly.
56 case "$DI_UNAME_MACHINE" in
57 i?86|x86_64) :;;

Subscribers

People subscribed via source and target branches