Skip to content

Commit 86fa58e

Browse files
author
Pearl Dsilva
committed
CLVM/ISO: Ensure volume is created on the same host as the VM being deployed on
1 parent 4f11707 commit 86fa58e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,17 @@ private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachinePro
20252025

20262026
volume = volFactory.getVolume(newVol.getId(), destPool);
20272027

2028+
// CLVM: pin templateless volume creation to the deploy host
2029+
StoragePoolVO poolVO = _storagePoolDao.findById(destPool.getId());
2030+
if (poolVO != null && ClvmPoolManager.isClvmPoolType(poolVO.getPoolType())) {
2031+
Long hostId = vm.getVirtualMachine().getHostId();
2032+
if (hostId != null) {
2033+
volume.setDestinationHostId(hostId);
2034+
clvmPoolManager.setClvmLockHostId(volume.getId(), hostId);
2035+
logger.info("CLVM pool detected during volume creation without a template. Setting lock host {} for volume {} "
2036+
+ "(persisted to DB) to route creation to correct host", hostId, volume.getUuid());
2037+
}
2038+
}
20282039
future = volService.createVolumeAsync(volume, destPool);
20292040
} else {
20302041
final VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);

0 commit comments

Comments
 (0)