From 8d128fa737300d88835d10f0b060e079f655494d Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Wed, 9 Nov 2011 12:52:31 -0800 Subject: [PATCH] bug 11573: made network wait timeout configurable status 11573: resolved fixed reviewed-by: Alex Huang Conflicts: setup/db/db/schema-2212to2213.sql --- server/src/com/cloud/configuration/Config.java | 1 + server/src/com/cloud/network/NetworkManagerImpl.java | 5 ++++- setup/db/db/schema-2212to2213.sql | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 9c1b1aa5dd6..c29571a94a7 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -95,6 +95,7 @@ public enum Config { OvsNetwork("Network", ManagementServer.class, Boolean.class, "open.vswitch.vlan.network", "false", "enable/disable vlan remapping of open vswitch network", null), OvsTunnelNetwork("Network", ManagementServer.class, Boolean.class, "open.vswitch.tunnel.network", "false", "enable/disable open vswitch tunnel network(no vlan)", null), VmNetworkThrottlingRate("Network", ManagementServer.class, Integer.class, "vm.network.throttling.rate", "200", "Default data transfer rate in megabits per second allowed in User vm's default network.", null), + NetworkLockTimeout("Network", ManagementServer.class, Integer.class, "network.lock.timeout", "600", "Lock wait timeout (seconds) while implementing network", null), SecurityGroupWorkCleanupInterval("Network", ManagementServer.class, Integer.class, "network.securitygroups.work.cleanup.interval", "120", "Time interval (seconds) in which finished work is cleaned up from the work table", null), diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 28b54fce727..20e4f86cc1c 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -248,6 +248,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag String _networkDomain; int _cidrLimit; boolean _allowSubdomainNetworkAccess; + int _networkLockTimeout; private Map _configs; @@ -382,6 +383,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag txn.start(); owner = _accountDao.acquireInLockTable(ownerId); + if (owner == null) { throw new ConcurrentOperationException("Unable to lock account " + ownerId); } @@ -755,6 +757,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag _networkDomain = _configs.get(Config.GuestDomainSuffix.key()); _cidrLimit = NumbersUtil.parseInt(_configs.get(Config.NetworkGuestCidrLimit.key()), 22); + _networkLockTimeout = NumbersUtil.parseInt(_configs.get(Config.NetworkLockTimeout.key()), 600); NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPublicNetwork, TrafficType.Public); publicNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(publicNetworkOffering); @@ -1154,7 +1157,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag Transaction.currentTxn(); Pair implemented = new Pair(null, null); - NetworkVO network = _networksDao.acquireInLockTable(networkId); + NetworkVO network = _networksDao.acquireInLockTable(networkId, _networkLockTimeout); if (network == null) { throw new ConcurrentOperationException("Unable to acquire network configuration: " + networkId); } diff --git a/setup/db/db/schema-2212to2213.sql b/setup/db/db/schema-2212to2213.sql index 4b8d7c13509..d0a8b0beb2d 100644 --- a/setup/db/db/schema-2212to2213.sql +++ b/setup/db/db/schema-2212to2213.sql @@ -62,3 +62,5 @@ update host_details set name='privateip' where host_id in (select id from host w INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.root.disk.controller', 'ide', 'Specify the default disk controller for root volumes, valid values are scsi, ide'); INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.destory.forcestop', 'false', 'On destory, force-stop takes this value'); +INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.lock.timeout', '600', 'Lock wait timeout (seconds) while implementing network'); +