Yaniv Bronhaim has posted comments on this change.

Change subject: Wrap validation of fingerprint in each connect using 
EngineSSHClient
......................................................................


Patch Set 8: (5 inline comments)

....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/EngineSSHDialog.java
Line 62:     }
Line 63: 
Line 64:     public void connect(VDS vds) throws Exception {
Line 65:         try {
Line 66:             if (_client != null) {
the null check? I have to have it here..
Line 67:                 throw new IOException("Already connected");
Line 68:             }
Line 69:             _client = _getSSHClient();
Line 70:             if (getHardTimeout() != 0) {


Line 65:         try {
Line 66:             if (_client != null) {
Line 67:                 throw new IOException("Already connected");
Line 68:             }
Line 69:             _client = _getSSHClient();
_getSSHClient is different between EngineSSHDialog and SSHDialog so i set the 
timeouts here instead of duplicate code.
Line 70:             if (getHardTimeout() != 0) {
Line 71:                 _client.setHardTimeout(getHardTimeout());
Line 72:             }
Line 73:             if (getSoftTimeout() != 0) {


Line 72:             }
Line 73:             if (getSoftTimeout() != 0) {
Line 74:                 _client.setSoftTimeout(getSoftTimeout());
Line 75:             }
Line 76:             ((EngineSSHClient)_client).setVds(vds);
no, I can't call to setVds before creating the _client instance, that's all the 
point. i have to setVds before connect to allow fingerprint enforcement .
Line 77: 
Line 78:             log.debug("connecting");
Line 79:             _client.connect();
Line 80:         }


Line 75:             }
Line 76:             ((EngineSSHClient)_client).setVds(vds);
Line 77: 
Line 78:             log.debug("connecting");
Line 79:             _client.connect();
The only way to fix all this mix up is to separate the creation of the _client 
and the connect call. creating the _client inside the connect function just 
making it clumsy.
Line 80:         }
Line 81:         catch(Exception e) {
Line 82:             log.debug(
Line 83:                 String.format(


....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/SSHDialog.java
Line 188:     public void setSoftTimeout(long timeout) {
Line 189:         _softTimeout = timeout;
Line 190:     }
Line 191: 
Line 192:     public long getSoftTimeout() {
I didn't want to change sshDialog as it is implemented right now, but as you 
see in sshDialog::connect we set host and port. by setting vds we get all those 
values from the vds object, and its quite different and related only to 
engineSSHDialog. I want to set the VDS before calling to connect, to allow the 
verification of the fingerprint that currently stored in the vds object. using 
sshDialog::connect brakes it, overriding the connect allows me to do that. do 
you have better suggestion how to set the vds before calling connect, if the 
connect creates the client? I can separate the client creation to 
sshDialog::init avoid overriding the connect function.
Line 193:         return _softTimeout;
Line 194:     }
Line 195: 
Line 196:     /**


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic01517a153406c8bafc672c20b0bf8686763a2f5
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to