Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
fix(VM Status): Timeout on connectivity check
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrrdk committed Oct 25, 2023
1 parent 6d21f9c commit 135f67c
Show file tree
Hide file tree
Showing 6 changed files with 2,931 additions and 9,003 deletions.
16 changes: 10 additions & 6 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,6 @@ def check_server_status(self, openstack_id: str) -> VM:
)
if self.netcat(host, port):
server = self.get_server(openstack_id)

if self.redis.exists(openstack_id) == 1:
global active_playbooks
if openstack_id in active_playbooks:
Expand Down Expand Up @@ -2529,11 +2528,16 @@ def netcat(self, host, port):
"""
self.LOG.info(f"Checking SSH Connection {host}:{port}")
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
r = sock.connect_ex((host, port))
self.LOG.info(f"Checking SSH Connection {host}:{port} Result = {r}")
if r == 0:
return True
else:
sock.settimeout(5000)
try:
r = sock.connect_ex((host, port))
self.LOG.info(f"Checking SSH Connection {host}:{port} Result = {r}")
if r == 0:
return True
else:
return False
except socket.timeout:
self.LOG.info(f"Connection to {host}:{port} timed out")
return False

def is_security_group_in_use(self, security_group_id):
Expand Down
2 changes: 1 addition & 1 deletion VirtualMachineService/VirtualMachineService-remote
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.16.0)
# Autogenerated by Thrift Compiler (0.17.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
Expand Down
Loading

0 comments on commit 135f67c

Please sign in to comment.