Skip to content

Commit 0b39592

Browse files
author
Daan Hoogland
committed
Merge branch '4.20'
2 parents f2bda46 + be08fff commit 0b39592

File tree

118 files changed

+1992
-1551
lines changed

Some content is hidden

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

118 files changed

+1992
-1551
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/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: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import com.cloud.user.UserData;
3434

3535
@APICommand(name = "registerUserData",
36-
description = "Register a new userdata.",
36+
description = "Register a new User Data.",
3737
since = "4.18",
3838
responseObject = SuccessResponse.class,
3939
requestHasSensitiveInfo = false,
@@ -46,9 +46,55 @@ public class RegisterUserDataCmd extends BaseRegisterUserDataCmd {
4646
//////////////// API parameters /////////////////////
4747
/////////////////////////////////////////////////////
4848

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

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

5399
public String getUserData() {
54100
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() {

api/src/main/java/org/apache/cloudstack/query/QueryService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ public interface QueryService {
114114
ConfigKey<Boolean> AllowUserViewDestroyedVM = new ConfigKey<>("Advanced", Boolean.class, "allow.user.view.destroyed.vm", "false",
115115
"Determines whether users can view their destroyed or expunging vm ", true, ConfigKey.Scope.Account);
116116

117-
static final ConfigKey<String> UserVMDeniedDetails = new ConfigKey<>(String.class,
117+
ConfigKey<String> UserVMDeniedDetails = new ConfigKey<>(String.class,
118118
"user.vm.denied.details", "Advanced", "rootdisksize, cpuOvercommitRatio, memoryOvercommitRatio, Message.ReservedCapacityFreed.Flag",
119119
"Determines whether users can view certain VM settings. When set to empty, default value used is: rootdisksize, cpuOvercommitRatio, memoryOvercommitRatio, Message.ReservedCapacityFreed.Flag.", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null);
120120

121-
static final ConfigKey<String> UserVMReadOnlyDetails = new ConfigKey<>(String.class,
121+
ConfigKey<String> UserVMReadOnlyDetails = new ConfigKey<>(String.class,
122122
"user.vm.readonly.details", "Advanced", "dataDiskController, rootDiskController",
123123
"List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null);
124124

@@ -127,16 +127,20 @@ public interface QueryService {
127127
"network offering, zones), we use the flag to determine if the entities should be sorted ascending (when flag is true) " +
128128
"or descending (when flag is false). Within the scope of the config all users see the same result.", true, ConfigKey.Scope.Global);
129129

130-
public static final ConfigKey<Boolean> AllowUserViewAllDomainAccounts = new ConfigKey<>("Advanced", Boolean.class,
130+
ConfigKey<Boolean> AllowUserViewAllDomainAccounts = new ConfigKey<>("Advanced", Boolean.class,
131131
"allow.user.view.all.domain.accounts", "false",
132132
"Determines whether users can view all user accounts within the same domain", true, ConfigKey.Scope.Domain);
133133

134-
static final ConfigKey<Boolean> SharePublicTemplatesWithOtherDomains = new ConfigKey<>("Advanced", Boolean.class, "share.public.templates.with.other.domains", "true",
134+
ConfigKey<Boolean> AllowUserViewAllDataCenters = new ConfigKey<>("Advanced", Boolean.class, "allow.user.view.all.zones", "true",
135+
"Determines whether for instance a Resource Admin can view zones that are not dedicated to them.", true, ConfigKey.Scope.Domain);
136+
137+
ConfigKey<Boolean> SharePublicTemplatesWithOtherDomains = new ConfigKey<>("Advanced", Boolean.class, "share.public.templates.with.other.domains", "true",
135138
"If false, templates of this domain will not show up in the list templates of other domains.", true, ConfigKey.Scope.Domain);
136139

137140
ConfigKey<Boolean> ReturnVmStatsOnVmList = new ConfigKey<>("Advanced", Boolean.class, "list.vm.default.details.stats", "true",
138141
"Determines whether VM stats should be returned when details are not explicitly specified in listVirtualMachines API request. When false, details default to [group, nics, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp]. When true, all details are returned including 'stats'.", true, ConfigKey.Scope.Global);
139142

143+
140144
ListResponse<UserResponse> searchForUsers(ResponseObject.ResponseView responseView, ListUsersCmd cmd) throws PermissionDeniedException;
141145

142146
ListResponse<UserResponse> searchForUsers(Long domainId, boolean recursive) throws PermissionDeniedException;

0 commit comments

Comments
 (0)