Skip to content

Commit bfdcf47

Browse files
João JandreJoaoJandre
authored andcommitted
Add backup validation
1 parent 4b1fcec commit bfdcf47

File tree

91 files changed

+2786
-650
lines changed

Some content is hidden

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

91 files changed

+2786
-650
lines changed

agent/conf/agent.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,3 +461,12 @@ iscsi.session.cleanup.enabled=false
461461
# Timeout (in seconds) for QCOW2 delta merge operations, mainly used for classic volume snapshots, disk-only VM snapshots on file-based storage, and the KNIB plugin.
462462
# If a value of 0 or less is informed, the default will be used.
463463
# qcow2.delta.merge.timeout=259200
464+
465+
466+
# Maximum number of backup validation jobs that can be executed at the same time. Values lower than 0 remove the limit, meaning that as many validations as possible will be done at
467+
# the same time.
468+
# backup.validation.max.concurrent.operations.per.host=
469+
470+
# Maximum number of backup compression jobs that can be executed at the same time. Values lower than 0 remove the limit, meaning that as many compressions as possible will be
471+
# done at the same time.
472+
# backup.compression.max.concurrent.operations.per.host=

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,18 @@ public Property<Integer> getWorkers() {
887887
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
888888

889889

890+
/**
891+
* Maximum number of backup validation jobs that can be executed at the same time. Values lower than 0 remove the limit, meaning that as many validations as possible will be done at
892+
* the same time.
893+
*/
894+
public static final Property<Integer> BACKUP_VALIDATION_MAX_CONCURRENT_OPERATIONS_PER_HOST = new Property<>("backup.validation.max.concurrent.operations.per.host", null, Integer.class);
895+
896+
/**
897+
* Maximum number of backup compression jobs that can be executed at the same time. Values lower than 0 remove the limit, meaning that as many compressions as possible will be
898+
* done at the same time.
899+
*/
900+
public static final Property<Integer> BACKUP_COMPRESSION_MAX_CONCURRENT_OPERATIONS_PER_HOST = new Property<>("backup.compression.max.concurrent.operations.per.host", null, Integer.class);
901+
890902
public static class Property <T>{
891903
private String name;
892904
private T defaultValue;

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ public class EventTypes {
643643
public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC";
644644
public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT";
645645
public static final String EVENT_VM_CREATE_FROM_BACKUP = "VM.CREATE.FROM.BACKUP";
646+
public static final String EVENT_SCREENSHOT_DOWNLOAD = "BACKUP.VALIDATION.SCREENSHOT.DOWNLOAD";
646647

647648
// external network device events
648649
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD";

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public static enum ImageFormat {
3535
VDI(true, true, false, "vdi"),
3636
TAR(false, false, false, "tar"),
3737
ZIP(false, false, false, "zip"),
38-
DIR(false, false, false, "dir");
38+
DIR(false, false, false, "dir"),
39+
PNG(false, false, false, "png");
3940

4041
private final boolean supportThinProvisioning;
4142
private final boolean supportSparse;

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

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

183183
boolean validateConditionsToReplaceDiskOfferingOfVolume(Volume volume, DiskOffering newDiskOffering, StoragePool destPool);
184184

185-
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);
185+
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge, Boolean countDisplayFalseInResourceCount);
186186

187187
void destroyVolume(long volumeId);
188188

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean displa
259259
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
260260

261261
void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
262-
void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
262+
void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering, Boolean countDisplayFalseInResourceCount);
263263

264264
void updateVmResourceCountForTemplateChange(long accountId, Boolean display, ServiceOffering offering, VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate);
265265

@@ -274,8 +274,8 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp
274274
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
275275
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
276276
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
277-
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
278-
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
277+
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceLimit);
278+
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceCount);
279279

280280
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
281281
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException;

api/src/main/java/com/cloud/vm/UserVmService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ public interface UserVmService {
7373
/**
7474
* Destroys one virtual machine
7575
*
76-
* @param cmd the API Command Object containg the parameters to use for this service action
76+
* @param cmd
77+
* the API Command Object containg the parameters to use for this service action
78+
* @param checkExpunge
7779
* @throws ConcurrentOperationException
7880
* @throws ResourceUnavailableException
7981
*/
80-
UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
82+
UserVm destroyVm(DestroyVMCmd cmd, boolean checkExpunge) throws ResourceUnavailableException, ConcurrentOperationException;
8183

8284
/**
8385
* Destroys one virtual machine

api/src/main/java/com/cloud/vm/VmDetailConstants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,10 @@ public interface VmDetailConstants {
132132

133133
// KNIB specific
134134
String LINKED_VOLUMES_SECONDARY_STORAGE_UUIDS = "linkedVolumesSecondaryStorageUuids";
135+
String VALIDATION_COMMAND = "backupValidationCommand";
136+
String VALIDATION_COMMAND_ARGUMENTS = "backupValidationCommandArguments";
137+
String VALIDATION_COMMAND_EXPECTED_RESULT = "backupValidationCommandExpectedResult";
138+
String VALIDATION_COMMAND_TIMEOUT = "backupValidationCommandTimeout";
139+
String VALIDATION_SCREENSHOT_WAIT = "backupValidationScreenshotWait";
140+
String VALIDATION_BOOT_TIMEOUT = "backupValidationBootTimeout";
135141
}

api/src/main/java/org/apache/cloudstack/alert/AlertService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ private AlertType(short type, String name, boolean isDefault) {
8383
public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", true, true);
8484
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
8585
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);
86+
public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_FAILED = new AlertType((short)35, "ALERT.BACKUP.VALIDATION.FAILED", true, true);
87+
public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_UNABLE_TO_VALIDATE = new AlertType((short)36, "ALERT.BACKUP.VALIDATION.UNABLE.TO.VALIDATE", true, true);
88+
public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_CLEANUP_FAILED = new AlertType((short)37, "ALERT.BACKUP.VALIDATION.CLEANUP_FAILED", true, true);
8689

8790
public short getType() {
8891
return type;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ public class ApiConstants {
572572
public static final String STATS = "stats";
573573
public static final String STATUS = "status";
574574
public static final String COMPRESSION_STATUS = "compressionstatus";
575+
public static final String VALIDATION_STATUS = "validationstatus";
575576
public static final String STORAGE_TYPE = "storagetype";
576577
public static final String STORAGE_POLICY = "storagepolicy";
577578
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
@@ -1389,6 +1390,8 @@ public class ApiConstants {
13891390

13901391
public static final String VALIDATE = "validate";
13911392

1393+
public static final String VALIDATION_STEPS = "validationsteps";
1394+
13921395
public static final String ALLOW_QUICK_RESTORE = "allowquickrestore";
13931396

13941397
public static final String ALLOW_EXTRACT_FILE = "allowextractfile";

0 commit comments

Comments
 (0)