bernardodemarco commented on code in PR #11222: URL: https://github.com/apache/cloudstack/pull/11222#discussion_r2210810184
########## server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java: ########## @@ -515,24 +516,44 @@ public List<BackupSchedule> listBackupSchedule(final Long vmId) { public boolean deleteBackupSchedule(DeleteBackupScheduleCmd cmd) { Long vmId = cmd.getVmId(); Long id = cmd.getId(); - if (Objects.isNull(vmId) && Objects.isNull(id)) { - throw new InvalidParameterValueException("Either instance ID or ID of backup schedule needs to be specified"); + if (ObjectUtils.allNull(vmId, id)) { + throw new InvalidParameterValueException("Either instance ID or ID of backup schedule needs to be specified."); } + if (Objects.nonNull(vmId)) { - final VMInstanceVO vm = findVmById(vmId); - validateForZone(vm.getDataCenterId()); - accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm); - return deleteAllVMBackupSchedules(vm.getId()); - } else { - final BackupSchedule schedule = backupScheduleDao.findById(id); - if (schedule == null) { - throw new CloudRuntimeException("Could not find the requested backup schedule."); - } - return backupScheduleDao.remove(schedule.getId()); + checkCallerAccessToBackupScheduleVm(vmId); + return deleteAllVmBackupSchedules(vmId); + } Review Comment: @DaanHoogland, yes, makes sense Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org