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

This commit is contained in:
Pearl Dsilva 2026-07-30 07:52:34 -04:00
parent 4f117071c9
commit 734640d12d

View File

@ -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);