Skip to content

Commit dad9f5e

Browse files
committed
use timeout set via "commands.timeout"
1 parent b958300 commit dad9f5e

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class TakeBackupCommand extends Command {
3535
private Boolean quiesce;
3636
@LogLevel(LogLevel.Log4jLevel.Off)
3737
private String mountOptions;
38-
private Integer timeout;
3938

4039
public TakeBackupCommand(String vmName, String backupPath) {
4140
super();
@@ -107,14 +106,6 @@ public void setQuiesce(Boolean quiesce) {
107106
this.quiesce = quiesce;
108107
}
109108

110-
public Integer getTimeout() {
111-
return this.timeout == null ? 0 : this.timeout;
112-
}
113-
114-
public void setTimeout(Integer timeout) {
115-
this.timeout = timeout;
116-
}
117-
118109
@Override
119110
public boolean executeInSequence() {
120111
return true;

plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ public class NASBackupProvider extends AdapterBase implements BackupProvider, Co
8585
true,
8686
BackupFrameworkEnabled.key());
8787

88-
ConfigKey<Integer> NASBackupCreateBackupTimeout = new ConfigKey<>("Advanced", Integer.class,
89-
"nas.backup.create.backup.timeout",
90-
"14400",
91-
"Timeout in seconds for the create backup command.",
92-
true,
93-
BackupFrameworkEnabled.key());
94-
9588
@Inject
9689
private BackupDao backupDao;
9790

@@ -212,7 +205,6 @@ public Pair<Boolean, Backup> takeBackup(final VirtualMachine vm, Boolean quiesce
212205
command.setBackupRepoAddress(backupRepository.getAddress());
213206
command.setMountOptions(backupRepository.getMountOptions());
214207
command.setQuiesce(quiesceVM);
215-
command.setTimeout(NASBackupCreateBackupTimeout.value());
216208

217209
if (VirtualMachine.State.Stopped.equals(vm.getState())) {
218210
List<VolumeVO> vmVolumes = volumeDao.findByInstance(vm.getId());

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Answer execute(RestoreBackupCommand command, LibvirtComputingResource ser
8888
List<PrimaryDataStoreTO> restoreVolumePools = command.getRestoreVolumePools();
8989
List<String> restoreVolumePaths = command.getRestoreVolumePaths();
9090
Integer mountTimeout = command.getMountTimeout() * 1000;
91-
int timeout = command.getWait();
91+
int timeout = command.getWait() > 0 ? command.getWait() * 1000 : serverResource.getCmdsTimeout();
9292
KVMStoragePoolManager storagePoolMgr = serverResource.getStoragePoolMgr();
9393
List<String> backupFiles = command.getBackupFiles();
9494

@@ -270,15 +270,15 @@ private boolean replaceVolumeWithBackup(KVMStoragePoolManager storagePoolMgr, Pr
270270
return replaceBlockDeviceWithBackup(storagePoolMgr, volumePool, volumePath, backupPath, timeout, createTargetVolume, size);
271271
}
272272

273-
int exitValue = Script.runSimpleBashScriptForExitValue(String.format(RSYNC_COMMAND, backupPath, volumePath));
273+
int exitValue = Script.runSimpleBashScriptForExitValue(String.format(RSYNC_COMMAND, backupPath, volumePath), timeout, false);
274274
return exitValue == 0;
275275
}
276276

277277
private boolean replaceBlockDeviceWithBackup(KVMStoragePoolManager storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String backupPath, int timeout, boolean createTargetVolume, Long size) {
278278
KVMStoragePool volumeStoragePool = storagePoolMgr.getStoragePool(volumePool.getPoolType(), volumePool.getUuid());
279279
QemuImg qemu;
280280
try {
281-
qemu = new QemuImg(timeout * 1000, true, false);
281+
qemu = new QemuImg(timeout, true, false);
282282
String volumeUuid = getVolumeUuidFromPath(volumePath, volumePool);
283283
KVMPhysicalDisk disk = null;
284284
if (createTargetVolume) {

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtTakeBackupCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public Answer execute(TakeBackupCommand command, LibvirtComputingResource libvir
5151
final String mountOptions = command.getMountOptions();
5252
List<PrimaryDataStoreTO> volumePools = command.getVolumePools();
5353
final List<String> volumePaths = command.getVolumePaths();
54-
Long timeout = (long) (command.getTimeout() * 1000);
5554
KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();
55+
int timeout = command.getWait() > 0 ? command.getWait() * 1000 : libvirtComputingResource.getCmdsTimeout();
5656

5757
List<String> diskPaths = new ArrayList<>();
5858
if (Objects.nonNull(volumePaths)) {

0 commit comments

Comments
 (0)