Skip to content

Commit 4a62d40

Browse files
piyush5netappSrivastava, Piyush
andauthored
bugfix/CSTACKEX-131: ISCSI VM created with small sized template which takes less than 30s copy will be a dummy VM (#42)
### Description This PR... <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [x] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): <img width="1451" height="117" alt="image" src="https://github.com/user-attachments/assets/3af9c3b4-e834-42f9-925d-6e87028fe3bf" /> <img width="1491" height="574" alt="image" src="https://github.com/user-attachments/assets/ac2a39c2-d32f-4c22-89d1-261a2e15bdd7" /> ### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document --> --------- Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
1 parent 7d08878 commit 4a62d40

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,19 @@ public KVMPhysicalDisk copyPhysicalDisk(KVMPhysicalDisk srcDisk, String destVolu
510510
try {
511511
QemuImg q = new QemuImg(timeout);
512512
q.convert(srcFile, destFile);
513+
// Below fix is required when vendor depends on host based copy rather than storage CAN_CREATE_VOLUME_FROM_VOLUME capability
514+
// When host based template copy is triggered , small size template sits in RAM(depending on host memory and RAM) and copy is marked successful and by the time flush to storage is triggered
515+
// disconnectPhysicalDisk would disconnect the lun , hence template staying in RAM is not copied to storage lun. Below does flushing of data to storage and marking
516+
// copy as successful once flush is complete.
517+
Script flushCmd = new Script(true, "blockdev", 0, logger);
518+
flushCmd.add("--flushbufs", destDisk.getPath());
519+
String flushResult = flushCmd.execute();
520+
if (flushResult != null) {
521+
logger.warn("iSCSI copyPhysicalDisk: blockdev --flushbufs returned: {}", flushResult);
522+
}
523+
Script syncCmd = new Script(true, "sync", 0, logger);
524+
syncCmd.execute();
525+
logger.info("iSCSI copyPhysicalDisk: flush/sync completed ");
513526
} catch (QemuImgException | LibvirtException ex) {
514527
String msg = "Failed to copy data from " + srcDisk.getPath() + " to " +
515528
destDisk.getPath() + ". The error was the following: " + ex.getMessage();

0 commit comments

Comments
 (0)