bug 9154: Update NetworkOfferingVO field

This commit is contained in:
Sheng Yang 2011-06-16 14:20:06 -07:00
parent 11e9b19780
commit d5ff0dfa12
4 changed files with 14 additions and 10 deletions

View File

@ -98,9 +98,9 @@ public interface NetworkOffering {
boolean isSharedSourceNatService();
boolean isRedundantRouterEnabled();
GuestIpType getGuestType();
String getUniqueName();
boolean getRedundantRouter();
}

View File

@ -2438,7 +2438,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setSpecifyVlan(offering.getSpecifyVlan());
response.setAvailability(offering.getAvailability().toString());
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
response.setRedundantRouter(offering.isRedundantRouterEnabled());
response.setRedundantRouter(offering.getRedundantRouter());
if (offering.getGuestType() != null) {
response.setGuestIpType(offering.getGuestType().toString());

View File

@ -821,7 +821,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
int router_nr = 1;
NetworkOffering offering = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId());
if (offering.isRedundantRouterEnabled()) {
if (offering.getRedundantRouter()) {
router_nr = 2;
}
@ -857,7 +857,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
networks.add(new Pair<NetworkVO, NicProfile>(publicNetworks.get(0), defaultNic));
NicProfile gatewayNic = new NicProfile();
/* For redundant router */
if (offering.isRedundantRouterEnabled()) {
if (offering.getRedundantRouter()) {
gatewayNic.setIp4Address(_networkMgr.acquireGuestIpAddress(guestNetwork));
gatewayNic.setMacAddress(_networkMgr.getNextAvailableMacAddressInNetwork(guestNetwork.getId()));
} else {
@ -879,11 +879,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
s_logger.error("Too much redundant routers!");
}
int priority = 0;
if (offering.isRedundantRouterEnabled()) {
if (offering.getRedundantRouter()) {
priority = 100 - routers.size() * 20;
}
router = new DomainRouterVO(id, _offering.getId(), VirtualMachineName.getRouterName(id, _instance), template.getId(), template.getHypervisorType(), template.getGuestOSId(),
owner.getDomainId(), owner.getId(), guestNetwork.getId(), offering.isRedundantRouterEnabled(), priority, RedundantState.UNKNOWN, _offering.getOfferHA());
owner.getDomainId(), owner.getId(), guestNetwork.getId(), offering.getRedundantRouter(), priority, RedundantState.UNKNOWN, _offering.getOfferHA());
router = _itMgr.allocate(router, template, _offering, networks, plan, null, owner);
routers.add(router);
}
@ -1033,7 +1033,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
buf.append(" name=").append(profile.getHostName());
NetworkOffering offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
if (offering.isRedundantRouterEnabled()) {
if (offering.getRedundantRouter()) {
buf.append(" redundant_router=1");
}
NicProfile controlNic = null;
@ -1088,7 +1088,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
controlNic = nic;
} else if (nic.getTrafficType() == TrafficType.Guest && offering.isRedundantRouterEnabled()) {
} else if (nic.getTrafficType() == TrafficType.Guest && offering.getRedundantRouter()) {
Network net = _networkMgr.getNetwork(nic.getNetworkId());
buf.append(" guestgw=").append(net.getGateway());
String brd = NetUtils.long2Ip(NetUtils.ip2Long(nic.getIp4Address()) | ~NetUtils.ip2Long(nic.getNetmask()));

View File

@ -333,10 +333,14 @@ public class NetworkOfferingVO implements NetworkOffering {
}
@Override
public boolean isRedundantRouterEnabled() {
public boolean getRedundantRouter() {
return this.redundantRouter;
}
public void setRedundantRouter(boolean redundantRouter) {
this.redundantRouter = redundantRouter;
}
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, boolean isDefault, Availability availability, boolean dhcpService, boolean dnsService, boolean userDataService, boolean gatewayService, boolean firewallService, boolean lbService, boolean vpnService, GuestIpType guestIpType, boolean isRedundantRouterEnabled) {
this.name = name;
this.displayText = displayText;