diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 0519c90..0000000 --- a/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -branch = True -source = converted_serializers - -[report] -ignore_errors = True diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 652b48b..0000000 --- a/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -*.py[cod] -.idea - -# C extensions -*.so - -# Packages -*.egg* -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -cover/ -.coverage* -!.coveragerc -.tox -nosetests.xml -.testrepository -.venv - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# Complexity -output/*.html -output/*/index.html - -# Sphinx -doc/build - -# pbr generates these -AUTHORS -ChangeLog - -# Editors -*~ -.*.swp -.*sw? - -# Files created by releasenotes build -extension.xml diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8dada3e..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index c978a52..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include AUTHORS -include ChangeLog -exclude .gitignore -exclude .gitreview - -global-exclude *.pyc diff --git a/README.rst b/README.rst index 2ca0eea..86e34d6 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,10 @@ -Fuel nailgun extenstion for converted serializers -================================================= +This project is no longer maintained. -This extension for Nailgun provides conversion layer which triggers pre-Mitaka -serializers to generate deployment data, so that pre-9.x clusters can leverage -Fuel Mitaka LCM features +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". -Installation ------------ -Just install the package `fuel-nailgun-extension-converted-serializers` +For any further questions, please email +openstack-discuss@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/bindep.txt b/bindep.txt deleted file mode 100644 index 568f269..0000000 --- a/bindep.txt +++ /dev/null @@ -1,6 +0,0 @@ -libpq-dev -postgresql -postgresql-client -# We don't use these, but mysql-prep step is in template job -mysql-client -mysql-server diff --git a/conftest.py b/conftest.py deleted file mode 100644 index a345985..0000000 --- a/conftest.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding: utf-8 - -# 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. - - -def pytest_configure(config): - from nailgun import db - db.dropdb() - db.syncdb() - - -def pytest_unconfigure(config): - from nailgun import db - db.dropdb() diff --git a/converted_serializers/__init__.py b/converted_serializers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/converted_serializers/extension.py b/converted_serializers/extension.py deleted file mode 100644 index 45df8a1..0000000 --- a/converted_serializers/extension.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 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. -import logging - -from nailgun import extensions -from nailgun import objects -from nailgun.orchestrator.deployment_serializers import \ - get_serializer_for_cluster -from nailgun import utils - - -logger = logging.getLogger(__name__) - - -class ConvertPreLCMtoLCM(extensions.BasePipeline): - - @classmethod - def pre_process_data_for_cluster(cls, cluster, data, **kwargs): - return data - - @classmethod - def post_process_data_for_cluster(cls, cluster, data, **kwargs): - return data - - @classmethod - def pre_process_data_for_node(cls, node, data, **kwargs): - return data - - @classmethod - def post_process_data_for_node(cls, node, data, **kwargs): - return data - - @classmethod - def serialize_cluster(cls, cluster, data, **kwargs): - if objects.Release.is_lcm_supported(cluster.release): - return data - else: - serializer = get_serializer_for_cluster(cluster)() - serializer.initialize(cluster) - common_attrs = serializer.get_common_attrs(cluster) - if cluster.replaced_deployment_info: - # patch common attributes with custom deployment info - utils.dict_update( - common_attrs, cluster.replaced_deployment_info - ) - return common_attrs - - @classmethod - def serialize_node(cls, node, data, **kwargs): - if objects.Release.is_lcm_supported(node.cluster.release): - return data - else: - serializer = get_serializer_for_cluster(node.cluster)() - serializer.initialize(node.cluster) - role = getattr(objects.Node, "all_roles", - objects.Node.all_tags)(node)[0] - real_data = serializer.serialize_node({}, node, role) - return real_data - - @classmethod - def process_deployment_for_cluster(cls, cluster, data, **kwargs): - pre_processed_data = cls.pre_process_data_for_cluster(cluster, data, - **kwargs) - real_data = cls.serialize_cluster(cluster, pre_processed_data, - **kwargs) - - post_processed_data = cls.post_process_data_for_cluster( - cluster, real_data, **kwargs) - # copypaste cluster specific values from LCM serializer. - # This is needed for tasks paramters interpolation like CLUSTER_ID - cluster_data = data['cluster'] - post_processed_data['cluster'] = cluster_data - return post_processed_data - - @classmethod - def process_deployment_for_node(cls, node, node_data, **kwargs): - pre_processed_data = cls.pre_process_data_for_node(node, - node_data, **kwargs) - real_data = cls.serialize_node(node, pre_processed_data, **kwargs) - - post_processed_data = cls.post_process_data_for_node(node, real_data, - **kwargs) - return post_processed_data - - -class ConvertedSerializersExtension(extensions.BaseExtension): - name = 'converted_serializers' - version = '0.0.1' - description = "Serializers Conversion extension" - weight = 100 - - data_pipelines = [ - ConvertPreLCMtoLCM, - ] diff --git a/converted_serializers/tests/__init__.py b/converted_serializers/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/converted_serializers/tests/test_pipelines.py b/converted_serializers/tests/test_pipelines.py deleted file mode 100644 index 3ce2a31..0000000 --- a/converted_serializers/tests/test_pipelines.py +++ /dev/null @@ -1,651 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 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. - - -import mock -import six - -import nailgun - -from nailgun import consts -from nailgun.db.sqlalchemy import models -from nailgun import objects -from nailgun import rpc - -from nailgun.extensions.network_manager.serializers.neutron_serializers import \ - NeutronNetworkDeploymentSerializer80 -from nailgun.extensions.network_manager.serializers.neutron_serializers import \ - NeutronNetworkTemplateSerializer80 -from nailgun.orchestrator import deployment_serializers -# from nailgun.orchestrator.deployment_serializers import \ -# deployment_info_to_legacy -from nailgun.orchestrator.deployment_serializers import \ - get_serializer_for_cluster -from nailgun.test.integration.test_orchestrator_serializer import \ - BaseDeploymentSerializer -from nailgun.test.integration.test_orchestrator_serializer import \ - TestSerializeInterfaceDriversData -from nailgun.test.integration.test_orchestrator_serializer_70 import \ - TestDeploymentHASerializer70 -from nailgun.test.integration.test_orchestrator_serializer_80 import \ - TestSerializer80Mixin - - -class TestSerializerWrapper(deployment_serializers.DeploymentLCMSerializer): - - def serialize(self, cluster, nodes, ignore_customized=False): - return deployment_serializers.serialize_for_lcm( - cluster, nodes, ignore_customized=ignore_customized) - - def get_net_provider_serializer(cls, cluster): - return deployment_serializers\ - .DeploymentHASerializer80.get_net_provider_serializer(cluster) - - -class TestSerializerConverter80To90MixIn(TestSerializer80Mixin): - env_version = "liberty-8.0" - task_deploy = True - is_propagate_task_deploy = True - enforce_lcm = True - - @classmethod - def create_serializer(cls, cluster): - serializer_type = TestSerializerWrapper - return serializer_type(None) - - -class TestNetworkTemplateSerializer80MixIn( - TestSerializerConverter80To90MixIn, - BaseDeploymentSerializer -): - legacy_serializer = NeutronNetworkDeploymentSerializer80 - template_serializer = NeutronNetworkTemplateSerializer80 - - def setUp(self, *args): - super(TestNetworkTemplateSerializer80MixIn, self).setUp() - self.env.create( - release_kwargs={'version': self.env_version}, - cluster_kwargs={ - 'mode': consts.CLUSTER_MODES.ha_compact, - 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron, - 'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan}) - self.net_template = self.env.read_fixtures(['network_template_80'])[0] - self.cluster = self.env.clusters[-1] - self.cluster.extensions = ['volume_manager', 'converted_serializers'] - self.serializer = self.create_serializer(self.cluster) - - def test_get_net_provider_serializer(self): - self.cluster.network_config.configuration_template = None - - net_serializer = self.serializer.\ - get_net_provider_serializer(self.cluster) - self.assertIs(net_serializer, self.legacy_serializer) - - self.cluster.network_config.configuration_template = \ - self.net_template - net_serializer = self.serializer.\ - get_net_provider_serializer(self.cluster) - self.assertIs(net_serializer, self.template_serializer) - - # def test_baremetal_neutron_attrs(self): - # brmtl_template = deepcopy( - # self.net_template['adv_net_template']['default']) - # brmtl_template['network_assignments']['baremetal'] = { - # 'ep': 'br-baremetal'} - # brmtl_template['templates_for_node_role']['controller'].append( - # 'baremetal') - # brmtl_template['nic_mapping']['default']['if8'] = 'eth7' - # brmtl_template['network_scheme']['baremetal'] = { - # 'endpoints': ['br-baremetal'], - # 'transformations': [], - # 'roles': {'baremetal': 'br-baremetal'}} - # self.cluster.network_config.configuration_template = { - # 'adv_net_template': {'default': brmtl_template}, 'pk': 1} - # self._check_baremetal_neutron_attrs(self.cluster) - - def test_network_schemes_priorities(self): - expected = [ - { - "action": "add-br", - "name": "br-prv", - "provider": "ovs" - }, - { - "action": "add-br", - "name": "br-aux" - }, - { - "action": "add-patch", - "bridges": [ - "br-prv", - "br-aux" - ], - "provider": "ovs", - "mtu": 65000 - }, - { - "action": "add-port", - "bridge": "br-aux", - "name": "eth3.101" - }, - { - "action": "add-br", - "name": "br-fw-admin" - }, - { - "action": "add-port", - "bridge": "br-fw-admin", - "name": "eth0" - }, - { - "action": "add-br", - "name": "br-mgmt" - }, - { - "action": "add-port", - "bridge": "br-mgmt", - "name": "eth1.104" - }, - { - "action": "add-br", - "name": "br-storage" - }, - { - "action": "add-port", - "bridge": "br-storage", - "name": "eth2" - } - ] - - objects.Cluster.set_network_template( - self.cluster, - self.net_template - ) - - node = self.env.create_nodes_w_interfaces_count( - 1, 8, roles=['compute', 'cinder'], - cluster_id=self.cluster.id - )[0] - - self.serializer = get_serializer_for_cluster(self.cluster) - net_serializer = self.serializer.get_net_provider_serializer( - self.cluster) - - nm = objects.Cluster.get_network_manager(self.cluster) - network_scheme = net_serializer.generate_network_scheme( - node, nm.get_node_networks(node)) - self.assertEqual(expected, network_scheme['transformations']) - - -class TestDeploymentTasksSerialization80MixIn( - TestSerializerConverter80To90MixIn, - BaseDeploymentSerializer -): - tasks_for_rerun = {"globals", "netconfig"} - - def setUp(self): - super(TestDeploymentTasksSerialization80MixIn, self).setUp() - self.env.create( - release_kwargs={'version': self.env_version}, - cluster_kwargs={ - 'mode': consts.CLUSTER_MODES.ha_compact, - 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron, - 'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan, - 'status': consts.CLUSTER_STATUSES.operational}, - nodes_kwargs=[ - {'roles': ['controller'], - 'status': consts.NODE_STATUSES.ready}] - ) - - self.cluster = self.env.clusters[-1] - self.cluster.extensions = ['volume_manager', 'converted_serializers'] - if not self.task_deploy: - self.env.disable_task_deploy(self.cluster) - - def add_node(self, role): - return self.env.create_node( - cluster_id=self.cluster.id, - pending_roles=[role], - pending_addition=True - ) - - def get_rpc_args(self): - self.env.launch_deployment() - args, kwargs = nailgun.task.manager.rpc.cast.call_args - return args[1][1]['args'] - - def check_add_node_for_task_deploy(self, rpc_message): - tasks_graph = rpc_message['tasks_graph'] - for node_id, tasks in six.iteritems(tasks_graph): - if node_id is None or node_id == consts.MASTER_NODE_UID: - # skip virtual node - continue - - task_ids = { - t['id'] for t in tasks - if t['type'] != consts.ORCHESTRATOR_TASK_TYPES.skipped - } - # all tasks are run on all nodes - self.assertTrue(self.tasks_for_rerun.issubset(task_ids)) - - def check_add_compute_for_granular_deploy(self, new_node_uid, rpc_message): - for node in rpc_message['deployment_info']: - task_ids = {t['id'] for t in node['tasks']} - if node['tasks'][0]['uids'] == [new_node_uid]: - # all tasks are run on a new node - self.assertTrue( - self.tasks_for_rerun.issubset(task_ids)) - else: - # only selected tasks are run on a deployed node - self.assertItemsEqual(self.tasks_for_rerun, task_ids) - - def check_add_controller_for_granular_deploy(self, rpc_message): - for node in rpc_message['deployment_info']: - task_ids = {t['id'] for t in node['tasks']} - # controller is redeployed when other one is added - # so all tasks are run on all nodes - self.assertTrue( - self.tasks_for_rerun.issubset(task_ids)) - - # @mock.patch('nailgun.rpc.cast') - # def test_add_compute(self, _): - # new_node = self.add_node('compute') - # rpc_deploy_message = self.get_rpc_args() - # if self.task_deploy: - # self.check_add_node_for_task_deploy(rpc_deploy_message) - # else: - # self.check_add_compute_for_granular_deploy( - # new_node.uid, rpc_deploy_message - # ) - - # @mock.patch('nailgun.rpc.cast') - # def test_add_controller(self, _): - # self.add_node('controller') - # rpc_deploy_message = self.get_rpc_args() - # - # if self.task_deploy: - # self.check_add_node_for_task_deploy(rpc_deploy_message) - # else: - # self.check_add_controller_for_granular_deploy(rpc_deploy_message) - - -class TestDeploymentAttributesSerialization80MixIn( - TestSerializerConverter80To90MixIn, - BaseDeploymentSerializer -): - def setUp(self): - super(TestDeploymentAttributesSerialization80MixIn, self).setUp() - self.cluster = self.env.create( - release_kwargs={ - 'version': self.env_version, - 'operating_system': consts.RELEASE_OS.ubuntu}, - cluster_kwargs={ - 'mode': consts.CLUSTER_MODES.ha_compact, - 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron, - 'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan}) - self.cluster_db = self.db.query(models.Cluster).get(self.cluster['id']) - self.cluster.extensions = ['volume_manager', 'converted_serializers'] - self.serializer = self.create_serializer(self.cluster_db) - - # def test_neutron_attrs(self): - # self.env.create_node( - # cluster_id=self.cluster_db.id, - # roles=['controller'], primary_roles=['controller'] - # ) - # objects.Cluster.prepare_for_deployment(self.cluster_db) - # serialized_for_astute = self.serializer.serialize( - # self.cluster_db, self.cluster_db.nodes) - # serialized_for_astute = deployment_info_to_legacy( - # serialized_for_astute) - # for node in serialized_for_astute: - # self.assertEqual( - # { - # "bridge": consts.DEFAULT_BRIDGES_NAMES.br_floating, - # "vlan_range": None - # }, - # node['quantum_settings']['L2']['phys_nets']['physnet1'] - # ) - # l2 = (node["quantum_settings"]["predefined_networks"] - # [self.cluster_db.network_config.floating_name]["L2"]) - # - # self.assertEqual("physnet1", l2["physnet"]) - # self.assertEqual("flat", l2["network_type"]) - - # def test_baremetal_transformations(self): - # self.env._set_additional_component(self.cluster_db, 'ironic', True) - # self.env.create_node(cluster_id=self.cluster_db.id, - # roles=['primary-controller']) - # objects.Cluster.prepare_for_deployment(self.cluster_db) - # serialized_for_astute = self.serializer.serialize( - # self.cluster_db, self.cluster_db.nodes) - # for node in serialized_for_astute: - # if node['uid'] == 'master': - # continue - # transformations = node['network_scheme']['transformations'] - # baremetal_brs = filter(lambda t: t.get('name') == - # consts.DEFAULT_BRIDGES_NAMES.br_baremetal, - # transformations) - # baremetal_ports = filter(lambda t: t.get('name') == "eth0.104", - # transformations) - # expected_patch = { - # 'action': 'add-patch', - # 'bridges': [consts.DEFAULT_BRIDGES_NAMES.br_ironic, - # consts.DEFAULT_BRIDGES_NAMES.br_baremetal], - # 'provider': 'ovs'} - # self.assertEqual(len(baremetal_brs), 1) - # self.assertEqual(len(baremetal_ports), 1) - # self.assertEqual(baremetal_ports[0]['bridge'], - # consts.DEFAULT_BRIDGES_NAMES.br_baremetal) - # self.assertIn(expected_patch, transformations) - - # def test_disks_attrs(self): - # disks = [ - # { - # "model": "TOSHIBA MK1002TS", - # "name": "sda", - # "disk": "sda", - # "size": 1004886016 - # }, - # ] - # expected_node_volumes_hash = [ - # { - # u'name': u'sda', - # u'bootable': True, - # u'extra': [], - # u'free_space': 330, - # u'volumes': [ - # { - # u'type': u'boot', - # u'size': 300 - # }, - # { - # u'mount': u'/boot', - # u'type': u'partition', - # u'file_system': u'ext2', - # u'name': u'Boot', - # u'size': 200 - # }, - # { - # u'type': u'lvm_meta_pool', - # u'size': 64 - # }, - # { - # u'vg': u'os', - # u'type': u'pv', - # u'lvm_meta_size': 64, - # u'size': 394 - # }, - # { - # u'vg': u'vm', - # u'type': u'pv', - # u'lvm_meta_size': 0, - # u'size': 0 - # } - # ], - # u'type': u'disk', - # u'id': u'sda', - # u'size': 958 - # }, - # { - # u'_allocate_size': u'min', - # u'label': u'Base System', - # u'min_size': 19456, - # u'volumes': [ - # { - # u'mount': u'/', - # u'size': -3766, - # u'type': u'lv', - # u'name': u'root', - # u'file_system': u'ext4' - # }, - # { - # u'mount': u'swap', - # u'size': 4096, - # u'type': u'lv', - # u'name': u'swap', - # u'file_system': u'swap' - # } - # ], - # u'type': u'vg', - # u'id': u'os' - # }, - # { - # u'_allocate_size': u'all', - # u'label': u'Virtual Storage', - # u'min_size': 5120, - # u'volumes': [ - # { - # u'mount': u'/var/lib/nova', - # u'size': 0, - # u'type': u'lv', - # u'name': u'nova', - # u'file_system': u'xfs' - # } - # ], - # u'type': u'vg', - # u'id': u'vm' - # } - # ] - # self.env.create_node( - # cluster_id=self.cluster_db.id, - # roles=['compute'], - # meta={"disks": disks}, - # ) - # objects.Cluster.prepare_for_deployment(self.cluster_db) - # serialized_for_astute = self.serializer.serialize( - # self.cluster_db, self.cluster_db.nodes) - # for node in serialized_for_astute: - # if node['uid'] == 'master': - # continue - # self.assertIn("node_volumes", node) - # self.assertItemsEqual( - # expected_node_volumes_hash, node["node_volumes"]) - - # def test_attributes_contains_plugins(self): - # self.env.create_plugin( - # cluster=self.cluster_db, - # name='plugin_1', - # attributes_metadata={'attributes': {'name': 'plugin_1'}}, - # package_version='4.0.0', - # fuel_version=['8.0']) - # self.env.create_plugin( - # cluster=self.cluster_db, - # name='plugin_2', - # attributes_metadata={'attributes': {'name': 'plugin_2'}}, - # package_version='4.0.0', - # fuel_version=['8.0']) - # self.env.create_plugin( - # cluster=self.cluster_db, - # enabled=False, - # name='plugin_3', - # attributes_metadata={'attributes': {'name': 'plugin_3'}}, - # package_version='4.0.0', - # fuel_version=['8.0']) - - expected_plugins_list = ['plugin_1', 'plugin_2'] - self.env.create_node( - cluster_id=self.cluster_db.id, - roles=['compute'] - ) - objects.Cluster.prepare_for_deployment(self.cluster_db) - serialized_for_astute = self.serializer.serialize( - self.cluster_db, self.cluster_db.nodes) - for node in serialized_for_astute: - if node['uid'] == 'master': - continue - self.assertIn('plugins', node) - self.assertItemsEqual( - expected_plugins_list, node['plugins']) - self.assertTrue(all(name in node for name - in expected_plugins_list)) - - # def test_common_attributes_contains_plugin_metadata(self): - # expected_value = 'check_value' - # plugin = self.env.create_plugin( - # cluster=self.cluster_db, - # name='test_plugin', - # package_version='4.0.0', - # fuel_version=['8.0'], - # attributes_metadata={ - # 'attributes': { - # 'config': { - # 'description': "Description", - # 'weight': 52, - # 'value': expected_value - # } - # } - # } - # ) - # attrs = self.serializer.get_common_attrs(self.cluster_db) - # self.assertIn('test_plugin', attrs) - # self.assertIn('metadata', attrs['test_plugin']) - # self.assertEqual( - # plugin.id, attrs['test_plugin']['metadata']['plugin_id'] - # ) - # self.assertEqual(expected_value, attrs['test_plugin']['config']) - - -class TestMultiNodeGroupsSerialization80MixIn( - TestSerializerConverter80To90MixIn, - BaseDeploymentSerializer -): - def setUp(self): - super(TestMultiNodeGroupsSerialization80MixIn, self).setUp() - cluster = self.env.create( - release_kwargs={'version': self.env_version}, - cluster_kwargs={ - 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron, - 'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan} - ) - self.env.create_nodes_w_interfaces_count( - nodes_count=3, - if_count=2, - roles=['controller', 'cinder'], - pending_addition=True, - cluster_id=cluster['id']) - self.cluster_db = self.db.query(models.Cluster).get(cluster['id']) - cluster.extensions = ['volume_manager', 'converted_serializers'] - self.serializer = self.create_serializer(cluster) - - def _add_node_group_with_node(self, cidr_start, node_address): - node_group = self.env.create_node_group( - api=False, cluster_id=self.cluster_db.id, - name='ng_' + cidr_start + '_' + str(node_address)) - - with mock.patch.object(rpc, 'cast'): - resp = self.env.setup_networks_for_nodegroup( - cluster_id=self.cluster_db.id, node_group=node_group, - cidr_start=cidr_start) - self.assertEqual(resp.status_code, 200) - - self.db.query(models.Task).filter_by( - name=consts.TASK_NAMES.update_dnsmasq - ).delete(synchronize_session=False) - - self.env.create_nodes_w_interfaces_count( - nodes_count=1, - if_count=2, - roles=['compute'], - pending_addition=True, - cluster_id=self.cluster_db.id, - group_id=node_group.id, - ip='{0}.9.{1}'.format(cidr_start, node_address)) - - def _check_routes_count(self, count): - objects.Cluster.prepare_for_deployment(self.cluster_db) - facts = self.serializer.serialize( - self.cluster_db, self.cluster_db.nodes) - - for node in facts: - if node['uid'] == 'master': - continue - endpoints = node['network_scheme']['endpoints'] - for name, descr in six.iteritems(endpoints): - if descr['IP'] == 'none': - self.assertNotIn('routes', descr) - else: - self.assertEqual(len(descr['routes']), count) - - # def test_routes_with_no_shared_networks_2_nodegroups(self): - # self._add_node_group_with_node('199.99', 3) - # # all networks have different CIDRs - # self._check_routes_count(1) - - # def test_routes_with_no_shared_networks_3_nodegroups(self): - # self._add_node_group_with_node('199.99', 3) - # self._add_node_group_with_node('199.77', 3) - # # all networks have different CIDRs - # self._check_routes_count(2) - - # def test_routes_with_shared_networks_3_nodegroups(self): - # self._add_node_group_with_node('199.99', 3) - # self._add_node_group_with_node('199.99', 4) - # # networks in two racks have equal CIDRs - # self._check_routes_count(1) - - -# class TestBlockDeviceDevicesSerialization80MixIn( -# TestSerializerConverter80To90MixIn, -# BaseDeploymentSerializer -# ): -# def setUp(self): -# super(TestBlockDeviceDevicesSerialization80MixIn, self).setUp() -# self.cluster = self.env.create( -# release_kwargs={'version': self.env_version}, -# cluster_kwargs={ -# 'mode': consts.CLUSTER_MODES.ha_compact, -# 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron, -# 'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan}) -# self.cluster_db = self.db.query(models.Cluster). -# get(self.cluster['id']) -# self.cluster.extensions = ['volume_manager', 'converted_serializers'] -# self.serializer = self.create_serializer(self.cluster_db) -# -# def test_block_device_disks(self): -# self.env.create_node( -# cluster_id=self.cluster_db.id, -# roles=['cinder-block-device'] -# ) -# self.env.create_node( -# cluster_id=self.cluster_db.id, -# roles=['controller'] -# ) -# objects.Cluster.prepare_for_deployment(self.cluster_db) -# serialized_for_astute = self.serializer.serialize( -# self.cluster_db, self.cluster_db.nodes) -# for node in serialized_for_astute: -# if node['uid'] == 'master': -# continue -# self.assertIn("node_volumes", node) -# for node_volume in node["node_volumes"]: -# if node_volume["id"] == "cinder-block-device": -# self.assertEqual(node_volume["volumes"], []) -# else: -# self.assertNotEqual(node_volume["volumes"], []) - - -class TestSerializeInterfaceDriversData80MixIn( - TestSerializerConverter80To90MixIn, - TestSerializeInterfaceDriversData -): - pass - - -class TestDeploymentHASerializer80MixIn( - TestSerializerConverter80To90MixIn, - TestDeploymentHASerializer70 -): - pass diff --git a/nailgun-test-settings.yaml b/nailgun-test-settings.yaml deleted file mode 100644 index d0be7e3..0000000 --- a/nailgun-test-settings.yaml +++ /dev/null @@ -1,15 +0,0 @@ -DEVELOPMENT: 1 -DATABASE: - name: "openstack_citest" - engine: "postgresql" - host: "localhost" - port: "5432" - user: "openstack_citest" - passwd: "openstack_citest" -API_LOG: "logs/api.log" -APP_LOG: "logs/app.log" -APP_LOGLEVEL: "ERROR" -RPC_CONSUMER_LOG_PATH: "logs/receiverd.log" -ASSASSIN_LOG_PATH: "logs/assassind.log" -STATS_LOGS_PATH: "logs/" -LCM_SERIALIZERS_CONCURRENCY_FACTOR: 1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 30806d5..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -pbr>=1.6 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e29fa63..0000000 --- a/setup.cfg +++ /dev/null @@ -1,28 +0,0 @@ -[metadata] -name = fuel-nailgun-extension-converted-serializers -summary = Converted serializers extension for Fuel -description-file = README.rst -author = Mirantis Inc. -author-email = product@mirantis.com -home-page = http://mirantis.com -classifier = - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.3 - Programming Language :: Python :: 3.4 - -[files] -packages = - converted_serializers - -[entry_points] -nailgun.extensions = - converted_serializers = converted_serializers.extension:ConvertedSerializersExtension - diff --git a/setup.py b/setup.py deleted file mode 100644 index 056c16c..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr'], - pbr=True) diff --git a/specs/fuel-nailgun-extension-converted-serializers.spec b/specs/fuel-nailgun-extension-converted-serializers.spec deleted file mode 100644 index 5a62927..0000000 --- a/specs/fuel-nailgun-extension-converted-serializers.spec +++ /dev/null @@ -1,38 +0,0 @@ -Name: fuel-nailgun-extension-converted-serializers -Version: 10.0~b1 -Release: 1%{?dist} -Summary: Converted serializers extension for Fuel -License: Apache-2.0 -Url: https://git.openstack.org/cgit/openstack/fuel-nailgun-extension-converted-serializers/ -Source0: %{name}-%{version}.tar.gz -BuildArch: noarch - -BuildRequires: python-devel -BuildRequires: python-pbr -BuildRequires: python-setuptools - -Requires: fuel-nailgun -Requires: python-pbr - -%description -Converted serializers extension for Fuel - -%prep -%setup -q -c -n %{name}-%{version} - -%build -export OSLO_PACKAGE_VERSION=%{version} -%py2_build - -%install -export OSLO_PACKAGE_VERSION=%{version} -%py2_install - -%files -%license LICENSE -%{python2_sitelib}/converted_serializers -%{python2_sitelib}/*.egg-info - -%changelog -* Thu Sep 8 2016 Vladimir Kuklin - 10.0~b1-1 -- Initial package. diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index b2427f4..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking -pytest diff --git a/tools/test-setup.sh b/tools/test-setup.sh deleted file mode 100755 index 07a0785..0000000 --- a/tools/test-setup.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -xe - -# This script will be run by OpenStack CI before unit tests are run, -# it sets up the test system as needed. -# Developers should setup their test systems in a similar way. - -# This setup needs to be run as a user that can run sudo. - -# The root password for the MySQL database; pass it in via -# MYSQL_ROOT_PW. -DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave} - -# This user and its password are used by the tests, if you change it, -# your tests might fail. -DB_USER=openstack_citest -DB_PW=openstack_citest - -sudo -H mysqladmin -u root password $DB_ROOT_PW - -# It's best practice to remove anonymous users from the database. If -# a anonymous user exists, then it matches first for connections and -# other connections from that host will not work. -sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e " - DELETE FROM mysql.user WHERE User=''; - FLUSH PRIVILEGES; - GRANT ALL PRIVILEGES ON *.* - TO '$DB_USER'@'%' identified by '$DB_PW' WITH GRANT OPTION;" - -# Now create our database. -mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e " - SET default_storage_engine=MYISAM; - DROP DATABASE IF EXISTS openstack_citest; - CREATE DATABASE openstack_citest CHARACTER SET utf8;" - -# Same for PostgreSQL -# The root password for the PostgreSQL database; pass it in via -# POSTGRES_ROOT_PW. -DB_ROOT_PW=${POSTGRES_ROOT_PW:-insecure_slave} - -# Setup user -root_roles=$(sudo -H -u postgres psql -t -c " - SELECT 'HERE' from pg_roles where rolname='$DB_USER'") -if [[ ${root_roles} == *HERE ]];then - sudo -H -u postgres psql -c "ALTER ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" -else - sudo -H -u postgres psql -c "CREATE ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" -fi - -# Store password for tests -cat << EOF > $HOME/.pgpass -*:*:*:$DB_USER:$DB_PW -EOF -chmod 0600 $HOME/.pgpass - -# Now create our database -psql -h 127.0.0.1 -U $DB_USER -d template1 -c "DROP DATABASE IF EXISTS openstack_citest" -createdb -h 127.0.0.1 -U $DB_USER -l C -T template0 -E utf8 openstack_citest diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 631a27b..0000000 --- a/tox.ini +++ /dev/null @@ -1,38 +0,0 @@ -[tox] -minversion = 2.0 -envlist = pep8,py27 -skipsdist = True - -[base] -NAILGUN_REPO = git+https://github.com/openstack/fuel-web.git -NAILGUN_CONFIG = {toxinidir}/nailgun-test-settings.yaml -NAILGUN_BRANCH={env:ZUUL_BRANCH:master} - -[testenv] -deps = -r{toxinidir}/test-requirements.txt -setenv = VIRTUAL_ENV={envdir} - -[testenv:py27] -usedevelop = True -deps = {[testenv]deps} - -r{toxinidir}/requirements.txt - -e{[base]NAILGUN_REPO}@{[base]NAILGUN_BRANCH}#egg=nailgun[test]&subdirectory=nailgun -setenv = {[testenv]setenv} - NAILGUN_CONFIG={[base]NAILGUN_CONFIG} - -commands = py.test -v --junit-xml {toxinidir}/extension.xml {posargs} - -[testenv:pep8] -commands = flake8 {posargs} - -[testenv:venv] -commands = {posargs} - -[flake8] -# E123, E125 skipped as they are invalid PEP-8. -# H101 - Don't force author's name on TODOs -# H304 is "No relative imports" error, required for extensions -show-source = True -ignore = E123,E125,H101,H304 -builtins = _ -exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build