Skip to content

Commit 7aa2edc

Browse files
committed
Merge branch 'main' into refactor-backup-schedules-retention-workflows
2 parents 6dbc1c0 + 6d5cefd commit 7aa2edc

File tree

102 files changed

+4093
-1021
lines changed

Some content is hidden

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

102 files changed

+4093
-1021
lines changed

.asf.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ github:
5353
- acs-robot
5454
- gpordeus
5555
- hsato03
56-
- bernardodemarco
5756
- FelipeM525
5857
- lucas-a-martins
5958
- nicoschmdt
6059
- abh1sar
61-
- sudo87
6260
- rosi-shapeblue
61+
- sudo87
6362

6463
protected_branches: ~
6564

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ public class AgentProperties{
155155
*/
156156
public static final Property<Integer> CMDS_TIMEOUT = new Property<>("cmds.timeout", 7200);
157157

158+
/**
159+
* The timeout (in seconds) for the snapshot merge operation, mainly used for classic volume snapshots and disk-only VM snapshots on file-based storage.<br>
160+
* This configuration is only considered if libvirt.events.enabled is also true. <br>
161+
* Data type: Integer.<br>
162+
* Default value: <code>259200</code>
163+
*/
164+
public static final Property<Integer> QCOW2_DELTA_MERGE_TIMEOUT = new Property<>("qcow2.delta.merge.timeout", 60 * 60 * 72);
165+
158166
/**
159167
* This parameter sets the VM migration speed (in mbps). The default value is -1,<br>
160168
* which means that the agent will try to guess the speed of the guest network and consume all possible bandwidth.<br>
@@ -833,7 +841,7 @@ public static class Property <T>{
833841
private T defaultValue;
834842
private Class<T> typeClass;
835843

836-
Property(String name, T value) {
844+
public Property(String name, T value) {
837845
init(name, value);
838846
}
839847

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
137137

138138
void updateDisplay(Volume volume, Boolean displayVolume);
139139

140-
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName) throws ResourceAllocationException;
140+
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName, Long vmSnapshotId) throws ResourceAllocationException;
141141

142142
/**
143143
* Checks if the storage pool supports the disk offering tags.

api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
3131
enum State {
3232
Allocated("The VM snapshot is allocated but has not been created yet."), Creating("The VM snapshot is being created."), Ready(
3333
"The VM snapshot is ready to be used."), Reverting("The VM snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed(
34-
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered");
34+
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered"),
35+
Hidden("The VM snapshot is hidden from the user and cannot be recovered.");
3536

3637
String _description;
3738

@@ -60,6 +61,8 @@ public String getDescription() {
6061
s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
6162
s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
6263
s_fsm.addTransition(Expunging, Event.OperationFailed, Error);
64+
s_fsm.addTransition(Expunging, Event.Hide, Hidden);
65+
s_fsm.addTransition(Hidden, Event.ExpungeRequested, Expunging);
6366
}
6467
}
6568

@@ -68,7 +71,7 @@ enum Type {
6871
}
6972

7073
enum Event {
71-
CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested,
74+
CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested, Hide,
7275
}
7376

7477
@Override

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public class ApiConstants {
223223
public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
224224
public static final String FORCE_DELETE_HOST = "forcedeletehost";
225225
public static final String FORCE_MS_TO_IMPORT_VM_FILES = "forcemstoimportvmfiles";
226+
public static final String FORCE_UPDATE_OS_TYPE = "forceupdateostype";
226227
public static final String FORMAT = "format";
227228
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
228229
public static final String FOR_SYSTEM_VMS = "forsystemvms";

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
5151
description = "the ID of the OS type that best represents the OS of this image.")
5252
private Long osTypeId;
5353

54+
@Parameter(name = ApiConstants.FORCE_UPDATE_OS_TYPE, type = CommandType.BOOLEAN, since = "4.21", description = "Force OS type update. Warning: Updating OS type will " +
55+
"update the guest OS configuration for all the existing Instances deployed with this template/iso, which may affect their behavior.")
56+
private Boolean forceUpdateOsType;
57+
5458
@Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "the format for the image")
5559
private String format;
5660

@@ -112,6 +116,10 @@ public Long getOsTypeId() {
112116
return osTypeId;
113117
}
114118

119+
public Boolean getForceUpdateOsType() {
120+
return forceUpdateOsType;
121+
}
122+
115123
public Boolean getPasswordEnabled() {
116124
return passwordEnabled;
117125
}

api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
description = "Deletes the backup schedule of a VM",
4444
responseObject = SuccessResponse.class, since = "4.14.0",
4545
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
46-
public class DeleteBackupScheduleCmd extends BaseCmd {
46+
public class DeleteBackupScheduleCmd extends BaseCmd {
4747

4848
@Inject
4949
private BackupManager backupManager;
@@ -52,17 +52,13 @@ public class DeleteBackupScheduleCmd extends BaseCmd {
5252
//////////////// API parameters /////////////////////
5353
/////////////////////////////////////////////////////
5454

55-
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
56-
type = CommandType.UUID,
57-
entityType = UserVmResponse.class,
58-
description = "ID of the VM")
55+
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class,
56+
description = "ID of the VM from which all backup schedules will be deleted.")
5957
private Long vmId;
6058

61-
@Parameter(name = ApiConstants.ID,
62-
type = CommandType.UUID,
63-
entityType = BackupScheduleResponse.class,
64-
description = "ID of the schedule",
65-
since = "4.20.1")
59+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BackupScheduleResponse.class,
60+
since = "4.20.1", description = "ID of the backup schedule to be deleted. It has precedence over the 'virtualmachineid' parameter, " +
61+
"i.e., when the 'id' parameter is specified, the 'virtualmachineid' parameter will be ignored.")
6662
private Long id;
6763

6864
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public ApiCommandResourceType getApiResourceType() {
153153

154154
@Override
155155
public void create() throws ResourceAllocationException {
156-
Snapshot snapshot = this._volumeService.allocSnapshotForVm(getVmId(), getVolumeId(), getSnapshotName());
156+
Snapshot snapshot = this._volumeService.allocSnapshotForVm(getVmId(), getVolumeId(), getSnapshotName(), getVMSnapshotId());
157157
if (snapshot != null) {
158158
this.setEntityId(snapshot.getId());
159159
this.setEntityUuid(snapshot.getUuid());

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
@EntityReference(value = BackupSchedule.class)
3030
public class BackupScheduleResponse extends BaseResponse {
31+
@SerializedName(ApiConstants.ID)
32+
@Param(description = "ID of the backup schedule.", since = "4.21.0")
33+
private String id;
3134

3235
@SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME)
3336
@Param(description = "name of the VM")
@@ -51,7 +54,11 @@ public class BackupScheduleResponse extends BaseResponse {
5154

5255
@SerializedName(ApiConstants.MAX_BACKUPS)
5356
@Param(description = "maximum number of backups retained")
54-
private Integer maxBakups;
57+
private Integer maxBackups;
58+
59+
public void setId(String id) {
60+
this.id = id;
61+
}
5562

5663
public String getVmName() {
5764
return vmName;
@@ -93,7 +100,7 @@ public void setTimezone(String timezone) {
93100
this.timezone = timezone;
94101
}
95102

96-
public void setMaxBakups(Integer maxBakups) {
97-
this.maxBakups = maxBakups;
103+
public void setMaxBackups(Integer maxBackups) {
104+
this.maxBackups = maxBackups;
98105
}
99106
}

api/src/main/java/org/apache/cloudstack/backup/BackupSchedule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ public interface BackupSchedule extends InternalIdentity {
3131
Date getScheduledTimestamp();
3232
Long getAsyncJobId();
3333
int getMaxBackups();
34+
String getUuid();
3435
}

0 commit comments

Comments
 (0)