Copilot commented on code in PR #13884:
URL: https://github.com/apache/cloudstack/pull/13884#discussion_r3925838794
##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -4576,7 +4575,7 @@ public Long getDiskIopsReadRate(final ServiceOffering
offering, final DiskOfferi
if ((diskOffering != null) && (diskOffering.getIopsReadRate() != null)
&& (diskOffering.getIopsReadRate() > 0)) {
return diskOffering.getIopsReadRate();
} else {
- Long iopsReadRate =
Long.parseLong(_configDao.getValue(Config.VmDiskThrottlingIopsReadRate.key()));
+ Long iopsReadRate =
Long.parseLong(_configDao.getValue(VmDiskThrottlingIopsReadRate.key()));
if ((iopsReadRate > 0) && ((offering == null) ||
(!offering.isSystemUse()))) {
return iopsReadRate;
Review Comment:
`Long.parseLong(_configDao.getValue(...))` can throw
NPE/NumberFormatException when the config key is missing/unset (e.g., before DB
upgrade inserts the new row), and it also bypasses the typed `ConfigKey`
default. Prefer using the `ConfigKey` typed accessor for iops throttling to
ensure a safe default.
This issue also appears on line 4590 of the same file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]