bug 12336: pass correct service offering id to createNetworkOffering command

This commit is contained in:
Alena Prokharchyk 2011-12-06 10:10:28 -08:00
parent 5ad92aeac2
commit edd25b93a1
5 changed files with 21 additions and 11 deletions

View File

@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -73,6 +74,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed")
private Integer networkRate;
@IdentityMapper(entityTableName="disk_offering")
@Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, description="the service offering ID used by virtual router provider")
private Long serviceOfferingId;

View File

@ -120,7 +120,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the router")
private String domainName;
@SerializedName("serviceofferingid") @Param(description="the ID of the service offering of the virtual machine")
@SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description="the ID of the service offering of the virtual machine")
private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering");
@SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine")

View File

@ -66,6 +66,9 @@ public class NetworkOfferingResponse extends BaseResponse{
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest type of the network offering, can be Shared or Isolated")
private String guestIpType;
@SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description="the ID of the service offering used by virtual router provider")
private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering");
@SerializedName(ApiConstants.SERVICE) @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@ -150,4 +153,8 @@ public class NetworkOfferingResponse extends BaseResponse{
public void setIsRedundantRouter(Boolean isRedundantRouter) {
this.isRedundantRouter = isRedundantRouter;
}
public void setServiceOfferingId(Long serviceOfferingId) {
this.serviceOfferingId.setValue(serviceOfferingId);
}
}

View File

@ -99,7 +99,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
@SerializedName("isodisplaytext") @Param(description="an alternate display text of the ISO attached to the virtual machine")
private String isoDisplayText;
@SerializedName("serviceofferingid") @Param(description="the ID of the service offering of the virtual machine")
@SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description="the ID of the service offering of the virtual machine")
private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering");
@SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine")

View File

@ -56,11 +56,11 @@ import com.cloud.api.response.FirewallRuleResponse;
import com.cloud.api.response.HostResponse;
import com.cloud.api.response.HypervisorCapabilitiesResponse;
import com.cloud.api.response.IPAddressResponse;
import com.cloud.api.response.LDAPConfigResponse;
import com.cloud.api.response.SecurityGroupRuleResponse;
import com.cloud.api.response.SecurityGroupRuleResultObject;
import com.cloud.api.response.InstanceGroupResponse;
import com.cloud.api.response.IpForwardingRuleResponse;
import com.cloud.api.response.LBStickinessPolicyResponse;
import com.cloud.api.response.LBStickinessResponse;
import com.cloud.api.response.LDAPConfigResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.LoadBalancerResponse;
import com.cloud.api.response.NetworkOfferingResponse;
@ -77,6 +77,8 @@ import com.cloud.api.response.ResourceCountResponse;
import com.cloud.api.response.ResourceLimitResponse;
import com.cloud.api.response.SecurityGroupResponse;
import com.cloud.api.response.SecurityGroupResultObject;
import com.cloud.api.response.SecurityGroupRuleResponse;
import com.cloud.api.response.SecurityGroupRuleResultObject;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.api.response.ServiceResponse;
import com.cloud.api.response.SnapshotPolicyResponse;
@ -139,11 +141,12 @@ import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupRules;
import com.cloud.network.security.SecurityGroupVO;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
@ -195,9 +198,6 @@ import com.cloud.vm.VmStats;
import com.cloud.vm.dao.UserVmData;
import com.cloud.vm.dao.UserVmData.NicData;
import com.cloud.vm.dao.UserVmData.SecurityGroupData;
import com.cloud.api.response.LBStickinessPolicyResponse;
import com.cloud.api.response.LBStickinessResponse;
import com.cloud.network.rules.StickinessPolicy;
public class ApiResponseHelper implements ResponseGenerator {
@ -2572,7 +2572,8 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setIsDefault(offering.isDefault());
response.setSpecifyVlan(offering.getSpecifyVlan());
response.setAvailability(offering.getAvailability().toString());
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
response.setServiceOfferingId(offering.getServiceOfferingId());
if (offering.getGuestType() != null) {
response.setGuestIpType(offering.getGuestType().toString());
}