Liron Aravot has uploaded a new change for review.

Change subject: core: NPE during RestoreAllSnapshotsCommand
......................................................................

core: NPE during RestoreAllSnapshotsCommand

When running the command for diskless snapshots an NPE might occur as
there is an attempt to access the first snapshot disk while there's no
one.

Change-Id: I1e56e6f266c22e59f33dde4ee4f4921e6e807e43
Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=892724
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
1 file changed, 13 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/10871/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
index 2a9336d..e042b88 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
@@ -355,15 +355,20 @@
     @Override
     public List<QuotaConsumptionParameter> 
getQuotaStorageConsumptionParameters() {
         List<QuotaConsumptionParameter> list = new 
ArrayList<QuotaConsumptionParameter>();
-        // TODO: need to be fixed. sp id should be available
-        setStoragePoolId(getImagesList().get(0).getstorage_pool_id());
+        List<DiskImage> disks = getImagesList();
 
-        for (DiskImage image : getImagesList()) {
-            if (!image.getImage().isActive() && image.getQuotaId() != null && 
!Guid.Empty.equals(image.getQuotaId())) {
-                list.add(new 
QuotaStorageConsumptionParameter(image.getQuotaId(), null,
-                        QuotaConsumptionParameter.QuotaAction.RELEASE,
-                        image.getstorage_ids().get(0),
-                        image.getActualSize()));
+        if (disks != null && !disks.isEmpty()) {
+            // TODO: need to be fixed. sp id should be available
+            setStoragePoolId(getImagesList().get(0).getstorage_pool_id());
+
+            for (DiskImage image : getImagesList()) {
+                if (!image.getImage().isActive() && image.getQuotaId() != null
+                        && !Guid.Empty.equals(image.getQuotaId())) {
+                    list.add(new 
QuotaStorageConsumptionParameter(image.getQuotaId(), null,
+                            QuotaConsumptionParameter.QuotaAction.RELEASE,
+                            image.getstorage_ids().get(0),
+                            image.getActualSize()));
+                }
             }
         }
 


--
To view, visit http://gerrit.ovirt.org/10871
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e56e6f266c22e59f33dde4ee4f4921e6e807e43
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to