Skip to content

Commit 64ef74f

Browse files
sureshanapartidhslove
authored andcommitted
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 (apache#11256)
1 parent 41676eb commit 64ef74f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
ALTER TABLE `cloud`.`backup_schedule` ADD COLUMN `max_backups` int(8) default NULL COMMENT 'maximum number of backups to maintain';
2424
ALTER TABLE `cloud`.`backups` ADD COLUMN `backup_interval_type` int(5) COMMENT 'type of backup, e.g. manual, recurring - hourly, daily, weekly or monthly';
2525

26+
-- Update default value for the config 'vm.network.nic.max.secondary.ipaddresses' (and value to default value if value is null)
27+
UPDATE `cloud`.`configuration` SET default_value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses';
28+
UPDATE `cloud`.`configuration` SET value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses' AND value IS NULL;
29+
2630
-- Add console_endpoint_creator_address column to cloud.console_session table
2731
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.console_session', 'console_endpoint_creator_address', 'VARCHAR(45)');
2832

server/src/main/java/com/cloud/configuration/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public enum Config {
411411
null),
412412
MaxNumberOfSecondaryIPsPerNIC(
413413
"Network", ManagementServer.class, Integer.class,
414-
"vm.network.nic.max.secondary.ipaddresses", "256",
414+
"vm.network.nic.max.secondary.ipaddresses", "10",
415415
"Specify the number of secondary ip addresses per nic per vm. Default value 10 is used, if not specified.", null),
416416

417417
EnableServiceMonitoring(

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ public NicSecondaryIp allocateSecondaryGuestIP(final long nicId, IpAddresses req
910910
throw new InvalidParameterValueException("Invalid network id is given");
911911
}
912912

913-
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), 10);
913+
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), Integer.parseInt(Config.MaxNumberOfSecondaryIPsPerNIC.getDefaultValue()));
914914
Long nicWiseIpCount = _nicSecondaryIpDao.countByNicId(nicId);
915915
if (nicWiseIpCount.intValue() >= maxAllowedIpsPerNic) {
916916
logger.error("Maximum Number of Ips \"vm.network.nic.max.secondary.ipaddresses = \"{} per Nic has been crossed for the nic {}.", maxAllowedIpsPerNic, nicVO);

0 commit comments

Comments
 (0)