Greg Padgett has uploaded a new change for review.

Change subject: engine: Exception when updating lun disk properties (#844153)
......................................................................

engine: Exception when updating lun disk properties (#844153)

https://bugzilla.redhat.com/844153

When updating properties of a LUN disk, the audit logger attempted to
retrieve the storage pool id of the disk.  The method to return the id
cast the Parameter to a DiskImage, even though the parameter was a
LunDisk, causing a ClassCastException.

The object is now checked to ensure it's an instance of DiskImage before
the cast, and if not it returns NGuid.Empty as the storage pool id.

Change-Id: Iba86289c25937002c9c07a06db5651bca4485d38
Signed-off-by: Greg Padgett <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/7230/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
index 1fd2918..cd0076d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
@@ -52,8 +52,12 @@
 
     @Override
     public NGuid getStoragePoolId() {
-        return ((DiskImage) getParameters().getDiskInfo()).getstorage_pool_id()
-                .getValue();
+        Disk d = getParameters().getDiskInfo();
+        if (d instanceof DiskImage) {
+            return ((DiskImage) d).getstorage_pool_id().getValue();
+        } else {
+            return NGuid.Empty;
+        }
     }
 
     @Override


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

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

Reply via email to