Added networkRate parameter to createServiceOffering api command

Conflicts:

	server/src/com/cloud/configuration/ConfigurationManager.java
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java
This commit is contained in:
alena 2011-08-22 12:05:34 -07:00
parent 0998b04098
commit 31a022c720
3 changed files with 23 additions and 12 deletions

View File

@ -78,6 +78,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".")
private String systemVmType;
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed.")
private Integer networkRate;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -133,6 +136,10 @@ public class CreateServiceOfferingCmd extends BaseCmd {
public String getSystemVmType() {
return systemVmType;
}
public Integer getNetworkRate() {
return networkRate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -58,7 +58,6 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
/**
* Creates a new service offering
* @param id
* @param name
* @param cpu
* @param ramSize
@ -66,12 +65,14 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @param displayText
* @param localStorageRequired
* @param offerHA
* @param useVirtualNetwork
* @param domainId
* @param hostTag
* @param networkRate TODO
* @param id
* @param useVirtualNetwork
* @return ID
*/
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag);
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag, Integer networkRate);
/**
* Creates a new disk offering
@ -171,11 +172,13 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @param tags
* @param maxConnections
* @param guestIpType TODO
* @param networkRate TODO
* @param id
* @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, boolean redundantRouter);
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, GuestIpType guestIpType, boolean redundantRouter, Integer networkRate);
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

@ -1624,15 +1624,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
return createServiceOffering(userId, cmd.getIsSystem(), vm_type, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(), localStorageRequired, offerHA,
limitCpuUse, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag());
limitCpuUse, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag(), cmd.getNetworkRate());
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag) {
boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag, Integer networkRate) {
tags = cleanupTags(tags);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, offerHA, limitResourceUse, displayText, localStorageRequired, false, tags, isSystem, vm_type, domainId, hostTag);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA, limitResourceUse, displayText, localStorageRequired, false, tags, isSystem, vm_type, domainId, hostTag);
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
UserContext.current().setEventDetails("Service offering id=" + offering.getId());
@ -2790,6 +2790,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
String availabilityStr = cmd.getAvailability();
String guestIpTypeString = cmd.getGuestIpType();
Boolean redundantRouter = cmd.getRedundantRouter();
Integer networkRate = cmd.getNetworkRate();
TrafficType trafficType = null;
GuestIpType guestIpType = null;
@ -2830,15 +2831,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
Integer maxConnections = cmd.getMaxconnections();
return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, guestIpType, redundantRouter);
return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, guestIpType, redundantRouter, networkRate);
}
@Override
public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan,
Availability availability, GuestIpType guestIpType, boolean redundantRouter) {
String networkRateStr = _configDao.getValue("network.throttling.rate");
public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan,
Availability availability, GuestIpType guestIpType, boolean redundantRouter, Integer networkRate) {
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
int networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
tags = cleanupTags(tags);