@@ -220,19 +220,37 @@ func createFaultDomainMap(ctx context.Context, vs *vSphere) map[string]string {
220220 return fdMap
221221}
222222
223+ func isSSHReachable (ip string , timeout time.Duration ) error {
224+ nimbusGeneratedK8sVmPwd := GetAndExpectStringEnvVar (nimbusK8sVmPwd )
225+ sshClientConfig := & ssh.ClientConfig {
226+ User : "root" ,
227+ Auth : []ssh.AuthMethod {
228+ ssh .Password (nimbusGeneratedK8sVmPwd ),
229+ },
230+ HostKeyCallback : ssh .InsecureIgnoreHostKey (),
231+ }
232+ // Read hosts sshd port number
233+ ip , portNum , err := getPortNumAndIP (ip )
234+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
235+ addr := ip + ":" + portNum
236+ _ , err = ssh .Dial ("tcp" , addr , sshClientConfig )
237+ return err
238+ }
239+
223240// waitForHostToBeDown wait for host to be down
224241func waitForHostToBeDown (ctx context.Context , ip string ) error {
225242 framework .Logf ("checking host status of %s" , ip )
226243 gomega .Expect (ip ).NotTo (gomega .BeNil ())
227244 gomega .Expect (ip ).NotTo (gomega .BeEmpty ())
228- // Read hosts sshd port number
245+ /* Read hosts sshd port number
229246 ip, portNum, err := getPortNumAndIP(ip)
230247 gomega.Expect(err).NotTo(gomega.HaveOccurred())
231- addr := ip + ":" + portNum
248+ addr := ip + ":" + portNum*/
232249
233250 waitErr := wait .PollUntilContextTimeout (ctx , poll * 2 , pollTimeoutShort * 2 , true ,
234251 func (ctx context.Context ) (bool , error ) {
235- _ , err := net .DialTimeout ("tcp" , addr , poll )
252+ //_, err := net.DialTimeout("tcp", addr, poll)
253+ err := isSSHReachable (ip , poll )
236254 if err == nil {
237255 framework .Logf ("host is reachable" )
238256 return false , nil
0 commit comments