Skip to content

Commit 1d503bb

Browse files
CLOUDSTACK-7835: Deleted volumes with null UUID and no removed timestamp in database still appear.
Also removed CREATING -> DESTROY via DESTROYREQUESTED, which was causing the volume to get stuck in expunging state.
1 parent 7a8f511 commit 1d503bb

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎api/src/com/cloud/storage/Volume.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public String getDescription() {
6969
s_fsm.addTransition(Creating, Event.OperationRetry, Creating);
7070
s_fsm.addTransition(Creating, Event.OperationFailed, Allocated);
7171
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
72-
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
7372
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
7473
s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing);
7574
s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);

‎engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,12 @@ protected Void copyVolumeCallBack(AsyncCallbackDispatcher<VolumeServiceImpl, Cop
10261026
destroyVolume(srcVolume.getId());
10271027
srcVolume = volFactory.getVolume(srcVolume.getId());
10281028
AsyncCallFuture<VolumeApiResult> destroyFuture = expungeVolumeAsync(srcVolume);
1029-
destroyFuture.get();
1029+
// If volume destroy fails, this could be because of vdi is still in use state, so wait and retry.
1030+
if (destroyFuture.get().isFailed()) {
1031+
Thread.sleep(5 * 1000);
1032+
destroyFuture = expungeVolumeAsync(srcVolume);
1033+
destroyFuture.get();
1034+
}
10301035
future.complete(res);
10311036
} catch (Exception e) {
10321037
s_logger.debug("failed to clean up volume on storage", e);

0 commit comments

Comments
 (0)