Skip to content

Commit ca2552d

Browse files
Add volumes in 'Expunging' state to storage cleanup thread and during delete storage pool
1 parent 3d7d412 commit ca2552d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,16 @@ public long secondaryStorageUsedForAccount(long accountId) {
579579

580580
@Override
581581
public List<VolumeVO> listVolumesToBeDestroyed() {
582-
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
583-
sc.setParameters("state", Volume.State.Destroy);
584-
585-
return listBy(sc);
582+
return listVolumesToBeDestroyed(null);
586583
}
587584

588585
@Override
589586
public List<VolumeVO> listVolumesToBeDestroyed(Date date) {
590587
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
591-
sc.setParameters("state", Volume.State.Destroy);
592-
sc.setParameters("updateTime", date);
588+
sc.setParameters("state", Volume.State.Destroy, Volume.State.Expunging);
589+
if (date != null) {
590+
sc.setParameters("updateTime", date);
591+
}
593592

594593
return listBy(sc);
595594
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ public AsyncCallFuture<VolumeApiResult> expungeVolumeAsync(VolumeInfo volume) {
434434
// no need to change state in volumes table
435435
volume.processEventOnly(Event.DestroyRequested);
436436
} else if (volume.getDataStore().getRole() == DataStoreRole.Primary) {
437+
if (vol.getState() == Volume.State.Expunging) {
438+
logger.info("Volume {} is already in Expunging, retrying", volume);
439+
}
437440
volume.processEvent(Event.ExpungeRequested);
438441
}
439442

0 commit comments

Comments
 (0)