Skip to content

Commit bcafbd1

Browse files
author
Daan Hoogland
committed
Merge branch '4.20'
2 parents 0d4147f + 609efcc commit bcafbd1

File tree

104 files changed

+1882
-1491
lines changed

Some content is hidden

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

104 files changed

+1882
-1491
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ public ListClustersCmd(String storageAccessGroup) {
145145

146146
protected Pair<List<ClusterResponse>, Integer> getClusterResponses() {
147147
Pair<List<? extends Cluster>, Integer> result = _mgr.searchForClusters(this);
148-
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
148+
List<ClusterResponse> clusterResponses = new ArrayList<>();
149149
for (Cluster cluster : result.first()) {
150150
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, showCapacities);
151151
clusterResponse.setObjectName("cluster");
152152
clusterResponses.add(clusterResponse);
153153
}
154-
return new Pair<List<ClusterResponse>, Integer>(clusterResponses, result.second());
154+
return new Pair<>(clusterResponses, result.second());
155155
}
156156

157157
@Override
158158
public void execute() {
159159
Pair<List<ClusterResponse>, Integer> clusterResponses = getClusterResponses();
160-
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
160+
ListResponse<ClusterResponse> response = new ListResponse<>();
161161
response.setResponses(clusterResponses.first(), clusterResponses.second());
162162
response.setResponseName(getCommandName());
163163
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
@@ -73,6 +73,7 @@ public void execute() {
7373
response.setSharedFsVmMinCpuCount((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_CPU_COUNT));
7474
response.setSharedFsVmMinRamSize((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_RAM_SIZE));
7575
response.setInstanceLeaseEnabled((Boolean) capabilities.get(ApiConstants.INSTANCE_LEASE_ENABLED));
76+
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
7677
response.setObjectName("capability");
7778
response.setResponseName(getCommandName());
7879
this.setResponseObject(response);

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
@@ -140,6 +140,10 @@ public class CapabilitiesResponse extends BaseResponse {
140140
@Param(description = "true if instance lease feature is enabled", since = "4.21.0")
141141
private Boolean instanceLeaseEnabled;
142142

143+
@SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED)
144+
@Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0")
145+
private Boolean dynamicScalingEnabled;
146+
143147
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
144148
this.securityGroupsEnabled = securityGroupsEnabled;
145149
}
@@ -255,4 +259,8 @@ public void setSharedFsVmMinRamSize(Integer sharedFsVmMinRamSize) {
255259
public void setInstanceLeaseEnabled(Boolean instanceLeaseEnabled) {
256260
this.instanceLeaseEnabled = instanceLeaseEnabled;
257261
}
262+
263+
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
264+
this.dynamicScalingEnabled = dynamicScalingEnabled;
265+
}
258266
}

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;

core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,33 @@
1717

1818
package com.cloud.agent.api;
1919

20+
import org.apache.cloudstack.storage.volume.VolumeOnStorageTO;
21+
22+
import java.util.Map;
23+
2024
public class CheckVolumeAnswer extends Answer {
2125

2226
private long size;
27+
private Map<VolumeOnStorageTO.Detail, String> volumeDetails;
2328

2429
CheckVolumeAnswer() {
2530
}
2631

27-
public CheckVolumeAnswer(CheckVolumeCommand cmd, String details, long size) {
28-
super(cmd, true, details);
32+
public CheckVolumeAnswer(CheckVolumeCommand cmd, final boolean success, String details, long size,
33+
Map<VolumeOnStorageTO.Detail, String> volumeDetails) {
34+
super(cmd, success, details);
2935
this.size = size;
36+
this.volumeDetails = volumeDetails;
3037
}
3138

3239
public long getSize() {
3340
return size;
3441
}
3542

43+
public Map<VolumeOnStorageTO.Detail, String> getVolumeDetails() {
44+
return volumeDetails;
45+
}
46+
3647
public String getString() {
3748
return "CheckVolumeAnswer [size=" + size + "]";
3849
}

0 commit comments

Comments
 (0)