Commit a65cf097 authored by Swann Perarnau's avatar Swann Perarnau

[feature] change libnrm ratelimit in manifest

Add a "monitoring" section to the manifest, that allows users to modify
libnrm through environment variables.
parent 5cf4f837
Pipeline #5664 passed with stages
in 8 minutes and 11 seconds
......@@ -34,6 +34,13 @@
"slowdown": "1.1"
}
},
{
"name": "argo/monitoring",
"value": {
"enabled": "1",
"ratelimit": "10000000"
}
},
{
"name": "argo/hwbind",
"value": {
......
......@@ -240,6 +240,34 @@ class HwBind(SpecField):
return True
class Monitoring(SpecField):
"""Monitoring options (libnrm)."""
fields = {"enabled": spec(unicode, False),
"monitoring": spec(unicode, False),
}
def __init__(self):
"""Create empty monitoring option object."""
pass
def load(self, data):
"""Load monitoring options."""
ret = super(Monitoring, self).load(data)
if not ret:
return ret
if self.enabled not in ["0", "False", "1", "True"]:
logger.error("Invalid value for monitoring options enabled: %s",
self.enabled)
return False
if self.ratelimit < 0:
logger.error("Invalid value for monitoring ratelimit: %s",
self.ratelimit)
return False
return True
class IsolatorList(SpecField):
"""Represent the list of isolator in a Manifest."""
......@@ -249,6 +277,7 @@ class IsolatorList(SpecField):
"argo/perfwrapper": spec(PerfWrapper, False),
"argo/power": spec(Power, False),
"argo/hwbind": spec(HwBind, False),
"argo/monitoring": spec(Monitoring, False),
}
def __init__(self):
......
......@@ -128,6 +128,11 @@ class ContainerManager(object):
environ['NRM_TRANSMIT'] = '1'
environ['NRM_DAMPER'] = container.power['damper']
# monitoring section involves libnrm
if manifest.is_feature_enabled('monitoring'):
environ['ARGO_NRM_RATELIMIT'] = \
manifest.app.isolators.monitoring.ratelimit
# build prefix to the entire command based on enabled features
argv = []
if manifest.is_feature_enabled('scheduler'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment