You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2026/07/30 11:52:53 UTC

(cloudstack) 01/01: CLVM/ISO: Ensure volume is created on the same host as the VM being deployed on

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

Pearl1594 pushed a commit to branch clvm-iso-deploy-fix
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 86fa58ec68cfc0d89de36f737d427fb19ec7ce2d
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Thu Jul 30 07:52:34 2026 -0400

    CLVM/ISO: Ensure volume is created on the same host as the VM being deployed on
---
 .../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..4331721deca 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 {} "
+                                + "(persisted to DB) to route creation to correct host", hostId, volume.getUuid());
+                    }
+                }
                 future = volService.createVolumeAsync(volume, destPool);
             } else {
                 final VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);