Dhandapani Gopal has uploaded a new change for review.

Change subject: engine: Import Cluster with Invalid Password (#894462)
......................................................................

engine: Import Cluster with Invalid Password (#894462)

Added localized error message in case of Authentication Exception
during the import cluster.

Change-Id: I10517a43d2f87bcfe2893f3bb97dbc13afb4915d
Bug-Url: https://bugzilla.redhat.com/894462
Signed-off-by: Dhandapani <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
5 files changed, 15 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/11257/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
index 1c74f83..6feb4e9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
@@ -8,6 +8,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.AuthenticationException;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.commons.lang.StringUtils;
@@ -54,7 +55,7 @@
         // Check whether the given server is already part of the cluster
         if 
(getVdsStaticDao().getAllForHost(getParameters().getServerName()).size() > 0
                 || 
getVdsStaticDao().getAllWithIpAddress(getParameters().getServerName()).size() > 
0) {
-            setReturnMessage();
+            
setReturnMessage(VdcBllMessages.SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER.toString());
         }
 
         SSHClient client = null;
@@ -69,10 +70,13 @@
 
             // Check if any of the server in the map is already part of some 
other cluster.
             if (!validateServers(serverFingerPrint.keySet())) {
-                setReturnMessage();
+                
setReturnMessage(VdcBllMessages.SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER.toString());
             }
             getQueryReturnValue().setReturnValue(serverFingerPrint);
-        } catch (Exception e) {
+        } catch (AuthenticationException ae) {
+            
setReturnMessage(VdcBllMessages.SSH_AUTHENTICATION_FAILED.toString());
+        }
+        catch (Exception e) {
             throw new RuntimeException(e);
         } finally {
             if (client != null) {
@@ -81,9 +85,9 @@
         }
     }
 
-    private void setReturnMessage() {
+    private void setReturnMessage(String errorMessage) {
         getQueryReturnValue().setSucceeded(false);
-        
getQueryReturnValue().setExceptionString(VdcBllMessages.SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER.toString());
+        getQueryReturnValue().setExceptionString(errorMessage);
         return;
     }
 
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
index 360cd41..7487c16 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
@@ -693,6 +693,7 @@
     MIGRATE_PAUSED_VM_IS_UNSUPPORTED,
     ACTION_TYPE_FAILED_SERVER_NAME_REQUIRED,
     SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER,
+    SSH_AUTHENTICATION_FAILED,
 
     VM_INTERFACE_NOT_EXIST,
     ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_DEVICE,
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index fb59a4c..98101e8 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -831,6 +831,7 @@
 ENGINE_IS_RUNNING_IN_PREPARE_MODE=This action is not allowed when Engine is 
preparing for maintenance.
 ACTION_TYPE_FAILED_SERVER_NAME_REQUIRED=Cannot ${action} ${type}. Server Name 
required.
 SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER=One or more servers are already part 
of an existing cluster.
+SSH_AUTHENTICATION_FAILED=SSH Authentication failed, Please make sure root 
password is correct.
 =======
 # Exteral Events Errors Messages
 VAR__TYPE__EXTERNAL_EVENT=$type Exteral Event
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 28eb476..46f6900 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -2207,4 +2207,7 @@
 
     @DefaultStringValue("One or more servers are already part of an existing 
cluster")
     String SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER();
+
+    @DefaultStringValue("SSH Authentication failed, Please make sure root 
password is correct.")
+    String SSH_AUTHENTICATION_FAILED();
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index b46b14c..9687ade 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -771,6 +771,7 @@
 ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE=Engine is running in Maintenance mode 
and is not accepting commands.
 ENGINE_IS_RUNNING_IN_PREPARE_MODE=This action is not allowed when Engine is 
preparing for maintenance.
 SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER=One or more servers are already part 
of an existing cluster.
+SSH_AUTHENTICATION_FAILED=SSH Authentication failed, Please make sure root 
password is correct.
 # Exteral Events Errors Messages
 VAR__TYPE__EXTERNAL_EVENT=$type Exteral Event
 ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN=Cannot ${action} ${type}. 
Illegal Origin for External Event : oVirt


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

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

Reply via email to