Config 'vm.network.nic.max.secondary.ipaddresses' - Sync default value (and value if not set) to 10 as per the config description and default value in parseInt of the config (#11256)

This commit is contained in:
Suresh Kumar Anaparti 2025-07-25 14:43:33 +05:30 committed by GitHub
parent 074f75838e
commit ae50103704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,10 @@
ALTER TABLE `cloud`.`backup_schedule` ADD COLUMN `max_backups` int(8) default NULL COMMENT 'maximum number of backups to maintain';
ALTER TABLE `cloud`.`backups` ADD COLUMN `backup_interval_type` int(5) COMMENT 'type of backup, e.g. manual, recurring - hourly, daily, weekly or monthly';
-- Update default value for the config 'vm.network.nic.max.secondary.ipaddresses' (and value to default value if value is null)
UPDATE `cloud`.`configuration` SET default_value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses';
UPDATE `cloud`.`configuration` SET value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses' AND value IS NULL;
-- Add console_endpoint_creator_address column to cloud.console_session table
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.console_session', 'console_endpoint_creator_address', 'VARCHAR(45)');

View File

@ -395,7 +395,7 @@ public enum Config {
null),
MaxNumberOfSecondaryIPsPerNIC(
"Network", ManagementServer.class, Integer.class,
"vm.network.nic.max.secondary.ipaddresses", "256",
"vm.network.nic.max.secondary.ipaddresses", "10",
"Specify the number of secondary ip addresses per nic per vm. Default value 10 is used, if not specified.", null),
EnableServiceMonitoring(

View File

@ -910,7 +910,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
throw new InvalidParameterValueException("Invalid network id is given");
}
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), 10);
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), Integer.parseInt(Config.MaxNumberOfSecondaryIPsPerNIC.getDefaultValue()));
Long nicWiseIpCount = _nicSecondaryIpDao.countByNicId(nicId);
if (nicWiseIpCount.intValue() >= maxAllowedIpsPerNic) {
logger.error("Maximum Number of Ips \"vm.network.nic.max.secondary.ipaddresses = \"{} per Nic has been crossed for the nic {}.", maxAllowedIpsPerNic, nicVO);