diff --git a/setup.cfg b/setup.cfg index 82bb79c7c..64c07489a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,8 +30,9 @@ oslo.config.opts = vitrage = vitrage.opts:list_opts vitrage.transformers = - nova.instance = vitrage.entity_graph.transformer.nova_transformer.InstanceTransformer - nova.host = vitrage.entity_graph.transformer.nova_transformer.HostTransformer + nova.instance = vitrage.entity_graph.transformer.nova_transformer.instance_transformer.InstanceTransformer + nova.host = vitrage.entity_graph.transformer.nova_transformer.host_transformer.HostTransformer + nova.zone = vitrage.entity_graph.transformer.nova_transformer.zone_transformer.ZoneTransformer [files] packages = diff --git a/vitrage/entity_graph/transformer/nova_transformers/__init__.py b/vitrage/entity_graph/transformer/nova_transformers/__init__.py new file mode 100644 index 000000000..dd32b852f --- /dev/null +++ b/vitrage/entity_graph/transformer/nova_transformers/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2016 - Nokia +# +# 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. + +__author__ = 'stack' diff --git a/vitrage/entity_graph/transformer/host_transformer.py b/vitrage/entity_graph/transformer/nova_transformers/host_transformer.py similarity index 100% rename from vitrage/entity_graph/transformer/host_transformer.py rename to vitrage/entity_graph/transformer/nova_transformers/host_transformer.py diff --git a/vitrage/entity_graph/transformer/instance_transformer.py b/vitrage/entity_graph/transformer/nova_transformers/instance_transformer.py similarity index 100% rename from vitrage/entity_graph/transformer/instance_transformer.py rename to vitrage/entity_graph/transformer/nova_transformers/instance_transformer.py diff --git a/vitrage/entity_graph/transformer/zone_transformer.py b/vitrage/entity_graph/transformer/nova_transformers/zone_transformer.py similarity index 100% rename from vitrage/entity_graph/transformer/zone_transformer.py rename to vitrage/entity_graph/transformer/nova_transformers/zone_transformer.py diff --git a/vitrage/entity_graph/transformer/transformer_manager.py b/vitrage/entity_graph/transformer/transformer_manager.py index 974e04fed..abc10441a 100644 --- a/vitrage/entity_graph/transformer/transformer_manager.py +++ b/vitrage/entity_graph/transformer/transformer_manager.py @@ -18,6 +18,12 @@ from oslo_utils import importutils from vitrage.common.constants import EntityType from vitrage.common.constants import SynchronizerProperties as SyncProps from vitrage.common.exception import VitrageTransformerError +from vitrage.entity_graph.transformer.nova_transformers.host_transformer \ + import HostTransformer +from vitrage.entity_graph.transformer.nova_transformers.instance_transformer \ + import InstanceTransformer +from vitrage.entity_graph.transformer.nova_transformers.zone_transformer \ + import ZoneTransformer LOG = logging.getLogger(__name__) @@ -33,16 +39,16 @@ class TransformerManager(object): transformers = {} transformers[EntityType.NOVA_INSTANCE] = importutils.import_object( - 'vitrage.entity_graph.transformer.instance_transformer.' - + 'InstanceTransformer', transformers) + "%s.%s" % (InstanceTransformer.__module__, + InstanceTransformer.__name__), transformers) transformers[EntityType.NOVA_HOST] = importutils.import_object( - 'vitrage.entity_graph.transformer.host_transformer.' - + 'HostTransformer', transformers) + "%s.%s" % (HostTransformer.__module__, HostTransformer.__name__), + transformers) transformers[EntityType.NOVA_ZONE] = importutils.import_object( - 'vitrage.entity_graph.transformer.zone_transformer.' - + 'ZoneTransformer', transformers) + "%s.%s" % (ZoneTransformer.__module__, ZoneTransformer.__name__), + transformers) return transformers diff --git a/vitrage/synchronizer/base_plugin.py b/vitrage/synchronizer/base_plugin.py index b9d2597e4..fad0f31c7 100644 --- a/vitrage/synchronizer/base_plugin.py +++ b/vitrage/synchronizer/base_plugin.py @@ -40,7 +40,7 @@ class BasePlugin(object): for field in fields_to_remove: pickleable_entity.pop(field) - self._add_sync_type(pickleable_entity) + self._add_sync_type(pickleable_entity, sync_type) self._add_sampling_time(pickleable_entity) pickleable_entities.append(pickleable_entity) diff --git a/vitrage/tests/unit/transformers/test_nova_host_transformer.py b/vitrage/tests/unit/transformers/test_nova_host_transformer.py index 7b182d6de..4a7c56baa 100644 --- a/vitrage/tests/unit/transformers/test_nova_host_transformer.py +++ b/vitrage/tests/unit/transformers/test_nova_host_transformer.py @@ -25,8 +25,10 @@ from vitrage.common.constants import SyncMode from vitrage.common.constants import VertexProperties from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer.base import TransformerBase -from vitrage.entity_graph.transformer.host_transformer import HostTransformer -from vitrage.entity_graph.transformer.zone_transformer import ZoneTransformer +from vitrage.entity_graph.transformer.nova_transformers.host_transformer \ + import HostTransformer +from vitrage.entity_graph.transformer.nova_transformers.zone_transformer \ + import ZoneTransformer from vitrage.tests import base from vitrage.tests.mocks import mock_syncronizer as mock_sync diff --git a/vitrage/tests/unit/transformers/test_nova_instance_transformers.py b/vitrage/tests/unit/transformers/test_nova_instance_transformers.py index 09a06ba9a..23b568a8e 100644 --- a/vitrage/tests/unit/transformers/test_nova_instance_transformers.py +++ b/vitrage/tests/unit/transformers/test_nova_instance_transformers.py @@ -25,9 +25,10 @@ from vitrage.common.constants import SyncMode from vitrage.common.constants import VertexProperties from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer.base import TransformerBase -from vitrage.entity_graph.transformer.host_transformer import HostTransformer -from vitrage.entity_graph.transformer.instance_transformer import \ - InstanceTransformer +from vitrage.entity_graph.transformer.nova_transformers.host_transformer \ + import HostTransformer +from vitrage.entity_graph.transformer.nova_transformers.instance_transformer \ + import InstanceTransformer from vitrage.tests import base from vitrage.tests.mocks import mock_syncronizer as mock_sync diff --git a/vitrage/tests/unit/transformers/test_nova_zone_transformer.py b/vitrage/tests/unit/transformers/test_nova_zone_transformer.py index 5ff35d3b8..6d41b5369 100644 --- a/vitrage/tests/unit/transformers/test_nova_zone_transformer.py +++ b/vitrage/tests/unit/transformers/test_nova_zone_transformer.py @@ -23,8 +23,10 @@ from vitrage.common.constants import SynchronizerProperties as SyncProps from vitrage.common.constants import VertexProperties from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer.base import TransformerBase -from vitrage.entity_graph.transformer.host_transformer import HostTransformer -from vitrage.entity_graph.transformer.zone_transformer import ZoneTransformer +from vitrage.entity_graph.transformer.nova_transformers.host_transformer \ + import HostTransformer +from vitrage.entity_graph.transformer.nova_transformers.zone_transformer \ + import ZoneTransformer from vitrage.tests import base from vitrage.tests.mocks import mock_syncronizer as mock_sync