Arik Hadas has uploaded a new change for review. Change subject: core: ignore image does not exists error on remove memory state ......................................................................
core: ignore image does not exists error on remove memory state If we are trying to remove the memory state images, and we find that the images don't exist, we treat this as if the operation was successful (because the images are not there anymore) instead of treat this as an error. Change-Id: Ic5dce38bed0675306d647b3830fe2d208e19d0d1 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/MemoryImageRemover.java 1 file changed, 29 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/17056/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/MemoryImageRemover.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/MemoryImageRemover.java index f54fc72..47b5eab 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/MemoryImageRemover.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/MemoryImageRemover.java @@ -9,14 +9,13 @@ import org.ovirt.engine.core.bll.tasks.TaskHandlerCommand; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.businessentities.VM; -import org.ovirt.engine.core.common.errors.VDSError; +import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllErrors; import org.ovirt.engine.core.common.vdscommands.DeleteImageGroupVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.utils.GuidUtils; -import org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException; public abstract class MemoryImageRemover { @@ -78,12 +77,21 @@ protected Guid removeMemoryImage(List<Guid> guids) { Guid taskId1 = enclosingCommand.persistAsyncTaskPlaceHolder(VmCommand.DELETE_PRIMARY_IMAGE_TASK_KEY); - VDSReturnValue vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( - VDSCommandType.DeleteImageGroup, - buildDeleteMemoryImageParams(guids)); + VDSReturnValue vdsRetValue; + try { + vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( + VDSCommandType.DeleteImageGroup, + buildDeleteMemoryImageParams(guids)); - if (!vdsRetValue.getSucceeded()) { - return null; + if (!vdsRetValue.getSucceeded()) { + return null; + } + } + catch(VdcBLLException e) { + if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { + return Guid.Empty; + } + throw e; } Guid guid1 = @@ -96,12 +104,21 @@ protected Guid removeConfImage(List<Guid> guids) { Guid taskId2 = enclosingCommand.persistAsyncTaskPlaceHolder(VmCommand.DELETE_SECONDARY_IMAGES_TASK_KEY); - VDSReturnValue vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( - VDSCommandType.DeleteImageGroup, - buildDeleteMemoryConfParams(guids)); + VDSReturnValue vdsRetValue; + try { + vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( + VDSCommandType.DeleteImageGroup, + buildDeleteMemoryConfParams(guids)); - if (!vdsRetValue.getSucceeded()) { - return null; + if (!vdsRetValue.getSucceeded()) { + return null; + } + } + catch(VdcBLLException e) { + if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { + return Guid.Empty; + } + throw e; } Guid guid2 = enclosingCommand.createTask(taskId2, vdsRetValue.getCreationInfo(), -- To view, visit http://gerrit.ovirt.org/17056 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic5dce38bed0675306d647b3830fe2d208e19d0d1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches