Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public boolean assignVMToBackupOffering(final VirtualMachine vm, final BackupOff
public boolean removeVMFromBackupOffering(final VirtualMachine vm) {
final VeeamClient client = getClient(vm.getDataCenterId());
final VmwareDatacenter vmwareDC = findVmwareDatacenterForVM(vm);
if (vm.getBackupExternalId() == null) {
throw new CloudRuntimeException("The VM does not have a backup job assigned.");
}
try {
if (!client.removeVMFromVeeamJob(vm.getBackupExternalId(), vm.getInstanceName(), vmwareDC.getVcenterHost())) {
LOG.warn("Failed to remove VM from Veeam Job id: " + vm.getBackupExternalId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ public boolean removeVMFromBackupOffering(final Long vmId, final boolean forced)

boolean result = false;
try {
result = backupProvider.removeVMFromBackupOffering(vm);
vm.setBackupOfferingId(null);
vm.setBackupExternalId(null);
vm.setBackupVolumes(null);
result = backupProvider.removeVMFromBackupOffering(vm);
vm.setBackupExternalId(null);
if (result && backupProvider.willDeleteBackupsOnOfferingRemoval()) {
final List<Backup> backups = backupDao.listByVmId(null, vm.getId());
for (final Backup backup : backups) {
Expand Down