From b46a1e14a32b34dd13ed42a211e3107847c0a6a1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 25 Oct 2024 12:11:58 -0400 Subject: [PATCH] Fix video console when first run has multiple nodes If client requested more than one on a fresh confluent run, then only one of the video consoles would properly wait. Fix by wrapping the assure in a startingup check. --- confluent_server/confluent/vinzmanager.py | 37 ++++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/confluent_server/confluent/vinzmanager.py b/confluent_server/confluent/vinzmanager.py index 308acb59..016bad3c 100644 --- a/confluent_server/confluent/vinzmanager.py +++ b/confluent_server/confluent/vinzmanager.py @@ -16,27 +16,34 @@ mountsbyuser = {} _vinzfd = None _vinztoken = None webclient = eventlet.import_patched('pyghmi.util.webclient') - +startingup = False # Handle the vinz VNC session def assure_vinz(): global _vinzfd global _vinztoken - if _vinzfd is None: - _vinztoken = base64.b64encode(os.urandom(33), altchars=b'_-').decode() - os.environ['VINZ_TOKEN'] = _vinztoken - os.makedirs('/var/run/confluent/vinz/sessions', exist_ok=True) + global startingup + while startingup: + eventlet.sleep(0.5) + try: + startingup = True + if _vinzfd is None: + _vinztoken = base64.b64encode(os.urandom(33), altchars=b'_-').decode() + os.environ['VINZ_TOKEN'] = _vinztoken + os.makedirs('/var/run/confluent/vinz/sessions', exist_ok=True) - _vinzfd = subprocess.Popen( - ['/opt/confluent/bin/vinz', - '-c', '/var/run/confluent/vinz/control', - '-w', '127.0.0.1:4007', - '-a', '/var/run/confluent/vinz/approval', - # vinz supports unix domain websocket, however apache reverse proxy is dicey that way in some versions - '-d', '/var/run/confluent/vinz/sessions']) - while not os.path.exists('/var/run/confluent/vinz/control'): - eventlet.sleep(0.5) - eventlet.spawn(monitor_requests) + _vinzfd = subprocess.Popen( + ['/opt/confluent/bin/vinz', + '-c', '/var/run/confluent/vinz/control', + '-w', '127.0.0.1:4007', + '-a', '/var/run/confluent/vinz/approval', + # vinz supports unix domain websocket, however apache reverse proxy is dicey that way in some versions + '-d', '/var/run/confluent/vinz/sessions']) + while not os.path.exists('/var/run/confluent/vinz/control'): + eventlet.sleep(0.5) + eventlet.spawn(monitor_requests) + finally: + startingup = False _unix_by_nodename = {} def get_url(nodename, inputdata):