Skip to content

Commit 9171ee7

Browse files
us0310306holmanb
authored andcommitted
feat: Identify Samsung Cloud Platform as OpenStack (canonical#5924)
1 parent e2a0e7b commit 9171ee7

File tree

7 files changed

+41
-2
lines changed

7 files changed

+41
-2
lines changed

cloudinit/apport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"OVF",
5757
"RbxCloud - (HyperOne, Rootbox, Rubikon)",
5858
"OpenTelekomCloud",
59+
"Samsung Cloud Platform",
5960
"SAP Converged Cloud",
6061
"Scaleway",
6162
"SmartOS",

cloudinit/sources/DataSourceOpenStack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
# -> compute.defaults.vmware.smbios_asset_tag for this value
3232
DMI_ASSET_TAG_SAPCCLOUD = "SAP CCloud VM"
3333
DMI_ASSET_TAG_HUAWEICLOUD = "HUAWEICLOUD"
34+
DMI_ASSET_TAG_SAMSUNGCLOUDPLATFORM = "Samsung Cloud Platform"
3435
VALID_DMI_ASSET_TAGS = VALID_DMI_PRODUCT_NAMES
3536
VALID_DMI_ASSET_TAGS += [
3637
DMI_ASSET_TAG_HUAWEICLOUD,
3738
DMI_ASSET_TAG_OPENTELEKOM,
39+
DMI_ASSET_TAG_SAMSUNGCLOUDPLATFORM,
3840
DMI_ASSET_TAG_SAPCCLOUD,
3941
]
4042

doc/rtd/reference/datasources/openstack.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ checks the following environment attributes as a potential OpenStack platform:
2121
``product_name=OpenStack Nova``.
2222
* ``DMI product_name``: Either ``Openstack Nova`` or ``OpenStack Compute``.
2323
* ``DMI chassis_asset_tag`` is ``HUAWEICLOUD``, ``OpenTelekomCloud``,
24-
``SAP CCloud VM``, ``OpenStack Nova`` (since 19.2) or
25-
``OpenStack Compute`` (since 19.2).
24+
``SAP CCloud VM``, ``Samsung Cloud Platform``,
25+
``OpenStack Nova`` (since 19.2) or ``OpenStack Compute`` (since 19.2).
2626

2727
Configuration
2828
=============

tests/unittests/sources/test_openstack.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,27 @@ def fake_asset_tag_dmi_read(dmi_key):
687687
"Expected ds_detect == True on Huawei Cloud VM",
688688
)
689689

690+
@test_helpers.mock.patch(MOCK_PATH + "dmi.read_dmi_data")
691+
def test_ds_detect_samsung_cloud_platform_chassis_asset_tag(
692+
self, m_dmi, m_is_x86
693+
):
694+
"""Return True on OpenStack reporting
695+
Samsung Cloud Platform VM asset-tag."""
696+
m_is_x86.return_value = True
697+
698+
def fake_asset_tag_dmi_read(dmi_key):
699+
if dmi_key == "system-product-name":
700+
return "c7.large.2" # No match
701+
if dmi_key == "chassis-asset-tag":
702+
return "Samsung Cloud Platform"
703+
assert False, "Unexpected dmi read of %s" % dmi_key
704+
705+
m_dmi.side_effect = fake_asset_tag_dmi_read
706+
self.assertTrue(
707+
self._fake_ds().ds_detect(),
708+
"Expected ds_detect == True on Samsung Cloud Platform VM",
709+
)
710+
690711
@test_helpers.mock.patch(MOCK_PATH + "dmi.read_dmi_data")
691712
def test_ds_detect_oraclecloud_chassis_asset_tag(self, m_dmi, m_is_x86):
692713
"""Return True on OpenStack reporting Oracle cloud asset-tag."""

tests/unittests/test_ds_identify.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,10 @@ def test_openstack_huawei_cloud(self):
934934
"""Open Huawei Cloud identification."""
935935
self._test_ds_found("OpenStack-HuaweiCloud")
936936

937+
def test_openstack_samsung_cloud_platform(self):
938+
"""Open Samsung Cloud Platform identification."""
939+
self._test_ds_found("OpenStack-SamsungCloudPlatform")
940+
937941
def test_openstack_asset_tag_nova(self):
938942
"""OpenStack identification via asset tag OpenStack Nova."""
939943
self._test_ds_found("OpenStack-AssetTag-Nova")
@@ -2120,6 +2124,12 @@ def _print_run_output(rc, out, err, cfg, files):
21202124
"files": {P_CHASSIS_ASSET_TAG: "HUAWEICLOUD\n"},
21212125
"mocks": [MOCK_VIRT_IS_KVM],
21222126
},
2127+
"OpenStack-SamsungCloudPlatform": {
2128+
# Samsung Cloud Platform hosts use OpenStack
2129+
"ds": "OpenStack",
2130+
"files": {P_CHASSIS_ASSET_TAG: "Samsung Cloud Platform\n"},
2131+
"mocks": [MOCK_VIRT_IS_KVM],
2132+
},
21232133
"OpenStack-AssetTag-Nova": {
21242134
# VMware vSphere can't modify product-name, LP: #1669875
21252135
"ds": "OpenStack",

tools/.github-cla-signers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ tsanghan
202202
tSU-RooT
203203
tyb-truth
204204
tylerschultz
205+
us0310306
205206
vorlonofportland
206207
vteratipally
207208
Vultaire

tools/ds-identify

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,10 @@ dscheck_OpenStack() {
14621462
return ${DS_FOUND}
14631463
fi
14641464

1465+
if dmi_chassis_asset_tag_matches "Samsung Cloud Platform"; then
1466+
return ${DS_FOUND}
1467+
fi
1468+
14651469
# LP: #1669875 : allow identification of OpenStack by asset tag
14661470
if dmi_chassis_asset_tag_matches "$nova"; then
14671471
return ${DS_FOUND}

0 commit comments

Comments
 (0)