Skip to content

Commit 6b67bca

Browse files
committed
Returning mshost uuid rather than msid in list hosts response
1 parent 8594bf0 commit 6b67bca

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class HostResponse extends BaseResponse {
166166

167167
@SerializedName("managementserverid")
168168
@Param(description = "the management server ID of the host")
169-
private Long managementServerId;
169+
private String managementServerId;
170170

171171
@SerializedName("clusterid")
172172
@Param(description = "the cluster ID of the host")
@@ -381,7 +381,7 @@ public void setLastPinged(Date lastPinged) {
381381
this.lastPinged = lastPinged;
382382
}
383383

384-
public void setManagementServerId(Long managementServerId) {
384+
public void setManagementServerId(String managementServerId) {
385385
this.managementServerId = managementServerId;
386386
}
387387

@@ -633,7 +633,7 @@ public Date getLastPinged() {
633633
return lastPinged;
634634
}
635635

636-
public Long getManagementServerId() {
636+
public String getManagementServerId() {
637637
return managementServerId;
638638
}
639639

server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
import com.cloud.api.ApiDBUtils;
4141
import com.cloud.api.query.vo.HostJoinVO;
42+
import com.cloud.cluster.ManagementServerHostVO;
43+
import com.cloud.cluster.dao.ManagementServerHostDao;
4244
import com.cloud.gpu.HostGpuGroupsVO;
4345
import com.cloud.gpu.VGPUTypesVO;
4446
import com.cloud.host.Host;
@@ -65,6 +67,8 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
6567
private HAConfigDao haConfigDao;
6668
@Inject
6769
private OutOfBandManagementDao outOfBandManagementDao;
70+
@Inject
71+
private ManagementServerHostDao managementServerHostDao;
6872

6973
private final SearchBuilder<HostJoinVO> hostSearch;
7074

@@ -103,7 +107,13 @@ public HostResponse newHostResponse(HostJoinVO host, EnumSet<HostDetails> detail
103107
hostResponse.setHypervisor(host.getHypervisorType());
104108
hostResponse.setHostType(host.getType());
105109
hostResponse.setLastPinged(new Date(host.getLastPinged()));
106-
hostResponse.setManagementServerId(host.getManagementServerId());
110+
Long mshostId = host.getManagementServerId();
111+
if (mshostId != null) {
112+
ManagementServerHostVO managementServer = managementServerHostDao.findByMsid(host.getManagementServerId());
113+
if (managementServer != null) {
114+
hostResponse.setManagementServerId(managementServer.getUuid());
115+
}
116+
}
107117
hostResponse.setName(host.getName());
108118
hostResponse.setPodId(host.getPodUuid());
109119
hostResponse.setRemoved(host.getRemoved());

0 commit comments

Comments
 (0)