CN-122018928-A - Multi-component installation planning method based on constraint solving and application thereof
Abstract
The invention provides a multi-component installation planning method based on constraint solving and application thereof, and belongs to the technical field of computer automation operation and maintenance. Aiming at the problem that deployment is easy to fail midway due to lack of global conflict prediction in the prior art, the method comprises the steps of obtaining a component list to be installed and multi-source metadata, constructing a global dependency graph comprising nodes and relationship edges, extracting multi-dimensional constraints and forming the multi-dimensional constraints into logic sentences, calling a constraint solver to solve the constraint, outputting component version combinations meeting the constraints, triggering a closed loop feedback flow if the solution is not solved, generating a strategy constraint set comprising isolation domains based on conflict features, solving the strategy constraint set for the second time until the strategy constraint set is feasible, and finally performing topological sorting based on the feasible combinations to generate the loop-free installation plan. The method can pre-judge and resolve cross-source and version conflicts in advance, and greatly improve the first success rate of complex application stack deployment.
Inventors
- WANG ZIHAN
- HUANG QIANG
- DONG KE
- JIN JIE
- KUANG GUOTAO
Assignees
- 深圳市生强科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260413
Claims (10)
- 1. The multi-component installation planning method based on constraint solving is characterized by comprising the following steps of: acquiring a to-be-installed component list input by a user, and detecting target host environment information; Metadata of the polymorphic components are collected from multiple heterogeneous sources through a preset source adapter, unified modeling is conducted on the metadata, and a global dependency graph comprising component nodes and directed edges with attributes is constructed; Extracting a multi-dimensional constraint condition based on the global dependency graph, the to-be-installed component list and the target host environment information, and formalizing the multi-dimensional constraint condition into a logic statement which can be identified by a constraint solver; Calling the constraint solver to solve the logic statement, and outputting a component version combination meeting all constraint conditions if the solution is successful, and triggering a conflict solution closed loop feedback process to generate a new constraint set to carry out secondary solution if the solution is judged to be free of solution until the feasible component version combination is obtained; and performing directed graph topology sequencing based on the component version combination and the global dependency graph to generate an acyclic installation sequence plan.
- 2. The method of claim 1, wherein the polymorphic component comprises a system software package, a container image, a binary compression package, and a source code compilation; Metadata of the polymorphic components are collected from multiple heterogeneous sources through a preset source adapter and are subjected to unified modeling, and a global dependency graph containing component nodes and directed edges with attributes is constructed, wherein the method comprises the following steps: Pulling the metadata from a system software warehouse, a container warehouse and a general file warehouse by adopting a multithreading parallel strategy with flow control; And extracting component identification, version and dependency information in the metadata, converting components with different forms into standardized data structures as the component nodes, and converting dependency, conflict, provision and replacement relations among the components into the attribute directed edges.
- 3. The method of claim 2, wherein the global dependency graph is stored in an adjacency list structure; The component node comprises a component ID, a version quantization value, a morphology type and a resource attribute field, wherein the version quantization value is the result of converting a semantical version number into a numerical value; The directed edge with attributes includes a relationship type, version constraint rules, and mandatory attributes field.
- 4. A multi-component installation planning method according to claim 1 or 3, wherein the step of calling the constraint solver to solve the logical statement further comprises: defining a quantization optimization objective function; According to the number of components to be installed and the number of constraint conditions, self-adaptively selecting an SAT solver or an ASP solver; if the ASP solver is selected, carrying out extremum normalization processing on a plurality of single-objective optimization functions, and based on a formula Constructing a comprehensive optimization objective function, wherein, For the comprehensive optimization objective function, S is the feasible solution, m is the number of optimization objectives, As the weight coefficient of the light-emitting diode, And (3) quantizing the value for the normalized single objective function, preferentially meeting the optimization target with high weight through pruning strategy in the traversing process of the solved search tree, and outputting the comprehensively optimal component version combination.
- 5. The method of multi-component installation planning of claim 1, wherein triggering a conflict resolution closed loop feedback process to generate a new set of constraints for secondary resolution comprises: traversing the logic statement reversely according to the non-solution result output by the constraint solver, and positioning conflict types and core conflict component pairs; Matching a target solution strategy from a strategy library according to the conflict type and the preset scene priority; And expanding the global dependency graph according to the target solving strategy to generate an isolation domain subgraph, dynamically adding a strategy constraint layer into an original logic statement to form the new constraint set, and inputting the new constraint set into the constraint solver for secondary solving.
- 6. The multi-component installation planning method of claim 5, wherein the policy repository stores a containerized quarantine policy and a source code compilation adaptation policy; When the matched target solution decision is slightly the containerized isolation policy, the generating the isolation domain subgraph and dynamically adding a policy constraint layer in the original logic statement comprises the following steps: creating an independent container isolation domain node in the global dependency graph for one of the pair of core conflict components; And converting the dependency constraint of the original conflict component into a logic statement which is only independently effective in the container isolation domain node, and restricting the global main environment to be irrelevant with the container isolation domain node so as to realize decoupling of contradictory constraint.
- 7. The method of multiple component installation planning of claim 1, further comprising, after generating the loop-free installation order plan: performing full-dimension simulation verification including resource verification, network verification and compatibility verification on the installation sequence plan; After verification is passed, the installation sequence plan is converted into an installation instruction sequence supporting a multi-execution carrier, wherein the multi-execution carrier comprises Shell script, ansible Playbook, saltStack configuration file or Puppet configuration file.
- 8. A multi-component installation planning system based on constraint solving, comprising: the data acquisition module is used for acquiring a to-be-installed component list input by a user and detecting the environment information of the target host; The dependency modeling module is used for acquiring metadata of the polymorphic components from multiple heterogeneous sources through a preset source adapter, uniformly modeling the metadata and constructing a global dependency graph comprising component nodes and directed edges with attributes; The constraint conversion module is used for extracting a multi-dimensional constraint condition based on the global dependency graph, the to-be-installed component list and the target host environment information, and forming the multi-dimensional constraint condition into a logic statement which can be identified by a constraint solver; the core solving module is used for calling the constraint solver to solve the logic statement, and outputting a component version combination meeting all constraint conditions if the solution is successful; The closed loop feedback module is used for being triggered when the constraint solver judges that the solution is not available, locating the conflict type, generating a new constraint set based on a target solution strategy, and inputting the new constraint set into the core solution module for secondary solution; and the planning generation module is used for carrying out directed graph topological ordering based on the feasible component version combination and the global dependency graph to generate an acyclic installation sequence plan.
- 9. The multi-component installation planning system of claim 8 wherein the closed loop feedback module is specifically configured to: And reversely positioning a core conflict component pair according to the no-resolution result output by the constraint solver, creating an isolation domain subgraph for the core conflict component pair in the global dependency graph, and limiting the original conflict constraint to be independently effective only in the isolation domain subgraph so as to resolve the logic contradiction.
- 10. A readable storage medium, characterized in that the readable storage medium has stored therein a computer program comprising program code for controlling a process to execute a process comprising the component installation planning method according to any one of claims 1 to 7.
Description
Multi-component installation planning method based on constraint solving and application thereof Technical Field The invention relates to the technical field of computer automation operation and maintenance and software deployment, in particular to a multi-component installation planning method based on constraint solving and application thereof. Background With the popularization of cloud computing and micro-service architecture, it is normal to automatically deploy complex application stacks containing various types of components such as system packages, container images, source codes and the like on Linux servers. The prior art is generally deployed by adopting a system package manager such as APT/YUM or a configuration management tool such as Ansible, terraform. The tool is mostly based on local and static dependency analysis logic, for example, APT can only process the dependency relationship in the software warehouse of the tool, and a global view cannot be established for the dependency of a third party component crossing sources and forms, meanwhile, the existing scheme is mostly dependent on fixed rules or greedy algorithm in version selection, and a passive execution mode of Cheng Zunxun 'try-report-manual intervention adjustment' is installed, so that the overall prejudgment and planning can not be carried out by combining the existing environment resource of a target host and the multidimensional configuration requirement of a user before execution. Therefore, a multi-component installation planning method based on constraint solving and application thereof are needed to solve the problems existing in the prior art. Disclosure of Invention The embodiment of the invention provides a multi-component installation planning method based on constraint solution and application thereof, aiming at the problems that the prior art has locality due to dependence analysis and lacks a global conflict prediction mechanism, so that cross-source or version conflict is very easy to occur in the execution process when a polymorphic complex application stack is deployed, and the technical defects of passive fault tolerance, difficult rollback, easy damage to the stability of a target system and the like are presented. The core technology of the invention mainly comprises the steps of constructing a global dependency graph of a cross-polymorphic component, formalizing a dependency relationship and an environmental state into multi-dimensional logic constraint, carrying out global conflict prejudgment and multi-objective optimization solution before installation by using a constraint solver (SAT/ASP), and automatically deriving a conflict-free optimal installation plan by combining a closed loop feedback decoupling strategy. In a first aspect, the present invention provides a method for multi-component installation planning based on constraint solving, the method comprising the steps of: acquiring a to-be-installed component list input by a user, and detecting target host environment information; Metadata of the polymorphic components are collected from multiple heterogeneous sources through a preset source adapter, unified modeling is conducted on the metadata, and a global dependency graph comprising component nodes and directed edges with attributes is constructed; extracting a multi-dimensional constraint condition based on the global dependency graph, the component list to be installed and the target host environment information, and formalizing the multi-dimensional constraint condition into a logic statement which can be identified by a constraint solver; Calling a constraint solver to solve the logic statement, and outputting a component version combination meeting all constraint conditions if the solution is successful, and triggering a conflict solution closed loop feedback process to generate a new constraint set to carry out secondary solution if the solution is judged to be free of solution until a feasible component version combination is obtained; and performing directed graph topology sequencing based on the component version combination and the global dependency graph to generate an acyclic installation sequence plan. Further, the polymorphic component comprises a system software package, a container mirror image, a binary compression package and a source code compiling product; metadata of the polymorphic components are collected from multiple heterogeneous sources through a preset source adapter and are subjected to unified modeling, and a global dependency graph containing component nodes and directed edges with attributes is constructed, wherein the method comprises the following steps: Pulling metadata from a system software warehouse, a container warehouse and a general file warehouse by adopting a multithreading parallel strategy with flow control; component identification, version and dependency information in metadata are extracted, components in different forms are converted into standardiz