From f92b24af216819137a1213177a0e3547632c1983 Mon Sep 17 00:00:00 2001 From: Nikolaus Eppinger Date: Tue, 14 Jul 2026 10:50:07 +0200 Subject: [PATCH] volume: reset pool_id on failed volume create for zone-wide storage When createVolumeAsync fails, createVolumeCallback resets the volume's pool_id only when volume.getPodId() != null. Zone-wide primary storage pools have no pod, so such a volume keeps a stale pool_id while it is reverted to Allocated. On the next create/attach, findStoragePool then returns no suitable pool because storagePoolCompatibleWithVolumePool rejects the volume (its state is not Ready), and the operation fails with "Unable to find suitable primary storage" even though the pool has plenty of capacity. Guard the reset on the field that is actually being cleared (getPoolId() != null) instead of getPodId(), so it also applies to zone-wide (and local) storage. The same guard is fixed in destroyAndReallocateManagedVolume. ensureVolumeIsExpungeReady is left unchanged as it legitimately clears pod_id. Regression from #10757. --- .../apache/cloudstack/storage/volume/VolumeServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java index 426d157b13a6..58807bdc6a65 100644 --- a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java +++ b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java @@ -329,7 +329,7 @@ protected Void createVolumeCallback(AsyncCallbackDispatcher