Skip to content

Commit c98b124

Browse files
committed
Fix incremental snapshot timeout
1 parent d1e1aa5 commit c98b124

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
@@ -2092,23 +2092,24 @@ protected void rebaseSnapshot(SnapshotObjectTO snapshotObjectTO, KVMStoragePool
20922092

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

2095+
int snapshotTimeoutInMillis = wait * 1000;
20952096
try {
2096-
QemuImg qemuImg = new QemuImg(wait);
2097+
QemuImg qemuImg = new QemuImg(snapshotTimeoutInMillis);
20972098
qemuImg.rebase(snapshotFile, parentSnapshotFile, PhysicalDiskFormat.QCOW2.toString(), false);
20982099
} catch (LibvirtException | QemuImgException e) {
20992100
if (!StringUtils.contains(e.getMessage(), "Is another process using the image")) {
21002101
logger.error("Exception while rebasing incremental snapshot [{}] due to: [{}].", snapshotName, e.getMessage(), e);
21012102
throw new CloudRuntimeException(e);
21022103
}
2103-
retryRebase(snapshotName, wait, e, snapshotFile, parentSnapshotFile);
2104+
retryRebase(snapshotName, snapshotTimeoutInMillis, e, snapshotFile, parentSnapshotFile);
21042105
}
21052106
}
21062107

2107-
private void retryRebase(String snapshotName, int wait, Exception e, QemuImgFile snapshotFile, QemuImgFile parentSnapshotFile) {
2108+
private void retryRebase(String snapshotName, int waitInMilliseconds, Exception e, QemuImgFile snapshotFile, QemuImgFile parentSnapshotFile) {
21082109
logger.warn("Libvirt still has not released the lock, will wait [{}] milliseconds and try again later.", incrementalSnapshotRetryRebaseWait);
21092110
try {
21102111
Thread.sleep(incrementalSnapshotRetryRebaseWait);
2111-
QemuImg qemuImg = new QemuImg(wait);
2112+
QemuImg qemuImg = new QemuImg(waitInMilliseconds);
21122113
qemuImg.rebase(snapshotFile, parentSnapshotFile, PhysicalDiskFormat.QCOW2.toString(), false);
21132114
} catch (LibvirtException | QemuImgException | InterruptedException ex) {
21142115
logger.error("Unable to rebase snapshot [{}].", snapshotName, ex);

0 commit comments

Comments
 (0)