Skip to content

Commit 5f5ba27

Browse files
João JandreSadiJr
authored andcommitted
Correção de erros de backup introduzidos na .6
1 parent f8ff7c3 commit 5f5ba27

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

api/src/main/java/org/apache/cloudstack/backup/Backup.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.cloudstack.backup;
1919

20+
import java.io.Serializable;
2021
import java.util.Date;
2122
import java.util.List;
2223
import java.util.Map;
@@ -131,7 +132,7 @@ public void setBackupUuid(String backupUuid) {
131132
}
132133
}
133134

134-
class VolumeInfo {
135+
class VolumeInfo implements Serializable {
135136
private String uuid;
136137
private Volume.Type type;
137138
private Long size;

server/src/main/java/org/apache/cloudstack/backup/BackupCompressionService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,19 @@ private void rescheduleLostJobs() {
222222
logger.debug("Searching lost compression jobs to reschedule in zone [{}].", dataCenterVO.getUuid());
223223
for (ClusterVO clusterVO : clusterDao.listByDcHyType(dataCenterVO.getId(), Hypervisor.HypervisorType.KVM.toString())) {
224224
List<HostVO> hostVOS = hostDao.findRoutingByClusterId(clusterVO.getId());
225+
if (hostVOS.isEmpty()) {
226+
logger.debug("No hosts found in cluster [{}]. Cannot reschedule jobs for it.", clusterVO.getUuid());
227+
continue;
228+
}
225229
Calendar date = Calendar.getInstance();
226230
date.add(Calendar.SECOND, (int)Math.round(NativeBackupProvider.backupCompressionTimeout.valueIn(clusterVO.getId()) * -RESCHEDULE_TO_TIMEOUT_RATIO));
227231
List<BackupCompressionJobVO> lostJobs = backupCompressionJobDao.listExecutingJobsByHostsAndStartTimeBefore(hostVOS.stream().map(HostVO::getId).toArray(),
228232
date.getTime());
229-
logger.debug("Found [{}] jobs to reschedule. Processing them as failures and rescheduling them.", lostJobs.size());
233+
if (lostJobs.isEmpty()) {
234+
logger.debug("Found no compression jobs to reschedule for cluster [{}].", clusterVO.getUuid());
235+
continue;
236+
}
237+
logger.debug("Found [{}] compression jobs to reschedule for cluster [{}]. Processing them as failures and rescheduling them.", lostJobs.size(), clusterVO.getUuid());
230238
lostJobs.forEach(job -> processJobResult(job, false));
231239
}
232240
}

0 commit comments

Comments
 (0)