Orchestrator DeploymentGraph is renamed to the GraphSolver
To avoid confusion with objest.DeploymentGraph and orchestrator.DeploymentGraph second one was renamed to the GraphSolver because this entity is used to find subgraphs, loops, and solve graph for the old orchestrators. Secondary changes: DeploymentGraphValidator -> GraphSolverValidator DeploymentGraphTasksValidator -> GraphSolverTasksValidator GraphVisualizationValidator -> GraphSolverVisualizationValidator validators/graph.py -> validators/orchestrator_graph.py orchestrator/deployment_graph.py -> orchestrator/orchestrator_graph.py Change-Id: Ic42a17115723b8145b9d94cc034bf2217d1d634b Implements: blueprint custom-graph-execution
This commit is contained in:
parent
c2ccb6f211
commit
0e9ca251cf
|
@ -25,14 +25,15 @@ import web
|
|||
|
||||
from nailgun.api.v1.validators.base import BaseDefferedTaskValidator
|
||||
from nailgun.api.v1.validators.base import BasicValidator
|
||||
from nailgun.api.v1.validators.graph import GraphTasksValidator
|
||||
from nailgun.api.v1.validators.orchestrator_graph import \
|
||||
GraphSolverTasksValidator
|
||||
from nailgun import consts
|
||||
from nailgun.db import db
|
||||
from nailgun.errors import errors
|
||||
from nailgun.logger import logger
|
||||
from nailgun import objects
|
||||
from nailgun.objects.serializers.base import BasicSerializer
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.settings import settings
|
||||
from nailgun import utils
|
||||
|
||||
|
@ -586,10 +587,10 @@ class DeferredTaskHandler(BaseHandler):
|
|||
self.raise_task(task)
|
||||
|
||||
|
||||
class DeploymentTasksHandler(SingleHandler):
|
||||
class OrchestratorDeploymentTasksHandler(SingleHandler):
|
||||
"""Handler for deployment graph serialization."""
|
||||
|
||||
validator = GraphTasksValidator
|
||||
validator = GraphSolverTasksValidator
|
||||
|
||||
@content
|
||||
def GET(self, obj_id):
|
||||
|
@ -608,7 +609,7 @@ class DeploymentTasksHandler(SingleHandler):
|
|||
# but the own release tasks is returned for release
|
||||
tasks = self.single.get_deployment_tasks(obj)
|
||||
if end or start:
|
||||
graph = deployment_graph.DeploymentGraph(tasks)
|
||||
graph = orchestrator_graph.GraphSolver(tasks)
|
||||
return graph.filter_subgraph(
|
||||
end=end, start=start, include=include).node.values()
|
||||
return tasks
|
||||
|
|
|
@ -25,7 +25,7 @@ from nailgun.api.v1.handlers.base import BaseHandler
|
|||
from nailgun.api.v1.handlers.base import CollectionHandler
|
||||
from nailgun.api.v1.handlers.base import content
|
||||
from nailgun.api.v1.handlers.base import DeferredTaskHandler
|
||||
from nailgun.api.v1.handlers.base import DeploymentTasksHandler
|
||||
from nailgun.api.v1.handlers.base import OrchestratorDeploymentTasksHandler
|
||||
from nailgun.api.v1.handlers.base import SingleHandler
|
||||
|
||||
from nailgun.api.v1.validators.cluster import ClusterAttributesValidator
|
||||
|
@ -250,7 +250,7 @@ class ClusterGeneratedData(BaseHandler):
|
|||
return cluster.attributes.generated
|
||||
|
||||
|
||||
class ClusterDeploymentTasksHandler(DeploymentTasksHandler):
|
||||
class ClusterDeploymentTasksHandler(OrchestratorDeploymentTasksHandler):
|
||||
"""Cluster Handler for deployment graph serialization."""
|
||||
|
||||
single = objects.Cluster
|
||||
|
|
|
@ -22,19 +22,20 @@ import web
|
|||
from nailgun.api.v1.handlers.base import BaseHandler
|
||||
from nailgun.api.v1.handlers.base import content
|
||||
from nailgun.api.v1.validators.cluster import ProvisionSelectedNodesValidator
|
||||
from nailgun.api.v1.validators.graph import GraphVisualizationValidator
|
||||
from nailgun.api.v1.validators.node import DeploySelectedNodesValidator
|
||||
from nailgun.api.v1.validators.node import NodeDeploymentValidator
|
||||
from nailgun.api.v1.validators.node import NodesFilterValidator
|
||||
from nailgun.api.v1.validators.orchestrator_graph import \
|
||||
GraphSolverVisualizationValidator
|
||||
|
||||
from nailgun.logger import logger
|
||||
|
||||
from nailgun.errors import errors
|
||||
from nailgun import objects
|
||||
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import deployment_serializers
|
||||
from nailgun.orchestrator import graph_visualization
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.orchestrator import provisioning_serializers
|
||||
from nailgun.orchestrator.stages import post_deployment_serialize
|
||||
from nailgun.orchestrator.stages import pre_deployment_serialize
|
||||
|
@ -152,7 +153,7 @@ class DefaultProvisioningInfo(DefaultOrchestratorInfo):
|
|||
class DefaultDeploymentInfo(DefaultOrchestratorInfo):
|
||||
|
||||
def _serialize(self, cluster, nodes):
|
||||
graph = deployment_graph.AstuteGraph(cluster)
|
||||
graph = orchestrator_graph.AstuteGraph(cluster)
|
||||
return deployment_serializers.serialize(
|
||||
graph, cluster, nodes, ignore_customized=True)
|
||||
|
||||
|
@ -163,7 +164,7 @@ class DefaultDeploymentInfo(DefaultOrchestratorInfo):
|
|||
class DefaultPrePluginsHooksInfo(DefaultOrchestratorInfo):
|
||||
|
||||
def _serialize(self, cluster, nodes):
|
||||
graph = deployment_graph.AstuteGraph(cluster)
|
||||
graph = orchestrator_graph.AstuteGraph(cluster)
|
||||
return pre_deployment_serialize(graph, cluster, nodes)
|
||||
|
||||
def get_default_nodes(self, cluster):
|
||||
|
@ -173,7 +174,7 @@ class DefaultPrePluginsHooksInfo(DefaultOrchestratorInfo):
|
|||
class DefaultPostPluginsHooksInfo(DefaultOrchestratorInfo):
|
||||
|
||||
def _serialize(self, cluster, nodes):
|
||||
graph = deployment_graph.AstuteGraph(cluster)
|
||||
graph = orchestrator_graph.AstuteGraph(cluster)
|
||||
return post_deployment_serialize(graph, cluster, nodes)
|
||||
|
||||
def get_default_nodes(self, cluster):
|
||||
|
@ -323,7 +324,7 @@ class DeploySelectedNodesWithTasks(BaseDeploySelectedNodes):
|
|||
|
||||
class TaskDeployGraph(BaseHandler):
|
||||
|
||||
validator = GraphVisualizationValidator
|
||||
validator = GraphSolverVisualizationValidator
|
||||
|
||||
def GET(self, cluster_id):
|
||||
""":returns: DOT representation of deployment graph.
|
||||
|
@ -336,7 +337,7 @@ class TaskDeployGraph(BaseHandler):
|
|||
|
||||
cluster = self.get_object_or_404(objects.Cluster, cluster_id)
|
||||
tasks = objects.Cluster.get_deployment_tasks(cluster)
|
||||
graph = deployment_graph.DeploymentGraph(tasks)
|
||||
graph = orchestrator_graph.GraphSolver(tasks)
|
||||
|
||||
tasks = web.input(tasks=None).tasks
|
||||
parents_for = web.input(parents_for=None).parents_for
|
||||
|
|
|
@ -20,7 +20,7 @@ Handlers dealing with releases
|
|||
|
||||
from nailgun.api.v1.handlers.base import CollectionHandler
|
||||
from nailgun.api.v1.handlers.base import content
|
||||
from nailgun.api.v1.handlers.base import DeploymentTasksHandler
|
||||
from nailgun.api.v1.handlers.base import OrchestratorDeploymentTasksHandler
|
||||
from nailgun.api.v1.handlers.base import SingleHandler
|
||||
from nailgun.api.v1.validators.release import ReleaseNetworksValidator
|
||||
from nailgun.api.v1.validators.release import ReleaseValidator
|
||||
|
@ -98,7 +98,7 @@ class ReleaseNetworksHandler(SingleHandler):
|
|||
raise self.http(405, 'Delete not supported for this entity')
|
||||
|
||||
|
||||
class ReleaseDeploymentTasksHandler(DeploymentTasksHandler):
|
||||
class ReleaseDeploymentTasksHandler(OrchestratorDeploymentTasksHandler):
|
||||
"""Release Handler for deployment graph configuration."""
|
||||
|
||||
single = Release
|
||||
|
|
|
@ -26,7 +26,7 @@ from nailgun.logger import logger
|
|||
|
||||
from nailgun import objects
|
||||
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.task import manager
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ class SpawnVmsHandler(BaseHandler):
|
|||
|
||||
def get_tasks(self, cluster):
|
||||
tasks = objects.Cluster.get_deployment_tasks(cluster)
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
graph.add_tasks(tasks)
|
||||
subgraph = graph.find_subgraph(end='generate_vms')
|
||||
return [task['id'] for task in subgraph.topology]
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
import six
|
||||
|
||||
from nailgun.api.v1.validators import base
|
||||
from nailgun.api.v1.validators.graph import TaskDeploymentValidator
|
||||
from nailgun.api.v1.validators.json_schema import base_types
|
||||
from nailgun.api.v1.validators.json_schema import node_schema
|
||||
from nailgun.api.v1.validators.orchestrator_graph import \
|
||||
TaskDeploymentValidator
|
||||
from nailgun import consts
|
||||
from nailgun.db import db
|
||||
from nailgun.db.sqlalchemy.models import Node
|
||||
|
|
|
@ -19,16 +19,16 @@ from nailgun.api.v1.validators.json_schema import tasks
|
|||
from nailgun import consts
|
||||
from nailgun.errors import errors
|
||||
from nailgun import objects
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
|
||||
|
||||
class GraphTasksValidator(BasicValidator):
|
||||
class GraphSolverTasksValidator(BasicValidator):
|
||||
|
||||
@classmethod
|
||||
def validate_update(cls, data, instance):
|
||||
parsed = cls.validate(data)
|
||||
cls.validate_schema(parsed, tasks.TASKS_SCHEMA)
|
||||
graph_validator = deployment_graph.DeploymentGraphValidator(
|
||||
graph_validator = orchestrator_graph.GraphSolverValidator(
|
||||
parsed)
|
||||
graph_validator.check()
|
||||
|
||||
|
@ -48,7 +48,7 @@ class TaskDeploymentValidator(BasicValidator):
|
|||
cls.validate_schema(tasks, base_types.STRINGS_ARRAY)
|
||||
|
||||
deployment_tasks = objects.Cluster.get_deployment_tasks(cluster)
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
graph.add_tasks(deployment_tasks)
|
||||
|
||||
non_existent_tasks = set(tasks) - set(graph.nodes())
|
||||
|
@ -74,7 +74,7 @@ class TaskDeploymentValidator(BasicValidator):
|
|||
return types
|
||||
|
||||
|
||||
class GraphVisualizationValidator(TaskDeploymentValidator):
|
||||
class GraphSolverVisualizationValidator(TaskDeploymentValidator):
|
||||
|
||||
@classmethod
|
||||
def validate(cls, data, cluster):
|
|
@ -21,7 +21,7 @@ from nailgun import consts
|
|||
|
||||
|
||||
class GraphVisualization(object):
|
||||
"""Wrapper for DeploymentGraph used for graph visualization."""
|
||||
"""Wrapper for GraphSolver used for graph visualization."""
|
||||
|
||||
def __init__(self, graph):
|
||||
self._graph = graph
|
||||
|
|
|
@ -33,7 +33,7 @@ from nailgun.policy.name_match import NameMatchingPolicy
|
|||
from nailgun.utils.role_resolver import RoleResolver
|
||||
|
||||
|
||||
class DeploymentGraph(nx.DiGraph):
|
||||
class GraphSolver(nx.DiGraph):
|
||||
"""DirectedGraph used to generate configs for speficific orchestrators
|
||||
|
||||
In case of astute - we are working with priorities
|
||||
|
@ -57,7 +57,7 @@ class DeploymentGraph(nx.DiGraph):
|
|||
adjlist_dict_factory = OrderedDict
|
||||
|
||||
def __init__(self, tasks=None, *args, **kwargs):
|
||||
super(DeploymentGraph, self).__init__(*args, **kwargs)
|
||||
super(GraphSolver, self).__init__(*args, **kwargs)
|
||||
# (dshulyak) we need to monkey patch created dicts, 1.9.1
|
||||
# doesnt support chaning those data structures by fabric
|
||||
self.node = self.node_dict_factory()
|
||||
|
@ -73,7 +73,7 @@ class DeploymentGraph(nx.DiGraph):
|
|||
self.succ[n] = self.adjlist_dict_factory()
|
||||
self.pred[n] = self.adjlist_dict_factory()
|
||||
self.node[n] = attr
|
||||
super(DeploymentGraph, self).add_node(n, **attr)
|
||||
super(GraphSolver, self).add_node(n, **attr)
|
||||
|
||||
def add_edge(self, u, v, **attr):
|
||||
if u not in self.succ:
|
||||
|
@ -84,7 +84,7 @@ class DeploymentGraph(nx.DiGraph):
|
|||
self.succ[v] = self.adjlist_dict_factory()
|
||||
self.pred[v] = self.adjlist_dict_factory()
|
||||
self.node[v] = self.node_dict_factory()
|
||||
super(DeploymentGraph, self).add_edge(u, v, **attr)
|
||||
super(GraphSolver, self).add_edge(u, v, **attr)
|
||||
|
||||
def add_tasks(self, tasks):
|
||||
for task in tasks:
|
||||
|
@ -122,7 +122,7 @@ class DeploymentGraph(nx.DiGraph):
|
|||
else:
|
||||
not_matched.append(available_group)
|
||||
# Add dependency for non-existing group which will be
|
||||
# resolved in DeploymentGraphValidator
|
||||
# resolved in GraphSolverValidator
|
||||
if len(available_groups) == len(not_matched):
|
||||
self.add_edge(task['id'], group)
|
||||
logger.warning(
|
||||
|
@ -250,7 +250,7 @@ class DeploymentGraph(nx.DiGraph):
|
|||
:param end: task name
|
||||
:param start: task name
|
||||
:param include: iterable with task names
|
||||
:returns: DeploymentGraph instance (subgraph from original)
|
||||
:returns: GraphSolver instance (subgraph from original)
|
||||
"""
|
||||
working_graph = self
|
||||
|
||||
|
@ -289,7 +289,7 @@ class AstuteGraph(object):
|
|||
def __init__(self, cluster):
|
||||
self.cluster = cluster
|
||||
self.tasks = objects.Cluster.get_deployment_tasks(cluster)
|
||||
self.graph = DeploymentGraph()
|
||||
self.graph = GraphSolver()
|
||||
self.graph.add_tasks(self.tasks)
|
||||
self.serializers = TaskSerializers()
|
||||
|
||||
|
@ -480,10 +480,10 @@ class AstuteGraph(object):
|
|||
return serialized
|
||||
|
||||
|
||||
class DeploymentGraphValidator(object):
|
||||
class GraphSolverValidator(object):
|
||||
|
||||
def __init__(self, tasks):
|
||||
self.graph = DeploymentGraph()
|
||||
self.graph = GraphSolver()
|
||||
self.graph.add_tasks(tasks)
|
||||
|
||||
def check(self):
|
|
@ -40,8 +40,8 @@ from nailgun.logger import logger
|
|||
from nailgun.network.checker import NetworkCheck
|
||||
from nailgun.network.manager import NetworkManager
|
||||
from nailgun import objects
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import deployment_serializers
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.orchestrator import provisioning_serializers
|
||||
from nailgun.orchestrator import stages
|
||||
from nailgun.orchestrator import task_based_deployment
|
||||
|
@ -232,27 +232,27 @@ class DeploymentTask(BaseDeploymentTask):
|
|||
:events: the list of events to find subscribed tasks
|
||||
:return: the arguments for RPC message
|
||||
"""
|
||||
orchestrator_graph = deployment_graph.AstuteGraph(task.cluster)
|
||||
orchestrator_graph.only_tasks(task_ids)
|
||||
graph = orchestrator_graph.AstuteGraph(task.cluster)
|
||||
graph.only_tasks(task_ids)
|
||||
|
||||
# NOTE(dshulyak) At this point parts of the orchestration can be empty,
|
||||
# it should not cause any issues with deployment/progress and was
|
||||
# done by design
|
||||
role_resolver = RoleResolver(nodes)
|
||||
serialized_cluster = deployment_serializers.serialize(
|
||||
orchestrator_graph, task.cluster, nodes)
|
||||
graph, task.cluster, nodes)
|
||||
|
||||
if affected_nodes:
|
||||
orchestrator_graph.reexecutable_tasks(events)
|
||||
graph.reexecutable_tasks(events)
|
||||
serialized_cluster.extend(deployment_serializers.serialize(
|
||||
orchestrator_graph, task.cluster, affected_nodes
|
||||
graph, task.cluster, affected_nodes
|
||||
))
|
||||
nodes = nodes + affected_nodes
|
||||
pre_deployment = stages.pre_deployment_serialize(
|
||||
orchestrator_graph, task.cluster, nodes,
|
||||
graph, task.cluster, nodes,
|
||||
role_resolver=role_resolver)
|
||||
post_deployment = stages.post_deployment_serialize(
|
||||
orchestrator_graph, task.cluster, nodes,
|
||||
graph, task.cluster, nodes,
|
||||
role_resolver=role_resolver)
|
||||
|
||||
return {
|
||||
|
@ -318,15 +318,15 @@ class UpdateNodesInfoTask(object):
|
|||
|
||||
@classmethod
|
||||
def message(cls, task):
|
||||
orchestrator_graph = deployment_graph.AstuteGraph(task.cluster)
|
||||
orchestrator_graph.only_tasks(cls._tasks)
|
||||
graph = orchestrator_graph.AstuteGraph(task.cluster)
|
||||
graph.only_tasks(cls._tasks)
|
||||
|
||||
rpc_message = make_astute_message(
|
||||
task,
|
||||
'execute_tasks',
|
||||
'deploy_resp',
|
||||
{
|
||||
'tasks': orchestrator_graph.post_tasks_serialize([])
|
||||
'tasks': graph.post_tasks_serialize([])
|
||||
}
|
||||
)
|
||||
db().flush()
|
||||
|
@ -1485,7 +1485,7 @@ class CheckBeforeDeploymentTask(object):
|
|||
example dependencies are: requires|required_for|tasks|groups
|
||||
"""
|
||||
deployment_tasks = objects.Cluster.get_deployment_tasks(task.cluster)
|
||||
graph_validator = deployment_graph.DeploymentGraphValidator(
|
||||
graph_validator = orchestrator_graph.GraphSolverValidator(
|
||||
deployment_tasks)
|
||||
graph_validator.check()
|
||||
|
||||
|
@ -1873,10 +1873,10 @@ class UpdateOpenstackConfigTask(BaseDeploymentTask):
|
|||
|
||||
@staticmethod
|
||||
def granular_deploy(task, nodes, update_configs, task_ids):
|
||||
orchestrator_graph = deployment_graph.AstuteGraph(task.cluster)
|
||||
orchestrator_graph.only_tasks(task_ids)
|
||||
deployment_tasks = orchestrator_graph.stage_tasks_serialize(
|
||||
orchestrator_graph.graph.topology, nodes
|
||||
graph = orchestrator_graph.AstuteGraph(task.cluster)
|
||||
graph.only_tasks(task_ids)
|
||||
deployment_tasks = graph.stage_tasks_serialize(
|
||||
graph.graph.topology, nodes
|
||||
)
|
||||
return make_astute_message(
|
||||
task, 'execute_tasks', 'update_config_resp', {
|
||||
|
|
|
@ -21,7 +21,7 @@ import yaml
|
|||
|
||||
from nailgun import consts
|
||||
from nailgun import objects
|
||||
from nailgun.orchestrator.deployment_graph import DeploymentGraph
|
||||
from nailgun.orchestrator.orchestrator_graph import GraphSolver
|
||||
from nailgun.test.base import BaseIntegrationTest
|
||||
from nailgun.test.base import DeploymentTasksTestMixin
|
||||
from nailgun.utils import reverse
|
||||
|
@ -376,7 +376,7 @@ class TestClusterGraphHandler(BaseGraphTasksTests, DeploymentTasksTestMixin):
|
|||
class TestStartEndTaskPassedCorrectly(BaseGraphTasksTests):
|
||||
|
||||
def assert_passed_correctly(self, url, **kwargs):
|
||||
with mock.patch.object(DeploymentGraph,
|
||||
with mock.patch.object(GraphSolver,
|
||||
'find_subgraph') as mfind_subgraph:
|
||||
resp = self.app.get(
|
||||
url,
|
||||
|
|
|
@ -51,7 +51,7 @@ from nailgun.orchestrator.deployment_serializers import\
|
|||
get_serializer_for_cluster
|
||||
|
||||
|
||||
from nailgun.orchestrator.deployment_graph import AstuteGraph
|
||||
from nailgun.orchestrator.orchestrator_graph import AstuteGraph
|
||||
|
||||
from nailgun.db.sqlalchemy import models
|
||||
from nailgun import objects
|
||||
|
|
|
@ -33,13 +33,13 @@ from nailgun.test import base
|
|||
from nailgun.test.base import DeploymentTasksTestMixin
|
||||
from nailgun.utils import reverse
|
||||
|
||||
from nailgun.orchestrator.deployment_graph import AstuteGraph
|
||||
from nailgun.orchestrator.deployment_serializers import \
|
||||
get_serializer_for_cluster
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkDeploymentSerializer70
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkTemplateSerializer70
|
||||
from nailgun.orchestrator.orchestrator_graph import AstuteGraph
|
||||
from nailgun.test.integration.test_orchestrator_serializer import \
|
||||
BaseDeploymentSerializer
|
||||
from nailgun.test.integration.test_orchestrator_serializer import \
|
||||
|
|
|
@ -25,13 +25,13 @@ from nailgun.db.sqlalchemy import models
|
|||
from nailgun import objects
|
||||
from nailgun import rpc
|
||||
|
||||
from nailgun.orchestrator.deployment_graph import AstuteGraph
|
||||
from nailgun.orchestrator.deployment_serializers import \
|
||||
get_serializer_for_cluster
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkDeploymentSerializer80
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkTemplateSerializer80
|
||||
from nailgun.orchestrator.orchestrator_graph import AstuteGraph
|
||||
from nailgun.test.integration.test_orchestrator_serializer import \
|
||||
BaseDeploymentSerializer
|
||||
from nailgun.test.integration.test_orchestrator_serializer import \
|
||||
|
|
|
@ -18,8 +18,8 @@ import six
|
|||
|
||||
from nailgun import consts
|
||||
from nailgun import objects
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import deployment_serializers
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
|
||||
from nailgun.orchestrator.neutron_serializers import \
|
||||
NeutronNetworkDeploymentSerializer90
|
||||
|
@ -267,7 +267,7 @@ class TestSriovSerialization90(
|
|||
|
||||
def serialize(self):
|
||||
objects.Cluster.prepare_for_deployment(self.env.clusters[0])
|
||||
graph = deployment_graph.AstuteGraph(self.env.clusters[0])
|
||||
graph = orchestrator_graph.AstuteGraph(self.env.clusters[0])
|
||||
return deployment_serializers.serialize(
|
||||
graph, self.env.clusters[0], self.env.nodes)
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ from nailgun.extensions import fire_callback_on_node_reset
|
|||
from nailgun.extensions import fire_callback_on_node_update
|
||||
from nailgun.extensions import get_extension
|
||||
from nailgun.extensions import node_extension_call
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import deployment_serializers
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.orchestrator import provisioning_serializers
|
||||
from nailgun.test.base import BaseTestCase
|
||||
|
||||
|
@ -221,7 +221,7 @@ class TestPipeline(BaseExtensionCase):
|
|||
|
||||
return cluster
|
||||
|
||||
@mock.patch.object(deployment_graph.AstuteGraph, 'deploy_task_serialize')
|
||||
@mock.patch.object(orchestrator_graph.AstuteGraph, 'deploy_task_serialize')
|
||||
def test_deployment_serialization_ignore_customized(self, _):
|
||||
cluster = self._create_cluster_with_extensions()
|
||||
|
||||
|
@ -243,13 +243,13 @@ class TestPipeline(BaseExtensionCase):
|
|||
cluster.nodes[0], 'replaced_deployment_info',
|
||||
new_callable=mock.Mock(return_value=replaced_data)):
|
||||
|
||||
graph = deployment_graph.AstuteGraph(cluster)
|
||||
graph = orchestrator_graph.AstuteGraph(cluster)
|
||||
deployment_serializers.serialize(
|
||||
graph, cluster, cluster.nodes, ignore_customized=True)
|
||||
|
||||
mfire_callback.assert_called_once_with(data, cluster, cluster.nodes)
|
||||
|
||||
@mock.patch.object(deployment_graph.AstuteGraph, 'deploy_task_serialize')
|
||||
@mock.patch.object(orchestrator_graph.AstuteGraph, 'deploy_task_serialize')
|
||||
def test_deployment_serialization_ignore_customized_false(self, _):
|
||||
cluster = self._create_cluster_with_extensions(
|
||||
nodes_kwargs=[
|
||||
|
@ -280,7 +280,7 @@ class TestPipeline(BaseExtensionCase):
|
|||
cluster.nodes[0], 'replaced_deployment_info',
|
||||
new_callable=mock.Mock(return_value=replaced_data)):
|
||||
|
||||
graph = deployment_graph.AstuteGraph(cluster)
|
||||
graph = orchestrator_graph.AstuteGraph(cluster)
|
||||
deployment_serializers.serialize(
|
||||
graph, cluster, cluster.nodes, ignore_customized=False)
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
|
||||
import six
|
||||
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import graph_visualization
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.test import base
|
||||
|
||||
|
||||
class TestDeploymentGraphViualization(base.BaseUnitTest):
|
||||
class TestGraphSolverViualization(base.BaseUnitTest):
|
||||
|
||||
def get_dotgraph_with_tasks(self, tasks):
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
graph.add_tasks(tasks)
|
||||
visualization = graph_visualization.GraphVisualization(graph)
|
||||
dotgraph = visualization.get_dotgraph()
|
||||
|
|
|
@ -22,8 +22,8 @@ import mock
|
|||
import yaml
|
||||
|
||||
from nailgun.errors import errors
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import graph_configuration
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.test import base
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ class TestGraphDependencies(base.BaseTestCase):
|
|||
self.tasks = yaml.load(TASKS)
|
||||
self.subtasks = yaml.load(SUBTASKS)
|
||||
self.subtasks_with_regexp = yaml.load(SUBTASKS_WITH_REGEXP)
|
||||
self.graph = deployment_graph.DeploymentGraph()
|
||||
self.graph = orchestrator_graph.GraphSolver()
|
||||
|
||||
def test_build_deployment_graph(self):
|
||||
self.graph.add_tasks(self.tasks)
|
||||
|
@ -170,14 +170,14 @@ class TestUpdateGraphDependencies(base.BaseTestCase):
|
|||
self.subtasks = yaml.load(SUBTASKS_WITH_REGEXP)
|
||||
|
||||
def test_groups_regexp_resolution(self):
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
graph.add_tasks(self.tasks + self.subtasks)
|
||||
self.assertItemsEqual(
|
||||
graph.succ['setup_something'],
|
||||
{'deploy_end': {}, 'cinder': {}, 'compute': {}, 'controller': {}})
|
||||
|
||||
def test_support_for_all_groups(self):
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
subtasks = copy.deepcopy(self.subtasks)
|
||||
subtasks[0]['groups'] = ['/.*/']
|
||||
graph.add_tasks(self.tasks + subtasks)
|
||||
|
@ -187,7 +187,7 @@ class TestUpdateGraphDependencies(base.BaseTestCase):
|
|||
'cinder': {}, 'compute': {}, 'controller': {}})
|
||||
|
||||
def test_simple_string_in_group(self):
|
||||
graph = deployment_graph.DeploymentGraph()
|
||||
graph = orchestrator_graph.GraphSolver()
|
||||
subtasks = copy.deepcopy(self.subtasks)
|
||||
subtasks[0]['groups'] = ['controller']
|
||||
graph.add_tasks(self.tasks + subtasks)
|
||||
|
@ -204,7 +204,7 @@ class TestAddDependenciesToNodes(base.BaseTestCase):
|
|||
cluster_m.get_deployment_tasks.return_value = yaml.load(
|
||||
TASKS + SUBTASKS)
|
||||
self.cluster = mock.Mock()
|
||||
self.graph = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.graph = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
|
||||
def test_priority_serilized_correctly_for_all_roles(self):
|
||||
nodes = [{'uid': '3', 'role': 'primary-controller'},
|
||||
|
@ -276,7 +276,7 @@ class TestLegacyGraphSerialized(base.BaseTestCase):
|
|||
cluster_m.get_deployment_tasks.return_value = yaml.load(
|
||||
graph_configuration.DEPLOYMENT_51_60)
|
||||
self.cluster = mock.Mock()
|
||||
self.graph = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.graph = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
|
||||
def test_serialized_with_tasks_and_priorities(self):
|
||||
"""Test verifies that priorities and tasks."""
|
||||
|
@ -312,7 +312,7 @@ class TestTasksRemoval(base.BaseTestCase):
|
|||
cluster_m.get_deployment_tasks.return_value = yaml.load(
|
||||
TASKS + SUBTASKS)
|
||||
self.cluster = mock.Mock()
|
||||
self.astute = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.astute = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
|
||||
def test_only_tasks(self):
|
||||
self.astute.only_tasks(['setup_network'])
|
||||
|
@ -338,7 +338,7 @@ class GroupsTraversalTest(base.BaseTestCase):
|
|||
cluster_m.get_deployment_tasks.return_value = yaml.load(
|
||||
self.GROUPS)
|
||||
self.cluster = mock.Mock()
|
||||
self.astute = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.astute = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
self.nodes = []
|
||||
|
||||
def get_node_by_role(self, role):
|
||||
|
@ -552,7 +552,7 @@ class TestFindGraph(base.BaseTestCase):
|
|||
def setUp(self):
|
||||
super(TestFindGraph, self).setUp()
|
||||
self.tasks = yaml.load(COMPLEX_DEPENDENCIES)
|
||||
self.graph = deployment_graph.DeploymentGraph()
|
||||
self.graph = orchestrator_graph.GraphSolver()
|
||||
self.graph.add_tasks(self.tasks)
|
||||
|
||||
def test_end_at_pre_deployment(self):
|
||||
|
@ -709,7 +709,7 @@ class TestOrdered(base.BaseTestCase):
|
|||
|
||||
def test_always_same_order(self):
|
||||
|
||||
graph = deployment_graph.DeploymentGraph(tasks=self.tasks)
|
||||
graph = orchestrator_graph.GraphSolver(tasks=self.tasks)
|
||||
# (dshulyak) order should be static
|
||||
self.assertEqual(
|
||||
[n['id'] for n in graph.topology],
|
||||
|
@ -733,7 +733,7 @@ class TestIncludeSkipped(base.BaseTestCase):
|
|||
def setUp(self):
|
||||
super(TestIncludeSkipped, self).setUp()
|
||||
self.tasks = yaml.load(self.TASKS)
|
||||
self.graph = deployment_graph.DeploymentGraph(tasks=self.tasks)
|
||||
self.graph = orchestrator_graph.GraphSolver(tasks=self.tasks)
|
||||
|
||||
def test_filter_subgraph_will_not_return_skipped(self):
|
||||
|
||||
|
@ -757,7 +757,7 @@ class TestIncludeSkipped(base.BaseTestCase):
|
|||
[t['id'] for t in self.tasks])
|
||||
|
||||
|
||||
class TestDeploymentGraphValidator(base.BaseTestCase):
|
||||
class TestGraphSolverValidator(base.BaseTestCase):
|
||||
|
||||
def test_validation_pass_with_existing_dependencies(self):
|
||||
yaml_tasks = """
|
||||
|
@ -776,7 +776,7 @@ class TestDeploymentGraphValidator(base.BaseTestCase):
|
|||
amount: 2
|
||||
"""
|
||||
tasks = yaml.load(yaml_tasks)
|
||||
graph_validator = deployment_graph.DeploymentGraphValidator(tasks)
|
||||
graph_validator = orchestrator_graph.GraphSolverValidator(tasks)
|
||||
graph_validator.check()
|
||||
|
||||
def test_validation_failed_with_not_existing_dependencies(self):
|
||||
|
@ -793,7 +793,8 @@ class TestDeploymentGraphValidator(base.BaseTestCase):
|
|||
type: one_by_one
|
||||
""".format(dependency_type=dependency_type)
|
||||
tasks = yaml.load(yaml_tasks)
|
||||
graph_validator = deployment_graph.DeploymentGraphValidator(tasks)
|
||||
graph_validator = orchestrator_graph.GraphSolverValidator(
|
||||
tasks)
|
||||
|
||||
with self.assertRaisesRegexp(
|
||||
errors.InvalidData,
|
||||
|
@ -812,7 +813,7 @@ class TestDeploymentGraphValidator(base.BaseTestCase):
|
|||
requires: [test-controller-1]
|
||||
"""
|
||||
tasks = yaml.load(yaml_tasks)
|
||||
graph_validator = deployment_graph.DeploymentGraphValidator(tasks)
|
||||
graph_validator = orchestrator_graph.GraphSolverValidator(tasks)
|
||||
with self.assertRaisesRegexp(
|
||||
errors.InvalidData,
|
||||
"Tasks can not be processed because it contains cycles in it"):
|
||||
|
|
|
@ -21,7 +21,7 @@ from nailgun import consts
|
|||
from nailgun.errors import errors
|
||||
from nailgun import objects
|
||||
from nailgun.orchestrator.base_serializers import NetworkDeploymentSerializer
|
||||
from nailgun.orchestrator import deployment_graph
|
||||
from nailgun.orchestrator import orchestrator_graph
|
||||
from nailgun.orchestrator import tasks_serializer
|
||||
from nailgun.test import base
|
||||
|
||||
|
@ -560,7 +560,7 @@ class TestPreTaskSerialization(BaseTaskSerializationTestUbuntu):
|
|||
""")
|
||||
|
||||
def test_tasks_serialized_correctly(self):
|
||||
self.graph = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.graph = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
self.cluster.release.operating_system = consts.RELEASE_OS.ubuntu
|
||||
tasks = self.graph.pre_tasks_serialize(self.nodes)
|
||||
self.assertEqual(len(tasks), 20)
|
||||
|
@ -618,7 +618,7 @@ class TestPostTaskSerialization(BaseTaskSerializationTest):
|
|||
super(TestPostTaskSerialization, self).setUp()
|
||||
self.control_uids = [n.uid for n in self.nodes
|
||||
if 'controller' in n.roles]
|
||||
self.graph = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.graph = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
|
||||
def test_post_task_serialize_all_tasks(self):
|
||||
self.nodes.append(self.env.create_node(
|
||||
|
@ -664,7 +664,7 @@ class TestConditionalTasksSerializers(BaseTaskSerializationTest):
|
|||
|
||||
def setUp(self):
|
||||
super(TestConditionalTasksSerializers, self).setUp()
|
||||
self.graph = deployment_graph.AstuteGraph(self.cluster)
|
||||
self.graph = orchestrator_graph.AstuteGraph(self.cluster)
|
||||
|
||||
def test_conditions_satisfied(self):
|
||||
self.cluster.status = 'operational'
|
||||
|
|
Loading…
Reference in New Issue