Merge remote-tracking branch 'origin/4.13'

This commit is contained in:
Rohit Yadav 2020-02-10 19:02:09 +05:30
commit ccda5fb776
3 changed files with 21 additions and 10 deletions

View File

@ -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")
@ -403,12 +403,12 @@ public class SystemVmResponse extends BaseResponse {
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() {

View File

@ -1039,6 +1039,10 @@ public class ApiDBUtils {
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);
}

View File

@ -1378,9 +1378,16 @@ public class ApiResponseHelper implements ResponseGenerator {
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());
}
}