Skip to content

Commit 07b3c1f

Browse files
author
Daan Hoogland
committed
Merge branch '4.22' into UserVmManagerCleanup
2 parents b24cb08 + 4df32ae commit 07b3c1f

224 files changed

Lines changed: 8566 additions & 3524 deletions

File tree

Some content is hidden

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

agent/conf/agent.properties

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,19 @@ iscsi.session.cleanup.enabled=false
457457

458458
# Instance conversion VIRT_V2V_TMPDIR env var
459459
#convert.instance.env.virtv2v.tmpdir=
460+
461+
# Time, in seconds, to wait before retrying to rebase during the incremental snapshot process.
462+
# incremental.snapshot.retry.rebase.wait=60
463+
464+
# Path to the VDDK library directory for VMware to KVM conversion via VDDK,
465+
# passed to virt-v2v as -io vddk-libdir=<path>
466+
#vddk.lib.dir=
467+
468+
# Ordered VDDK transport preference for VMware to KVM conversion via VDDK, passed as
469+
# -io vddk-transports=<value> to virt-v2v. Example: nbd:nbdssl
470+
#vddk.transports=
471+
472+
# Optional vCenter SHA1 thumbprint for VMware to KVM conversion via VDDK, passed as
473+
# -io vddk-thumbprint=<value>. If unset, CloudStack computes it on the KVM host via openssl.
474+
#vddk.thumbprint=
475+

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,30 @@ public Property<Integer> getWorkers() {
808808
*/
809809
public static final Property<String> CONVERT_ENV_VIRTV2V_TMPDIR = new Property<>("convert.instance.env.virtv2v.tmpdir", null, String.class);
810810

811+
/**
812+
* Path to the VDDK library directory on the KVM conversion host, used when converting VMs from VMware to KVM via VDDK.
813+
* This directory is passed to virt-v2v as <code>-io vddk-libdir=&lt;path&gt;</code>.
814+
* Data type: String.<br>
815+
* Default value: <code>null</code>
816+
*/
817+
public static final Property<String> VDDK_LIB_DIR = new Property<>("vddk.lib.dir", null, String.class);
818+
819+
/**
820+
* Ordered list of VDDK transports for virt-v2v, passed as <code>-io vddk-transports=&lt;value&gt;</code>.
821+
* Example: <code>nbd:nbdssl</code>.
822+
* Data type: String.<br>
823+
* Default value: <code>null</code>
824+
*/
825+
public static final Property<String> VDDK_TRANSPORTS = new Property<>("vddk.transports", null, String.class);
826+
827+
/**
828+
* vCenter TLS certificate thumbprint used by virt-v2v VDDK mode, passed as <code>-io vddk-thumbprint=&lt;value&gt;</code>.
829+
* If unset, the KVM host computes it at runtime from the vCenter endpoint.
830+
* Data type: String.<br>
831+
* Default value: <code>null</code>
832+
*/
833+
public static final Property<String> VDDK_THUMBPRINT = new Property<>("vddk.thumbprint", null, String.class);
834+
811835
/**
812836
* BGP controll CIDR
813837
* Data type: String.<br>
@@ -885,6 +909,11 @@ public Property<Integer> getWorkers() {
885909
*/
886910
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
887911

912+
/**
913+
* Time, in seconds, to wait before retrying to rebase during the incremental snapshot process.
914+
* */
915+
public static final Property<Integer> INCREMENTAL_SNAPSHOT_RETRY_REBASE_WAIT = new Property<>("incremental.snapshot.retry.rebase.wait", 60);
916+
888917

889918
public static class Property <T>{
890919
private String name;

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/agent/api/to/RemoteInstanceTO.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ public class RemoteInstanceTO implements Serializable {
3636
private String vcenterPassword;
3737
private String vcenterHost;
3838
private String datacenterName;
39+
private String clusterName;
40+
private String hostName;
3941

4042
public RemoteInstanceTO() {
4143
}
4244

43-
public RemoteInstanceTO(String instanceName) {
45+
public RemoteInstanceTO(String instanceName, String clusterName, String hostName) {
4446
this.hypervisorType = Hypervisor.HypervisorType.VMware;
4547
this.instanceName = instanceName;
48+
this.clusterName = clusterName;
49+
this.hostName = hostName;
4650
}
4751

4852
public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
@@ -55,6 +59,12 @@ public RemoteInstanceTO(String instanceName, String instancePath, String vcenter
5559
this.datacenterName = datacenterName;
5660
}
5761

62+
public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName, String clusterName, String hostName) {
63+
this(instanceName, instancePath, vcenterHost, vcenterUsername, vcenterPassword, datacenterName);
64+
this.clusterName = clusterName;
65+
this.hostName = hostName;
66+
}
67+
5868
public Hypervisor.HypervisorType getHypervisorType() {
5969
return this.hypervisorType;
6070
}
@@ -82,4 +92,12 @@ public String getVcenterHost() {
8292
public String getDatacenterName() {
8393
return datacenterName;
8494
}
95+
96+
public String getClusterName() {
97+
return clusterName;
98+
}
99+
100+
public String getHostName() {
101+
return hostName;
102+
}
85103
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public static String[] toStrings(Host.Type... types) {
5757
String HOST_UEFI_ENABLE = "host.uefi.enable";
5858
String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
5959
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
60+
String HOST_VDDK_SUPPORT = "host.vddk.support";
61+
String HOST_VDDK_LIB_DIR = "vddk.lib.dir";
62+
String HOST_VDDK_VERSION = "host.vddk.version";
6063
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
6164
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
6265
String HOST_SSH_PORT = "host.ssh.port";

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 & 10 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

@@ -191,6 +192,7 @@ public interface ResourceLimitService {
191192
*/
192193
public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException;
193194
public void checkResourceLimitWithTag(Account account, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
195+
public void checkResourceLimitWithTag(Account account, Long domainId, boolean considerSystemAccount, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
194196

195197
/**
196198
* Gets the count of resources for a resource type and account
@@ -251,12 +253,12 @@ public interface ResourceLimitService {
251253
List<String> getResourceLimitStorageTags(DiskOffering diskOffering);
252254
void updateTaggedResourceLimitsAndCountsForAccounts(List<AccountResponse> responses, String tag);
253255
void updateTaggedResourceLimitsAndCountsForDomains(List<DomainResponse> responses, String tag);
254-
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
255-
256+
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
257+
List<String> getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering);
256258
void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize,
257-
DiskOffering currentOffering, DiskOffering newOffering) throws ResourceAllocationException;
259+
DiskOffering currentOffering, DiskOffering newOffering, List<Reserver> reservations) throws ResourceAllocationException;
258260

259-
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
261+
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
260262

261263
void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
262264
void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
@@ -273,25 +275,23 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp
273275

274276
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
275277
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
276-
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
278+
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;
277279
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
278280
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
279281

280282
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
281-
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
283+
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;
282284

283285
void checkVmResourceLimitsForTemplateChange(Account owner, Boolean display, ServiceOffering offering,
284-
VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate) throws ResourceAllocationException;
286+
VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate, List<Reserver> reservations) throws ResourceAllocationException;
285287

286-
void checkVmCpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu) throws ResourceAllocationException;
287288
void incrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
288289
void decrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
289-
void checkVmMemoryResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory) throws ResourceAllocationException;
290290
void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
291291
void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
292292

293-
void checkVmGpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu) throws ResourceAllocationException;
294293
void incrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
295294
void decrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
296295

296+
long recalculateDomainResourceCount(final long domainId, final ResourceType type, String tag);
297297
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public String toString() {
127127
}
128128

129129
public static ApiCommandResourceType fromString(String value) {
130-
if (StringUtils.isNotEmpty(value) && EnumUtils.isValidEnum(ApiCommandResourceType.class, value)) {
131-
return valueOf(value);
130+
if (StringUtils.isNotBlank(value) && EnumUtils.isValidEnumIgnoreCase(ApiCommandResourceType.class, value)) {
131+
return EnumUtils.getEnumIgnoreCase(ApiCommandResourceType.class, value);
132132
}
133133
return null;
134134
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ public class ApiConstants {
502502
public static final String RECOVER = "recover";
503503
public static final String REPAIR = "repair";
504504
public static final String REQUIRES_HVM = "requireshvm";
505+
public static final String RESERVED_RESOURCE_DETAILS = "reservedresourcedetails";
505506
public static final String RESOURCES = "resources";
506507
public static final String RESOURCE_COUNT = "resourcecount";
507508
public static final String RESOURCE_NAME = "resourcename";
@@ -621,6 +622,7 @@ public class ApiConstants {
621622
public static final String USER_CONFIGURABLE = "userconfigurable";
622623
public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
623624
public static final String USER_SECRET_KEY = "usersecretkey";
625+
public static final String USE_VDDK = "usevddk";
624626
public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
625627
public static final String USE_VIRTUAL_ROUTER_IP_RESOLVER = "userouteripresolver";
626628
public static final String UPDATE_IN_SEQUENCE = "updateinsequence";

0 commit comments

Comments
 (0)