Skip to content

Commit ea36568

Browse files
committed
Merge branch '4.20' of https://github.com/apache/cloudstack
2 parents 1732f67 + 704d7a9 commit ea36568

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.apache.cloudstack.api.response.SecurityGroupResponse;
4242
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
4343
import org.apache.cloudstack.api.response.TemplateResponse;
44+
import org.apache.cloudstack.api.response.UserDataResponse;
4445
import org.apache.cloudstack.api.response.UserResponse;
4546
import org.apache.cloudstack.api.response.UserVmResponse;
4647
import org.apache.cloudstack.api.response.VpcResponse;
@@ -149,6 +150,9 @@ public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements
149150
@Parameter(name = ApiConstants.USER_DATA, type = CommandType.BOOLEAN, description = "Whether to return the VMs' user data or not. By default, user data will not be returned.", since = "4.18.0.0")
150151
private Boolean showUserData;
151152

153+
@Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, required = false, description = "the instances by userdata", since = "4.20.1")
154+
private Long userdataId;
155+
152156
/////////////////////////////////////////////////////
153157
/////////////////// Accessors ///////////////////////
154158
/////////////////////////////////////////////////////
@@ -243,6 +247,10 @@ protected boolean isViewDetailsEmpty() {
243247
return CollectionUtils.isEmpty(viewDetails);
244248
}
245249

250+
public Long getUserdataId() {
251+
return userdataId;
252+
}
253+
246254
public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
247255
if (isViewDetailsEmpty()) {
248256
if (_queryService.ReturnVmStatsOnVmList.value()) {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) {
13051305
Long storageId = null;
13061306
StoragePoolVO pool = null;
13071307
Long userId = cmd.getUserId();
1308+
Long userdataId = cmd.getUserdataId();
13081309
Map<String, String> tags = cmd.getTags();
13091310

13101311
boolean isAdmin = false;
@@ -1377,6 +1378,10 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) {
13771378
userVmSearchBuilder.and("templateId", userVmSearchBuilder.entity().getTemplateId(), Op.EQ);
13781379
}
13791380

1381+
if (userdataId != null) {
1382+
userVmSearchBuilder.and("userdataId", userVmSearchBuilder.entity().getUserDataId(), Op.EQ);
1383+
}
1384+
13801385
if (hypervisor != null) {
13811386
userVmSearchBuilder.and("hypervisorType", userVmSearchBuilder.entity().getHypervisorType(), Op.EQ);
13821387
}
@@ -1569,6 +1574,10 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) {
15691574
userVmSearchCriteria.setParameters("templateId", templateId);
15701575
}
15711576

1577+
if (userdataId != null) {
1578+
userVmSearchCriteria.setParameters("userdataId", userdataId);
1579+
}
1580+
15721581
if (display != null) {
15731582
userVmSearchCriteria.setParameters("display", display);
15741583
}

ui/src/config/section/compute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ export default {
925925
related: [{
926926
name: 'vm',
927927
title: 'label.instances',
928-
param: 'userdata'
928+
param: 'userdataid'
929929
}],
930930
tabs: [
931931
{

0 commit comments

Comments
 (0)