Skip to content

Commit 66132f8

Browse files
JoaoJandreJoão JandrebernardodemarcowinterhazelGaOrtiga
authored
Introduce new backup provider (KBOSS) (#12758)
Co-authored-by: João Jandre <joao@scclouds.com.br> Co-authored-by: Bernardo De Marco Gonçalves <bernardomg2004@gmail.com> Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com> Co-authored-by: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com>
1 parent 0e43c6a commit 66132f8

246 files changed

Lines changed: 18950 additions & 981 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,15 @@ iscsi.session.cleanup.enabled=false
488488
# Optional vCenter SHA1 thumbprint for VMware to KVM conversion via VDDK, passed as
489489
# -io vddk-thumbprint=<value>. If unset, CloudStack computes it on the KVM host via openssl.
490490
#vddk.thumbprint=
491+
492+
# Timeout (in seconds) for QCOW2 delta merge operations, mainly used for classic volume snapshots, disk-only VM snapshots on file-based storage, and the KBOSS plugin.
493+
# If a value of 0 or less is informed, the default will be used.
494+
# qcow2.delta.merge.timeout=259200
495+
496+
# 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
497+
# the same time.
498+
# backup.validation.max.concurrent.operations.per.host=
499+
500+
# 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
501+
# done at the same time.
502+
# backup.compression.max.concurrent.operations.per.host=

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ public class AgentProperties{
170170
public static final Property<Integer> CMDS_TIMEOUT = new Property<>("cmds.timeout", 7200);
171171

172172
/**
173-
* 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>
173+
* The timeout (in seconds) for QCOW2 delta merge operations, mainly used for classic volume snapshots, disk-only VM snapshots on file-based storage, and the KBOSS plugin.
174+
* If a value of 0 or less is informed, the default will be used.<br>
174175
* This configuration is only considered if libvirt.events.enabled is also true. <br>
175176
* Data type: Integer.<br>
176177
* Default value: <code>259200</code>
@@ -953,6 +954,18 @@ public Property<Integer> getWorkers() {
953954
public static final Property<Boolean> VM_NETWORK_MACIP_STATIC = new Property<>("vm.network.macip.static", false, Boolean.class);
954955

955956

957+
/**
958+
* 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
959+
* the same time.
960+
*/
961+
public static final Property<Integer> BACKUP_VALIDATION_MAX_CONCURRENT_OPERATIONS_PER_HOST = new Property<>("backup.validation.max.concurrent.operations.per.host", null, Integer.class);
962+
963+
/**
964+
* 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
965+
* done at the same time.
966+
*/
967+
public static final Property<Integer> BACKUP_COMPRESSION_MAX_CONCURRENT_OPERATIONS_PER_HOST = new Property<>("backup.compression.max.concurrent.operations.per.host", null, Integer.class);
968+
956969
public static class Property <T>{
957970
private String name;
958971
private T defaultValue;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
package com.cloud.agent.api.to;
2020

2121
public enum DataObjectType {
22-
VOLUME, SNAPSHOT, TEMPLATE, ARCHIVE
22+
VOLUME, SNAPSHOT, TEMPLATE, ARCHIVE, BACKUP
2323
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ public class EventTypes {
668668
public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC";
669669
public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT";
670670
public static final String EVENT_VM_CREATE_FROM_BACKUP = "VM.CREATE.FROM.BACKUP";
671+
public static final String EVENT_SCREENSHOT_DOWNLOAD = "BACKUP.VALIDATION.SCREENSHOT.DOWNLOAD";
671672

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

api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Map;
2121

2222
import org.apache.cloudstack.backup.Backup;
23+
import org.apache.cloudstack.backup.BackupProvider;
2324
import org.apache.cloudstack.framework.config.ConfigKey;
2425

2526
import com.cloud.agent.api.Command;
@@ -94,10 +95,10 @@ public interface HypervisorGuru extends Adapter {
9495
Map<String, String> getClusterSettings(long vmId);
9596

9697
VirtualMachine importVirtualMachineFromBackup(long zoneId, long domainId, long accountId, long userId,
97-
String vmInternalName, Backup backup) throws Exception;
98+
String vmInternalName, Backup backup, BackupProvider backupProvider) throws Exception;
9899

99100
boolean attachRestoredVolumeToVirtualMachine(long zoneId, String location, Backup.VolumeInfo volumeInfo,
100-
VirtualMachine vm, long poolId, Backup backup) throws Exception;
101+
VirtualMachine vm, long poolId, Backup backup, BackupProvider backupProvider) throws Exception;
101102
/**
102103
* Will generate commands to migrate a vm to a pool. For now this will only work for stopped VMs on Vmware.
103104
*

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/Volume.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ enum State {
6060
UploadError(false, "Volume upload encountered some error"),
6161
UploadAbandoned(false, "Volume upload is abandoned since the upload was never initiated within a specified time"),
6262
Attaching(true, "The volume is attaching to a VM from Ready state."),
63-
Restoring(true, "The volume is being restored from backup.");
63+
Restoring(true, "The volume is being restored from backup."),
64+
Consolidating(true, "The volume is being flattened."),
65+
RestoreError(false, "The volume restore encountered an error.");
6466

6567
boolean _transitional;
6668

@@ -153,6 +155,10 @@ public String getDescription() {
153155
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Destroy, Event.RestoreRequested, Restoring, null));
154156
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Restoring, Event.RestoreSucceeded, Ready, null));
155157
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Restoring, Event.RestoreFailed, Ready, null));
158+
s_fsm.addTransition(new StateMachine2.Transition<>(Ready, Event.ConsolidationRequested, Consolidating, null));
159+
s_fsm.addTransition(new StateMachine2.Transition<>(Consolidating, Event.OperationSucceeded, Ready, null));
160+
s_fsm.addTransition(new StateMachine2.Transition<>(Consolidating, Event.OperationFailed, RestoreError, null));
161+
s_fsm.addTransition(new StateMachine2.Transition<>(RestoreError, Event.RestoreFailed, RestoreError, null));
156162
}
157163
}
158164

@@ -179,7 +185,8 @@ enum Event {
179185
OperationTimeout,
180186
RestoreRequested,
181187
RestoreSucceeded,
182-
RestoreFailed;
188+
RestoreFailed,
189+
ConsolidationRequested
183190
}
184191

185192
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Volume allocVolume(long ownerId, Long zoneId, Long diskOfferingId, Long vmId, Lo
114114

115115
Volume attachVolumeToVM(AttachVolumeCmd command);
116116

117-
Volume attachVolumeToVM(Long vmId, Long volumeId, Long deviceId, Boolean allowAttachForSharedFS);
117+
Volume attachVolumeToVM(Long vmId, Long volumeId, Long deviceId, Boolean allowAttachForSharedFS, boolean allowAttachOnRestoring);
118118

119119
Volume detachVolumeViaDestroyVM(long vmId, long volumeId);
120120

@@ -189,7 +189,7 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
189189

190190
boolean validateConditionsToReplaceDiskOfferingOfVolume(Volume volume, DiskOffering newDiskOffering, StoragePool destPool);
191191

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

194194
void destroyVolume(long volumeId);
195195

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ public interface ResourceLimitService {
254254
void updateTaggedResourceLimitsAndCountsForAccounts(List<AccountResponse> responses, String tag);
255255
void updateTaggedResourceLimitsAndCountsForDomains(List<DomainResponse> responses, String tag);
256256
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
257-
List<String> getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering);
257+
List<String> getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering, Boolean enforceResourceLimitOnDisplayFalse);
258258
void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize,
259259
DiskOffering currentOffering, DiskOffering newOffering, List<Reserver> reservations) throws ResourceAllocationException;
260260

261261
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List<Reserver> reservations) throws ResourceAllocationException;
262262

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

266266
void updateVmResourceCountForTemplateChange(long accountId, Boolean display, ServiceOffering offering, VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate);
267267

@@ -276,8 +276,8 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp
276276
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
277277
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
278278
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;
279-
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
280-
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
279+
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceLimit);
280+
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceCount);
281281

282282
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
283283
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template, List<Reserver> reservations) throws ResourceAllocationException;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ public interface UserVmService {
7575
* Destroys one virtual machine
7676
*
7777
* @param cmd the API Command Object containg the parameters to use for this service action
78+
* @param checkExpunge
7879
* @throws ConcurrentOperationException
7980
* @throws ResourceUnavailableException
8081
*/
81-
UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
82+
UserVm destroyVm(DestroyVMCmd cmd, boolean checkExpunge) throws ResourceUnavailableException, ConcurrentOperationException;
8283

8384
/**
8485
* Destroys one virtual machine

0 commit comments

Comments
 (0)