Sergiy Markin d00eaf0303 Drydock focal related upgrades
This PS implements the following changes:
- switches freeze approach to requirements-direct.txt and
  requirements-frozen.txt files
- adjusts code tabulation style according to  yapf recommendations
- replaces deprecated usage of responce.body attribute with
  responce.text
- fixes integration tests in controlled by Makefile + tox
- uplifts Helm to v3.9.4

Change-Id: I751db72eb8f670825382f11a36657112faeb169a
2023-04-26 22:32:49 +00:00

25 lines
963 B
Python

from drydock_provisioner.orchestrator.validations.validators import Validators
class HugepagesValidity(Validators):
def __init__(self):
super().__init__('Hugepages', 'DD1008')
def run_validation(self, site_design, orchestrator=None):
"""
Ensures that if hugepages are specified in kernel params, that both
size and count exist.
"""
for baremetal_node in site_design.baremetal_nodes or []:
if (('hugepages' in baremetal_node.kernel_params
and 'hugepagesz' not in baremetal_node.kernel_params)
or ('hugepages' not in baremetal_node.kernel_params
and 'hugepagesz' in baremetal_node.kernel_params)):
self.report_error(
'Invalid hugepages kernel configuration',
[baremetal_node.doc_ref],
'hugepages and hugepagesz must be specified together')
return