implements: blueprint static-synchronizer

Change-Id: I83d232d92d5af285456cc1e2e5cc3a40fb1736fa
This commit is contained in:
Alexey Weyl 2016-02-01 17:12:08 +02:00
parent 091f80e150
commit 626f12316c
10 changed files with 43 additions and 16 deletions

View File

@ -30,8 +30,9 @@ oslo.config.opts =
vitrage = vitrage.opts:list_opts vitrage = vitrage.opts:list_opts
vitrage.transformers = vitrage.transformers =
nova.instance = vitrage.entity_graph.transformer.nova_transformer.InstanceTransformer nova.instance = vitrage.entity_graph.transformer.nova_transformer.instance_transformer.InstanceTransformer
nova.host = vitrage.entity_graph.transformer.nova_transformer.HostTransformer nova.host = vitrage.entity_graph.transformer.nova_transformer.host_transformer.HostTransformer
nova.zone = vitrage.entity_graph.transformer.nova_transformer.zone_transformer.ZoneTransformer
[files] [files]
packages = packages =

View File

@ -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'

View File

@ -18,6 +18,12 @@ from oslo_utils import importutils
from vitrage.common.constants import EntityType from vitrage.common.constants import EntityType
from vitrage.common.constants import SynchronizerProperties as SyncProps from vitrage.common.constants import SynchronizerProperties as SyncProps
from vitrage.common.exception import VitrageTransformerError 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__) LOG = logging.getLogger(__name__)
@ -33,16 +39,16 @@ class TransformerManager(object):
transformers = {} transformers = {}
transformers[EntityType.NOVA_INSTANCE] = importutils.import_object( transformers[EntityType.NOVA_INSTANCE] = importutils.import_object(
'vitrage.entity_graph.transformer.instance_transformer.' "%s.%s" % (InstanceTransformer.__module__,
+ 'InstanceTransformer', transformers) InstanceTransformer.__name__), transformers)
transformers[EntityType.NOVA_HOST] = importutils.import_object( transformers[EntityType.NOVA_HOST] = importutils.import_object(
'vitrage.entity_graph.transformer.host_transformer.' "%s.%s" % (HostTransformer.__module__, HostTransformer.__name__),
+ 'HostTransformer', transformers) transformers)
transformers[EntityType.NOVA_ZONE] = importutils.import_object( transformers[EntityType.NOVA_ZONE] = importutils.import_object(
'vitrage.entity_graph.transformer.zone_transformer.' "%s.%s" % (ZoneTransformer.__module__, ZoneTransformer.__name__),
+ 'ZoneTransformer', transformers) transformers)
return transformers return transformers

View File

@ -40,7 +40,7 @@ class BasePlugin(object):
for field in fields_to_remove: for field in fields_to_remove:
pickleable_entity.pop(field) pickleable_entity.pop(field)
self._add_sync_type(pickleable_entity) self._add_sync_type(pickleable_entity, sync_type)
self._add_sampling_time(pickleable_entity) self._add_sampling_time(pickleable_entity)
pickleable_entities.append(pickleable_entity) pickleable_entities.append(pickleable_entity)

View File

@ -25,8 +25,10 @@ from vitrage.common.constants import SyncMode
from vitrage.common.constants import VertexProperties from vitrage.common.constants import VertexProperties
from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer import base as tbase
from vitrage.entity_graph.transformer.base import TransformerBase from vitrage.entity_graph.transformer.base import TransformerBase
from vitrage.entity_graph.transformer.host_transformer import HostTransformer from vitrage.entity_graph.transformer.nova_transformers.host_transformer \
from vitrage.entity_graph.transformer.zone_transformer import ZoneTransformer import HostTransformer
from vitrage.entity_graph.transformer.nova_transformers.zone_transformer \
import ZoneTransformer
from vitrage.tests import base from vitrage.tests import base
from vitrage.tests.mocks import mock_syncronizer as mock_sync from vitrage.tests.mocks import mock_syncronizer as mock_sync

View File

@ -25,9 +25,10 @@ from vitrage.common.constants import SyncMode
from vitrage.common.constants import VertexProperties from vitrage.common.constants import VertexProperties
from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer import base as tbase
from vitrage.entity_graph.transformer.base import TransformerBase from vitrage.entity_graph.transformer.base import TransformerBase
from vitrage.entity_graph.transformer.host_transformer import HostTransformer from vitrage.entity_graph.transformer.nova_transformers.host_transformer \
from vitrage.entity_graph.transformer.instance_transformer import \ import HostTransformer
InstanceTransformer from vitrage.entity_graph.transformer.nova_transformers.instance_transformer \
import InstanceTransformer
from vitrage.tests import base from vitrage.tests import base
from vitrage.tests.mocks import mock_syncronizer as mock_sync from vitrage.tests.mocks import mock_syncronizer as mock_sync

View File

@ -23,8 +23,10 @@ from vitrage.common.constants import SynchronizerProperties as SyncProps
from vitrage.common.constants import VertexProperties from vitrage.common.constants import VertexProperties
from vitrage.entity_graph.transformer import base as tbase from vitrage.entity_graph.transformer import base as tbase
from vitrage.entity_graph.transformer.base import TransformerBase from vitrage.entity_graph.transformer.base import TransformerBase
from vitrage.entity_graph.transformer.host_transformer import HostTransformer from vitrage.entity_graph.transformer.nova_transformers.host_transformer \
from vitrage.entity_graph.transformer.zone_transformer import ZoneTransformer import HostTransformer
from vitrage.entity_graph.transformer.nova_transformers.zone_transformer \
import ZoneTransformer
from vitrage.tests import base from vitrage.tests import base
from vitrage.tests.mocks import mock_syncronizer as mock_sync from vitrage.tests.mocks import mock_syncronizer as mock_sync