Skip to content

Commit 59aac60

Browse files
committed
Merge remote-tracking branch 'upstream/main' into instance-from-backup-latest
2 parents 9451c48 + 8429223 commit 59aac60

File tree

190 files changed

+5907
-3817
lines changed

Some content is hidden

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

190 files changed

+5907
-3817
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ repos:
7575
name: run codespell
7676
description: Check spelling with codespell
7777
args: [--ignore-words=.github/linters/codespell.txt]
78-
exclude: ^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
78+
exclude: ^systemvm/agent/noVNC/|^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
7979
- repo: https://github.com/pycqa/flake8
8080
rev: 7.0.0
8181
hooks:

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/cluster/ListClustersCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ protected Pair<List<ClusterResponse>, Integer> getClusterResponses() {
190190
@Override
191191
public void execute() {
192192
Pair<List<ClusterResponse>, Integer> clusterResponses = getClusterResponses();
193-
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
193+
ListResponse<ClusterResponse> response = new ListResponse<>();
194194
response.setResponses(clusterResponses.first(), clusterResponses.second());
195195
response.setResponseName(getCommandName());
196196
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
@@ -103,8 +103,8 @@ public ListPodsByCmd(String storageAccessGroup) {
103103
@Override
104104
public void execute() {
105105
Pair<List<? extends Pod>, Integer> result = _mgr.searchForPods(this);
106-
ListResponse<PodResponse> response = new ListResponse<PodResponse>();
107-
List<PodResponse> podResponses = new ArrayList<PodResponse>();
106+
ListResponse<PodResponse> response = new ListResponse<>();
107+
List<PodResponse> podResponses = new ArrayList<>();
108108
for (Pod pod : result.first()) {
109109
PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
110110
podResponse.setObjectName("pod");

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
@@ -74,6 +74,7 @@ public void execute() {
7474
response.setSharedFsVmMinRamSize((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_RAM_SIZE));
7575
response.setInstanceLeaseEnabled((Boolean) capabilities.get(ApiConstants.INSTANCE_LEASE_ENABLED));
7676
response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH));
77+
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
7778
response.setObjectName("capability");
7879
response.setResponseName(getCommandName());
7980
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: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.apache.cloudstack.api.ApiConstants;
2222
import org.apache.cloudstack.api.Parameter;
2323
import org.apache.cloudstack.api.ServerApiException;
24+
import org.apache.cloudstack.api.response.DomainResponse;
25+
import org.apache.cloudstack.api.response.ProjectResponse;
2426
import org.apache.cloudstack.api.response.SuccessResponse;
2527
import org.apache.cloudstack.api.response.UserDataResponse;
2628
import org.apache.cloudstack.context.CallContext;
@@ -33,7 +35,7 @@
3335
import com.cloud.user.UserData;
3436

3537
@APICommand(name = "registerUserData",
36-
description = "Register a new userdata.",
38+
description = "Register a new User Data.",
3739
since = "4.18",
3840
responseObject = SuccessResponse.class,
3941
requestHasSensitiveInfo = false,
@@ -46,9 +48,55 @@ public class RegisterUserDataCmd extends BaseRegisterUserDataCmd {
4648
//////////////// API parameters /////////////////////
4749
/////////////////////////////////////////////////////
4850

49-
@Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, required = true, description = "User data content", length = 1048576)
50-
protected String userData;
51+
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the User Data")
52+
private String name;
5153

54+
//Owner information
55+
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the User Data. Must be used with domainId.")
56+
private String accountName;
57+
58+
@Parameter(name = ApiConstants.DOMAIN_ID,
59+
type = CommandType.UUID,
60+
entityType = DomainResponse.class,
61+
description = "an optional domainId for the User Data. If the account parameter is used, domainId must also be used.")
62+
private Long domainId;
63+
64+
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the User Data")
65+
private Long projectId;
66+
67+
@Parameter(name = ApiConstants.USER_DATA,
68+
type = CommandType.STRING,
69+
required = true,
70+
description = "Base64 encoded User Data content. " +
71+
"Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " +
72+
"Using HTTP POST (via POST body), you can send up to 32KB of data after base64 encoding, " +
73+
"which can be increased upto 1MB using the vm.userdata.max.length setting",
74+
length = 1048576)
75+
private String userData;
76+
77+
@Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, description = "comma separated list of variables declared in the User Data content")
78+
private String params;
79+
80+
81+
/////////////////////////////////////////////////////
82+
/////////////////// Accessors ///////////////////////
83+
/////////////////////////////////////////////////////
84+
85+
public String getName() {
86+
return name;
87+
}
88+
89+
public String getAccountName() {
90+
return accountName;
91+
}
92+
93+
public Long getDomainId() {
94+
return domainId;
95+
}
96+
97+
public Long getProjectId() {
98+
return projectId;
99+
}
52100

53101
public String getUserData() {
54102
return userData;

api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
3535
public class ListZonesCmd extends BaseListCmd implements UserCmd {
3636

37-
private static final String s_name = "listzonesresponse";
38-
3937
/////////////////////////////////////////////////////
4038
//////////////// API parameters /////////////////////
4139
/////////////////////////////////////////////////////
@@ -130,11 +128,6 @@ public ListZonesCmd(String storageAccessGroup) {
130128
/////////////// API Implementation///////////////////
131129
/////////////////////////////////////////////////////
132130

133-
@Override
134-
public String getCommandName() {
135-
return s_name;
136-
}
137-
138131
@Override
139132
public void execute() {
140133
ListResponse<ZoneResponse> response = _queryService.listDataCenters(this);

api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ public class CapabilitiesResponse extends BaseResponse {
145145
@Param(description = "The path of the extensions directory", since = "4.21.0", authorized = {RoleType.Admin})
146146
private String extensionsPath;
147147

148+
@SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED)
149+
@Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0")
150+
private Boolean dynamicScalingEnabled;
151+
148152
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
149153
this.securityGroupsEnabled = securityGroupsEnabled;
150154
}
@@ -264,4 +268,8 @@ public void setInstanceLeaseEnabled(Boolean instanceLeaseEnabled) {
264268
public void setExtensionsPath(String extensionsPath) {
265269
this.extensionsPath = extensionsPath;
266270
}
271+
272+
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
273+
this.dynamicScalingEnabled = dynamicScalingEnabled;
274+
}
267275
}

api/src/main/java/org/apache/cloudstack/api/response/UserDataResponse.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,41 @@
2727
public class UserDataResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse {
2828

2929
@SerializedName(ApiConstants.ID)
30-
@Param(description = "ID of the ssh keypair")
30+
@Param(description = "ID of the User Data")
3131
private String id;
3232

3333
@SerializedName(ApiConstants.NAME)
34-
@Param(description = "Name of the userdata")
34+
@Param(description = "Name of the User Data")
3535
private String name;
3636

37-
@SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the owner id of the userdata")
37+
@SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the owner id of the User Data")
3838
private String accountId;
3939

40-
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the userdata")
40+
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the User Data")
4141
private String accountName;
4242

4343
@SerializedName(ApiConstants.PROJECT_ID)
44-
@Param(description = "the project id of the userdata", since = "4.19.1")
44+
@Param(description = "the project id of the User Data", since = "4.19.1")
4545
private String projectId;
4646

4747
@SerializedName(ApiConstants.PROJECT)
48-
@Param(description = "the project name of the userdata", since = "4.19.1")
48+
@Param(description = "the project name of the User Data", since = "4.19.1")
4949
private String projectName;
5050

51-
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the userdata owner")
51+
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the User Data owner")
5252
private String domainId;
5353

54-
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the userdata owner")
54+
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the User Data owner")
5555
private String domain;
5656

5757
@SerializedName(ApiConstants.DOMAIN_PATH)
58-
@Param(description = "path of the domain to which the userdata owner belongs", since = "4.19.2.0")
58+
@Param(description = "path of the domain to which the User Data owner belongs", since = "4.19.2.0")
5959
private String domainPath;
6060

61-
@SerializedName(ApiConstants.USER_DATA) @Param(description="base64 encoded userdata content")
61+
@SerializedName(ApiConstants.USER_DATA) @Param(description="base64 encoded User Data content")
6262
private String userData;
6363

64-
@SerializedName(ApiConstants.PARAMS) @Param(description="list of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in userdata")
64+
@SerializedName(ApiConstants.PARAMS) @Param(description="list of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in the User Data")
6565
private String params;
6666

6767
public UserDataResponse() {

0 commit comments

Comments
 (0)