Maor Lipchuk has posted comments on this change. Change subject: engine: Removes not used image groups after snapshot removal ......................................................................
Patch Set 2: Code-Review+1 (4 comments) Solution looks good, minor comments inline .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java Line 158: } Line 159: } Line 160: } Line 161: Line 162: private void removeNotUsedImageGroups() { Suggestion: Consider changing the method name to be removeUnusedDisksPriorCommit (if you think it makes more sense) Line 163: Set<Guid> imageGroupIdsUsedByActiveSnapshot = new HashSet<>(); Line 164: for (DiskImage diskImage : getImagesList()) { Line 165: imageGroupIdsUsedByActiveSnapshot.add(diskImage.getId()); Line 166: } Line 170: List<DiskImage> snapshotDiskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshotToRemove); Line 171: imageGroupsToRemove.addAll(snapshotDiskImages); Line 172: } Line 173: Line 174: Set<Guid> removeInProcessImageGroupsIds = new HashSet<>(); /s/removeInProcessImageGroupsIds/removeInProcessImageGroupIds (without the groups) Line 175: for (DiskImage diskImage : imageGroupsToRemove) { Line 176: if (imageGroupIdsUsedByActiveSnapshot.contains(diskImage.getId()) || Line 177: removeInProcessImageGroupsIds.contains(diskImage.getId())) { Line 178: continue; Line 177: removeInProcessImageGroupsIds.contains(diskImage.getId())) { Line 178: continue; Line 179: } Line 180: Line 181: // This command responsible to delete the entire image group I would put this comment at the top of the method as java doc (without the command word) Line 182: VdcReturnValueBase retValue = runAsyncTask(VdcActionType.RemoveImage, Line 183: new RemoveImageParameters(diskImage.getImageId())); Line 184: Line 185: if (retValue.getSucceeded()) { Line 184: Line 185: if (retValue.getSucceeded()) { Line 186: removeInProcessImageGroupsIds.add(diskImage.getImageId()); Line 187: } else { Line 188: log.infoFormat("Failed to remove image <{0}>", diskImage.getImageId()); Please use errorFormat here Line 189: } Line 190: } Line 191: } Line 192: -- To view, visit http://gerrit.ovirt.org/18647 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07928bc8ff4225055586b96e47d3787d741a95b4 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches