Skip to content

Commit b1ac80a

Browse files
authored
Merge branch '4.20' into fix-svcoff-speedcheck
2 parents 2cefcc3 + 6f1aa96 commit b1ac80a

File tree

126 files changed

+3812
-2922
lines changed

Some content is hidden

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

126 files changed

+3812
-2922
lines changed

.github/workflows/merge-conflict-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
name: "PR Merge Conflict Check"
1919
on:
2020
push:
21-
pull_request_target:
22-
types: [synchronize]
21+
pull_request:
22+
types: [opened, synchronize, reopened]
2323

2424
permissions: # added using https://github.com/step-security/secure-workflows
2525
contents: read

api/src/main/java/com/cloud/agent/api/to/BucketTO.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ public final class BucketTO {
2626

2727
private String secretKey;
2828

29+
private long accountId;
30+
2931
public BucketTO(Bucket bucket) {
3032
this.name = bucket.getName();
3133
this.accessKey = bucket.getAccessKey();
3234
this.secretKey = bucket.getSecretKey();
35+
this.accountId = bucket.getAccountId();
3336
}
3437

3538
public BucketTO(String name) {
@@ -47,4 +50,8 @@ public String getAccessKey() {
4750
public String getSecretKey() {
4851
return this.secretKey;
4952
}
53+
54+
public long getAccountId() {
55+
return this.accountId;
56+
}
5057
}

api/src/main/java/com/cloud/host/Host.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static String[] toStrings(Host.Type... types) {
5959
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
6060
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
6161
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
62+
String HOST_SSH_PORT = "host.ssh.port";
63+
64+
int DEFAULT_SSH_PORT = 22;
6265

6366
/**
6467
* @return name of the machine.

api/src/main/java/com/cloud/projects/ProjectService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public interface ProjectService {
8282

8383
Project updateProject(long id, String name, String displayText, String newOwnerName, Long userId, Role newRole) throws ResourceAllocationException;
8484

85-
boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType);
85+
boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType) throws ResourceAllocationException;
8686

8787
boolean deleteAccountFromProject(long projectId, String accountName);
8888

@@ -100,6 +100,6 @@ public interface ProjectService {
100100

101101
Project findByProjectAccountIdIncludingRemoved(long projectAccountId);
102102

103-
boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole);
103+
boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole) throws ResourceAllocationException;
104104

105105
}

api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323

2424
public interface VMTemplateStorageResourceAssoc extends InternalIdentity {
2525
public static enum Status {
26-
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
26+
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, LIMIT_REACHED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
2727
}
2828

29+
List<Status> ERROR_DOWNLOAD_STATES = List.of(Status.DOWNLOAD_ERROR, Status.ABANDONED, Status.LIMIT_REACHED, Status.UNKNOWN);
2930
List<Status> PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS);
3031

3132
String getInstallPath();

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.cloud.offering.DiskOffering;
3131
import com.cloud.offering.ServiceOffering;
3232
import com.cloud.template.VirtualMachineTemplate;
33+
import org.apache.cloudstack.resourcelimit.Reserver;
3334

3435
public interface ResourceLimitService {
3536

@@ -185,6 +186,7 @@ public interface ResourceLimitService {
185186
*/
186187
public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException;
187188
public void checkResourceLimitWithTag(Account account, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
189+
public void checkResourceLimitWithTag(Account account, Long domainId, boolean considerSystemAccount, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
188190

189191
/**
190192
* Gets the count of resources for a resource type and account
@@ -245,12 +247,12 @@ public interface ResourceLimitService {
245247
List<String> getResourceLimitStorageTags(DiskOffering diskOffering);
246248
void updateTaggedResourceLimitsAndCountsForAccounts(List<AccountResponse> responses, String tag);
247249
void updateTaggedResourceLimitsAndCountsForDomains(List<DomainResponse> responses, String tag);
248-
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
249-
250+
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
251+
List<String> getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering);
250252
void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize,
251-
DiskOffering currentOffering, DiskOffering newOffering) throws ResourceAllocationException;
253+
DiskOffering currentOffering, DiskOffering newOffering, List<Reserver> reservations) throws ResourceAllocationException;
252254

253-
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
255+
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
254256

255257
void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
256258
void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
@@ -267,21 +269,20 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp
267269

268270
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
269271
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
270-
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
272+
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;
271273
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
272274
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
273275

274276
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
275-
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
277+
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;
276278

277279
void checkVmResourceLimitsForTemplateChange(Account owner, Boolean display, ServiceOffering offering,
278-
VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate) throws ResourceAllocationException;
280+
VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate, List<Reserver> reservations) throws ResourceAllocationException;
279281

280-
void checkVmCpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu) throws ResourceAllocationException;
281282
void incrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
282283
void decrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
283-
void checkVmMemoryResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory) throws ResourceAllocationException;
284284
void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
285285
void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
286286

287+
long recalculateDomainResourceCount(final long domainId, final ResourceType type, String tag);
287288
}

api/src/main/java/org/apache/cloudstack/api/ApiServerService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4848
boolean forgotPassword(UserAccount userAccount, Domain domain);
4949

5050
boolean resetPassword(UserAccount userAccount, String token, String password);
51+
52+
String getDomainId(Map<String, Object[]> params);
5153
}

api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public class AddHostCmd extends BaseCmd {
6060
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The Pod ID for the host")
6161
private Long podId;
6262

63-
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL")
63+
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL, optionally add ssh port (format: 'host:port') for KVM hosts," +
64+
" otherwise falls back to the port defined at the config 'kvm.host.discovery.ssh.port'")
6465
private String url;
6566

6667
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The Zone ID for the host")

api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.List;
2020

21+
import com.cloud.exception.ResourceAllocationException;
2122
import org.apache.cloudstack.api.ApiArgValidator;
2223
import org.apache.cloudstack.api.ApiCommandResourceType;
2324
import org.apache.cloudstack.api.BaseCmd;
@@ -106,7 +107,7 @@ public ProjectAccount.Role getRoleType() {
106107
/////////////////////////////////////////////////////
107108

108109
@Override
109-
public void execute() {
110+
public void execute() throws ResourceAllocationException {
110111
if (accountName == null && email == null) {
111112
throw new InvalidParameterValueException("Either accountName or email is required");
112113
}

api/src/main/java/org/apache/cloudstack/api/command/user/account/AddUserToProjectCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.cloudstack.api.command.user.account;
1919

20+
import com.cloud.exception.ResourceAllocationException;
2021
import org.apache.cloudstack.acl.RoleType;
2122
import org.apache.cloudstack.api.APICommand;
2223
import org.apache.cloudstack.api.ApiArgValidator;
@@ -111,7 +112,7 @@ public String getEventDescription() {
111112
/////////////////////////////////////////////////////
112113

113114
@Override
114-
public void execute() {
115+
public void execute() throws ResourceAllocationException {
115116
validateInput();
116117
boolean result = _projectService.addUserToProject(getProjectId(), getUsername(), getEmail(), getProjectRoleId(), getRoleType());
117118
if (result) {

0 commit comments

Comments
 (0)