Michael Kublin has uploaded a new change for review.

Change subject: engine: Vds initializyng- query improvements
......................................................................

engine: Vds initializyng- query improvements

The following patch is doing a following:
1. Remove duplicate query for vds, in order to retrieve it name
2. Replaced query in loop: from getVds() to getVdsDynamic().
   getVdsDynamic() query is faster, and retrirves data only from one single 
table
3. Fixing error log mesage

Change-Id: Iea601133e62927bc2808feb2f56efd9fb0e675d0
Signed-off-by: Michael Kublin <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
1 file changed, 18 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/12813/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
index 04d6cd9..9dc894f 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
@@ -743,23 +743,25 @@
          * @param curVdsId
          */
         private void waitForVdsIfIsInitializing(Guid curVdsId) {
-            if (!Guid.Empty.equals(curVdsId)
-                    && 
DbFacade.getInstance().getVdsDao().get(curVdsId).getStatus() == 
VDSStatus.Initializing) {
-                final int DELAY = 5;// 5 Sec
-                int total = 0;
-                Integer maxSecToWait = 
Config.GetValue(ConfigValues.WaitForVdsInitInSec);
-                String vdsName = 
DbFacade.getInstance().getVdsDao().get(curVdsId).getName();
-                while (total <= maxSecToWait
-                        && 
DbFacade.getInstance().getVdsDao().get(curVdsId).getStatus() == 
VDSStatus.Initializing) {
-                    try {
-                        Thread.sleep(DELAY * 1000);
-                    } catch (InterruptedException e) {
-                        e.printStackTrace();
-                        // exit the while block
-                        break;
+            if (!Guid.Empty.equals(curVdsId)) {
+                VDS vds = DbFacade.getInstance().getVdsDao().get(curVdsId);
+                String vdsName = vds.getName();
+                if (vds.getStatus() == VDSStatus.Initializing) {
+                    final int DELAY = 5;// 5 Sec
+                    int total = 0;
+                    Integer maxSecToWait = 
Config.GetValue(ConfigValues.WaitForVdsInitInSec);
+                    while (total <= maxSecToWait
+                            && 
DbFacade.getInstance().getVdsDynamicDao().get(curVdsId).getstatus() == 
VDSStatus.Initializing) {
+                        try {
+                            Thread.sleep(DELAY * 1000);
+                        } catch (InterruptedException e) {
+                            log.errorFormat("Interrupt exception {0}", 
e.getMessage());
+                            // exit the while block
+                            break;
+                        }
+                        total += DELAY;
+                        log.infoFormat("Waiting to Host {0} to finish 
initialization for {1} Sec.", vdsName, total);
                     }
-                    total += DELAY;
-                    log.infoFormat("Waiting to Host {0} to finish 
initialization for {1} Sec.", vdsName, total);
                 }
             }
         }


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

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

Reply via email to