Fix offering setup

This commit is contained in:
Antonio Fornie 2014-07-15 04:06:44 -05:00 committed by wilderrodrigues
parent 6b2d35c8c2
commit 563f853d59
2 changed files with 19 additions and 9 deletions

View File

@ -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<? extends PhysicalNetwork> pNtwks = pNtwkDao.listByZone(vpc.getZoneId());

View File

@ -416,7 +416,6 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
int _routerStatsInterval = 300;
int _routerCheckInterval = 30;
int _rvrStatusUpdatePoolSize = 10;
protected ServiceOfferingVO _offering;
private String _dnsBasicZoneUpdates = "all";
private final Set<String> _guestOSNeedGatewayOnNonDefaultNetwork = new HashSet<String>();
@ -737,14 +736,16 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
_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<State, VirtualMachine.Event, VirtualMachine> {
Long offeringId = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId();
if (offeringId == null) {
offeringId = _offering.getId();
offeringId = routerDeploymentManager.getOfferingId();
}
PublicIp sourceNatIp = null;