Maor Lipchuk has uploaded a new change for review. Change subject: core: Fix NPE on Clone VM from Snapshot ......................................................................
core: Fix NPE on Clone VM from Snapshot Clone VM from snapshot throw NPE while using MoveOrCopyImageGroup. This happens since AddVmFromSnapshot creates the task first with the parameters and only after that it creates the disk in the DB. The proposed fix is to get the wipeAfterDelete flag from the parameters in case the destination disk is null. This fix should be revisited, to change the AddVmFromSnapshot to create the disk before the creation of task. Change-Id: I2c18b1ac552f598fc20e74aa67f81dabb915a8c2 Signed-Off-By: Maor Lipchuk <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyImageGroupCommand.java 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/9445/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyImageGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyImageGroupCommand.java index 96f1a21..ee46f4b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyImageGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyImageGroupCommand.java @@ -79,7 +79,7 @@ getParameters().getVolumeFormat(), getParameters() .getVolumeType(), - getDestinationDiskImage().isWipeAfterDelete(), + isWipeAfterDelete(), getParameters() .getForceOverride(), getStoragePool().getcompatibility_version().toString())); @@ -94,7 +94,7 @@ getParameters().getStorageDomainId(), getParameters().getContainerId(), getParameters().getOperation(), - getDestinationDiskImage().isWipeAfterDelete(), + isWipeAfterDelete(), getParameters().getForceOverride(), getStoragePool() .getcompatibility_version().toString())); @@ -117,7 +117,6 @@ } //update qutoa if (getParameters().getQuotaId() != null) { - getDestinationDiskImage().setQuotaId(getParameters().getQuotaId()); getImageDao().updateQuotaForImageAndSnapshots(getParameters().getDestImageGroupId(), getParameters().getQuotaId()); } @@ -126,6 +125,11 @@ } } + private boolean isWipeAfterDelete() { + return getDestinationDiskImage() != null ? getDestinationDiskImage().isWipeAfterDelete() + : getParameters().getWipeAfterDelete(); + } + /** * Shareable disk which shared between more then one VM, will be returned more then once when fetching the images by image group * since it has multiple VM devices (one for each VM it is attached to) and not because he has snapshots, -- To view, visit http://gerrit.ovirt.org/9445 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2c18b1ac552f598fc20e74aa67f81dabb915a8c2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
