Skip to content

Commit 43bd3a8

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
bugfix/CSTACKEX-131: host based copy ram to storage flush fix
1 parent ea40967 commit 43bd3a8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,16 @@ public KVMPhysicalDisk copyPhysicalDisk(KVMPhysicalDisk srcDisk, String destVolu
460460
try {
461461
QemuImg q = new QemuImg(timeout);
462462
q.convert(srcFile, destFile);
463+
// Below fix is required when vendor depends on host based copy rather than storage CAN_CREATE_VOLUME_FROM_VOLUME capability
464+
Script flushCmd = new Script(true, "blockdev", 0, logger);
465+
flushCmd.add("--flushbufs", destDisk.getPath());
466+
String flushResult = flushCmd.execute();
467+
if (flushResult != null) {
468+
logger.warn("iSCSI copyPhysicalDisk: blockdev --flushbufs returned: {}", flushResult);
469+
}
470+
Script syncCmd = new Script(true, "sync", 0, logger);
471+
syncCmd.execute();
472+
logger.info("iSCSI copyPhysicalDisk: flush/sync completed ");
463473
} catch (QemuImgException | LibvirtException ex) {
464474
String msg = "Failed to copy data from " + srcDisk.getPath() + " to " +
465475
destDisk.getPath() + ". The error was the following: " + ex.getMessage();

0 commit comments

Comments
 (0)