File tree 3 files changed +21
-10
lines changed
api/src/main/java/org/apache/cloudstack/api/response
server/src/main/java/com/cloud/api
3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,9 @@ public class SystemVmResponse extends BaseResponse {
154
154
@ Param (description = "public vlan range" )
155
155
private List <String > publicVlan ;
156
156
157
- @ SerializedName ("lastpinged " )
158
- @ Param (description = "the date and time the host was last pinged " , since = "4.13.1" )
159
- private Date lastPinged ;
157
+ @ SerializedName ("disconnected " )
158
+ @ Param (description = "the last disconnected date of host" , since = "4.13.1" )
159
+ private Date disconnectedOn ;
160
160
161
161
@ SerializedName ("version" )
162
162
@ Param (description = "the systemvm agent version" , since = "4.13.1" )
@@ -403,12 +403,12 @@ public void setPublicVlan(List<String> publicVlan) {
403
403
this .publicVlan = publicVlan ;
404
404
}
405
405
406
- public Date getLastPinged () {
407
- return lastPinged ;
406
+ public Date getDisconnectedOn () {
407
+ return disconnectedOn ;
408
408
}
409
409
410
- public void setLastPinged (Date lastPinged ) {
411
- this .lastPinged = lastPinged ;
410
+ public void setDisconnectedOn (Date disconnectedOn ) {
411
+ this .disconnectedOn = disconnectedOn ;
412
412
}
413
413
414
414
public String getVersion () {
Original file line number Diff line number Diff line change @@ -1039,6 +1039,10 @@ public static HostVO findHostById(Long hostId) {
1039
1039
return s_hostDao .findByIdIncludingRemoved (hostId );
1040
1040
}
1041
1041
1042
+ public static HostVO findHostByTypeNameAndZoneId (Long zoneId , String name , Host .Type type ) {
1043
+ return s_hostDao .findByTypeNameAndZoneId (zoneId , name , type );
1044
+ }
1045
+
1042
1046
public static IPAddressVO findIpAddressById (long addressId ) {
1043
1047
return s_ipAddressDao .findById (addressId );
1044
1048
}
Original file line number Diff line number Diff line change @@ -1378,9 +1378,16 @@ public SystemVmResponse createSystemVmResponse(VirtualMachine vm) {
1378
1378
vmResponse .setHostId (host .getUuid ());
1379
1379
vmResponse .setHostName (host .getName ());
1380
1380
vmResponse .setHypervisor (host .getHypervisorType ().toString ());
1381
- vmResponse .setAgentState (host .getStatus ());
1382
- vmResponse .setLastPinged (new Date (host .getLastPinged ()));
1383
- vmResponse .setVersion (host .getVersion ());
1381
+ }
1382
+ }
1383
+
1384
+ if (vm .getType () == Type .SecondaryStorageVm || vm .getType () == Type .ConsoleProxy ) {
1385
+ Host systemVmHost = ApiDBUtils .findHostByTypeNameAndZoneId (vm .getDataCenterId (), vm .getHostName (),
1386
+ Type .SecondaryStorageVm .equals (vm .getType ()) ? Host .Type .SecondaryStorageVM : Host .Type .ConsoleProxy );
1387
+ if (systemVmHost != null ) {
1388
+ vmResponse .setAgentState (systemVmHost .getStatus ());
1389
+ vmResponse .setDisconnectedOn (systemVmHost .getDisconnectedOn ());
1390
+ vmResponse .setVersion (systemVmHost .getVersion ());
1384
1391
}
1385
1392
}
1386
1393
You can’t perform that action at this time.
0 commit comments