Fix DPDK settings get for upgrades
Change-Id: I226cb5d1168b1b02c9779b5fd48d30fd52f83728 Closes-bug: #1645471 Co-Authored-By: Fedor Zhadaev <fzhadaev@mirantis.com>
This commit is contained in:
parent
163e05ee1a
commit
c8b3447676
@ -841,6 +841,18 @@ class Cluster(NailgunObject):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def dpdk_enabled(cls, instance):
|
||||||
|
# Had to do this due to issues with modules imports in current
|
||||||
|
# nailgun __init__.py which cannot be resolved easily
|
||||||
|
from nailgun.objects import Node
|
||||||
|
|
||||||
|
if Release.is_nfv_supported(instance.release):
|
||||||
|
for node in cls.get_nodes_not_for_deletion(instance):
|
||||||
|
if Node.dpdk_enabled(node):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_roles(cls, instance):
|
def get_roles(cls, instance):
|
||||||
"""Returns a dictionary of node roles available for deployment.
|
"""Returns a dictionary of node roles available for deployment.
|
||||||
|
@ -448,7 +448,7 @@ class ClusterTransaction(DeploymentTask):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def mark_skipped(cls, tasks, ids_not_to_skip):
|
def mark_skipped(cls, tasks, ids_not_to_skip):
|
||||||
"""Change tasks type which ids not present in ids_not_to_skip to skipped
|
"""Change tasks type which ids are not ids_not_to_skip to skipped
|
||||||
|
|
||||||
:param tasks: the list of deployment tasks to execute
|
:param tasks: the list of deployment tasks to execute
|
||||||
:param ids_not_to_skip: the list of task ids that will be not skipped
|
:param ids_not_to_skip: the list of task ids that will be not skipped
|
||||||
@ -1526,7 +1526,8 @@ class CheckBeforeDeploymentTask(object):
|
|||||||
# TODO(asvechnikov): Make an appropriate versioning of tasks
|
# TODO(asvechnikov): Make an appropriate versioning of tasks
|
||||||
if objects.Release.is_nfv_supported(task.cluster.release):
|
if objects.Release.is_nfv_supported(task.cluster.release):
|
||||||
cls._check_sriov_properties(task)
|
cls._check_sriov_properties(task)
|
||||||
cls._check_dpdk_properties(task)
|
if objects.Cluster.dpdk_enabled(task.cluster):
|
||||||
|
cls._check_dpdk_properties(task)
|
||||||
|
|
||||||
if objects.Release.is_external_mongo_enabled(task.cluster.release):
|
if objects.Release.is_external_mongo_enabled(task.cluster.release):
|
||||||
cls._check_mongo_nodes(task)
|
cls._check_mongo_nodes(task)
|
||||||
@ -1868,8 +1869,10 @@ class CheckBeforeDeploymentTask(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _check_dpdk_properties(self, task):
|
def _check_dpdk_properties(self, task):
|
||||||
dpdk_enabled = False
|
dpdk_enabled = False
|
||||||
for node in task.cluster.nodes:
|
for node in objects.Cluster.get_nodes_not_for_deletion(task.cluster):
|
||||||
if node.pending_deletion:
|
|
||||||
|
if (not objects.NodeAttributes.is_cpu_pinning_enabled(node) and
|
||||||
|
not objects.Node.dpdk_enabled):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -23,6 +23,7 @@ from nailgun import errors
|
|||||||
from nailgun import objects
|
from nailgun import objects
|
||||||
from nailgun.orchestrator.task_based_deployment import TaskProcessor
|
from nailgun.orchestrator.task_based_deployment import TaskProcessor
|
||||||
from nailgun import rpc
|
from nailgun import rpc
|
||||||
|
from nailgun.task.task import CheckBeforeDeploymentTask
|
||||||
from nailgun.test.base import BaseIntegrationTest
|
from nailgun.test.base import BaseIntegrationTest
|
||||||
from nailgun.test.base import fake_tasks
|
from nailgun.test.base import fake_tasks
|
||||||
from nailgun.test.base import mock_rpc
|
from nailgun.test.base import mock_rpc
|
||||||
@ -411,7 +412,8 @@ class TestTaskDeploy90(BaseIntegrationTest):
|
|||||||
if task['type'] != consts.ORCHESTRATOR_TASK_TYPES.skipped)
|
if task['type'] != consts.ORCHESTRATOR_TASK_TYPES.skipped)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_deploy_check_failed_with_dpdk_cpu_distribution(self):
|
@mock.patch('objects.Node.dpdk_enabled', return_value=True)
|
||||||
|
def test_deploy_check_failed_with_dpdk_cpu_distribution(self, _):
|
||||||
node = self.env.nodes[0]
|
node = self.env.nodes[0]
|
||||||
|
|
||||||
objects.Node.update_attributes(node, {
|
objects.Node.update_attributes(node, {
|
||||||
@ -429,6 +431,17 @@ class TestTaskDeploy90(BaseIntegrationTest):
|
|||||||
task.message
|
task.message
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('objects.Node.dpdk_enabled', return_value=False)
|
||||||
|
def test_deploy_disabled_dpdk_check_ok_without_numa_meta(self, _):
|
||||||
|
node = self.env.nodes[0]
|
||||||
|
|
||||||
|
node.meta.pop('numa_topology', {})
|
||||||
|
|
||||||
|
task = models.Task(name=consts.TASK_NAMES.deployment,
|
||||||
|
cluster=self.cluster)
|
||||||
|
self.assertNotRaises(
|
||||||
|
errors.InvalidData, CheckBeforeDeploymentTask.execute, task)
|
||||||
|
|
||||||
|
|
||||||
class TestTaskDeploy90AfterDeployment(BaseIntegrationTest):
|
class TestTaskDeploy90AfterDeployment(BaseIntegrationTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user