@@ -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 );
@@ -2536,7 +2537,7 @@ private void convertTheBaseFileToSnapshot(KVMPhysicalDisk baseFile, String snaps
25362537 QemuImgFile destFile = new QemuImgFile (snapshotPath );
25372538 destFile .setFormat (PhysicalDiskFormat .QCOW2 );
25382539
2539- QemuImg q = new QemuImg (wait );
2540+ QemuImg q = new QemuImg (wait * 1000 );
25402541 q .convert (srcFile , destFile , options , qemuObjects , qemuImageOpts , null , true );
25412542 }
25422543
0 commit comments