Skip to content

Commit 3f6d458

Browse files
Merge branch '4.20' into 4.20-fix-password-reset-starttls
2 parents 368c511 + 0f0155c commit 3f6d458

File tree

157 files changed

+2190
-1689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+2190
-1689
lines changed

api/src/main/java/com/cloud/user/AccountService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ User createUser(String userName, String password, String firstName, String lastN
8787

8888
boolean isDomainAdmin(Long accountId);
8989

90+
boolean isResourceDomainAdmin(Long accountId);
91+
9092
boolean isNormalUser(long accountId);
9193

9294
User getActiveUserByRegistrationToken(String registrationToken);

api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public String getRoleName() {
7272

7373
@Override
7474
public void execute() {
75-
List<ProjectRole> projectRoles;
75+
List<ProjectRole> projectRoles = new ArrayList<>();
7676
if (getProjectId() != null && getProjectRoleId() != null) {
7777
projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId()));
7878
} else if (StringUtils.isNotBlank(getRoleName())) {

api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,19 @@ public CPU.CPUArch getArch() {
128128

129129
protected Pair<List<ClusterResponse>, Integer> getClusterResponses() {
130130
Pair<List<? extends Cluster>, Integer> result = _mgr.searchForClusters(this);
131-
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
131+
List<ClusterResponse> clusterResponses = new ArrayList<>();
132132
for (Cluster cluster : result.first()) {
133133
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, showCapacities);
134134
clusterResponse.setObjectName("cluster");
135135
clusterResponses.add(clusterResponse);
136136
}
137-
return new Pair<List<ClusterResponse>, Integer>(clusterResponses, result.second());
137+
return new Pair<>(clusterResponses, result.second());
138138
}
139139

140140
@Override
141141
public void execute() {
142142
Pair<List<ClusterResponse>, Integer> clusterResponses = getClusterResponses();
143-
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
143+
ListResponse<ClusterResponse> response = new ListResponse<>();
144144
response.setResponses(clusterResponses.first(), clusterResponses.second());
145145
response.setResponseName(getCommandName());
146146
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public Boolean getShowCapacities() {
8686
@Override
8787
public void execute() {
8888
Pair<List<? extends Pod>, Integer> result = _mgr.searchForPods(this);
89-
ListResponse<PodResponse> response = new ListResponse<PodResponse>();
90-
List<PodResponse> podResponses = new ArrayList<PodResponse>();
89+
ListResponse<PodResponse> response = new ListResponse<>();
90+
List<PodResponse> podResponses = new ArrayList<>();
9191
for (Pod pod : result.first()) {
9292
PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
9393
podResponse.setObjectName("pod");

api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,16 @@ public void execute() {
132132
Collections.sort(capacityResponses, new Comparator<CapacityResponse>() {
133133
public int compare(CapacityResponse resp1, CapacityResponse resp2) {
134134
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
135+
// Group by zone
135136
if (res != 0) {
136137
return res;
137-
} else {
138-
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
139138
}
139+
// Sort by capacity type only if not already sorted by usage
140+
return (getSortBy() != null) ? 0 : resp1.getCapacityType().compareTo(resp2.getCapacityType());
140141
}
141142
});
142143

144+
143145
response.setResponses(capacityResponses);
144146
response.setResponseName(getCommandName());
145147
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public Long getServiceOfferingId() {
7474
}
7575

7676
public Map<String, String> getDetails() {
77-
return details;
77+
return convertDetailsToMap(details);
7878
}
7979

8080
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Long getServiceOfferingId() {
6868
}
6969

7070
public Map<String, String> getDetails() {
71-
return details;
71+
return convertDetailsToMap(details);
7272
}
7373

7474
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public void execute() {
7272
response.setInstancesDisksStatsRetentionTime((Integer) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME));
7373
response.setSharedFsVmMinCpuCount((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_CPU_COUNT));
7474
response.setSharedFsVmMinRamSize((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_RAM_SIZE));
75+
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
7576
response.setObjectName("capability");
7677
response.setResponseName(getCommandName());
7778
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.List;
2121
import java.util.Map;
2222

23+
import com.cloud.cpu.CPU;
2324
import org.apache.cloudstack.acl.SecurityChecker;
2425
import org.apache.cloudstack.api.APICommand;
2526
import org.apache.cloudstack.api.ApiCommandResourceType;
@@ -148,6 +149,11 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd {
148149
since = "4.19.0")
149150
private String accountName;
150151

152+
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
153+
description = "the CPU arch of the template. Valid options are: x86_64, aarch64. Defaults to x86_64",
154+
since = "4.20.2")
155+
private String arch;
156+
151157
// ///////////////////////////////////////////////////
152158
// ///////////////// Accessors ///////////////////////
153159
// ///////////////////////////////////////////////////
@@ -234,6 +240,10 @@ public String getAccountName() {
234240
return accountName;
235241
}
236242

243+
public CPU.CPUArch getArch() {
244+
return CPU.CPUArch.fromType(arch);
245+
}
246+
237247
// ///////////////////////////////////////////////////
238248
// ///////////// API Implementation///////////////////
239249
// ///////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmd.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import com.cloud.user.UserData;
4444

4545
@APICommand(name = "registerUserData",
46-
description = "Register a new userdata.",
46+
description = "Register a new User Data.",
4747
since = "4.18",
4848
responseObject = SuccessResponse.class,
4949
requestHasSensitiveInfo = false,
@@ -56,33 +56,33 @@ public class RegisterUserDataCmd extends BaseCmd {
5656
//////////////// API parameters /////////////////////
5757
/////////////////////////////////////////////////////
5858

59-
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the userdata")
59+
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the User Data")
6060
private String name;
6161

6262
//Owner information
63-
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the userdata. Must be used with domainId.")
63+
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the User Data. Must be used with domainId.")
6464
private String accountName;
6565

6666
@Parameter(name = ApiConstants.DOMAIN_ID,
6767
type = CommandType.UUID,
6868
entityType = DomainResponse.class,
69-
description = "an optional domainId for the userdata. If the account parameter is used, domainId must also be used.")
69+
description = "an optional domainId for the User Data. If the account parameter is used, domainId must also be used.")
7070
private Long domainId;
7171

72-
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the userdata")
72+
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the User Data")
7373
private Long projectId;
7474

7575
@Parameter(name = ApiConstants.USER_DATA,
7676
type = CommandType.STRING,
7777
required = true,
78-
description = "Base64 encoded userdata content. " +
78+
description = "Base64 encoded User Data content. " +
7979
"Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " +
80-
"Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " +
81-
"You also need to change vm.userdata.max.length value",
80+
"Using HTTP POST (via POST body), you can send up to 32KB of data after base64 encoding, " +
81+
"which can be increased upto 1MB using the vm.userdata.max.length setting",
8282
length = 1048576)
8383
private String userData;
8484

85-
@Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, description = "comma separated list of variables declared in userdata content")
85+
@Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, description = "comma separated list of variables declared in the User Data content")
8686
private String params;
8787

8888

0 commit comments

Comments
 (0)