Maor Lipchuk has uploaded a new change for review. Change subject: core: Fix NPE when removing a VM with Cinder disks. ......................................................................
core: Fix NPE when removing a VM with Cinder disks. Remove disk from snapshot's OVF only if the snapshot exists. Change the parameter class passed to coco to be RemoveCinderDiskParameters. Change-Id: I570f59bac7e1bc569d82767b8c6fee0b0d997ccb Bug-Url: https://bugzilla.redhat.com/1185826 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveCinderDiskCommand.java 2 files changed, 10 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/42333/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java index 87e4576..a926ac6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java @@ -12,7 +12,7 @@ import org.ovirt.engine.core.bll.tasks.interfaces.CommandCallback; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters; -import org.ovirt.engine.core.common.action.RemoveDiskParameters; +import org.ovirt.engine.core.common.action.RemoveCinderDiskParameters; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.businessentities.SubjectEntity; @@ -66,8 +66,8 @@ return null; } - private RemoveDiskParameters buildChildCommandParameters(CinderDisk cinderDisk) { - RemoveDiskParameters removeDiskParams = new RemoveDiskParameters(cinderDisk.getId(), cinderDisk.getStorageIds().get(0)); + private RemoveCinderDiskParameters buildChildCommandParameters(CinderDisk cinderDisk) { + RemoveCinderDiskParameters removeDiskParams = new RemoveCinderDiskParameters(cinderDisk.getId()); removeDiskParams.setParentCommand(getActionType()); removeDiskParams.setParentParameters(getParameters()); return removeDiskParams; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveCinderDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveCinderDiskCommand.java index d6285eb..88be567 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveCinderDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveCinderDiskCommand.java @@ -112,7 +112,9 @@ getImageStorageDomainMapDao().remove(lastCinderVolume.getImageId()); getImageDao().remove(lastCinderVolume.getImageId()); getDiskImageDynamicDAO().remove(lastCinderVolume.getImageId()); - getSnapshotDao().update(updated); + if (updated != null) { + getSnapshotDao().update(updated); + } return null; } }); @@ -123,8 +125,10 @@ Snapshot updated = null; if (vmSnapshotId != null && !Guid.Empty.equals(vmSnapshotId)) { Snapshot snapshot = getSnapshotDao().get(vmSnapshotId); - updated = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage(snapshot, - lastCinderVolume.getImageId()); + if (snapshot != null) { + updated = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage(snapshot, + lastCinderVolume.getImageId()); + } } return updated; } -- To view, visit https://gerrit.ovirt.org/42333 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I570f59bac7e1bc569d82767b8c6fee0b0d997ccb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches