Arik Hadas has uploaded a new change for review. Change subject: core: fix possible NPE on import VM with ram snapshot ......................................................................
core: fix possible NPE on import VM with ram snapshot In case the memory volumes are set to be imported to storage domain that no disk was set to be imported to, we were getting NPE in ImportVmCommand#setDomainsForMemoryImages since we assumed that the storage domain exists in domain2requiredSize map but it doesn't exists there in that case. So from now on we will check whether the storage domain that the memory volumes are going to be imported to exists in domain2requiredSize or not and act accordingly in ImportVmCommand#setDomainsForMemoryImages. Change-Id: I2a574266bdf6f06b7906c1338428071094430a9b Bug-Url: https://bugzilla.redhat.com/1031371 Signed-off-by: Arik Hadas <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/65/21465/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java index 3abfdc5..e259978 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java @@ -451,8 +451,9 @@ if (storageDomain == null) { return false; } - domain2requiredSize.put(storageDomain, - domain2requiredSize.get(storageDomain) + requiredSizeForMemory); + int requiredSizeInDomainIncludingMemoryVolumes = domain2requiredSize.containsKey(storageDomain) ? + domain2requiredSize.get(storageDomain) + requiredSizeForMemory : requiredSizeForMemory; + domain2requiredSize.put(storageDomain, requiredSizeInDomainIncludingMemoryVolumes); String modifiedMemoryVolume = MemoryUtils.changeStorageDomainAndPoolInMemoryState( memoryVolume, storageDomain.getId(), getParameters().getStoragePoolId()); // replace the volume representation with the one with the correct domain & pool -- To view, visit http://gerrit.ovirt.org/21465 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a574266bdf6f06b7906c1338428071094430a9b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Arik Hadas <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
