Daniel Erez has uploaded a new change for review. Change subject: core: avoid broken status on snapshot removal ......................................................................
core: avoid broken status on snapshot removal RemoveSnapshotCommand: on failure, instead of declaring the entire snapshot as broken, removing the successfully deleted disks from the snapshot while keeping the others. Change-Id: I2a15034185ef30f53fbeaa46440cd92954d39eee Bug-Url: https://bugzilla.redhat.com/1056935 Bug-Url: https://bugzilla.redhat.com/996945 Signed-off-by: Daniel Erez <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/27611/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 da927b9..0288532 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 @@ -21,6 +21,7 @@ import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.ImagesContainterParametersBase; import org.ovirt.engine.core.common.action.RemoveSnapshotParameters; +import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.asynctasks.EntityInfo; @@ -189,7 +190,22 @@ if (getParameters().getTaskGroupSuccess()) { getSnapshotDao().remove(getParameters().getSnapshotId()); } else { - getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.BROKEN); + // Remove successfully deleted images from the snapshot + for (VdcActionParametersBase parametersBase : getParameters().getImagesParameters()) { + ImagesContainterParametersBase imagesParams = (ImagesContainterParametersBase) parametersBase; + + if (imagesParams.getTaskGroupSuccess()) { + Snapshot snapshotWithoutImage = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage( + getParameters().getSnapshotId(), imagesParams.getImageId()); + getSnapshotDao().update(snapshotWithoutImage); + } + else { + log.errorFormat("Could not delete image {1} from snapshot {2}", + getParameters().getSnapshotId(), imagesParams.getImageId()); + } + } + + getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.OK); } super.endVmCommand(); -- To view, visit http://gerrit.ovirt.org/27611 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a15034185ef30f53fbeaa46440cd92954d39eee Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
