mirror of https://github.com/apache/cloudstack.git
Block remove of VM which has backup offering (#5457)
Co-authored-by: SadiJr <sadi@scclouds.com.br>
This commit is contained in:
parent
d82cd5569a
commit
478e24493e
|
|
@ -2364,6 +2364,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
List<Backup> backupsForVm = backupDao.listByVmId(vm.getDataCenterId(), vm.getId());
|
||||
if (CollectionUtils.isEmpty(backupsForVm)) {
|
||||
backupManager.removeVMFromBackupOffering(vm.getId(), true);
|
||||
} else {
|
||||
throw new CloudRuntimeException(String.format("This VM [uuid: %s, name: %s] has a "
|
||||
+ "Backup Offering [id: %s, external id: %s] with %s backups. Please, remove the backup offering "
|
||||
+ "before proceeding to VM exclusion!", vm.getUuid(), vm.getInstanceName(), vm.getBackupOfferingId(),
|
||||
vm.getBackupExternalId(), backupsForVm.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue