Skip to content
Permalink
Browse files

Fix the h2 request multiplexing for list of nodes

Hyper splits the "o-node: n1,n2" header because of the comma.

Use HeaderMap client-side to be more explicit about this happening.
And server-side to rebuild the original selector.

The issue was detected on a "om <path> clear".
  • Loading branch information...
cvaroqui committed Jul 16, 2019
1 parent 944f2ce commit 5c535f34f475c9d9d2bc6f696ec6be84e6b77164
Showing with 23 additions and 6 deletions.
  1. +10 −5 lib/comm.py
  2. +13 −1 lib/osvcd_mon.py
@@ -20,6 +20,7 @@ class DummyException(Exception):
import ssl
import h2.connection
import hyper
from hyper.common.headers import HTTPHeaderMap
SSLWantReadError = ssl.SSLWantReadError
SSLError = ssl.SSLError
has_ssl = True
@@ -705,7 +706,7 @@ def h2_daemon_get(self, data, server=None, node=None, with_result=True, silent=F
path = self.h2_path_from_data(data)
headers = self.h2_headers(node=node, secret=secret, af=sp.af)
body = self.h2_body_from_data(data)
headers["Content-Length"] = str(len(body))
headers.update({"Content-Length": str(len(body))})
conn = self.h2c(sp=sp)
method = "GET"
try:
@@ -816,11 +817,15 @@ def h2_path_from_data(data):
return "/"+data.get("action", "")

def h2_headers(self, node=None, secret=None, af=None):
headers = {}
headers = HTTPHeaderMap()
if node:
headers[Headers.node] = node
if isinstance(node, (tuple, list, set)):
for n in node:
headers.update({Headers.node: n})
else:
headers.update({Headers.node: node})
if secret and af != socket.AF_UNIX:
headers[Headers.secret] = secret
headers.update({Headers.secret: secret})
return headers

@staticmethod
@@ -862,7 +867,7 @@ def h2_daemon_stream_conn(self, data, server=None, node=None, cluster_name=None,
path = self.h2_path_from_data(data)
headers = self.h2_headers(node=node, secret=secret, af=sp.af)
body = self.h2_body_from_data(data)
headers["Content-Length"] = str(len(body))
headers.update({"Content-Length": str(len(body))})
conn = self.h2c(sp=sp, enable_push=True)
stream_id = conn.request("GET", path, headers=headers, body=body)
#data = resp.read()
@@ -2550,6 +2550,18 @@ def get_agg_aborted(self, path):
return False
return True

def get_agg_conf(self, path):
data = Storage()
for inst in self.get_service_instances(path).values():
scale = inst.get("scale")
if scale is not None:
data.scale = scale
scaler_slave = inst.get("scaler_slave")
if scaler_slave:
data.scaler_slave = True
break
return data

def get_agg_deleted(self, path):
if len([True for inst in self.get_service_instances(path).values() if "updated" in inst]) > 0:
return False
@@ -3414,7 +3426,7 @@ def instance_unprovisioned(self, instance):
return not instance.get("provisioned", False)

def get_agg(self, path):
data = Storage()
data = self.get_agg_conf(path)
data.avail = self.get_agg_avail(path)
data.frozen = self.get_agg_frozen(path)
data.overall = self.get_agg_overall(path)

0 comments on commit 5c535f3

Please sign in to comment.
You can’t perform that action at this time.