Merge "Switch provider from ovs to dpdkovs"

This commit is contained in:
Jenkins 2017-01-12 11:59:29 +00:00 committed by Gerrit Code Review
commit ccac8ae8ed
3 changed files with 113 additions and 6 deletions

View File

@ -1481,7 +1481,7 @@ class DPDKSerializerMixin90(object):
@classmethod
def configure_private_network_dpdk(cls, node, nm, transformations,
nets_by_ifaces):
nets_by_ifaces, dpdk_br_provider):
"""This method configures transformations for private network.
It is used for VLAN and VXLAN segmentation types only.
@ -1499,7 +1499,7 @@ class DPDKSerializerMixin90(object):
transformations.append(cls.add_bridge(
br_name,
provider=consts.NEUTRON_L23_PROVIDERS.ovs,
provider=dpdk_br_provider,
vendor_specific=vendor_specific))
for iface in node.nic_interfaces:
@ -1598,13 +1598,14 @@ class NeutronNetworkDeploymentSerializer90(
@classmethod
def generate_transformations_by_segmentation_type(
cls, node, nm, transformations, prv_base_ep, nets_by_ifaces
cls, node, nm, transformations, prv_base_ep, nets_by_ifaces,
dpdk_br_provider=consts.NEUTRON_L23_PROVIDERS.ovs
):
if (objects.Node.dpdk_enabled(node) and
objects.Cluster.is_dpdk_supported_for_segmentation(
node.cluster)):
cls.configure_private_network_dpdk(
node, nm, transformations, nets_by_ifaces
node, nm, transformations, nets_by_ifaces, dpdk_br_provider
)
else:
(super(NeutronNetworkDeploymentSerializer90, cls)
@ -1650,3 +1651,22 @@ class NeutronNetworkTemplateSerializer90(
NeutronNetworkTemplateSerializer80
):
pass
class NeutronNetworkTemplateSerializer110(
NeutronNetworkTemplateSerializer90
):
pass
class NeutronNetworkDeploymentSerializer110(
NeutronNetworkDeploymentSerializer90
):
@classmethod
def generate_transformations_by_segmentation_type(
cls, node, nm, transformations, prv_base_ep, nets_by_ifaces
):
(super(NeutronNetworkDeploymentSerializer110, cls)
.generate_transformations_by_segmentation_type(
node, nm, transformations, prv_base_ep, nets_by_ifaces,
consts.NEUTRON_L23_PROVIDERS.dpdkovs))

View File

@ -849,6 +849,16 @@ class DeploymentLCMSerializer(DeploymentHASerializer90):
return serialized_node
class DeploymentLCMSerializer110(DeploymentLCMSerializer):
@classmethod
def get_net_provider_serializer(cls, cluster):
if cluster.network_config.configuration_template:
return neutron_serializers.NeutronNetworkTemplateSerializer110
else:
return neutron_serializers.NeutronNetworkDeploymentSerializer110
def get_serializer_for_cluster(cluster):
"""Returns a serializer depends on a given `cluster`.
@ -890,7 +900,7 @@ def get_serializer_for_cluster(cluster):
return serializers[env_mode]
# return latest serializer by default
latest_version = max(serializers_map, key=lambda v: StrictVersion(v))
latest_version = max(serializers_map.keys(), key=StrictVersion)
return serializers_map[latest_version][env_mode]
@ -925,8 +935,19 @@ def serialize(orchestrator_graph, cluster, nodes,
def serialize_for_lcm(cluster, nodes,
ignore_customized=False, skip_extensions=False):
serializers_map = {
'default': DeploymentLCMSerializer,
'11.0': DeploymentLCMSerializer110,
}
serializer_lcm = serializers_map['default']
for version, serializer in six.iteritems(serializers_map):
if cluster.release.environment_version.startswith(version):
serializer_lcm = serializer
break
return _invoke_serializer(
DeploymentLCMSerializer(), cluster, nodes,
serializer_lcm(), cluster, nodes,
ignore_customized, skip_extensions
)

View File

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nailgun import consts
from nailgun.orchestrator import deployment_serializers
from nailgun.test.integration import test_orchestrator_serializer_90
class TestSerializer110Mixin(object):
env_version = 'ocata-11.0'
task_deploy = True
dpdk_bridge_provider = consts.NEUTRON_L23_PROVIDERS.dpdkovs
@classmethod
def create_serializer(cls, cluster):
return deployment_serializers.DeploymentLCMSerializer110()
@classmethod
def _get_serializer(cluster):
return deployment_serializers.DeploymentLCMSerializer110()
@staticmethod
def _get_plugins_names(plugins):
"""Plugins names for LCM serializers
Single out <name> since plugin data may contain
<scripts>, <repositories>, <whatever> as well.
:param nodes: array of plugins data
:returns: singled out names of plugins
"""
return [plugin['name'] for plugin in plugins]
class TestDeploymentAttributesSerialization110(
TestSerializer110Mixin,
test_orchestrator_serializer_90.TestDeploymentAttributesSerialization90
):
pass
class TestDeploymentLCMSerialization110(
TestSerializer110Mixin,
test_orchestrator_serializer_90.TestDeploymentLCMSerialization90
):
pass
class TestSerializeInterfaceDriversData110(
TestSerializer110Mixin,
test_orchestrator_serializer_90.TestSerializeInterfaceDriversData90
):
pass