You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "shwstppr (via GitHub)" <gi...@apache.org> on 2025/04/15 06:25:35 UTC
Re: [PR] [WIP] Remove allocated snapshots / vm snapshots on start [cloudstack]
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org