Liran Zelkha has uploaded a new change for review.

Change subject: core: Calculate Vds name from VdsStatic not VDS
......................................................................

core: Calculate Vds name from VdsStatic not VDS

Change getVdsName to use VdsStatic which loads faster
than Vds which loads slower

Change-Id: I5b5f5445c4a7b986bfb983051a850b3794d25bfe
Signed-off-by: [email protected] <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/31463/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java
index 701c6a6..443c62e 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java
@@ -17,6 +17,7 @@
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.businessentities.VdsStatic;
 import org.ovirt.engine.core.common.businessentities.VmTemplate;
 import org.ovirt.engine.core.common.businessentities.aaa.DbUser;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
@@ -36,6 +37,7 @@
 import org.ovirt.engine.core.dao.VdsDAO;
 import org.ovirt.engine.core.dao.VdsDynamicDAO;
 import org.ovirt.engine.core.dao.VdsGroupDAO;
+import org.ovirt.engine.core.dao.VdsStaticDAO;
 import org.ovirt.engine.core.dao.VmDAO;
 import org.ovirt.engine.core.dao.VmDynamicDAO;
 import org.ovirt.engine.core.dao.VmStaticDAO;
@@ -66,6 +68,7 @@
     private Guid mVmTemplateId;
     private String mVmTemplateName;
     private VDS mVds;
+    private VdsStatic mVdsStatic;
     private VM mVm;
     private VmTemplate mVmTemplate;
     private Guid _storageDomainId;
@@ -360,6 +363,21 @@
         return mVds;
     }
 
+    protected VdsStatic getVdsStatic() {
+        if (mVdsStatic == null
+                && ((mVdsId != null && !Guid.Empty.equals(mVdsId)) || (getVm() 
!= null && getVm().getRunOnVds() != null))) {
+            if (mVdsId == null || Guid.Empty.equals(mVdsId)) {
+                mVdsId = getVm().getRunOnVds();
+            }
+            try {
+                mVdsStatic = getVdsStaticDAO().get(getVdsId());
+            } catch (final RuntimeException e) {
+                log.infoFormat("Failed to get vds {0}\n{1}", mVdsId, 
e.getMessage());
+            }
+        }
+        return mVdsStatic;
+    }
+
     public void setVds(final VDS value) {
         mVds = value;
         mVdsName = null;
@@ -578,6 +596,10 @@
         return getDbFacade().getVdsDao();
     }
 
+    public VdsStaticDAO getVdsStaticDAO() {
+        return getDbFacade().getVdsStaticDao();
+    }
+
     public VdsDynamicDAO getVdsDynamicDao() {
         return getDbFacade().getVdsDynamicDao();
     }


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

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

Reply via email to