diff options
author | Parth Yadav <parthyadav3105@gmail.com> | 2021-04-30 08:23:15 +0530 |
---|---|---|
committer | Parth Yadav <parthyadav3105@gmail.com> | 2021-04-30 23:02:45 +0000 |
commit | 4743d6120a9afe077e3666e3128e16808cb04c09 (patch) | |
tree | 964ade7a9840a9c0f9e77f015677e211fca3e503 /sdv/docker/sdvstate/validator/airship | |
parent | d1cc451f841f995028d57677e897a39229a065a2 (diff) |
Bug Fixes: Fix failing http based health checks && Vswitch core checks
This Patch ensures sdvstate support for Airship 1.7 and Airship 1.8.
* Http based health check:
Added a sandbox pod for curl utility for sending https requests
to pods within cluster. Few Airship components are required to
be checked by sending http request on their status endpoints,
like Kibana.
* Fix config file parsing bug for:
1. vswitch_pmd_cores_check and
2. vswitch_dpdk_lcores_check
Signed-off-by: Parth Yadav<parthyadav3105@gmail.com>
Change-Id: I0864b9fd269c189b6e9807123da43dcf1fe1cbef
Diffstat (limited to 'sdv/docker/sdvstate/validator/airship')
-rw-r--r-- | sdv/docker/sdvstate/validator/airship/airship.py | 4 | ||||
-rw-r--r-- | sdv/docker/sdvstate/validator/airship/compute_check.py | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sdv/docker/sdvstate/validator/airship/airship.py b/sdv/docker/sdvstate/validator/airship/airship.py index 18de66d..f2bdebd 100644 --- a/sdv/docker/sdvstate/validator/airship/airship.py +++ b/sdv/docker/sdvstate/validator/airship/airship.py @@ -21,7 +21,7 @@ import logging from datetime import datetime as dt from tools.conf import settings -from tools.kube_utils import load_kube_api +from tools.kube_utils import load_kube_api, delete_kube_curl_pod from validator.validator import Validator from . import * @@ -92,6 +92,8 @@ class AirshipValidator(Validator): self.update_report(nova_scheduler_filters_check()) self.update_report(cpu_allocation_ratio_check()) + delete_kube_curl_pod() + self._report['stop_date'] = dt.now().strftime('%Y-%m-%d %H:%M:%S') diff --git a/sdv/docker/sdvstate/validator/airship/compute_check.py b/sdv/docker/sdvstate/validator/airship/compute_check.py index ff6f6db..a602471 100644 --- a/sdv/docker/sdvstate/validator/airship/compute_check.py +++ b/sdv/docker/sdvstate/validator/airship/compute_check.py @@ -18,6 +18,7 @@ Compute Related Checks import configparser import json +import re from tools.kube_utils import kube_exec, get_pod_with_labels from tools.conf import settings @@ -291,7 +292,14 @@ def trace_vswitch_pmd_cores(): cmd = ['ovs-vsctl', '-t', '5', 'get', 'Open_vSwitch', '.', 'other_config'] response = kube_exec(ovs_pod, cmd) - response.replace('=', ':') + # convert config str to json str + match = re.findall("[a-zA-Z0-9-]+=", response) + for key in match: + response = response.replace(key, '"' + key[:-1] + '":') + match = re.findall(":[a-zA-Z0-9-]+", response) + for key in match: + response = response.replace(key[1:], '"' + key[1:] + '"') + config = json.loads(response) if 'pmd-cpu-mask' in config: @@ -330,7 +338,14 @@ def trace_vswitch_dpdk_lcores(): cmd = ['ovs-vsctl', '-t', '5', 'get', 'Open_vSwitch', '.', 'other_config'] response = kube_exec(ovs_pod, cmd) - response.replace('=', ':') + # convert config str to json str + match = re.findall("[a-zA-Z0-9-]+=", response) + for key in match: + response = response.replace(key, '"' + key[:-1] + '":') + match = re.findall(":[a-zA-Z0-9-]+", response) + for key in match: + response = response.replace(key[1:], '"' + key[1:] + '"') + config = json.loads(response) if 'dpdk-lcore-mask' in config: |