Included guestOsId to userVmResponse - as we let to change this param through updateVm call, we should return it in the response

This commit is contained in:
Alena Prokharchyk 2013-12-26 13:27:44 -08:00
parent fead6706ff
commit 526af5e326
2 changed files with 15 additions and 8 deletions

View File

@ -21,8 +21,6 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
@ -32,6 +30,7 @@ import com.cloud.network.router.VirtualRouter;
import com.cloud.serializer.Param;
import com.cloud.uservm.UserVm;
import com.cloud.vm.VirtualMachine;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@EntityReference(value = {VirtualMachine.class, UserVm.class, VirtualRouter.class})
@ -229,7 +228,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
private Set<ResourceTagResponse> tags;
@SerializedName(ApiConstants.DETAILS)
@Param(description = "Template details in key/value pairs.", since = "4.2.1")
@Param(description = "Vm details in key/value pairs.", since = "4.2.1")
private Map details;
@SerializedName(ApiConstants.SSH_KEYPAIR)
@ -247,10 +246,15 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
@SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE)
@Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
private Boolean isDynamicallyScalable;
@SerializedName(ApiConstants.SERVICE_STATE)
@Param(description = "State of the Service from LB rule")
private String serviceState;
@SerializedName(ApiConstants.OS_TYPE_ID)
@Param(description = "OS type id of the vm", since = "4.4")
private Long osTypeId;
public UserVmResponse() {
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
nics = new LinkedHashSet<NicResponse>();
@ -715,4 +719,8 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
public void setDetails(Map details) {
this.details = details;
}
public void setOsTypeId(Long osTypeId) {
this.osTypeId = osTypeId;
}
}

View File

@ -28,15 +28,14 @@ import java.util.Set;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.query.vo.ResourceTagJoinVO;
@ -164,6 +163,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
userVmResponse.setPublicIpId(userVm.getPublicIpUuid());
userVmResponse.setPublicIp(userVm.getPublicIpAddress());
userVmResponse.setKeyPairName(userVm.getKeypairName());
userVmResponse.setOsTypeId(userVm.getGuestOsId());
if (details.contains(VMDetails.all) || details.contains(VMDetails.stats)) {
// stats calculation
@ -175,8 +175,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
userVmResponse.setNetworkKbsWrite((long)vmStats.getNetworkWriteKBs());
if ((userVm.getHypervisorType() != null) &&
(userVm.getHypervisorType().equals(HypervisorType.KVM) || userVm.getHypervisorType().equals(HypervisorType.XenServer))) { // support KVM and XenServer only util 2013.06.25
if ((userVm.getHypervisorType() != null) && (userVm.getHypervisorType().equals(HypervisorType.KVM) || userVm.getHypervisorType().equals(HypervisorType.XenServer))) { // support KVM and XenServer only util 2013.06.25
userVmResponse.setDiskKbsRead((long)vmStats.getDiskReadKBs());
userVmResponse.setDiskKbsWrite((long)vmStats.getDiskWriteKBs());