mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Conflicts:
api/src/org/apache/cloudstack/api/response/AccountResponse.java Signed-off-by: Min Chen <min.chen@citrix.com>
This commit is contained in:
parent
de8aa86542
commit
348d3ae448
@ -31,6 +31,8 @@ public interface DataCenter extends Grouping {
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getDns1();
|
||||
|
||||
String getDns2();
|
||||
|
||||
@ -33,6 +33,8 @@ public interface Domain extends OwnedBy {
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
Long getParent();
|
||||
|
||||
void setParent(Long parent);
|
||||
|
||||
@ -66,6 +66,8 @@ public interface Host extends StateObject<Status> {
|
||||
*/
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
/**
|
||||
* @return name of the machine.
|
||||
*/
|
||||
|
||||
@ -27,6 +27,8 @@ public interface Cluster extends Grouping {
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
@ -51,6 +51,8 @@ public interface Account extends ControlledEntity {
|
||||
|
||||
public long getId();
|
||||
|
||||
public String getUuid();
|
||||
|
||||
public String getAccountName();
|
||||
|
||||
public short getType();
|
||||
|
||||
@ -25,7 +25,6 @@ import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@ -33,7 +32,7 @@ import org.apache.cloudstack.api.BaseResponse;
|
||||
@Entity(value = Account.class)
|
||||
public class AccountResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the id of the account")
|
||||
private IdentityProxy id = new IdentityProxy("account");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the account")
|
||||
private String name;
|
||||
@ -42,13 +41,13 @@ public class AccountResponse extends BaseResponse {
|
||||
private Short accountType;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too")
|
||||
private IdentityProxy domainId = new IdentityProxy("domain");
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="name of the Domain the account belongs too")
|
||||
private String domainName;
|
||||
|
||||
@SerializedName(ApiConstants.DEFAULT_ZONE_ID) @Param(description="the default zone of the account")
|
||||
private IdentityProxy defaultZoneId = new IdentityProxy("data_center");
|
||||
private String defaultZoneId;
|
||||
|
||||
@SerializedName(ApiConstants.RECEIVED_BYTES) @Param(description="the total number of network traffic bytes received")
|
||||
private Long bytesReceived;
|
||||
@ -150,8 +149,8 @@ public class AccountResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account")
|
||||
private Map<String, String> details;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
@ -162,8 +161,8 @@ public class AccountResponse extends BaseResponse {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId.setValue(domainId);
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public void setDomainName(String domainName) {
|
||||
@ -290,7 +289,7 @@ public class AccountResponse extends BaseResponse {
|
||||
this.networkAvailable = networkAvailable;
|
||||
}
|
||||
|
||||
public void setDefaultZone(Long defaultZoneId) {
|
||||
this.defaultZoneId.setValue(defaultZoneId);
|
||||
public void setDefaultZone(String defaultZoneId) {
|
||||
this.defaultZoneId = defaultZoneId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,19 +27,19 @@ public class CapacityResponse extends BaseResponse {
|
||||
private Short capacityType;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID")
|
||||
private IdentityProxy podId = new IdentityProxy("host_pod_ref");
|
||||
private String podId;
|
||||
|
||||
@SerializedName("podname") @Param(description="the Pod name")
|
||||
private String podName;
|
||||
|
||||
@SerializedName(ApiConstants.CLUSTER_ID) @Param(description="the Cluster ID")
|
||||
private IdentityProxy clusterId = new IdentityProxy("cluster");
|
||||
private String clusterId;
|
||||
|
||||
@SerializedName("clustername") @Param(description="the Cluster name")
|
||||
private String clusterName;
|
||||
@ -61,12 +61,12 @@ public class CapacityResponse extends BaseResponse {
|
||||
this.capacityType = capacityType;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId.getValue();
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId.setValue(zoneId);
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getZoneName() {
|
||||
@ -77,12 +77,12 @@ public class CapacityResponse extends BaseResponse {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public Long getPodId() {
|
||||
return podId.getValue();
|
||||
public String getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
public void setPodId(Long podId) {
|
||||
this.podId.setValue(podId);
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public String getPodName() {
|
||||
@ -93,12 +93,12 @@ public class CapacityResponse extends BaseResponse {
|
||||
this.podName = podName;
|
||||
}
|
||||
|
||||
public Long getClusterId() {
|
||||
return clusterId.getValue();
|
||||
public String getClusterId() {
|
||||
return clusterId;
|
||||
}
|
||||
|
||||
public void setClusterId(Long clusterId) {
|
||||
this.clusterId.setValue(clusterId);
|
||||
public void setClusterId(String clusterId) {
|
||||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
|
||||
@ -32,19 +32,19 @@ import org.apache.cloudstack.api.BaseResponse;
|
||||
@Entity(value = Cluster.class)
|
||||
public class ClusterResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the cluster ID")
|
||||
private IdentityProxy id = new IdentityProxy("cluster");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the cluster name")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the cluster")
|
||||
private IdentityProxy podId = new IdentityProxy("host_pod_ref");
|
||||
private String podId;
|
||||
|
||||
@SerializedName("podname") @Param(description="the Pod name of the cluster")
|
||||
private String podName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the cluster")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the cluster")
|
||||
private String zoneName;
|
||||
@ -64,12 +64,12 @@ public class ClusterResponse extends BaseResponse {
|
||||
@SerializedName("capacity") @Param(description="the capacity of the Cluster", responseObject = CapacityResponse.class)
|
||||
private List<CapacityResponse> capacitites;
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -80,12 +80,12 @@ public class ClusterResponse extends BaseResponse {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getPodId() {
|
||||
return podId.getValue();
|
||||
public String getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
public void setPodId(Long podId) {
|
||||
this.podId.setValue(podId);
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public String getPodName() {
|
||||
@ -96,12 +96,12 @@ public class ClusterResponse extends BaseResponse {
|
||||
this.podName = podName;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId.getValue();
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId.setValue(zoneId);
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getZoneName() {
|
||||
|
||||
@ -27,7 +27,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
@Entity(value = Domain.class)
|
||||
public class DomainResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the domain")
|
||||
private IdentityProxy id = new IdentityProxy("domain");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the domain")
|
||||
private String domainName;
|
||||
@ -36,7 +36,7 @@ public class DomainResponse extends BaseResponse {
|
||||
private Integer level;
|
||||
|
||||
@SerializedName("parentdomainid") @Param(description="the domain ID of the parent domain")
|
||||
private IdentityProxy parentDomainId = new IdentityProxy("domain");
|
||||
private String parentDomainId;
|
||||
|
||||
@SerializedName("parentdomainname") @Param(description="the domain name of the parent domain")
|
||||
private String parentDomainName;
|
||||
@ -50,12 +50,12 @@ public class DomainResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.PATH) @Param(description="the path of the domain")
|
||||
private String path;
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
@ -74,12 +74,12 @@ public class DomainResponse extends BaseResponse {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getParentDomainId() {
|
||||
return parentDomainId.getValue();
|
||||
public String getParentDomainId() {
|
||||
return parentDomainId;
|
||||
}
|
||||
|
||||
public void setParentDomainId(Long parentDomainId) {
|
||||
this.parentDomainId.setValue(parentDomainId);
|
||||
public void setParentDomainId(String parentDomainId) {
|
||||
this.parentDomainId = parentDomainId;
|
||||
}
|
||||
|
||||
public String getParentDomainName() {
|
||||
|
||||
@ -29,7 +29,7 @@ import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class HostResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the host")
|
||||
private IdentityProxy id = new IdentityProxy("host");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the host")
|
||||
private String name;
|
||||
@ -44,7 +44,7 @@ public class HostResponse extends BaseResponse {
|
||||
private Host.Type hostType;
|
||||
|
||||
@SerializedName("oscategoryid") @Param(description="the OS category ID of the host")
|
||||
private IdentityProxy osCategoryId = new IdentityProxy("guest_os_category");
|
||||
private String osCategoryId;
|
||||
|
||||
@SerializedName("oscategoryname") @Param(description="the OS category name of the host")
|
||||
private String osCategoryName;
|
||||
@ -53,13 +53,13 @@ public class HostResponse extends BaseResponse {
|
||||
private String ipAddress;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the host")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the host")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the host")
|
||||
private IdentityProxy podId = new IdentityProxy("host_pod_ref");
|
||||
private String podId;
|
||||
|
||||
@SerializedName("podname") @Param(description="the Pod name of the host")
|
||||
private String podName;
|
||||
@ -119,7 +119,7 @@ public class HostResponse extends BaseResponse {
|
||||
private Long managementServerId;
|
||||
|
||||
@SerializedName("clusterid") @Param(description="the cluster ID of the host")
|
||||
private IdentityProxy clusterId = new IdentityProxy("cluster");
|
||||
private String clusterId;
|
||||
|
||||
@SerializedName("clustername") @Param(description="the cluster name of the host")
|
||||
private String clusterName;
|
||||
@ -158,17 +158,12 @@ public class HostResponse extends BaseResponse {
|
||||
private Boolean haHost;
|
||||
|
||||
|
||||
@Override
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
@ -187,8 +182,8 @@ public class HostResponse extends BaseResponse {
|
||||
this.hostType = hostType;
|
||||
}
|
||||
|
||||
public void setOsCategoryId(Long osCategoryId) {
|
||||
this.osCategoryId.setValue(osCategoryId);
|
||||
public void setOsCategoryId(String osCategoryId) {
|
||||
this.osCategoryId = osCategoryId;
|
||||
}
|
||||
|
||||
public void setOsCategoryName(String osCategoryName) {
|
||||
@ -199,16 +194,16 @@ public class HostResponse extends BaseResponse {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId.setValue(zoneId);
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setPodId(Long podId) {
|
||||
this.podId.setValue(podId);
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public void setPodName(String podName) {
|
||||
@ -287,8 +282,8 @@ public class HostResponse extends BaseResponse {
|
||||
this.managementServerId = managementServerId;
|
||||
}
|
||||
|
||||
public void setClusterId(Long clusterId) {
|
||||
this.clusterId.setValue(clusterId);
|
||||
public void setClusterId(String clusterId) {
|
||||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
@ -348,22 +343,6 @@ public class HostResponse extends BaseResponse {
|
||||
this.hypervisorVersion = hypervisorVersion;
|
||||
}
|
||||
|
||||
public void setOsCategoryId(IdentityProxy osCategoryId) {
|
||||
this.osCategoryId = osCategoryId;
|
||||
}
|
||||
|
||||
public void setZoneId(IdentityProxy zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public void setPodId(IdentityProxy podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public void setClusterId(IdentityProxy clusterId) {
|
||||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public void setHaHost(Boolean haHost) {
|
||||
this.haHost = haHost;
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@ -30,7 +29,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
@Entity(value = DataCenter.class)
|
||||
public class ZoneResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="Zone id")
|
||||
private IdentityProxy id = new IdentityProxy("data_center");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="Zone name")
|
||||
private String name;
|
||||
@ -93,8 +92,8 @@ public class ZoneResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.LOCAL_STORAGE_ENABLED) @Param(description="true if local storage offering enabled, false otherwise")
|
||||
private boolean localStorageEnabled;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
@ -43,6 +43,12 @@ public class CheckOnHostCommandTest {
|
||||
return 101L;
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return "101";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "hostName";
|
||||
};
|
||||
|
||||
@ -48,7 +48,7 @@ import com.cloud.utils.db.GenericDao;
|
||||
@Table(name="host")
|
||||
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
|
||||
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class HostVO implements Host, Identity {
|
||||
public class HostVO implements Host {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
|
||||
@ -33,7 +33,7 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="account")
|
||||
public class AccountVO implements Account, Identity {
|
||||
public class AccountVO implements Account {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
|
||||
@ -259,14 +259,20 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
public AccountResponse createAccountResponse(Account account) {
|
||||
boolean accountIsAdmin = (account.getType() == Account.ACCOUNT_TYPE_ADMIN);
|
||||
AccountResponse accountResponse = new AccountResponse();
|
||||
accountResponse.setId(account.getId());
|
||||
accountResponse.setId(account.getUuid());
|
||||
accountResponse.setName(account.getAccountName());
|
||||
accountResponse.setAccountType(account.getType());
|
||||
accountResponse.setDomainId(account.getDomainId());
|
||||
accountResponse.setDomainName(ApiDBUtils.findDomainById(account.getDomainId()).getName());
|
||||
Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
|
||||
if (domain != null) {
|
||||
accountResponse.setDomainId(domain.getUuid());
|
||||
accountResponse.setDomainName(domain.getName());
|
||||
}
|
||||
accountResponse.setState(account.getState().toString());
|
||||
accountResponse.setNetworkDomain(account.getNetworkDomain());
|
||||
accountResponse.setDefaultZone(account.getDefaultZoneId());
|
||||
DataCenterVO dc = ApiDBUtils.findZoneById(account.getDefaultZoneId());
|
||||
if (dc != null) {
|
||||
accountResponse.setDefaultZone(dc.getUuid());
|
||||
}
|
||||
|
||||
// get network stat
|
||||
List<UserStatisticsVO> stats = ApiDBUtils.listUserStatsBy(account.getId());
|
||||
@ -415,10 +421,10 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
public DomainResponse createDomainResponse(Domain domain) {
|
||||
DomainResponse domainResponse = new DomainResponse();
|
||||
domainResponse.setDomainName(domain.getName());
|
||||
domainResponse.setId(domain.getId());
|
||||
domainResponse.setId(domain.getUuid());
|
||||
domainResponse.setLevel(domain.getLevel());
|
||||
domainResponse.setNetworkDomain(domain.getNetworkDomain());
|
||||
domainResponse.setParentDomainId(domain.getParent());
|
||||
domainResponse.setParentDomainId(ApiDBUtils.findDomainById(domain.getParent()).getUuid());
|
||||
StringBuilder domainPath = new StringBuilder("ROOT");
|
||||
(domainPath.append(domain.getPath())).deleteCharAt(domainPath.length() - 1);
|
||||
domainResponse.setPath(domainPath.toString());
|
||||
@ -583,18 +589,30 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public HostResponse createHostResponse(Host host, EnumSet<HostDetails> details) {
|
||||
HostResponse hostResponse = new HostResponse();
|
||||
hostResponse.setId(host.getId());
|
||||
hostResponse.setId(host.getUuid());
|
||||
hostResponse.setCapabilities(host.getCapabilities());
|
||||
hostResponse.setClusterId(host.getClusterId());
|
||||
ClusterVO cluster = null;
|
||||
if (host.getClusterId() != null) {
|
||||
cluster = ApiDBUtils.findClusterById(host.getClusterId());
|
||||
if (cluster != null) {
|
||||
hostResponse.setClusterId(cluster.getUuid());
|
||||
}
|
||||
}
|
||||
hostResponse.setCpuNumber(host.getCpus());
|
||||
hostResponse.setZoneId(host.getDataCenterId());
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(host.getDataCenterId());
|
||||
if (zone != null) {
|
||||
hostResponse.setZoneId(zone.getUuid());
|
||||
}
|
||||
hostResponse.setDisconnectedOn(host.getDisconnectedOn());
|
||||
hostResponse.setHypervisor(host.getHypervisorType());
|
||||
hostResponse.setHostType(host.getType());
|
||||
hostResponse.setLastPinged(new Date(host.getLastPinged()));
|
||||
hostResponse.setManagementServerId(host.getManagementServerId());
|
||||
hostResponse.setName(host.getName());
|
||||
hostResponse.setPodId(host.getPodId());
|
||||
HostPodVO pod = ApiDBUtils.findPodById(host.getPodId());
|
||||
if (pod != null) {
|
||||
hostResponse.setPodId(pod.getUuid());
|
||||
}
|
||||
hostResponse.setRemoved(host.getRemoved());
|
||||
hostResponse.setCpuSpeed(host.getSpeed());
|
||||
hostResponse.setState(host.getStatus());
|
||||
@ -607,20 +625,18 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = ApiDBUtils.getHostGuestOSCategory(host.getId());
|
||||
if (guestOSCategory != null) {
|
||||
hostResponse.setOsCategoryId(guestOSCategory.getId());
|
||||
hostResponse.setOsCategoryId(guestOSCategory.getUuid());
|
||||
hostResponse.setOsCategoryName(guestOSCategory.getName());
|
||||
}
|
||||
hostResponse.setZoneName(ApiDBUtils.findZoneById(host.getDataCenterId()).getName());
|
||||
if (zone != null) {
|
||||
hostResponse.setZoneName(zone.getName());
|
||||
}
|
||||
|
||||
if (host.getPodId() != null) {
|
||||
HostPodVO pod = ApiDBUtils.findPodById(host.getPodId());
|
||||
if (pod != null) {
|
||||
hostResponse.setPodName(pod.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (host.getClusterId() != null) {
|
||||
ClusterVO cluster = ApiDBUtils.findClusterById(host.getClusterId());
|
||||
if (cluster != null) {
|
||||
hostResponse.setClusterName(cluster.getName());
|
||||
hostResponse.setClusterType(cluster.getClusterType().toString());
|
||||
}
|
||||
@ -935,7 +951,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
public ZoneResponse createZoneResponse(DataCenter dataCenter, Boolean showCapacities) {
|
||||
Account account = UserContext.current().getCaller();
|
||||
ZoneResponse zoneResponse = new ZoneResponse();
|
||||
zoneResponse.setId(dataCenter.getId());
|
||||
zoneResponse.setId(dataCenter.getUuid());
|
||||
zoneResponse.setName(dataCenter.getName());
|
||||
zoneResponse.setSecurityGroupsEnabled(ApiDBUtils.isSecurityGroupEnabledInZone(dataCenter.getId()));
|
||||
zoneResponse.setLocalStorageEnabled(dataCenter.isLocalStorageEnabled());
|
||||
@ -1216,20 +1232,24 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities) {
|
||||
ClusterResponse clusterResponse = new ClusterResponse();
|
||||
clusterResponse.setId(cluster.getId());
|
||||
clusterResponse.setId(cluster.getUuid());
|
||||
clusterResponse.setName(cluster.getName());
|
||||
clusterResponse.setPodId(cluster.getPodId());
|
||||
clusterResponse.setZoneId(cluster.getDataCenterId());
|
||||
HostPodVO pod = ApiDBUtils.findPodById(cluster.getPodId());
|
||||
if (pod != null) {
|
||||
clusterResponse.setPodId(pod.getUuid());
|
||||
clusterResponse.setPodName(pod.getName());
|
||||
}
|
||||
DataCenterVO dc = ApiDBUtils.findZoneById(cluster.getDataCenterId());
|
||||
if (dc != null) {
|
||||
clusterResponse.setZoneId(dc.getUuid());
|
||||
clusterResponse.setZoneName(dc.getName());
|
||||
}
|
||||
clusterResponse.setHypervisorType(cluster.getHypervisorType().toString());
|
||||
clusterResponse.setClusterType(cluster.getClusterType().toString());
|
||||
clusterResponse.setAllocationState(cluster.getAllocationState().toString());
|
||||
clusterResponse.setManagedState(cluster.getManagedState().toString());
|
||||
HostPodVO pod = ApiDBUtils.findPodById(cluster.getPodId());
|
||||
if (pod != null) {
|
||||
clusterResponse.setPodName(pod.getName());
|
||||
}
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(cluster.getDataCenterId());
|
||||
clusterResponse.setZoneName(zone.getName());
|
||||
|
||||
|
||||
if (showCapacities != null && showCapacities) {
|
||||
List<SummedCapacity> capacities = ApiDBUtils.getCapacityByClusterPodZone(null, null, cluster.getId());
|
||||
Set<CapacityResponse> capacityResponses = new HashSet<CapacityResponse>();
|
||||
@ -2196,26 +2216,30 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
capacityResponse.setCapacityType(summedCapacity.getCapacityType());
|
||||
capacityResponse.setCapacityUsed(summedCapacity.getUsedCapacity());
|
||||
if (summedCapacity.getPodId() != null) {
|
||||
capacityResponse.setPodId(summedCapacity.getPodId());
|
||||
capacityResponse.setPodId(ApiDBUtils.findPodById(summedCapacity.getPodId()).getUuid());
|
||||
HostPodVO pod = ApiDBUtils.findPodById(summedCapacity.getPodId());
|
||||
if (pod != null) {
|
||||
capacityResponse.setPodId(pod.getUuid());
|
||||
capacityResponse.setPodName(pod.getName());
|
||||
}
|
||||
}
|
||||
if (summedCapacity.getClusterId() != null) {
|
||||
capacityResponse.setClusterId(summedCapacity.getClusterId());
|
||||
ClusterVO cluster = ApiDBUtils.findClusterById(summedCapacity.getClusterId());
|
||||
if (cluster != null) {
|
||||
capacityResponse.setClusterId(cluster.getUuid());
|
||||
capacityResponse.setClusterName(cluster.getName());
|
||||
if (summedCapacity.getPodId() == null) {
|
||||
long podId = cluster.getPodId();
|
||||
capacityResponse.setPodId(podId);
|
||||
capacityResponse.setPodName(ApiDBUtils.findPodById(podId).getName());
|
||||
HostPodVO pod = ApiDBUtils.findPodById(cluster.getPodId());
|
||||
capacityResponse.setPodId(pod.getUuid());
|
||||
capacityResponse.setPodName(pod.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
capacityResponse.setZoneId(summedCapacity.getDataCenterId());
|
||||
capacityResponse.setZoneName(ApiDBUtils.findZoneById(summedCapacity.getDataCenterId()).getName());
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(summedCapacity.getDataCenterId());
|
||||
if (zone != null) {
|
||||
capacityResponse.setZoneId(zone.getUuid());
|
||||
capacityResponse.setZoneName(zone.getName());
|
||||
}
|
||||
if (summedCapacity.getUsedPercentage() != null){
|
||||
capacityResponse.setPercentUsed(format.format(summedCapacity.getUsedPercentage() * 100f));
|
||||
} else if (summedCapacity.getTotalCapacity() != 0) {
|
||||
|
||||
@ -38,7 +38,7 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="cluster")
|
||||
public class ClusterVO implements Cluster, Identity {
|
||||
public class ClusterVO implements Cluster {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
||||
@ -39,7 +39,7 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="data_center")
|
||||
public class DataCenterVO implements DataCenter, Identity {
|
||||
public class DataCenterVO implements DataCenter {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
|
||||
@ -33,7 +33,7 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="domain")
|
||||
public class DomainVO implements Domain, Identity {
|
||||
public class DomainVO implements Domain {
|
||||
public static final Logger s_logger = Logger.getLogger(DomainVO.class.getName());
|
||||
|
||||
@Id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user