Federico Simoncelli has uploaded a new change for review.

Change subject: backend: [wip] add a new specific VDS_CONNECTION_ERROR
......................................................................

backend: [wip] add a new specific VDS_CONNECTION_ERROR

At the moment VDS_NETWORK_ERROR is used both for timeouts and connection
errors. The assumption is that when a VDS_NETWORK_ERROR is encountered
the backend does't know if the request reached VDSM or not.
This patch adds the new specific VDS_CONNECTION_ERROR that will help us
to make more informed decisions in the negative flows as we can reliably
tell if the request wasn't received by VDSM at all.

Change-Id: Icac5e6fa1d7113e6a478f6beb98066b35b2785e5
Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SpmStopVDSCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerCommand.java
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
8 files changed, 25 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/20301/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
index 86ce33f..827e7dd 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
@@ -426,6 +426,7 @@
     PROVIDER_FAILURE(5050),
     PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR(5051),
     PROVIDER_SSL_FAILURE(5052),
+    VDS_CONNECTION_ERROR(5053),
     // Gluster errors
     NO_UP_SERVER_FOUND(7000),
     // error to indicate backend does not recognize the session
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
index 08b69cf..e00a632 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
@@ -203,6 +203,7 @@
 MAC_POOL_INITIALIZATION_FAILED=Error Initializing MAC Pool
 VDS_FENCING_OPERATION_FAILED=Host Fencing operation failed.
 VDS_NETWORK_ERROR=Network error during communication with the Host.
+VDS_CONNECTION_ERROR=Network error during the connection with the host
 DeviceNotFound=Device not found or not accessible
 CannotModifyVolumeTime=Cannot change volume's modify time
 CannotDeleteVolume=Volume deletion error
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 a26b3bd..817bc64 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
@@ -1,6 +1,7 @@
 package org.ovirt.engine.core.vdsbroker.irsbroker;
 
 import java.lang.reflect.UndeclaredThrowableException;
+import java.net.ConnectException;
 import java.net.SocketException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -1500,14 +1501,19 @@
                 }
             }
             catch (UndeclaredThrowableException ex) {
+                Throwable rootCause = ExceptionUtils.getRootCause(ex);
+                VdcBllErrors vdcBllError = VdcBllErrors.VDS_NETWORK_ERROR;
                 getVDSReturnValue().setExceptionString(ex.toString());
                 getVDSReturnValue().setExceptionObject(ex);
-                getVDSReturnValue().setVdsError(new 
VDSError(VdcBllErrors.VDS_NETWORK_ERROR, ex.getMessage()));
-                if (ExceptionUtils.getRootCause(ex) != null) {
-                    logException(ExceptionUtils.getRootCause(ex));
-                } else {
+                if (rootCause == null) {
                     LoggedUtils.logError(log, LoggedUtils.getObjectId(this), 
this, ex);
+                } else {
+                    logException(rootCause);
+                    if (rootCause.getClass() == ConnectException.class) {
+                        vdcBllError = VdcBllErrors.VDS_CONNECTION_ERROR;
+                    }
                 }
+                getVDSReturnValue().setVdsError(new VDSError(vdcBllError, 
ex.getMessage()));
                 failover();
             }
             catch (XmlRpcRunTimeException ex) {
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SpmStopVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SpmStopVDSCommand.java
index f844f58..1ac2796 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SpmStopVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SpmStopVDSCommand.java
@@ -54,7 +54,8 @@
                     VDSError error = new VDSError();
                     error.setCode(VdcBllErrors.TaskInProgress);
                     getVDSReturnValue().setVdsError(error);
-                } else if (getVDSReturnValue().getVdsError().getCode() == 
VdcBllErrors.VDS_NETWORK_ERROR) {
+                } else if (getVDSReturnValue().getVdsError().getCode() == 
VdcBllErrors.VDS_NETWORK_ERROR
+                        || getVDSReturnValue().getVdsError().getCode() == 
VdcBllErrors.VDS_CONNECTION_ERROR) {
                     log.infoFormat(
                             "SpmStopVDSCommand::Could not get tasks on vds {0} 
- network exception, not stopping spm! pool id {1}",
                             getVds().getName(),
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerCommand.java
index 8a9b03f..28061ed 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerCommand.java
@@ -1,5 +1,7 @@
 package org.ovirt.engine.core.vdsbroker.vdsbroker;
 
+import java.net.ConnectException;
+
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VdsStatic;
@@ -99,8 +101,12 @@
             throw ex;
         } catch (XmlRpcRunTimeException ex) {
             Throwable rootCause = ExceptionUtils.getRootCause(ex);
+            VdcBllErrors vdcBllError = VdcBllErrors.VDS_NETWORK_ERROR;
+            if (rootCause != null && rootCause.getClass() == 
ConnectException.class) {
+                vdcBllError = VdcBllErrors.VDS_CONNECTION_ERROR;
+            }
             VDSNetworkException networkException = new 
VDSNetworkException(rootCause);
-            networkException.setVdsError(new 
VDSError(VdcBllErrors.VDS_NETWORK_ERROR, rootCause.toString()));
+            networkException.setVdsError(new VDSError(vdcBllError, 
rootCause.toString()));
             PrintReturnValue();
             throw networkException;
         }
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
index bf13d1a..7fe7717 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
@@ -399,6 +399,8 @@
 
     String VDS_NETWORK_ERROR();
 
+    String VDS_CONNECTION_ERROR();
+
     String DeviceNotFound();
 
     String CannotModifyVolumeTime();
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index f510ad9..00f6851 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -196,6 +196,7 @@
 MAC_POOL_INITIALIZATION_FAILED=Error Initializing MAC Pool
 VDS_FENCING_OPERATION_FAILED=Host Fencing operation failed.
 VDS_NETWORK_ERROR=Network error during communication with the Host.
+VDS_CONNECTION_ERROR=Network error during the connection with the host
 DeviceNotFound=Device not found or not accessible
 CannotModifyVolumeTime=Cannot change volume's modify time
 CannotDeleteVolume=Volume deletion error
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index 8afe4b2..fa0fa79 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -196,6 +196,7 @@
 MAC_POOL_INITIALIZATION_FAILED=Error Initializing MAC Pool
 VDS_FENCING_OPERATION_FAILED=Host Fencing operation failed.
 VDS_NETWORK_ERROR=Network error during communication with the Host.
+VDS_CONNECTION_ERROR=Network error during the connection with the host
 DeviceNotFound=Device not found or not accessible
 CannotModifyVolumeTime=Cannot change volume's modify time
 CannotDeleteVolume=Volume deletion error


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

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

Reply via email to