mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Set external Id to null after backupProvider.removeVMFromBackup (#10562)
This commit is contained in:
parent
95c24810ab
commit
35e809e7ce
@ -199,6 +199,9 @@ public class VeeamBackupProvider extends AdapterBase implements BackupProvider,
|
|||||||
public boolean removeVMFromBackupOffering(final VirtualMachine vm) {
|
public boolean removeVMFromBackupOffering(final VirtualMachine vm) {
|
||||||
final VeeamClient client = getClient(vm.getDataCenterId());
|
final VeeamClient client = getClient(vm.getDataCenterId());
|
||||||
final VmwareDatacenter vmwareDC = findVmwareDatacenterForVM(vm);
|
final VmwareDatacenter vmwareDC = findVmwareDatacenterForVM(vm);
|
||||||
|
if (vm.getBackupExternalId() == null) {
|
||||||
|
throw new CloudRuntimeException("The VM does not have a backup job assigned.");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (!client.removeVMFromVeeamJob(vm.getBackupExternalId(), vm.getInstanceName(), vmwareDC.getVcenterHost())) {
|
if (!client.removeVMFromVeeamJob(vm.getBackupExternalId(), vm.getInstanceName(), vmwareDC.getVcenterHost())) {
|
||||||
LOG.warn("Failed to remove VM from Veeam Job id: " + vm.getBackupExternalId());
|
LOG.warn("Failed to remove VM from Veeam Job id: " + vm.getBackupExternalId());
|
||||||
|
|||||||
@ -368,10 +368,10 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager {
|
|||||||
|
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
try {
|
try {
|
||||||
vm.setBackupOfferingId(null);
|
|
||||||
vm.setBackupExternalId(null);
|
|
||||||
vm.setBackupVolumes(null);
|
|
||||||
result = backupProvider.removeVMFromBackupOffering(vm);
|
result = backupProvider.removeVMFromBackupOffering(vm);
|
||||||
|
vm.setBackupOfferingId(null);
|
||||||
|
vm.setBackupVolumes(null);
|
||||||
|
vm.setBackupExternalId(null);
|
||||||
if (result && backupProvider.willDeleteBackupsOnOfferingRemoval()) {
|
if (result && backupProvider.willDeleteBackupsOnOfferingRemoval()) {
|
||||||
final List<Backup> backups = backupDao.listByVmId(null, vm.getId());
|
final List<Backup> backups = backupDao.listByVmId(null, vm.getId());
|
||||||
for (final Backup backup : backups) {
|
for (final Backup backup : backups) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user