Skip to content

Commit add657a

Browse files
authored
api: Remove redundant API parameters (apache#6143)
1 parent aa00ef9 commit add657a

2 files changed

Lines changed: 5 additions & 32 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@
3838
import org.apache.cloudstack.api.Parameter;
3939
import org.apache.cloudstack.api.ResponseObject.ResponseView;
4040
import org.apache.cloudstack.api.response.BackupOfferingResponse;
41-
import org.apache.cloudstack.api.response.HostResponse;
4241
import org.apache.cloudstack.api.response.InstanceGroupResponse;
4342
import org.apache.cloudstack.api.response.IsoVmResponse;
4443
import org.apache.cloudstack.api.response.ListResponse;
4544
import org.apache.cloudstack.api.response.NetworkResponse;
46-
import org.apache.cloudstack.api.response.PodResponse;
4745
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
48-
import org.apache.cloudstack.api.response.StoragePoolResponse;
4946
import org.apache.cloudstack.api.response.TemplateResponse;
5047
import org.apache.cloudstack.api.response.UserVmResponse;
5148
import org.apache.cloudstack.api.response.VpcResponse;
@@ -69,9 +66,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
6966
@Parameter(name = ApiConstants.GROUP_ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "the group ID")
7067
private Long groupId;
7168

72-
@Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID")
73-
private Long hostId;
74-
7569
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the virtual machine")
7670
private Long id;
7771

@@ -81,9 +75,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
8175
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)")
8276
private String name;
8377

84-
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the pod ID")
85-
private Long podId;
86-
8778
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.")
8879
private String state;
8980

@@ -101,12 +92,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
10192
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the target hypervisor for the template")
10293
private String hypervisor;
10394

104-
@Parameter(name = ApiConstants.STORAGE_ID,
105-
type = CommandType.UUID,
106-
entityType = StoragePoolResponse.class,
107-
description = "the storage ID where vm's volumes belong to")
108-
private Long storageId;
109-
11095
@Parameter(name = ApiConstants.DETAILS,
11196
type = CommandType.LIST,
11297
collectionType = CommandType.STRING,
@@ -222,18 +207,6 @@ public String getKeyPairName() {
222207
return keypair;
223208
}
224209

225-
public Long getHostId() {
226-
return hostId;
227-
}
228-
229-
public Long getPodId() {
230-
return podId;
231-
}
232-
233-
public Long getStorageId() {
234-
return storageId;
235-
}
236-
237210
public Long getSecurityGroupId() {
238211
return securityGroupId;
239212
}

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,12 +1002,12 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
10021002
Object hostId = null;
10031003
Object storageId = null;
10041004
if (_accountMgr.isRootAdmin(caller.getId())) {
1005-
pod = cmd.getPodId();
10061005
if (cmd instanceof ListVMsCmdByAdmin) {
1007-
clusterId = ((ListVMsCmdByAdmin)cmd).getClusterId();
1006+
pod = ((ListVMsCmdByAdmin) cmd).getPodId();
1007+
clusterId = ((ListVMsCmdByAdmin) cmd).getClusterId();
1008+
hostId = ((ListVMsCmdByAdmin) cmd).getHostId();
1009+
storageId = ((ListVMsCmdByAdmin) cmd).getStorageId();
10081010
}
1009-
hostId = cmd.getHostId();
1010-
storageId = cmd.getStorageId();
10111011
}
10121012

10131013
sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
@@ -1193,7 +1193,7 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
11931193
}
11941194

11951195
if (_accountMgr.isRootAdmin(caller.getId())) {
1196-
if (cmd.getPodId() != null) {
1196+
if (pod != null) {
11971197
sc.setParameters("podId", pod);
11981198

11991199
if (state == null) {

0 commit comments

Comments
 (0)