Alon Bar-Lev has uploaded a new change for review. Change subject: bootstrap: host add: differentiate between authentication error and other errors ......................................................................
bootstrap: host add: differentiate between authentication error and other errors New SSHClient implementation allows differentiating between these cases as requested. Change-Id: I0d87fdd0c8942ec39632bd4562694bd5d027cbd7 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.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/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 6 files changed, 22 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/9178/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java index 4a4719e..9d907f8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import javax.naming.AuthenticationException; import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.context.CommandContext; @@ -362,6 +363,16 @@ sshclient.connect(); sshclient.authenticate(); } + catch (AuthenticationException e) { + log.errorFormat( + "Failed to authenticate session with host {0}", + vds.getvds_name(), + e + ); + + addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_AUTHENTICATE_TO_SERVER); + returnValue = false; + } catch (Exception e) { log.errorFormat( "Failed to establish session with host {0}", 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 7095af6..13b1ec4 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 @@ -212,6 +212,7 @@ VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION, VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE, VDS_CANNOT_CONNECT_TO_SERVER, + VDS_CANNOT_AUTHENTICATE_TO_SERVER, VAR__ACTION__MANUAL_FENCE, VAR__ACTION__MAINTENANCE, ACTION_TYPE_FAILED_PM_ENABLED_WITHOUT_AGENT, 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 e39b835..13eddfd 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -665,7 +665,8 @@ VDS_REGISTER_NO_HOSTNAME_INPUT=Cannot register Host. No Hostname specified. VDS_REGISTER_UNIQUE_ID_DIFFERENT_TYPE=Cannot register Host, Host with the same unique ID was found, but requested Host type does not match. VDS_REGISTER_UNIQUE_ID_AMBIGUOUS=Cannot add host which has the same unique ID as one of the hosts: ${HostNameList}.\nThis might occur in case this host was already added to the system. -VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Failed creating an SSH session with the host. Verify that the host is reachable (IP address, routable address etc.) and authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Cannot connect to host via SSH. Verify that the host is reachable (IP address, routable address etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_AUTHENTICATE_TO_SERVER=Cannot ${action} ${type}. Cannot authenticate to host. Verify authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. AUTO_MIGRATE_DISABLED=Cannot migrate - check relevant configuration options. AUTO_MIGRATE_VDS_NOT_FOUND=Cannot migrate - Host not found. AUTO_MIGRATE_POWERCLIENT_NOT_FOUND=Cannot migrate - Power Client not found. 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 da53061..afb3954 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 @@ -1774,9 +1774,12 @@ @DefaultStringValue("Cannot add Host, Host unique ID is ambiguous with hosts: ${HostNameList}.") String VDS_REGISTER_UNIQUE_ID_AMBIGUOUS(); - @DefaultStringValue("Cannot ${action} ${type}. Failed creating an SSH session with the host. Verify that the host is reachable (IP address, routable address etc.) and authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details.") + @DefaultStringValue("Cannot ${action} ${type}. Cannot connect to host via SSH. Verify that the host is reachable (IP address, routable address etc.) You may refer to the engine.log file for further details.") String VDS_CANNOT_CONNECT_TO_SERVER(); + @DefaultStringValue("Cannot ${action} ${type}. Cannot authenticate to host. Verify authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details.") + String VDS_CANNOT_AUTHENTICATE_TO_SERVER(); + @DefaultStringValue("Cannot migrate - check relevant configuration options.") String AUTO_MIGRATE_DISABLED(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 86194a7..c4d8ade 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -657,7 +657,8 @@ VDS_REGISTER_NO_HOSTNAME_INPUT=Cannot register Host. No Hostname specified. VDS_REGISTER_UNIQUE_ID_DIFFERENT_TYPE=Cannot register Host, Host with the same unique ID was found, but requested Host type does not match. VDS_REGISTER_UNIQUE_ID_AMBIGUOUS=Cannot add host which has the same unique ID as one of the hosts: ${HostNameList}.\nThis might occur in case this host was already added to the system. -VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Failed creating an SSH session with the host. Verify that the host is reachable (IP address, routable address etc.) and authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Cannot connect to host via SSH. Verify that the host is reachable (IP address, routable address etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_AUTHENTICATE_TO_SERVER=Cannot ${action} ${type}. Cannot authenticate to host. Verify authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. AUTO_MIGRATE_DISABLED=Cannot migrate - check relevant configuration options. AUTO_MIGRATE_VDS_NOT_FOUND=Cannot migrate - Host not found. AUTO_MIGRATE_POWERCLIENT_NOT_FOUND=Cannot migrate - Power Client not found. 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 2c729ff..27fb637 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 @@ -657,7 +657,8 @@ VDS_REGISTER_NO_HOSTNAME_INPUT=Cannot register Host. No Hostname specified. VDS_REGISTER_UNIQUE_ID_DIFFERENT_TYPE=Cannot register Host, Host with the same unique ID was found, but requested Host type does not match. VDS_REGISTER_UNIQUE_ID_AMBIGUOUS=Cannot add host which has the same unique ID as one of the hosts: ${HostNameList}.\nThis might occur in case this host was already added to the system. -VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Failed creating an SSH session with the host. Verify that the host is reachable (IP address, routable address etc.) and authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_CONNECT_TO_SERVER=Cannot ${action} ${type}. Cannot connect to host via SSH. Verify that the host is reachable (IP address, routable address etc.) You may refer to the engine.log file for further details. +VDS_CANNOT_AUTHENTICATE_TO_SERVER=Cannot ${action} ${type}. Cannot authenticate to host. Verify authentication parameters are correct (Username/Password, public-key etc.) You may refer to the engine.log file for further details. AUTO_MIGRATE_DISABLED=Cannot migrate - check relevant configuration options. AUTO_MIGRATE_VDS_NOT_FOUND=Cannot migrate - Host not found. AUTO_MIGRATE_POWERCLIENT_NOT_FOUND=Cannot migrate - Power Client not found. -- To view, visit http://gerrit.ovirt.org/9178 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0d87fdd0c8942ec39632bd4562694bd5d027cbd7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches