performance improvement in the processor.
Use set instead of using list. Change-Id: I61fd045b8e228d06aeb3221dc753079a123ec11c
This commit is contained in:
parent
09c4b8df98
commit
0e93ae638e
vitrage
datasources
entity_graph/processor
vitrage_tempest_tests/tests/api
@ -36,7 +36,7 @@ OPTS = [
|
||||
' datasource itself.',
|
||||
required=True),
|
||||
cfg.IntOpt(DSOpts.CHANGES_INTERVAL,
|
||||
default=20,
|
||||
min=20,
|
||||
default=10,
|
||||
min=10,
|
||||
help='interval between checking changes in aodh data source'),
|
||||
]
|
||||
|
@ -36,8 +36,8 @@ OPTS = [
|
||||
' datasource itself.',
|
||||
required=True),
|
||||
cfg.IntOpt(DSOpts.CHANGES_INTERVAL,
|
||||
default=30,
|
||||
min=30,
|
||||
default=20,
|
||||
min=10,
|
||||
help='interval between checking changes in nagios data source'),
|
||||
cfg.StrOpt('user', default='nagiosadmin',
|
||||
help='Nagios user name'),
|
||||
|
@ -120,5 +120,5 @@ class ChangesService(DatasourceService):
|
||||
for entity in datasource.get_changes(DatasourceAction.UPDATE):
|
||||
self.send_to_queue(entity)
|
||||
except Exception as e:
|
||||
LOG.error("Get changes Failed - %s", str(e))
|
||||
LOG.exception("Get changes Failed - %s", e)
|
||||
LOG.debug("end get changes")
|
||||
|
@ -38,6 +38,7 @@ OPTS = [
|
||||
required=True),
|
||||
cfg.IntOpt(DSOpts.CHANGES_INTERVAL,
|
||||
default=30,
|
||||
min=10,
|
||||
help='interval in seconds between checking changes in the'
|
||||
'static configuration files'),
|
||||
# NOTE: This folder is already used by static_physical datasource. Legacy
|
||||
|
@ -36,7 +36,7 @@ OPTS = [
|
||||
' datasource itself.',
|
||||
required=True),
|
||||
cfg.IntOpt(DSOpts.CHANGES_INTERVAL,
|
||||
default=30,
|
||||
default=20,
|
||||
min=10,
|
||||
help='interval between checking changes in zabbix data source'),
|
||||
cfg.StrOpt('user', default='admin',
|
||||
|
@ -84,7 +84,7 @@ class Processor(processor.ProcessorBase):
|
||||
# so it will be done in one central place
|
||||
self._find_and_fix_graph_vertex(new_vertex, neighbors)
|
||||
self.entity_graph.add_vertex(new_vertex)
|
||||
self._connect_neighbors(neighbors, [], GraphAction.CREATE_ENTITY)
|
||||
self._connect_neighbors(neighbors, set(), GraphAction.CREATE_ENTITY)
|
||||
|
||||
def update_entity(self, updated_vertex, neighbors):
|
||||
"""Updates the vertex in the entity graph
|
||||
@ -235,8 +235,8 @@ class Processor(processor.ProcessorBase):
|
||||
2. connects the new neighbors.
|
||||
"""
|
||||
|
||||
(valid_edges, obsolete_edges) = self._find_edges_status(
|
||||
vertex, neighbors)
|
||||
(valid_edges, obsolete_edges) = self._find_edges_status(vertex,
|
||||
neighbors)
|
||||
self._delete_old_connections(vertex, obsolete_edges)
|
||||
self._connect_neighbors(neighbors,
|
||||
valid_edges,
|
||||
@ -293,15 +293,15 @@ class Processor(processor.ProcessorBase):
|
||||
longer connected to those entities), and which are valid connections.
|
||||
"""
|
||||
|
||||
valid_edges = []
|
||||
obsolete_edges = []
|
||||
valid_edges = set()
|
||||
obsolete_edges = set()
|
||||
|
||||
graph_neighbor_types = \
|
||||
PUtils.find_neighbor_types(neighbors)
|
||||
|
||||
for curr_edge in self.entity_graph.get_edges(
|
||||
vertex.vertex_id,
|
||||
direction=Direction.BOTH):
|
||||
neighbor_edges = set(e for v, e in neighbors)
|
||||
for curr_edge in self.entity_graph.get_edges(vertex.vertex_id,
|
||||
direction=Direction.BOTH):
|
||||
# check if the edge in the graph has a a connection to the
|
||||
# same type of resources in the new neighbors list
|
||||
neighbor_vertex = self.entity_graph.get_vertex(
|
||||
@ -311,14 +311,13 @@ class Processor(processor.ProcessorBase):
|
||||
neighbor_vertex) in graph_neighbor_types
|
||||
|
||||
if not is_connection_type_exist:
|
||||
valid_edges.append(curr_edge)
|
||||
valid_edges.add(curr_edge)
|
||||
continue
|
||||
|
||||
neighbor_edges = [e for v, e in neighbors]
|
||||
if curr_edge in neighbor_edges:
|
||||
valid_edges.append(curr_edge)
|
||||
valid_edges.add(curr_edge)
|
||||
else:
|
||||
obsolete_edges.append(curr_edge)
|
||||
obsolete_edges.add(curr_edge)
|
||||
|
||||
return valid_edges, obsolete_edges
|
||||
|
||||
@ -457,7 +456,6 @@ class Processor(processor.ProcessorBase):
|
||||
raise VitrageError(
|
||||
'found too many vertices with same properties: %s ',
|
||||
vertex)
|
||||
graph_vertex = None if not graph_vertices \
|
||||
else graph_vertices[0]
|
||||
graph_vertex = None if not graph_vertices else graph_vertices[0]
|
||||
|
||||
return graph_vertex
|
||||
|
@ -134,14 +134,11 @@ class BaseApiTest(base.BaseTestCase):
|
||||
if public_net:
|
||||
kwargs.update({"networks": [{'uuid': public_net['id']}]})
|
||||
|
||||
# public_net = self._get_public_network()
|
||||
# nics = [{'net-id': public_net['id']}]
|
||||
img = images_list.next()
|
||||
resources = [self.nova_client.servers.create(
|
||||
name='%s-%s' % ('vm', index),
|
||||
flavor=flavors_list[0],
|
||||
image=img,
|
||||
# nics=nics,
|
||||
**kwargs) for index in range(num_instances)]
|
||||
|
||||
self._wait_for_status(30,
|
||||
|
Loading…
Reference in New Issue
Block a user