Yaniv Bronhaim has uploaded a new change for review.

Change subject: core: host-deploy: Using ssh username and password to install 
and update host
......................................................................

core: host-deploy: Using ssh username and password to install and update host

Currently we provide installation only with root user. This patch adds
username and password fields to add and update vds command and makes
those parameters configurable for authentication.

Change-Id: I3d9b23771314ebebb3e10686decb4f0d5ace6d3c
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsCommandTest.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ApproveVdsParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UpdateVdsActionParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsOperationActionParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ValidationUtils.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.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
25 files changed, 95 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/16686/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 d47bd49..7ec604e 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
@@ -26,6 +26,7 @@
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import org.ovirt.engine.core.common.action.VdsActionParameters;
+import 
org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions;
 import org.ovirt.engine.core.common.businessentities.StoragePool;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDS;
@@ -64,8 +65,6 @@
 
 @NonTransactiveCommandAttribute(forceCompensation = true)
 public class AddVdsCommand<T extends AddVdsActionParameters> extends 
VdsCommand<T> {
-
-    private static final String USER_NAME = "root";
 
     private VDS upServer;
 
@@ -150,8 +149,7 @@
         // do not install vds's which added in pending mode (currently power
         // clients). they are installed as part of the approve process
         if (Config.<Boolean> GetValue(ConfigValues.InstallVds) && 
!getParameters().getAddPending()) {
-            final InstallVdsParameters installVdsParameters = new 
InstallVdsParameters(getVdsId(),
-                    getParameters().getRootPassword());
+            final InstallVdsParameters installVdsParameters = new 
InstallVdsParameters(getVdsId(), getParameters().getPassword());
             
installVdsParameters.setOverrideFirewall(getParameters().getOverrideFirewall());
             
installVdsParameters.setRebootAfterInstallation(getParameters().isRebootAfterInstallation());
             Map<String, String> values = new HashMap<String, String>();
@@ -317,6 +315,11 @@
                 returnValue = 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED);
             } else if (getVdsDAO().getAllForHostname(hostName).size() != 0) {
                 returnValue = 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST);
+            } else if (!ValidationUtils.validatePort(vds.getSshPort())) {
+                returnValue = 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT);
+            } else if ((StringUtils.isEmpty(vds.getSshUsername())) ||
+                       (vds.getSshUsername().length() > 
BusinessEntitiesDefinitions.USER_USER_NAME_SIZE)) {
+                returnValue = 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME);
             } else {
                 returnValue = returnValue && 
validateSingleHostAttachedToLocalStorage();
 
@@ -324,7 +327,7 @@
                         && !EngineEncryptionUtils.haveKey()) {
                     returnValue = 
failCanDoAction(VdcBllMessages.VDS_TRY_CREATE_SECURE_CERTIFICATE_NOT_FOUND);
                 } else if (!getParameters().getAddPending()
-                        && 
StringUtils.isEmpty(getParameters().getRootPassword())) {
+                        && StringUtils.isEmpty(getParameters().getPassword())) 
{
                     // We block vds installations if it's not a RHEV-H and 
password is empty
                     // Note that this may override local host SSH policy. See 
BZ#688718.
                     returnValue = 
failCanDoAction(VdcBllMessages.VDS_CANNOT_INSTALL_EMPTY_PASSWORD);
@@ -360,16 +363,16 @@
         return ClusterUtils.getInstance();
     }
 
-    public SSHClient getSSHClient(String hostname) {
+    public SSHClient getSSHClient() {
         Long timeout =
                 TimeUnit.SECONDS.toMillis(Config.<Integer> 
GetValue(ConfigValues.ConnectToServerTimeoutInSeconds));
 
         SSHClient sshclient = new EngineSSHClient();
         sshclient.setHardTimeout(timeout);
         sshclient.setSoftTimeout(timeout);
-        sshclient.setHost(hostname);
-        sshclient.setUser(USER_NAME);
-        sshclient.setPassword(getParameters().getRootPassword());
+        sshclient.setHost(getVds().getStaticData().getHostName(), 
getVds().getStaticData().getSshPort());
+        sshclient.setUser(getVds().getStaticData().getSshUsername());
+        sshclient.setPassword(getParameters().getPassword());
         return sshclient;
     }
 
@@ -401,7 +404,7 @@
         if (vds.getVdsType() == VDSType.VDS && Config.<Boolean> 
GetValue(ConfigValues.InstallVds)) {
             SSHClient sshclient = null;
             try {
-                sshclient = getSSHClient(vds.getHostName());
+                sshclient = getSSHClient();
                 sshclient.connect();
                 sshclient.authenticate();
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
index 7e19fcf..d904301 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
@@ -154,8 +154,7 @@
 
                 switch (getVds().getVdsType()) {
                 case VDS:
-                    installer.setUser("root");
-                    installer.setPassword(parameters.getRootPassword());
+                    installer.setPassword(parameters.getPassword());
                     installer.setFirewall(parameters.getOverrideFirewall());
                     break;
                 case oVirtNode:
@@ -166,7 +165,6 @@
                             getVds().getVdsType().name()
                         );
                     }
-                    installer.setUser("root");
                     installer.useDefaultKeyPair();
                     break;
                 default:
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
index 4299c2f..72422ec 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
@@ -87,7 +87,7 @@
                         && _oldVds.getStatus() != VDSStatus.InstallFailed) {
                     
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL);
                 } else if (getParameters().getInstallVds()
-                        && 
StringUtils.isEmpty(getParameters().getRootPassword())
+                        && StringUtils.isEmpty(getParameters().getPassword())
                         && getParameters().getVdsStaticData().getVdsType() == 
VDSType.VDS) {
                     
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_EMPTY_PASSWORD);
                 } else if (!getParameters().getInstallVds()
@@ -129,7 +129,7 @@
         }
 
         if (getParameters().getInstallVds()) {
-            InstallVdsParameters tempVar = new 
InstallVdsParameters(getVdsId(), getParameters().getRootPassword());
+            InstallVdsParameters tempVar = new 
InstallVdsParameters(getVdsId(), getParameters().getPassword());
             
tempVar.setIsReinstallOrUpgrade(getParameters().getIsReinstallOrUpgrade());
             tempVar.setoVirtIsoFile(getParameters().getoVirtIsoFile());
             tempVar.setOverrideFirewall(getParameters().getOverrideFirewall());
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
index f5a646e..eda6c10 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
@@ -267,6 +267,13 @@
         }},
         new Callable<Object>() { public Object call() throws Exception {
             _parser.cliEnvironmentSet(
+                NetEnv.SSH_USER,
+                _vds.getSshUsername()
+            );
+            return null;
+        }},
+        new Callable<Object>() { public Object call() throws Exception {
+            _parser.cliEnvironmentSet(
                 NetEnv.SSH_KEY,
                 EngineEncryptionUtils.getEngineSSHPublicKey().replace("\n", "")
             );
@@ -838,7 +845,8 @@
     public void execute() throws Exception {
         InputStream in = null;
         try {
-            _dialog.setHost(_vds.getHostName());
+            _dialog.setHost(_vds.getHostName(), _vds.getSshPort());
+            setUser(_vds.getSshUsername());
             _dialog.connect();
             _messages.post(
                 InstallerMessages.Severity.INFO,
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsCommandTest.java
index 5bdfdc3..c13d6a0 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsCommandTest.java
@@ -78,7 +78,7 @@
     @Before
     public void createParameters() {
         parameters = new AddVdsActionParameters();
-        parameters.setRootPassword("secret");
+        parameters.setPassword("secret");
         VDS newVds = makeTestVds(vdsId);
         parameters.setvds(newVds);
     }
@@ -98,7 +98,7 @@
         
when(commandMock.validateSingleHostAttachedToLocalStorage()).thenReturn(true);
         when(commandMock.isPowerManagementLegal()).thenReturn(true);
 
-        
when(commandMock.getSSHClient(any(String.class))).thenReturn(sshClient);
+        when(commandMock.getSSHClient()).thenReturn(sshClient);
         doNothing().when(sshClient).connect();
         doNothing().when(sshClient).authenticate();
     }
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
index 210a88c..29ad7aa 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
@@ -57,7 +57,7 @@
     }
 
     private static InstallVdsParameters createParameters() {
-        InstallVdsParameters param = new InstallVdsParameters(Guid.newGuid(), 
null);
+        InstallVdsParameters param = new InstallVdsParameters(Guid.newGuid());
         param.setIsReinstallOrUpgrade(true);
         return param;
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java
index bd6fe43..3e95767 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java
@@ -6,8 +6,8 @@
 public class AddVdsActionParameters extends VdsOperationActionParameters {
     private static final long serialVersionUID = 8452910234577071082L;
 
-    public AddVdsActionParameters(VdsStatic vdsStatic, String rootPassword) {
-        super(vdsStatic, rootPassword);
+    public AddVdsActionParameters(VdsStatic vdsStatic, String password) {
+        super(vdsStatic, password);
     }
 
     private Guid vdsId;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ApproveVdsParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ApproveVdsParameters.java
index b9cc0ac..bfdc4de 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ApproveVdsParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ApproveVdsParameters.java
@@ -7,7 +7,7 @@
     private boolean isApprovedByRegister;
 
     public ApproveVdsParameters(Guid vdsId) {
-        super(vdsId, "");
+        super(vdsId);
     }
 
     public ApproveVdsParameters() {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java
index ceab53b..c46f201 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java
@@ -13,10 +13,15 @@
     public InstallVdsParameters() {
     }
 
+    public InstallVdsParameters(Guid vdsId) {
+        super();
+        this.setVdsId(vdsId);
+    }
+
     public InstallVdsParameters(Guid vdsId, String password) {
         super();
         this.setVdsId(vdsId);
-        setRootPassword(password);
+        setPassword(password);
     }
 
     public boolean getIsReinstallOrUpgrade() {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UpdateVdsActionParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UpdateVdsActionParameters.java
index 68e123e..cd98944 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UpdateVdsActionParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UpdateVdsActionParameters.java
@@ -5,8 +5,13 @@
 public class UpdateVdsActionParameters extends VdsOperationActionParameters {
     private static final long serialVersionUID = -7467029979089285065L;
 
-    public UpdateVdsActionParameters(VdsStatic vdsStatic, String rootPassword, 
boolean installVds) {
-        super(vdsStatic, rootPassword);
+    public UpdateVdsActionParameters(VdsStatic vdsStatic, String password, 
boolean installVds) {
+        super(vdsStatic, password);
+        _installVds = installVds;
+    }
+
+    public UpdateVdsActionParameters(VdsStatic vdsStatic, boolean installVds) {
+        super(vdsStatic);
         _installVds = installVds;
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsOperationActionParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsOperationActionParameters.java
index 6e530b5..8cdda7b 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsOperationActionParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsOperationActionParameters.java
@@ -9,9 +9,9 @@
     private static final long serialVersionUID = 4156122527623908516L;
 
     @Valid
-    private VdsStatic _vdsStatic;
+    private VdsStatic vdsStatic;
 
-    private String _rootPassword;
+    private String password;
 
     private boolean overrideFirewall;
 
@@ -20,13 +20,13 @@
      */
     private boolean rebootAfterInstallation = true;
 
-    public VdsOperationActionParameters(VdsStatic vdsStatic, String 
rootPassword) {
-        super(vdsStatic.getId());
-        if ("".equals(vdsStatic.getManagementIp())) {
-            vdsStatic.setManagementIp(null);
+    public VdsOperationActionParameters(VdsStatic vdsStaticVal, String 
passwordVal) {
+        super(vdsStaticVal.getId());
+        if ("".equals(vdsStaticVal.getManagementIp())) {
+            vdsStaticVal.setManagementIp(null);
         }
-        _vdsStatic = vdsStatic;
-        _rootPassword = rootPassword;
+        vdsStatic = vdsStaticVal;
+        password = passwordVal;
     }
 
     public VdsOperationActionParameters(VdsStatic vdsStatic) {
@@ -34,28 +34,37 @@
     }
 
     public VdsStatic getVdsStaticData() {
-        return _vdsStatic;
+        return vdsStatic;
     }
 
-    public String getRootPassword() {
-        return _rootPassword;
+    public String getPassword() {
+        return password;
     }
 
-    public void setRootPassword(String value) {
-        _rootPassword = value;
+    public void setPassword(String value) {
+        password = value;
     }
 
     public VdsOperationActionParameters() {
     }
 
+    // Deprecated to keep old api with root password
+    public String getRootPassword() {
+        return password;
+    }
+
+    public void setRootPassword(String value) {
+        password = value;
+    }
+
     public VDS getvds() {
         VDS vds = new VDS();
-        vds.setStaticData(_vdsStatic);
+        vds.setStaticData(vdsStatic);
         return vds;
     }
 
     public void setvds(VDS value) {
-        _vdsStatic = value.getStaticData();
+        vdsStatic = value.getStaticData();
     }
 
     public void setOverrideFirewall(boolean overrideFirewall) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 5b8ebdf..ae17d5a 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -173,6 +173,8 @@
     
ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST(ErrorType.CONFLICT),
+    ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT(ErrorType.BAD_PARAMETERS),
+    ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_ILLEGAL_MEMORY_SIZE(ErrorType.CONSTRAINT_VIOLATION),
     ACTION_TYPE_FAILED_ILLEGAL_NUM_OF_MONITORS(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ValidationUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ValidationUtils.java
index 1903f63..41c3119 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ValidationUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ValidationUtils.java
@@ -13,6 +13,7 @@
 import javax.validation.Validator;
 
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
+import 
org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions;
 import org.ovirt.engine.core.common.businessentities.VmPool;
 
 public class ValidationUtils {
@@ -89,4 +90,7 @@
         return messages;
     }
 
+    public static boolean validatePort(int port) {
+        return ((port >= BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT) 
&& (port <= BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT));
+    }
 }
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 646ff6f..01fb69f 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -521,6 +521,8 @@
        -Please remove VLAN from the interface.
 NETWORK_ALREADY_ATTACHED_TO_CLUSTER=Logical Network is already attached to 
Cluster.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST=Cannot ${action} ${type}. Host 
with the same address already exists.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT=Cannot ${action} ${type}. Invalid 
SSH port was entered.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME=Cannot ${action} ${type}. 
Invalid SSH user-name was entered.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST=Cannot ${action} ${type}. Host 
with the same UUID already exists.
 ACTION_TYPE_FAILED_ILLEGAL_MEMORY_SIZE=Cannot ${action} ${type}. Illegal 
memory size is provided, size needs to be between ${minMemorySize} MB and 
${maxMemorySize} MB.
 ACTION_TYPE_FAILED_ILLEGAL_NUM_OF_MONITORS=Cannot ${action} ${type}. Illegal 
number of monitors is provided, max allowed number of monitors is 1 for VNC and 
the max number in the ValidNumOfMonitors configuration variable for SPICE.
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
index e89b942..90052d4 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
@@ -102,7 +102,7 @@
         if (action.isSetSsh()) {
             if (action.getSsh().isSetUser()) {
                 if (action.getSsh().getUser().isSetPassword()) {
-                    
params.setRootPassword(action.getSsh().getUser().getPassword());
+                    
params.setPassword(action.getSsh().getUser().getPassword());
                 }
                 // TODO: adding username support.
                 //if (action.getSsh().getUser().isSetUserName()) {
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
index 8ad08d0..0c4cc41 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
@@ -99,7 +99,7 @@
         if (host.isSetSsh()) {
             if (host.getSsh().isSetUser()) {
                 if (host.getSsh().getUser().isSetPassword()) {
-                    
addParams.setRootPassword(host.getSsh().getUser().getPassword());
+                    
addParams.setPassword(host.getSsh().getUser().getPassword());
                 }
                 // TODO: adding username support.
                 //if (action.getSsh().getUser().isSetUserName()) {
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 3777a64..faab5d1 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
@@ -1408,6 +1408,12 @@
     @DefaultStringValue("Cannot ${action} ${type}. Host with the same address 
already exists.")
     String ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Invalid SSH port was 
entered.")
+    String ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT();
+
+    @DefaultStringValue("Cannot ${action} ${type}. Invalid SSH user-name was 
entered.")
+    String ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME();
+
     @DefaultStringValue("Cannot ${action} ${type}. Host with the same UUID 
already exists.")
     String ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST();
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
index 77e0054..6687f89 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
@@ -498,7 +498,7 @@
             AddVdsActionParameters parameters = new AddVdsActionParameters();
             parameters.setVdsId(host.getId());
             parameters.setvds(host);
-            parameters.setRootPassword(hostDetailModel.getPassword());
+            parameters.setPassword(hostDetailModel.getPassword());
             parameters.setOverrideFirewall(false);
             
parameters.setRebootAfterInstallation(getEntity().supportsVirtService());
             parametersList.add(parameters);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
index 308f846..ecbdbca 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
@@ -492,7 +492,7 @@
         AddVdsActionParameters vdsActionParams = new AddVdsActionParameters();
         vdsActionParams.setvds(host);
         vdsActionParams.setVdsId(host.getId());
-        vdsActionParams.setRootPassword((String) 
model.getRootPassword().getEntity());
+        vdsActionParams.setPassword((String) 
model.getRootPassword().getEntity());
         vdsActionParams.setRebootAfterInstallation(((VDSGroup) 
model.getCluster().getSelectedItem()).supportsVirtService());
 
         model.startProgress(null);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
index a82430b..450e70a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
@@ -834,7 +834,7 @@
             AddVdsActionParameters parameters = new AddVdsActionParameters();
             parameters.setVdsId(host.getId());
             parameters.setvds(host);
-            parameters.setRootPassword(hostDetailModel.getPassword());
+            parameters.setPassword(hostDetailModel.getPassword());
             parameters.setOverrideFirewall(false);
             
parameters.setRebootAfterInstallation(hostsModel.getClusterModel().getEnableOvirtService().getIsSelected());
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
index 0e9d7de..ae3e707 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
@@ -1626,7 +1626,7 @@
         AddVdsActionParameters addVdsParams = new AddVdsActionParameters();
         addVdsParams.setVdsId(host.getId());
         addVdsParams.setvds(host);
-        addVdsParams.setRootPassword((String) 
model.getRootPassword().getEntity());
+        addVdsParams.setPassword((String) model.getRootPassword().getEntity());
         addVdsParams.setRebootAfterInstallation(((VDSGroup) 
model.getCluster().getSelectedItem()).supportsVirtService());
         model.startProgress(null);
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
index 04949d2..cbbad65 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
@@ -906,7 +906,7 @@
         UpdateVdsActionParameters param = new UpdateVdsActionParameters();
         param.setvds(getEntity());
         param.setVdsId(getEntity().getId());
-        param.setRootPassword((String) model.getRootPassword().getEntity());
+        param.setPassword((String) model.getRootPassword().getEntity());
         param.setIsReinstallOrUpgrade(true);
         param.setInstallVds(true);
         param.setoVirtIsoFile(isOVirt ? ((RpmVersion) 
model.getOVirtISO().getSelectedItem()).getRpmName() : null);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
index 2a9c89a..9e71230 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
@@ -860,7 +860,7 @@
             AddVdsActionParameters parameters = new AddVdsActionParameters();
             parameters.setVdsId(host.getId());
             parameters.setvds(host);
-            parameters.setRootPassword((String) 
model.getRootPassword().getEntity());
+            parameters.setPassword((String) 
model.getRootPassword().getEntity());
             parameters.setOverrideFirewall((Boolean) 
model.getOverrideIpTables().getEntity());
             parameters.setRebootAfterInstallation(isVirt) ;
 
@@ -882,7 +882,7 @@
             UpdateVdsActionParameters parameters = new 
UpdateVdsActionParameters();
             parameters.setvds(host);
             parameters.setVdsId(host.getId());
-            parameters.setRootPassword(""); //$NON-NLS-1$
+            parameters.setPassword(""); //$NON-NLS-1$
             parameters.setInstallVds(false);
             parameters.setRebootAfterInstallation(isVirt) ;
 
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 1e0a112..48dd17a 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
@@ -518,6 +518,8 @@
        -Please remove VLAN from the interface.
 NETWORK_ALREADY_ATTACHED_TO_CLUSTER=Logical Network is already attached to 
Cluster.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST=Cannot ${action} ${type}. Host 
with the same address already exists.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT=Cannot ${action} ${type}. Invalid 
SSH port was entered.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME=Cannot ${action} ${type}. 
Invalid SSH user-name was entered.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST=Cannot ${action} ${type}. Host 
with the same UUID already exists.
 ACTION_TYPE_FAILED_ILLEGAL_MEMORY_SIZE=Cannot ${action} ${type}. Illegal 
memory size is provided, size needs to be between ${minMemorySize} MB and 
${maxMemorySize} MB.
 ACTION_TYPE_FAILED_ILLEGAL_NUM_OF_MONITORS=Cannot ${action} ${type}. Illegal 
number of monitors is provided, max allowed number of monitors is 1 for VNC and 
the max number in the ValidNumOfMonitors configuration variable for SPICE.
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 48b3c85..a1b03b7 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
@@ -526,6 +526,8 @@
        -Please remove VLAN from the interface.
 NETWORK_ALREADY_ATTACHED_TO_CLUSTER=Logical Network is already attached to 
Cluster.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST=Cannot ${action} ${type}. Host 
with the same address already exists.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_PORT=Cannot ${action} ${type}. Invalid 
SSH port was entered.
+ACTION_TYPE_FAILED_VDS_WITH_INVALID_SSH_USERNAME=Cannot ${action} ${type}. 
Invalid SSH user-name was entered.
 ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST=Cannot ${action} ${type}. Host 
with the same UUID already exists.
 ACTION_TYPE_FAILED_ILLEGAL_MEMORY_SIZE=Cannot ${action} ${type}. Illegal 
memory size is provided, size needs to be between ${minMemorySize} MB and 
${maxMemorySize} MB.
 ACTION_TYPE_FAILED_ILLEGAL_NUM_OF_MONITORS=Cannot ${action} ${type}. Illegal 
number of monitors is provided, max allowed number of monitors is 1 for VNC and 
the max number in the ValidNumOfMonitors configuration variable for SPICE.


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

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

Reply via email to