shwstppr commented on code in PR #8452:
URL: https://github.com/apache/cloudstack/pull/8452#discussion_r2043721978
##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1516,6 +1516,11 @@ public boolean configure(String name, Map<String,
Object> params) throws Configu
@Override
public boolean start() {
+ //remove snapshots in allocated state
+ List<SnapshotVO> allocatedSnapshots =
_snapshotDao.listAllByStatus(Snapshot.State.Allocated);
+ for (SnapshotVO snapshot : allocatedSnapshots) {
+ _snapshotDao.remove(snapshot.getId());
+ }
Review Comment:
this can be a single call to DB - `removeAllByStatus`?
##########
server/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java:
##########
@@ -200,6 +200,11 @@ public boolean configure(String name, Map<String, Object>
params) throws Configu
@Override
public boolean start() {
+ //Remove VM Snapshots in allocated state
+ List<VMSnapshotVO> allocatedVMSnapshots =
_vmSnapshotDao.listAllByStatus(VMSnapshot.State.Allocated);
+ for (VMSnapshotVO vmSnapshot : allocatedVMSnapshots) {
+ _vmSnapshotDao.remove(vmSnapshot.getId());
+ }
Review Comment:
this can be a single call to DB - `removeAllByStatus`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]