Skip to content

bugfix/CSTACKEX-169: Fix enum case sensitive issues#53

Open
piyush5netapp wants to merge 1 commit intomainfrom
bugfix/CSTACKEX-169
Open

bugfix/CSTACKEX-169: Fix enum case sensitive issues#53
piyush5netapp wants to merge 1 commit intomainfrom
bugfix/CSTACKEX-169

Conversation

@piyush5netapp
Copy link
Copy Markdown

@piyush5netapp piyush5netapp commented Apr 28, 2026

Description

This PR...

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

By creating a VM instance. Here is snippet of logs.
2026-04-28 10:13:45,025 INFO [o.a.c.s.f.FeignConfiguration] (Work-Job-Executor-1:[ctx-a3544284, job-35/job-36, ctx-cd6a1c15]) (logid:cef3100b) Body: {"name":"/vol/testSAN1/ROOT_6","os_type":"linux","space":{"size":188743680},"svm":{"name":"WLMDB_VS1"}}
2026-04-28 10:13:45,075 DEBUG [o.a.c.s.f.FeignConfiguration] (Work-Job-Executor-1:[ctx-a3544284, job-35/job-36, ctx-cd6a1c15]) (logid:cef3100b) Decoding JSON response: {
"num_records": 1,
"records": [
{
"uuid": "16ac3c6e-4bf3-4581-9ce4-cf66add1f980",
"svm": {
"uuid": "df666364-5a1e-11ef-b9b5-00a098b4ac56",
"name": "WLMDB_VS1",
"_links": {
"self": {
"href": "/api/svm/svms/df666364-5a1e-11ef-b9b5-00a098b4ac56"
}
}
},
"name": "/vol/testSAN1/ROOT_6",
"location": {
"logical_unit": "ROOT_6",
"node": {
"name": "WFDB-node1",
"uuid": "b93df103-2a2b-11ef-b0c5-00a098b4ac56",
"_links": {
"self": {
"href": "/api/cluster/nodes/b93df103-2a2b-11ef-b0c5-00a098b4ac56"
}
}
},
"volume": {
"uuid": "26282889-42e2-11f1-bf0f-00a098b4ac56",
"name": "testSAN1",
"_links": {
"self": {
"href": "/api/storage/volumes/26282889-42e2-11f1-bf0f-00a098b4ac56"
}
}
}
},
"class": "regular",
"create_time": "2026-04-28T09:47:51+00:00",
"enabled": true,
"os_type": "linux",
"serial_number": "80C/e+WyWIF7",
"space": {
"scsi_thin_provisioning_support_enabled": false,
"size": 188743680,
"used": 0,
"guarantee": {
"requested": false,
"reserved": false
}
},
"status": {
"container_state": "online",
"mapped": false,
"read_only": false,
"state": "online"
},
"vvol": {
"is_bound": false
},
"_links": {
"self": {
"href": "/api/storage/luns/16ac3c6e-4bf3-4581-9ce4-cf66add1f980"
}
}
}
]
}
2026-04-28 10:13:45,080 DEBUG [o.a.c.s.s.UnifiedSANStrategy] (Work-Job-Executor-1:[ctx-a3544284, job-35/job-36, ctx-cd6a1c15]) (logid:cef3100b) createCloudStackVolume: LUN created successfully. Lun: class Lun {
autoDelete: null
propertyClass: regular
enabled: true
lunMaps: null
name: /vol/testSAN1/ROOT_6
osType: linux
serialNumber: 80C/e+WyWIF7
space: class LunSpace {
scsiThinProvisioningSupportEnabled: false
size: 188743680
used: 0
physicalUsed: null
}
svm: org.apache.cloudstack.storage.feign.model.Svm@3d3d1717
uuid: 16ac3c6e-4bf3-4581-9ce4-cf66add1f980
}

How did you try to break this feature and the system with this change?

if (text == null) return null;
for (ProtocolsEnum b : ProtocolsEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
if (b.value.equalsIgnoreCase(text)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause NPE if b.value is null.
Add null check for b.value or add a opposite condition like text.equalsIgnoreCase(b.value)

if (text == null) return null;
for (OsTypeEnum b : OsTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
if (b.value.equalsIgnoreCase(text)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause NPE if b.value is null.
Add null check for b.value or add a opposite condition like text.equalsIgnoreCase(b.value)

if (text == null) return null;
for (ProtocolEnum b : ProtocolEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
if (b.value.equalsIgnoreCase(text)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants