Raise error in non QAT system
This commit includes the code for raising the error whenever it does not find the QAT driver in the system. It checks the chart name intel-device-plugins-qat. TEST CASES: PASSED: Build is success. PASSED: Bootstrap is success. PASSED: Upload the package using command system application-upload. PASSED: Check chart enabled status using command "system helm-override-list intel-device-plugins-operator --long" PASSED: Enable the QAT chart using command "system helm-chart-attribute-modify --enabled true intel-device-plugins-operator intel-device-plugins-qat intel-device-plugins-operator", raises error in not QAT system. PASSED: Raises "qat_service is not up" when it does not find service using command "/etc/init.d/qat_service status" PASSED: Raises "qat_service is inactive" when it runs command "systemctl status qat_service.service". PASSED: Raises "qat_service is disabled" when qat_service is not enabled with command "systemctl is-enabled qat_service.service". PASSED: Raises "qat_service is up but vfio_pci driver is not installed" when it does not list vfio_pci drive using command "lsmod | grep vfio". Story: 2010604 Task: 50027 Change-Id: Ied634cf35b53421bcaa2f8307e76a0fc87d3bb1f Signed-off-by: Md Irshad Sheikh <mdirshad.sheikh@windriver.com>
This commit is contained in:
parent
159039de4c
commit
bccd257649
|
@ -7,6 +7,7 @@
|
|||
import pecan
|
||||
from pecan import rest
|
||||
import six
|
||||
import subprocess
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
import wsmeext.pecan as wsme_pecan
|
||||
|
@ -230,7 +231,11 @@ class HelmChartsController(rest.RestController):
|
|||
(k, ','.join(common.HELM_CHART_ATTRS)))
|
||||
|
||||
if k == common.HELM_CHART_ATTR_ENABLED:
|
||||
attributes[k] = attributes[k] in ['true', 'True']
|
||||
if attributes[k] in ['true', 'True'] and name == "intel-device-plugins-qat":
|
||||
self._is_qat_driver_present()
|
||||
attributes[k] = attributes[k] in ['true', 'True']
|
||||
else:
|
||||
attributes[k] = attributes[k] in ['true', 'True']
|
||||
|
||||
# update the attribute changes
|
||||
system_overrides = db_chart.system_overrides
|
||||
|
@ -263,3 +268,28 @@ class HelmChartsController(rest.RestController):
|
|||
raise wsme.exc.ClientSideError(_("Application %s not found." % app_name))
|
||||
except exception.HelmOverrideNotFound:
|
||||
pass
|
||||
|
||||
def _is_qat_driver_present(self):
|
||||
"""
|
||||
Check whether the system has QAT hardware or not.
|
||||
"""
|
||||
cmd = "/etc/init.d/qat_service status"
|
||||
service_status = subprocess.run(cmd, shell=True, check=False, capture_output=True, text=True)
|
||||
if "4xxx" not in service_status.stdout:
|
||||
raise exception.LifecycleSemanticCheckException(
|
||||
"qat_service is not up")
|
||||
cmd = "systemctl status qat_service.service"
|
||||
service_active = subprocess.run(cmd, shell=True, check=False, capture_output=True, text=True)
|
||||
if "inactive" in service_active.stdout:
|
||||
raise exception.LifecycleSemanticCheckException(
|
||||
"qat_service is inactive")
|
||||
cmd = "systemctl is-enabled qat_service.service"
|
||||
service_enabled = subprocess.run(cmd, shell=True, check=False, capture_output=True, text=True)
|
||||
if "disabled" in service_enabled.stdout:
|
||||
raise exception.LifecycleSemanticCheckException(
|
||||
"qat_service is disabled")
|
||||
cmd = "lsmod | grep vfio"
|
||||
driver_present = subprocess.run(cmd, shell=True, check=False, capture_output=True, text=True)
|
||||
if "vfio_pci" not in driver_present.stdout:
|
||||
raise exception.LifecycleSemanticCheckException(
|
||||
"qat_service is up but vfio_pci driver is not installed")
|
||||
|
|
Loading…
Reference in New Issue