Skip to content

Commit 1f9cbd4

Browse files
committed
address review comments
1 parent 1f306b7 commit 1f9cbd4

7 files changed

Lines changed: 19 additions & 23 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public class CreateImageTransferCmd extends BaseCmd implements AdminCmd {
6565

6666
@Parameter(name = ApiConstants.FORMAT,
6767
type = CommandType.STRING,
68-
description = "Format of the image: cow/raw. Currently only raw is supported for download. Defaults to raw if not provided")
68+
description = "Format for the image transfer: raw/cow. 'raw' will create an NBD backend. 'cow' will use the File backend." +
69+
"For download, only the 'raw' format is supported. Default: raw")
6970
private String format;
7071

7172
public Long getBackupId() {

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.apache.cloudstack.context.CallContext;
3333

3434
@APICommand(name = "finalizeImageTransfer",
35-
description = "Finalize an image transfe. This API is intended for testing only and is disabled by default.r",
35+
description = "Finalize an image transfer. This API is intended for testing only and is disabled by default.",
3636
responseObject = SuccessResponse.class,
3737
since = "4.23.0",
3838
authorized = {RoleType.Admin})

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/StartBackupCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import com.cloud.event.EventTypes;
3838

3939
@APICommand(name = "startBackup",
40-
description = "Start a VM backup session. This API is intended for testing only and is disabled by default.",
40+
description = "Start a VM backup session using pull mode backup-begin on the KVM host. This API is intended for testing only and is disabled by default.",
4141
responseObject = BackupResponse.class,
4242
since = "4.23.0",
4343
authorized = {RoleType.Admin})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface Backup extends ControlledEntity, InternalIdentity, Identity {
3939
Long getHostId();
4040

4141
enum Status {
42-
Allocated, Queued, BackingUp, ReadyForTransfer, FinalizingTransfer, BackedUp, Error, Failed, Restoring, Removed, Expunged
42+
Allocated, Queued, BackingUp, ReadyForImageTransfer, FinalizingImageTransfer, BackedUp, Error, Failed, Restoring, Removed, Expunged
4343
}
4444

4545
class Metric {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
5858
ConfigKey<String> BackupProviderPlugin = new ValidatedConfigKey<>("Advanced", String.class,
5959
"backup.framework.provider.plugin",
6060
"dummy",
61-
"The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker, nas",
61+
"The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker and nas",
6262
true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key(), value -> validateBackupProviderConfig((String)value));
6363

6464
ConfigKey<Long> BackupSyncPollingInterval = new ConfigKey<>("Advanced", Long.class,

plugins/integrations/veeam-control-service/src/main/java/org/apache/cloudstack/veeam/api/converter/BackupVOToBackupConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ private static String mapStatusToPhase(final BackupVO.Status status) {
8686
return "initializing";
8787
case BackingUp:
8888
return "starting";
89-
case ReadyForTransfer:
89+
case ReadyForImageTransfer:
9090
return "ready";
91-
case FinalizingTransfer:
91+
case FinalizingImageTransfer:
9292
return "finalizing";
9393
case Restoring:
9494
case BackedUp:

server/src/main/java/org/apache/cloudstack/backup/KVMBackupExportServiceImpl.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ public class KVMBackupExportServiceImpl extends ManagerBase implements KVMBackup
138138

139139
VmWorkJobHandlerProxy jobHandlerProxy = new VmWorkJobHandlerProxy(this);
140140

141-
private boolean isKVMBackupExportServiceSupported(Long zoneId) {
142-
return !BackupFrameworkEnabled.value() || StringUtils.equals("dummy", BackupProviderPlugin.valueIn(zoneId));
141+
private void verifyKVMBackupExportServiceSupported(Long zoneId) {
142+
if (BackupFrameworkEnabled.value() && !StringUtils.equals("dummy", BackupProviderPlugin.valueIn(zoneId))) {
143+
throw new CloudRuntimeException("Veeam-KVM integration can not be used along with the " + BackupProviderPlugin.valueIn(zoneId) +
144+
" backup provider. Either set backup.framework.enabled to false or set the Zone level config backup.framework.provider.plugin to \"dummy\".");
145+
}
143146
}
144147

145148
@Override
@@ -151,10 +154,7 @@ public Backup createBackup(StartBackupCmd cmd) {
151154
throw new CloudRuntimeException("VM not found: " + vmId);
152155
}
153156

154-
if (!isKVMBackupExportServiceSupported(vm.getDataCenterId())) {
155-
throw new CloudRuntimeException("Veeam-KVM integration can not be used along with the " + BackupProviderPlugin.valueIn(vm.getDataCenterId()) +
156-
" backup provider. Either set backup.framework.enabled to false or set the Zone level config backup.framework.provider.plugin to \"dummy\".");
157-
}
157+
verifyKVMBackupExportServiceSupported(vm.getDataCenterId());
158158

159159
if (vm.getState() != State.Running && vm.getState() != State.Stopped) {
160160
throw new CloudRuntimeException("VM must be running or stopped to start backup");
@@ -281,7 +281,7 @@ public Backup startBackup(StartBackupCmd cmd) {
281281

282282
// Update backup with checkpoint creation time
283283
backup.setCheckpointCreateTime(answer.getCheckpointCreateTime());
284-
updateBackupState(backup, Backup.Status.ReadyForTransfer);
284+
updateBackupState(backup, Backup.Status.ReadyForImageTransfer);
285285
queueBackupFinalizeWaitWorkJob(vm, backup);
286286
return backup;
287287
}
@@ -329,7 +329,7 @@ public Backup finalizeBackup(FinalizeBackupCmd cmd) {
329329
throw new CloudRuntimeException("VM not found: " + vmId);
330330
}
331331

332-
updateBackupState(backup, Backup.Status.FinalizingTransfer);
332+
updateBackupState(backup, Backup.Status.FinalizingImageTransfer);
333333

334334
List<ImageTransferVO> transfers = imageTransferDao.listByBackupId(backupId);
335335
for (ImageTransferVO transfer : transfers) {
@@ -607,10 +607,7 @@ public ImageTransfer createImageTransfer(long volumeId, Long backupId, ImageTran
607607
throw new CloudRuntimeException("Volume not found with the specified Id");
608608
}
609609

610-
if (!isKVMBackupExportServiceSupported(volume.getDataCenterId())) {
611-
throw new CloudRuntimeException("Veeam-KVM integration can not be used along with the " + BackupProviderPlugin.valueIn(volume.getDataCenterId()) +
612-
" backup provider. Either set backup.framework.enabled to false or set the Zone level config backup.framework.provider.plugin to \"dummy\".");
613-
}
610+
verifyKVMBackupExportServiceSupported(volume.getDataCenterId());
614611

615612
ImageTransferVO existingTransfer = imageTransferDao.findByVolume(volume.getId());
616613
if (existingTransfer != null) {
@@ -805,10 +802,8 @@ public boolean deleteVmCheckpoint(DeleteVmCheckpointCmd cmd) {
805802
if (vm == null) {
806803
throw new CloudRuntimeException("VM not found: " + cmd.getVmId());
807804
}
808-
if (!isKVMBackupExportServiceSupported(vm.getDataCenterId())) {
809-
throw new CloudRuntimeException("Veeam-KVM integration can not be used along with the " + BackupProviderPlugin.valueIn(vm.getDataCenterId()) +
810-
" backup provider. Either set backup.framework.enabled to false or set the Zone level config backup.framework.provider.plugin to \"dummy\".");
811-
}
805+
806+
verifyKVMBackupExportServiceSupported(vm.getDataCenterId());
812807

813808
if (vm.getState() != State.Running && vm.getState() != State.Stopped) {
814809
throw new CloudRuntimeException("VM must be running or stopped to delete checkpoint");

0 commit comments

Comments
 (0)