Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ public class SystemVmResponse extends BaseResponse {
@Param(description = "public vlan range")
private List<String> publicVlan;

@SerializedName("lastpinged")
@Param(description = "the date and time the host was last pinged", since = "4.13.1")
private Date lastPinged;
@SerializedName("disconnected")
@Param(description = "the last disconnected date of host", since = "4.13.1")
private Date disconnectedOn;

@SerializedName("version")
@Param(description = "the systemvm agent version", since = "4.13.1")
Expand Down Expand Up @@ -403,12 +403,12 @@ public void setPublicVlan(List<String> publicVlan) {
this.publicVlan = publicVlan;
}

public Date getLastPinged() {
return lastPinged;
public Date getDisconnectedOn() {
return disconnectedOn;
}

public void setLastPinged(Date lastPinged) {
this.lastPinged = lastPinged;
public void setDisconnectedOn(Date disconnectedOn) {
this.disconnectedOn = disconnectedOn;
}

public String getVersion() {
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/java/com/cloud/api/ApiDBUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,10 @@ public static HostVO findHostById(Long hostId) {
return s_hostDao.findByIdIncludingRemoved(hostId);
}

public static HostVO findHostByTypeNameAndZoneId(Long zoneId, String name, Host.Type type) {
return s_hostDao.findByTypeNameAndZoneId(zoneId, name, type);
}

public static IPAddressVO findIpAddressById(long addressId) {
return s_ipAddressDao.findById(addressId);
}
Expand Down
13 changes: 10 additions & 3 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,16 @@ public SystemVmResponse createSystemVmResponse(VirtualMachine vm) {
vmResponse.setHostId(host.getUuid());
vmResponse.setHostName(host.getName());
vmResponse.setHypervisor(host.getHypervisorType().toString());
vmResponse.setAgentState(host.getStatus());
vmResponse.setLastPinged(new Date(host.getLastPinged()));
vmResponse.setVersion(host.getVersion());
}
}

if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) {
Host systemVmHost = ApiDBUtils.findHostByTypeNameAndZoneId(vm.getDataCenterId(), vm.getHostName(),
Type.SecondaryStorageVm.equals(vm.getType()) ? Host.Type.SecondaryStorageVM : Host.Type.ConsoleProxy);
if (systemVmHost != null) {
vmResponse.setAgentState(systemVmHost.getStatus());
vmResponse.setDisconnectedOn(systemVmHost.getDisconnectedOn());
vmResponse.setVersion(systemVmHost.getVersion());
}
}

Expand Down