Merge "Fix DPDK settings get for upgrades" into stable/mitaka

This commit is contained in:
Jenkins 2017-01-09 17:48:21 +00:00 committed by Gerrit Code Review
commit 7162bcd62a
3 changed files with 33 additions and 5 deletions

View File

@ -841,6 +841,18 @@ class Cluster(NailgunObject):
else:
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
def get_roles(cls, instance):
"""Returns a dictionary of node roles available for deployment.

View File

@ -446,7 +446,7 @@ class ClusterTransaction(DeploymentTask):
@classmethod
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 ids_not_to_skip: the list of task ids that will be not skipped
@ -1537,7 +1537,8 @@ class CheckBeforeDeploymentTask(object):
# TODO(asvechnikov): Make an appropriate versioning of tasks
if objects.Release.is_nfv_supported(task.cluster.release):
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):
cls._check_mongo_nodes(task)
@ -1914,8 +1915,10 @@ class CheckBeforeDeploymentTask(object):
@classmethod
def _check_dpdk_properties(self, task):
dpdk_enabled = False
for node in task.cluster.nodes:
if node.pending_deletion:
for node in objects.Cluster.get_nodes_not_for_deletion(task.cluster):
if (not objects.NodeAttributes.is_cpu_pinning_enabled(node) and
not objects.Node.dpdk_enabled):
continue
try:

View File

@ -23,6 +23,7 @@ from nailgun import errors
from nailgun import objects
from nailgun.orchestrator.task_based_deployment import TaskProcessor
from nailgun import rpc
from nailgun.task.task import CheckBeforeDeploymentTask
from nailgun.test.base import BaseIntegrationTest
from nailgun.test.base import fake_tasks
from nailgun.utils import reverse
@ -409,7 +410,8 @@ class TestTaskDeploy90(BaseIntegrationTest):
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]
objects.Node.update_attributes(node, {
@ -427,6 +429,17 @@ class TestTaskDeploy90(BaseIntegrationTest):
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):
def setUp(self):