Daniel Erez has uploaded a new change for review. Change subject: core: fix remove snapshot with memory only ......................................................................
core: fix remove snapshot with memory only Fix removal of snapshot with a memory volume only (and no disks). RemoveSnapshotCommand -> removeMemory: invoking 'endVmCommand' manually when no async tasks are available (i.e. when the snapshot doesn't include any disk) [current behaviour leaves a locked snapshot in DB]. Change-Id: I95cef37947fd02fb54d8bb5a2014ccbab27dc434 Bug-Url: https://bugzilla.redhat.com/1189570 Signed-off-by: Daniel Erez <de...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java 1 file changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/37581/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java index e998221..14bd873 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java @@ -139,7 +139,7 @@ } if (removeSnapshotMemory) { - removeMemory(snapshot, useTaskManagerToRemoveMemory); + removeMemory(snapshot, useTaskManagerToRemoveMemory, snapshotHasImages); } setSucceeded(true); @@ -154,7 +154,7 @@ getDbFacade().getSnapshotDao().getNumOfSnapshotsByMemory(memoryVolume) == 1; } - private void removeMemory(final Snapshot snapshot, boolean useTaskManager) { + private void removeMemory(final Snapshot snapshot, boolean useTaskManager, boolean snapshotHasImages) { RemoveMemoryVolumesParameters parameters = new RemoveMemoryVolumesParameters(snapshot.getMemoryVolume(), getVmId()); if (useTaskManager) { CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.RemoveMemoryVolumes, parameters, cloneContextAndDetachFromParent()); @@ -163,6 +163,10 @@ if (!ret.getSucceeded()) { log.error("Cannot remove memory volumes for snapshot '{}'", snapshot.getId()); } + else if (!snapshotHasImages) { + // no async tasks - ending command manually + endVmCommand(); + } } } -- To view, visit http://gerrit.ovirt.org/37581 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95cef37947fd02fb54d8bb5a2014ccbab27dc434 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <de...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches