Revert "Remove 'nodes' key from serializer for 10.0"

This reverts commit 80d7188700.

Change-Id: I71288ce79ab1f30bb291e77dde1217a26899c85d
This commit is contained in:
Bulat Gaifullin 2016-07-15 16:38:40 +00:00
parent 0825f3e96c
commit 28461933e4
4 changed files with 22 additions and 47 deletions

View File

@ -539,6 +539,10 @@ class DeploymentHASerializer90(DeploymentHASerializer80):
node_attrs['nova_hugepages_enabled'] = (
objects.NodeAttributes.is_nova_hugepages_enabled(node))
# we don't need nodes in serialized data for 9.0 environments
# https://bugs.launchpad.net/fuel/+bug/1531128
attrs.pop('nodes')
return attrs
@classmethod
@ -635,18 +639,6 @@ class DeploymentHASerializer90(DeploymentHASerializer80):
hugepages)
class DeploymentHASerializer10(DeploymentHASerializer90):
def get_common_attrs(self, cluster):
attrs = super(DeploymentHASerializer10, self).get_common_attrs(cluster)
# we don't need nodes in serialized data for 10.0 environments
# https://bugs.launchpad.net/fuel/+bug/1531128
attrs.pop('nodes')
return attrs
class DeploymentLCMSerializer(DeploymentHASerializer90):
_configs = None
_priorities = {
@ -808,10 +800,7 @@ def get_serializer_for_cluster(cluster):
},
'9.0': {
'ha': DeploymentHASerializer90,
},
'10.0': {
'ha': DeploymentHASerializer10,
},
}
}
env_mode = 'ha' if cluster.is_ha_mode else 'multinode'

View File

@ -1,30 +0,0 @@
# -*- 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.test.integration import test_orchestrator_serializer_90
class TestDeploymentHASerializer100(
test_orchestrator_serializer_90.TestDeploymentHASerializer90):
env_version = 'newton-10.0'
def test_remove_nodes_from_common_attrs(self):
cluster_db = self.env.clusters[0]
serializer = self.create_serializer(cluster_db)
common_attrs = serializer.get_common_attrs(cluster_db)
self.assertNotIn('nodes', common_attrs)

View File

@ -18,6 +18,7 @@ import mock
import six
from oslo_serialization import jsonutils
import unittest2
from nailgun import consts
from nailgun import objects
@ -653,6 +654,13 @@ class TestDeploymentHASerializer90(
for item in serialized:
self.assertIn(item, cust_serialized)
def test_remove_nodes_from_common_attrs(self):
cluster_db = self.env.clusters[0]
serializer = self.create_serializer(cluster_db)
common_attrs = serializer.get_common_attrs(cluster_db)
self.assertNotIn('nodes', common_attrs)
class TestDeploymentTasksSerialization90(
TestSerializer90Mixin,
@ -721,6 +729,14 @@ class TestNetworkTemplateSerializer90CompatibleWith80(
self.assertEqual(node_attrs['swift_zone'], node.uid)
self.assertEqual(node_attrs['nova_cpu_pinning_enabled'], False)
@unittest2.skip(
"'nodes' key was removed from 9.0 version serializer output, "
"thus test bound to this data (that exists in parent test case class) "
"must be skipped"
)
def test_network_not_mapped_to_nics_w_template(self):
pass
class TestNetworkTemplateSerializer90(
TestSerializer90Mixin,

View File

@ -97,4 +97,4 @@ class TestGetSerializer(BaseUnitTest):
cluster.release.environment_version = '9999.0'
self.assertIs(
ds.get_serializer_for_cluster(cluster),
ds.DeploymentHASerializer10)
ds.DeploymentHASerializer90)