Tal Nisan has uploaded a new change for review.

Change subject: core: Make sure disk alias will never be null
......................................................................

core: Make sure disk alias will never be null

In case of running a VM with disks imported from version lower than V3.0
OVFs or from P2V/V2V, the disk aliases created can be null, when the
CreateVmVdsCommand is running it sorts the disks by the aliases yet the
comparator does not check if one of the aliases is null and fails on an
NPE, this patch fixes this issue by making sure that the disk alias
property will never be null

Change-Id: I110f40b121a0bff8117888399fd5b798a9f19c10
Signed-off-by: Tal Nisan <[email protected]>
Bug-url: https://bugzilla.redhat.com/1059403
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BaseDisk.java
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/24396/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BaseDisk.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BaseDisk.java
index 3afbd21..f0363c0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BaseDisk.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BaseDisk.java
@@ -42,7 +42,7 @@
      */
     @Size(min = 0, max = BusinessEntitiesDefinitions.GENERAL_NAME_SIZE, groups 
= { CreateEntity.class })
     @ValidI18NName(message = "VALIDATION.DISK.ALIAS.INVALID", groups = { 
CreateEntity.class, UpdateEntity.class })
-    private String diskAlias;
+    private String diskAlias = "";
 
     /**
      * The description of the disk.
@@ -144,7 +144,7 @@
     }
 
     public void setDiskAlias(String diskAlias) {
-        this.diskAlias = diskAlias;
+        this.diskAlias = diskAlias == null ? "" : diskAlias;
     }
 
     public boolean isShareable() {


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

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

Reply via email to