bug 10311: Update create network_offering API

This commit is contained in:
Sheng Yang 2011-06-22 15:24:04 -07:00
parent dc46ffb0c7
commit 0d750dacc2
4 changed files with 13 additions and 5 deletions

View File

@ -66,6 +66,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed.")
private Integer networkRate;
@Parameter(name=ApiConstants.REDUNDANT_ROUTER, type=CommandType.BOOLEAN, description="if network offering supports redundant router.")
private Boolean redundantRouter;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -106,6 +109,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
public String getGuestIpType() {
return guestIpType;
}
public Boolean getRedundantRouter() {
return redundantRouter == null ? false : redundantRouter;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -242,7 +242,7 @@ removeVpnUser=com.cloud.api.commands.RemoveVpnUserCmd;15
listVpnUsers=com.cloud.api.commands.ListVpnUsersCmd;15
#### network offering commands
#### createNetworkOffering=com.cloud.api.commands.CreateNetworkOfferingCmd;1
createNetworkOffering=com.cloud.api.commands.CreateNetworkOfferingCmd;1
updateNetworkOffering=com.cloud.api.commands.UpdateNetworkOfferingCmd;1
#### deleteNetworkOffering=com.cloud.api.commands.DeleteNetworkOfferingCmd;1
listNetworkOfferings=com.cloud.api.commands.ListNetworkOfferingsCmd;15

View File

@ -174,7 +174,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @param specifyVlan;
* @return network offering object
*/
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, GuestIpType guestIpType);
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, GuestIpType guestIpType, boolean redundantRouter);
Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, boolean forVirtualNetwork, String vlanId, Account account, Long networkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;

View File

@ -2681,6 +2681,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
Boolean specifyVlan = cmd.getSpecifyVlan();
String availabilityStr = cmd.getAvailability();
String guestIpTypeString = cmd.getGuestIpType();
Boolean redundantRouter = cmd.getRedundantRouter();
TrafficType trafficType = null;
GuestIpType guestIpType = null;
@ -2721,12 +2722,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
Integer maxConnections = cmd.getMaxconnections();
return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, guestIpType);
return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, guestIpType, redundantRouter);
}
@Override
public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan,
Availability availability, GuestIpType guestIpType) {
Availability availability, GuestIpType guestIpType, boolean redundantRouter) {
String networkRateStr = _configDao.getValue("network.throttling.rate");
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
int networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
@ -2746,7 +2747,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, false, specifyVlan, networkRate, multicastRate, maxConnections, false, availability, true, true, true,
gatewayService, firewallService, lbService, vpnService, guestIpType, false);
gatewayService, firewallService, lbService, vpnService, guestIpType, redundantRouter);
if ((offering = _networkOfferingDao.persist(offering)) != null) {
UserContext.current().setEventDetails(" Id: "+offering.getId()+" Name: "+name);