This is an automated email from the ASF dual-hosted git repository.
weizhouapache pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new 6ad0d75885f volume: reset pool_id on failed volume create for
zone-wide storage (#13611)
6ad0d75885f is described below
commit 6ad0d75885fdea91a936259241ae18618e2f84f0
Author: Nikolaus Eppinger <[email protected]>
AuthorDate: Tue Sep 8 08:18:52 2026 +0200
volume: reset pool_id on failed volume create for zone-wide storage (#13611)
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.
---
.../java/org/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 426d157b13a..58807bdc6a6 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 @@ public class VolumeServiceImpl implements VolumeService {
vo.processEvent(Event.OperationFailed);
errMsg = result.getResult();
VolumeVO volume = volDao.findById(vo.getId());
- if (volume != null && volume.getState() == State.Allocated &&
volume.getPodId() != null) {
+ if (volume != null && volume.getState() == State.Allocated &&
volume.getPoolId() != null) {
volume.setPoolId(null);
volDao.update(volume.getId(), volume);
}
@@ -1273,7 +1273,7 @@ public class VolumeServiceImpl implements VolumeService {
}
if (volume.getState() == State.Allocated) { // Possible states here:
Allocated, Ready & Creating
- if (volume.getPodId() != null) {
+ if (volume.getPoolId() != null) {
volume.setPoolId(null);
volDao.update(volume.getId(), volume);
}