Skip to content

Commit c95146f

Browse files
committed
Log exception before trying to recover vm.
1 parent b35e800 commit c95146f

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,13 @@ protected void backupVolumes(TakeKbossBackupCommand command, LibvirtComputingRes
110110
maxWaitInMillis = calculateRemainingTime(maxWaitInMillis, startTimeMillis);
111111
}
112112
} catch (Exception ex) {
113-
recoverPreviousVmStateAndDeletePartialBackup(resource, volumeTosAndNewPaths, vmName, runningVM,
114-
mapVolumeUuidToDeltaPathOnSecondaryAndDeltaSize, storagePoolManager, command.getImageStoreUrl());
115-
throw new BackupException(String.format("There was an exception during the backup process for VM [%s], but the VM has been successfully normalized.", vmName),
116-
ex, true);
113+
logger.error("There has been an exception during the backup creation process. We will try to revert the VM [{}] to its previous state. The exception is: {}", vmName,
114+
ex.getMessage(), ex);
115+
recoverPreviousVmStateAndDeletePartialBackup(resource, volumeTosAndNewPaths, vmName, runningVM, mapVolumeUuidToDeltaPathOnSecondaryAndDeltaSize, storagePoolManager,
116+
command.getImageStoreUrl());
117+
118+
throw new BackupException(String.format("There was an exception during the backup process for VM [%s], but the VM has been successfully normalized.", vmName), ex,
119+
true);
117120
}
118121
}
119122

@@ -317,8 +320,6 @@ protected void endChainForVolume(LibvirtComputingResource resource, VolumeObject
317320
* */
318321
protected void recoverPreviousVmStateAndDeletePartialBackup(LibvirtComputingResource resource, List<Pair<VolumeObjectTO, String>> volumeTosAndNewPaths, String vmName,
319322
boolean runningVm, Map<String, Pair<String, Long>> mapVolumeUuidToDeltaPathOnSecondaryAndSize, KVMStoragePoolManager storagePoolManager, String imageStoreUrl) {
320-
logger.error("There has been an exception during the backup creation process. We will try to revert the VM [{}] to its previous state.", vmName);
321-
322323
for (Pair<VolumeObjectTO, String> volumeObjectTOAndNewPath : volumeTosAndNewPaths) {
323324
VolumeObjectTO volumeObjectTO = volumeObjectTOAndNewPath.first();
324325
String volumeUuid = volumeObjectTO.getUuid();

0 commit comments

Comments
 (0)