mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Veeam: revert unnecessary state change if restore backup and attach to another VM (#8614)
This commit is contained in:
parent
af2e277999
commit
a924a110e1
@ -770,20 +770,16 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager {
|
||||
String[] hostPossibleValues = {host.getPrivateIpAddress(), host.getName()};
|
||||
String[] datastoresPossibleValues = {datastore.getUuid(), datastore.getName()};
|
||||
|
||||
updateVmState(vm, VirtualMachine.Event.RestoringRequested, VirtualMachine.State.Restoring);
|
||||
Pair<Boolean, String> result = restoreBackedUpVolume(backedUpVolumeUuid, backup, backupProvider, hostPossibleValues, datastoresPossibleValues);
|
||||
|
||||
if (BooleanUtils.isFalse(result.first())) {
|
||||
updateVmState(vm, VirtualMachine.Event.RestoringFailed, VirtualMachine.State.Stopped);
|
||||
throw new CloudRuntimeException(String.format("Error restoring volume [%s] of VM [%s] to host [%s] using backup provider [%s] due to: [%s].",
|
||||
backedUpVolumeUuid, vm.getUuid(), host.getUuid(), backupProvider.getName(), result.second()));
|
||||
}
|
||||
if (!attachVolumeToVM(vm.getDataCenterId(), result.second(), vmFromBackup.getBackupVolumeList(),
|
||||
backedUpVolumeUuid, vm, datastore.getUuid(), backup)) {
|
||||
updateVmState(vm, VirtualMachine.Event.RestoringFailed, VirtualMachine.State.Stopped);
|
||||
throw new CloudRuntimeException(String.format("Error attaching volume [%s] to VM [%s]." + backedUpVolumeUuid, vm.getUuid()));
|
||||
}
|
||||
updateVmState(vm, VirtualMachine.Event.RestoringSuccess, VirtualMachine.State.Stopped);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user