Michael Kublin has uploaded a new change for review.

Change subject: engine: Removed useless checks at 
ConnectHostToStoragePoolServersCommand
......................................................................

engine: Removed useless checks at ConnectHostToStoragePoolServersCommand

The following checks at canDoaction are useless, the command is called only 
once form
InitVdsOnUp and the same checks are performed before a call to command

Change-Id: I25c6f4db1108b513663b81fbc7956e66edd9c797
Signed-off-by: Michael Kublin <mkub...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java
1 file changed, 21 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/9567/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java
index b9da88a..2f648e3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java
@@ -6,7 +6,6 @@
 import org.ovirt.engine.core.bll.InternalCommandAttribute;
 import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
 import org.ovirt.engine.core.common.action.StoragePoolParametersBase;
-import org.ovirt.engine.core.common.businessentities.StoragePoolStatus;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import 
org.ovirt.engine.core.common.businessentities.storage_server_connections;
 import 
org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters;
@@ -48,33 +47,28 @@
 
     @Override
     protected boolean canDoAction() {
-        boolean returnValue = checkStoragePool()
-                && 
CheckStoragePoolStatusNotEqual(StoragePoolStatus.Uninitialized,
-                        
VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL)
-                && InitializeVds();
-        if (returnValue) {
-            InitConnectionList();
-            if (!ValidConnection(getStoragePool().getstorage_pool_type(), 
getConnections())) {
-                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION);
-                returnValue = false;
-            } else {
-                if (getIsoConnections() != null && getIsoConnections().size() 
!= 0) {
-                    setNeedToConnectIso(ValidConnection(getIsoType(), 
getIsoConnections()));
-                    if (!getNeedToConnectIso()) {
-                        log.infoFormat(
-                                "Failed to validated connections for host {0} 
to StoragePool {1} Iso domain/s connections",
-                                getVds().getvds_name(),
-                                getStoragePool().getname());
-                    }
+        boolean returnValue = true;
+        InitConnectionList();
+        if (!ValidConnection(getStoragePool().getstorage_pool_type(), 
getConnections())) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION);
+            returnValue = false;
+        } else {
+            if (getIsoConnections() != null && getIsoConnections().size() != 
0) {
+                setNeedToConnectIso(ValidConnection(getIsoType(), 
getIsoConnections()));
+                if (!getNeedToConnectIso()) {
+                    log.infoFormat(
+                            "Failed to validated connections for host {0} to 
StoragePool {1} Iso domain/s connections",
+                            getVds().getvds_name(),
+                            getStoragePool().getname());
                 }
-                if (getExportConnections() != null && 
getExportConnections().size() != 0) {
-                    setNeedToConnectExport(ValidConnection(getExportType(), 
getExportConnections()));
-                    if (!getNeedToConnectExport()) {
-                        log.infoFormat(
-                                "Failed to validated connections for host {0} 
to StoragePool {1} Export domain/s connections",
-                                getVds().getvds_name(),
-                                getStoragePool().getname());
-                    }
+            }
+            if (getExportConnections() != null && 
getExportConnections().size() != 0) {
+                setNeedToConnectExport(ValidConnection(getExportType(), 
getExportConnections()));
+                if (!getNeedToConnectExport()) {
+                    log.infoFormat(
+                            "Failed to validated connections for host {0} to 
StoragePool {1} Export domain/s connections",
+                            getVds().getvds_name(),
+                            getStoragePool().getname());
                 }
             }
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25c6f4db1108b513663b81fbc7956e66edd9c797
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Kublin <mkub...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to