This is an automated email from the ASF dual-hosted git repository.

weizhouapache pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a42d17cf26 CLVM/ISO: Ensure volume is created on the same host as the 
VM being deployed on (#13748)
8a42d17cf26 is described below

commit 8a42d17cf26ed9099543bf71edcfb1fff8fc9f88
Author: Pearl Dsilva <[email protected]>
AuthorDate: Thu Aug 6 04:58:48 2026 -0400

    CLVM/ISO: Ensure volume is created on the same host as the VM being 
deployed on (#13748)
    
    Co-authored-by: Pearl Dsilva <[email protected]>
---
 .../cloudstack/engine/orchestration/VolumeOrchestrator.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git 
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
 
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index f4198819dd1..2fad96ec1da 100644
--- 
a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -2025,6 +2025,17 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
 
                 volume = volFactory.getVolume(newVol.getId(), destPool);
 
+                // CLVM: pin templateless volume creation to the deploy host
+                StoragePoolVO poolVO = 
_storagePoolDao.findById(destPool.getId());
+                if (poolVO != null && 
ClvmPoolManager.isClvmPoolType(poolVO.getPoolType())) {
+                    Long hostId = vm.getVirtualMachine().getHostId();
+                    if (hostId != null) {
+                        volume.setDestinationHostId(hostId);
+                        clvmPoolManager.setClvmLockHostId(volume.getId(), 
hostId);
+                        logger.info("CLVM pool detected during volume creation 
without a template. Setting lock host {} for volume {} "
+                                + "to route creation to correct host", hostId, 
volume.getUuid());
+                    }
+                }
                 future = volService.createVolumeAsync(volume, destPool);
             } else {
                 final VirtualMachineTemplate template = 
_entityMgr.findById(VirtualMachineTemplate.class, templateId);

Reply via email to