Skip to content

Commit 7f9f33d

Browse files
authored
Identify SAP Converged Cloud as OpenStack
add SAP Converged Cloud as cloud provider
1 parent 4403962 commit 7f9f33d

File tree

6 files changed

+39
-3
lines changed

6 files changed

+39
-3
lines changed

cloudinit/apport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
'OVF',
3737
'RbxCloud - (HyperOne, Rootbox, Rubikon)',
3838
'OpenTelekomCloud',
39+
'SAP Converged Cloud',
3940
'Scaleway',
4041
'SmartOS',
4142
'VMware',

cloudinit/sources/DataSourceOpenStack.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
DMI_PRODUCT_COMPUTE = 'OpenStack Compute'
3030
VALID_DMI_PRODUCT_NAMES = [DMI_PRODUCT_NOVA, DMI_PRODUCT_COMPUTE]
3131
DMI_ASSET_TAG_OPENTELEKOM = 'OpenTelekomCloud'
32-
VALID_DMI_ASSET_TAGS = [DMI_ASSET_TAG_OPENTELEKOM]
32+
# See github.com/sapcc/helm-charts/blob/master/openstack/nova/values.yaml
33+
# -> compute.defaults.vmware.smbios_asset_tag for this value
34+
DMI_ASSET_TAG_SAPCCLOUD = 'SAP CCloud VM'
35+
VALID_DMI_ASSET_TAGS = [DMI_ASSET_TAG_OPENTELEKOM, DMI_ASSET_TAG_SAPCCLOUD]
3336

3437

3538
class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):

doc/rtd/topics/datasources/openstack.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ checks the following environment attributes as a potential OpenStack platform:
1919

2020
* **/proc/1/environ**: Nova-lxd contains *product_name=OpenStack Nova*
2121
* **DMI product_name**: Either *Openstack Nova* or *OpenStack Compute*
22-
* **DMI chassis_asset_tag** is *OpenTelekomCloud* or *OpenStack Nova*
23-
(since 19.2) or *OpenStack Compute* (since 19.2)
22+
* **DMI chassis_asset_tag** is *OpenTelekomCloud*, *SAP CCloud VM*,
23+
*OpenStack Nova* (since 19.2) or *OpenStack Compute* (since 19.2)
2424

2525

2626
Configuration

tests/unittests/test_datasource/test_openstack.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,24 @@ def fake_dmi_read(dmi_key):
509509
ds.detect_openstack(),
510510
'Expected detect_openstack == True on OpenTelekomCloud')
511511

512+
@test_helpers.mock.patch(MOCK_PATH + 'util.read_dmi_data')
513+
def test_detect_openstack_sapccloud_chassis_asset_tag(self, m_dmi,
514+
m_is_x86):
515+
"""Return True on OpenStack reporting SAP CCloud VM asset-tag."""
516+
m_is_x86.return_value = True
517+
518+
def fake_dmi_read(dmi_key):
519+
if dmi_key == 'system-product-name':
520+
return 'VMware Virtual Platform' # SAP CCloud uses VMware
521+
if dmi_key == 'chassis-asset-tag':
522+
return 'SAP CCloud VM'
523+
assert False, 'Unexpected dmi read of %s' % dmi_key
524+
525+
m_dmi.side_effect = fake_dmi_read
526+
self.assertTrue(
527+
ds.detect_openstack(),
528+
'Expected detect_openstack == True on SAP CCloud VM')
529+
512530
@test_helpers.mock.patch(MOCK_PATH + 'util.read_dmi_data')
513531
def test_detect_openstack_oraclecloud_chassis_asset_tag(self, m_dmi,
514532
m_is_x86):

tests/unittests/test_ds_identify.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ def test_openstack_open_telekom_cloud(self):
447447
"""Open Telecom identification."""
448448
self._test_ds_found('OpenStack-OpenTelekom')
449449

450+
def test_openstack_sap_ccloud(self):
451+
"""SAP Converged Cloud identification"""
452+
self._test_ds_found('OpenStack-SAPCCloud')
453+
450454
def test_openstack_asset_tag_nova(self):
451455
"""OpenStack identification via asset tag OpenStack Nova."""
452456
self._test_ds_found('OpenStack-AssetTag-Nova')
@@ -834,6 +838,12 @@ def _print_run_output(rc, out, err, cfg, files):
834838
'files': {P_CHASSIS_ASSET_TAG: 'OpenTelekomCloud\n'},
835839
'mocks': [MOCK_VIRT_IS_XEN],
836840
},
841+
'OpenStack-SAPCCloud': {
842+
# SAP CCloud hosts use OpenStack on VMware
843+
'ds': 'OpenStack',
844+
'files': {P_CHASSIS_ASSET_TAG: 'SAP CCloud VM\n'},
845+
'mocks': [MOCK_VIRT_IS_VMWARE],
846+
},
837847
'OpenStack-AssetTag-Nova': {
838848
# VMware vSphere can't modify product-name, LP: #1669875
839849
'ds': 'OpenStack',

tools/ds-identify

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,10 @@ dscheck_OpenStack() {
10621062
return ${DS_FOUND}
10631063
fi
10641064

1065+
if dmi_chassis_asset_tag_matches "SAP CCloud VM"; then
1066+
return ${DS_FOUND}
1067+
fi
1068+
10651069
# LP: #1669875 : allow identification of OpenStack by asset tag
10661070
if dmi_chassis_asset_tag_matches "$nova"; then
10671071
return ${DS_FOUND}

0 commit comments

Comments
 (0)