mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-2120: mixed zone management - (1) extend listVolumes API to to take in zonetype. (2) UI: populate Volumes list page with instances whose zonetype matches selected option in zone type dropdown on top menu.
This commit is contained in:
parent
435f4bceb2
commit
d893ba881b
@ -75,8 +75,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
|
||||
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine")
|
||||
private String state;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
description="the availability zone ID")
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the availability zone ID")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
|
||||
@ -67,6 +67,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
|
||||
description="the ID of the availability zone")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
private String zoneType;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -100,6 +103,10 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -1522,6 +1522,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
Map<String, String> tags = cmd.getTags();
|
||||
|
||||
Long zoneId = cmd.getZoneId();
|
||||
String zoneType = cmd.getZoneType();
|
||||
Long podId = null;
|
||||
if (_accountMgr.isAdmin(caller.getType())) {
|
||||
podId = cmd.getPodId();
|
||||
@ -1549,6 +1550,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
sb.and("volumeType", sb.entity().getVolumeType(), SearchCriteria.Op.LIKE);
|
||||
sb.and("instanceId", sb.entity().getVmId(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
|
||||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
// Only return volumes that are not destroyed
|
||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
|
||||
@ -1608,6 +1610,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
if (zoneId != null) {
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
}
|
||||
if (zoneType != null) {
|
||||
sc.setParameters("dataCenterType", zoneType);
|
||||
}
|
||||
if (podId != null) {
|
||||
sc.setParameters("podId", podId);
|
||||
}
|
||||
|
||||
@ -398,12 +398,18 @@
|
||||
|
||||
if(args.context != null) {
|
||||
if("instances" in args.context) {
|
||||
$.extend(data, {
|
||||
virtualMachineId: args.context.instances[0].id
|
||||
});
|
||||
$.extend(data, {
|
||||
virtualMachineId: args.context.instances[0].id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(args.context.zoneType != null && args.context.zoneType.length > 0) { //Basic type or Advanced type
|
||||
$.extend(data, {
|
||||
zonetype: args.context.zoneType
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listVolumes'),
|
||||
data: data,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user