diff --git a/server/src/com/cloud/network/router/RouterDeploymentManager.java b/server/src/com/cloud/network/router/RouterDeploymentManager.java index dacd02da669..24a2a280908 100644 --- a/server/src/com/cloud/network/router/RouterDeploymentManager.java +++ b/server/src/com/cloud/network/router/RouterDeploymentManager.java @@ -96,9 +96,18 @@ public class RouterDeploymentManager { VpcVirtualNetworkHelperImpl vpcHelper; - protected ServiceOfferingVO _offering; + protected ServiceOfferingVO offering; + + public void setOffering(ServiceOfferingVO offering) { + this.offering = offering; + } + + public Long getOfferingId() { + return offering.getId(); + } + /////////////////////////////////////////////////////////////////////// // Non-VPC behavior /////////////////////////////////////////////////////////////////////// @@ -141,7 +150,7 @@ public class RouterDeploymentManager { Long offeringId = vpcOffDao.findById(vpc.getVpcOfferingId()).getServiceOfferingId(); if (offeringId == null) { - offeringId = _offering.getId(); + offeringId = offering.getId(); } //3) Deploy Virtual Router List pNtwks = pNtwkDao.listByZone(vpc.getZoneId()); diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 065b904ac83..49f13044eee 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -416,7 +416,6 @@ Configurable, StateListener { int _routerStatsInterval = 300; int _routerCheckInterval = 30; int _rvrStatusUpdatePoolSize = 10; - protected ServiceOfferingVO _offering; private String _dnsBasicZoneUpdates = "all"; private final Set _guestOSNeedGatewayOnNonDefaultNetwork = new HashSet(); @@ -737,14 +736,16 @@ Configurable, StateListener { _agentMgr.registerForHostEvents(new SshKeysDistriMonitor(_agentMgr, _hostDao, _configDao), true, false, false); final boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key())); - _offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, ProvisioningType.THIN, useLocalStorage, - true, null, true, VirtualMachine.Type.DomainRouter, true); - _offering.setUniqueName(ServiceOffering.routerDefaultOffUniqueName); - _offering = _serviceOfferingDao.persistSystemServiceOffering(_offering); + ServiceOfferingVO offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, ProvisioningType.THIN, + useLocalStorage, true, null, true, VirtualMachine.Type.DomainRouter, true); + offering.setUniqueName(ServiceOffering.routerDefaultOffUniqueName); + + offering = _serviceOfferingDao.persistSystemServiceOffering(offering); + routerDeploymentManager.setOffering(offering); // this can sometimes happen, if DB is manually or programmatically // manipulated - if (_offering == null) { + if (offering == null) { final String msg = "Data integrity problem : System Offering For Software router VM has been removed?"; s_logger.error(msg); throw new ConfigurationException(msg); @@ -1660,7 +1661,7 @@ Configurable, StateListener { Long offeringId = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId(); if (offeringId == null) { - offeringId = _offering.getId(); + offeringId = routerDeploymentManager.getOfferingId(); } PublicIp sourceNatIp = null;