Skip to content

Commit d494a2c

Browse files
committed
feat: Identify Samsung Cloud Platform as OpenStack
1 parent 2d847f5 commit d494a2c

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ 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
24+
``SAP CCloud VM``, ``Samsung Cloud Platform``, ``OpenStack Nova`` (since 19.2) or
2525
``OpenStack Compute`` (since 19.2).
2626

2727
Configuration

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
@@ -928,6 +928,10 @@ def test_openstack_huawei_cloud(self):
928928
"""Open Huawei Cloud identification."""
929929
self._test_ds_found("OpenStack-HuaweiCloud")
930930

931+
def test_openstack_samsung_cloud_platform(self):
932+
"""Open Samsung Cloud Platform identification."""
933+
self._test_ds_found("OpenStack-SamsungCloudPlatform")
934+
931935
def test_openstack_asset_tag_nova(self):
932936
"""OpenStack identification via asset tag OpenStack Nova."""
933937
self._test_ds_found("OpenStack-AssetTag-Nova")
@@ -2076,6 +2080,12 @@ def _print_run_output(rc, out, err, cfg, files):
20762080
"files": {P_CHASSIS_ASSET_TAG: "HUAWEICLOUD\n"},
20772081
"mocks": [MOCK_VIRT_IS_KVM],
20782082
},
2083+
"OpenStack-SamsungCloudPlatform": {
2084+
# Samsung Cloud Platform hosts use OpenStack
2085+
"ds": "OpenStack",
2086+
"files": {P_CHASSIS_ASSET_TAG: "Samsung Cloud Platform\n"},
2087+
"mocks": [MOCK_VIRT_IS_KVM],
2088+
},
20792089
"OpenStack-AssetTag-Nova": {
20802090
# VMware vSphere can't modify product-name, LP: #1669875
20812091
"ds": "OpenStack",

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)