Skip to content

Commit bea7581

Browse files
author
Fabrício Duarte
committed
Merge branch 'fix-incremental-snapshot-timeout' into '4.20.0.0-scclouds'
Corrige o timeout para o rebase de snapshots incrementais See merge request scclouds/scclouds!1333
2 parents 0371517 + 5869818 commit bea7581

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,23 +2050,24 @@ protected void rebaseSnapshot(SnapshotObjectTO snapshotObjectTO, KVMStoragePool
20502050

20512051
logger.debug("Rebasing snapshot [{}] with parent [{}].", snapshotName, parentSnapshotPath);
20522052

2053+
int snapshotTimeoutInMillis = wait * 1000;
20532054
try {
2054-
QemuImg qemuImg = new QemuImg(wait);
2055+
QemuImg qemuImg = new QemuImg(snapshotTimeoutInMillis);
20552056
qemuImg.rebase(snapshotFile, parentSnapshotFile, PhysicalDiskFormat.QCOW2.toString(), false);
20562057
} catch (LibvirtException | QemuImgException e) {
20572058
if (!e.getMessage().contains("Is another process using the image")) {
20582059
logger.error("Exception while rebasing incremental snapshot [{}] due to: [{}].", snapshotName, e.getMessage(), e);
20592060
throw new CloudRuntimeException(e);
20602061
}
2061-
retryRebase(snapshotName, wait, e, snapshotFile, parentSnapshotFile);
2062+
retryRebase(snapshotName, snapshotTimeoutInMillis, e, snapshotFile, parentSnapshotFile);
20622063
}
20632064
}
20642065

2065-
private void retryRebase(String snapshotName, int wait, Exception e, QemuImgFile snapshotFile, QemuImgFile parentSnapshotFile) {
2066+
private void retryRebase(String snapshotName, int waitInMilliseconds, Exception e, QemuImgFile snapshotFile, QemuImgFile parentSnapshotFile) {
20662067
logger.warn("Libvirt still has not released the lock, will wait 60 seconds and try again later.");
20672068
try {
20682069
Thread.sleep(60*1000);
2069-
QemuImg qemuImg = new QemuImg(wait);
2070+
QemuImg qemuImg = new QemuImg(waitInMilliseconds);
20702071
qemuImg.rebase(snapshotFile, parentSnapshotFile, PhysicalDiskFormat.QCOW2.toString(), false);
20712072
} catch (LibvirtException | QemuImgException | InterruptedException ex) {
20722073
logger.error("Unable to rebase snapshot [{}].", snapshotName, ex);

0 commit comments

Comments
 (0)