Automatic virtual machine starting system and method based on custom template

Through custom templates and automated deployment tools, the problems of inefficiency and high error rates in traditional virtual machine deployment are solved, and the rapid and reliable virtual machine deployment process is achieved. It is adapted to a variety of physical machine specifications and system forms, enhancing the stability and security of the virtualized environment.

CN120335931APending Publication Date: 2025-07-18SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510373897.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-18

Smart Images

  • Figure CN120335931A_ABST
    Figure CN120335931A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of automatic deployment, in particular to an automatic virtual machine starting system and method based on a user-defined template, and the system comprises a user-defined configuration file design module, an automatic deployment tool and an error detection and processing mechanism. The method has the beneficial effects that by customizing the virtual machine configuration file, the strategy better meeting the environment requirement is created. Compared with the prior art, the method has the advantages that original fixed and rigid manual steps are abandoned, various operating system platforms can be well compatible, the deployment speed of the virtual machine is remarkably increased, the deployment speed is shortened from dozens of minutes to several minutes, and the resource allocation efficiency is greatly improved. And the stability and the security of the virtualization environment are enhanced. Compared with the prior art, more possibilities are provided for component access, the deployment process is simplified, the workload of operation and maintenance personnel is reduced, and virtual machine deployment becomes a repeatable and predictable process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automated deployment, and particularly to an automated virtual machine startup system and method based on a custom template. Background Art

[0002] With the rapid development of cloud computing and virtualization technologies, virtual machines have become an important part of building elastic computing resources.

[0003] However, in the process of traditional virtual machine deployment, users often need to manually configure complex parameters, such as memory capacity, number of CPU cores, disk size, network interface, etc., and then execute operations such as creation and startup one by one through the virsh command-line tool. This manual configuration method is not only time-consuming and laborious, but also extremely prone to human errors, seriously affecting the efficiency and reliability of virtual machine deployment. And manual operations often need to adapt to various specifications of physical machine models and systems, and are accompanied by various pre-environment detections, which are too cumbersome and complex. Summary of the Invention

[0004] The purpose of the present invention is to provide an automated virtual machine startup system and method based on a custom template, so as to solve the problems of low efficiency and high error rate caused by manually configuring virtual machine parameters. Improve the automation level of the virtual machine deployment process, reduce manual intervention operations in each link, adapt to various physical machine specifications and system forms, and enhance the accuracy and consistency of deployment, so as to solve the problems proposed in the above background art.

[0005] To achieve the above purpose, the present invention provides the following technical solution: An automated virtual machine startup system based on a custom template, the system includes:

[0006] A custom configuration file design module, used to define a standardized configuration file in YAML or JSON format, and the configuration file covers all key configuration items of the virtual machine, including but not limited to virtual machine name, image path, CPU size, memory size, disk information, VNC port, network configuration, and custom commands executed after startup;

[0007] An automated deployment tool, written in Go language and shell commands, can automatically generate and execute corresponding virsh commands according to the YAML or JSON format configuration file to achieve the creation, startup, monitoring, and management of virtual machines;

[0008] An error detection and handling mechanism, which performs an integrity check on the configuration file before deployment to ensure that all necessary parameters are correctly set, and provides detailed error prompt information and repair suggestions when an error is detected.

[0009] Preferably, the custom configuration file design module further includes:

[0010] A configuration file template, defined in YAML or JSON format, containing the basic information and configuration details of virtual machines;

[0011] A parsing and execution tool that can accurately read and understand the configuration information in the configuration file template and convert it into an internal data structure of the system for subsequent processing.

[0012] Preferably, the automated deployment tool includes:

[0013] An environment detection component for detecting whether the current environment meets the conditions for running virtualization, including system support, toolkit integrity, and resource sufficiency;

[0014] A command generator that generates an XML file or a set of commands compliant with the virsh standard of the current environment according to the content of the configuration file;

[0015] A virtual machine lifecycle management component VLM that supports creating virtual machines by specifying a configuration file and performing management operations such as viewing, deleting, starting, and stopping virtual machines.

[0016] Preferably, the virtual machine lifecycle management component VLM specifically includes:

[0017] A creation command that creates a virtual machine according to the configuration file and detects whether a virtual machine with the same name already exists in the environment before creation;

[0018] A monitoring and alarm function that intermittently monitors the status of each virtual machine, issues an alarm when a virtual machine cannot be accessed continuously for multiple times, and supports docking common monitoring components such as Zabbix and Prometheus, providing an alarm monitoring reporting API;

[0019] A function to execute commands after startup. After the virtual machine starts, it executes custom startup commands according to the script parameter in the configuration file.

[0020] Preferably, the system further includes:

[0021] A system integration and testing module for integrating the automated deployment tool into an existing virtualization management system, conducting multiple rounds of functional and performance tests, and verifying the stability, accuracy, and deployment efficiency of the system;

[0022] A configuration file verification module that, after loading the configuration file, detects the structural correctness of the file content, parameter formats, and value rationality, including but not limited to the integrity of configuration items, the validity of numerical values, and the rationality of dependency relationships, to ensure that the configuration file complies with predefined specifications.

[0023] A startup method for an automated virtual machine startup system based on a custom template, the method comprising:

[0024] Define a configuration file in a standardized YAML or JSON format, the configuration file containing all key configuration items of the virtual machine, including but not limited to the virtual machine name, image path, CPU size, memory size, disk information, VNC port, network configuration, and custom commands to be executed after startup;

[0025] Develop an automated deployment tool that reads and parses the YAML or JSON configuration file and automatically generates corresponding virtualization management commands according to the configuration information;

[0026] Perform environment detection through the automated deployment tool to confirm that the system environment meets the virtualization running conditions;

[0027] Generate and execute commands to create and start the virtual machine according to the parsed content of the configuration file;

[0028] Monitor the startup status of the virtual machine and execute the custom commands defined in the configuration file after the virtual machine starts up.

[0029] Preferably, the method further comprises:

[0030] After reading the configuration file, perform integrity verification and parameter format verification of the configuration file to ensure that all required parameters are correctly set, and provide error prompt information and repair suggestions;

[0031] Before generating the command to create the virtual machine, check whether the current system resources are sufficient, including CPU, memory, storage, and network resources, to ensure that the resource requirements in the configuration file are met.

[0032] Preferably, the automated deployment tool is written in the Go language and shell commands, and includes a virtual machine life cycle management component, supporting the following operations:

[0033] An environment detection command for detecting whether the system has the basic conditions for running virtualization;

[0034] A virtual machine creation command to create a virtual machine according to the custom configuration file;

[0035] A virtual machine viewing command for viewing the list of virtual machines in the current system;

[0036] A virtual machine deletion command for deleting a specified virtual machine;

[0037] Other virtual machine management commands, including starting, stopping, and copying virtual machines.

[0038] Preferably, the method further comprises:

[0039] Integrated monitoring and alarm mechanism. The automated deployment tool intermittently monitors the running status of virtual machines. When it detects that a virtual machine cannot be accessed, it issues an alarm.

[0040] Provide docking interfaces with common monitoring components such as Zabbix and Prometheus, and report monitoring and alarm information through the API.

[0041] Preferably, the design of the configuration file follows the principles of clarity, simplicity, and extensibility, ensuring comprehensive coverage of various configuration options required for virtual machine deployment and supporting new features that may be added in the future; the automated deployment tool improves the efficiency of resource allocation by flexibly adapting to virtual machine clusters of different scales, significantly shortens the virtual machine deployment time, and enhances the stability and security of the virtualization environment.

[0042] Compared with the prior art, the beneficial effects of the present invention are:

[0043] The present invention proposes an automated virtual machine startup system and method based on a custom template. Brief Description of the Drawings

[0044] Figure 1 It is the execution logic flowchart of vlm of the present invention. By customizing the virtual machine configuration file, a strategy that better meets the environmental requirements is created. Abandoning the previous fixed and rigid manual steps, and it can be well compatible with various operating system platforms, significantly improving the virtual machine deployment speed, shortening from dozens of minutes to a few minutes, greatly improving the resource allocation efficiency. Enhancing the stability and security of the virtualization environment. Not only providing more possibilities for the access of components, but also simplifying the deployment process, reducing the workload of operation and maintenance personnel, making the virtual machine deployment a repeatable and predictable process. Detailed Embodiments

[0045] In order to clearly and completely describe the purpose, technical solution of the present invention, and make the advantages more clearly understood, the following further details the embodiments of the present invention with reference to the drawings. It should be understood that the specific embodiments described herein are part of the embodiments of the present invention, rather than all of the embodiments, and are only used to explain the embodiments of the present invention, not to limit the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0046] Embodiment 1, please refer to Figure 1 , the present invention provides a technical solution: an automated virtual machine startup system based on a custom template, the system includes:

[0047] Custom Configuration File Design and Parsing: Define a set of standardized YAML or JSON configuration file formats that cover all key configuration items of virtual machines, such as memory capacity, number of CPU cores, disk size, network interfaces, operating system images, etc. Develop specialized parsing and execution tools that can accurately read and understand the configuration information in YAML or JSON files.

[0048] Automated Deployment Tool Development: Use Go language + shell to write an automated deployment tool that can automatically generate and execute corresponding commands according to the YAML or JSON custom configuration file, realizing operations such as virtual machine creation, startup, monitoring, and management.

[0049] Error Detection and Handling Mechanism: Integrate a powerful error detection function that can perform integrity checks on the YAML or JSON custom configuration file before deployment to ensure that all necessary parameters are correctly set. At the same time, provide detailed error prompt information and repair suggestions to help users quickly locate and solve problems.

[0050] The following is a detailed explanation of the key points in the technical solution:

[0051] 1) config Configuration File: A custom configuration file template in YAML or JSON format that configures the basic information of the virtual machine, including:

[0052] vm: A collection of virtual machine configuration information

[0053] name: Virtual machine name

[0054] image: Virtual machine image path

[0055] cpu: Virtual machine cpu size

[0056] memrry: Virtual machine memory size

[0057] disk: A collection of virtual machine disk information, including disk type, disk size, disk format, etc.

[0058] vnc: Virtual machine vnc port

[0059] network: Virtual machine ip address, which can be static or dhcp

[0060] script: Execute custom commands after virtual startup

[0061] 2) vlm: virtual machine lifecycle management component, an automated binary tool written in Go and shell commands, which is the core part of this patent. It supports creating virtual machines by specifying a configuration file and also supports other operations, including:

[0062] Environment detection command: vlmcheckenv to detect whether the environment has the conditions to run virtualization

[0063] Virtual machine creation command: vlmcreate -f config.yaml to create a virtual machine according to a custom file

[0064] Virtual machine viewing command: vlm show list to view the virtual machine list

[0065] Virtual machine deletion command: vlmdelete test01 to delete the virtual machine test01

[0066] Other common commands: vlmstoptest01,, vlmstarttest01, vlmcptest01test02

[0067] 3) Monitoring and alarming. In this patent system, vlm will intermittently monitor the status of each virtual machine. When a virtual machine cannot be accessed continuously for multiple times, an alarm will be issued. Vlm supports docking with common monitoring components such as zibbix and prometheus and provides an alarm monitoring reporting api.

[0068] An example of a virtual machine configuration file is as follows:

[0069]

[0070]

[0071] The execution logic of vlm:

[0072] First, detect whether the current environment has the basic conditions for creating virtual machines, including whether the system supports virtualization, whether the toolkits are complete, whether the resources are sufficient, etc.

[0073] Read a custom configuration file in yaml or json format

[0074] Detect the custom configuration file in yaml or json format and verify whether the file format and parameters meet the specifications

[0075] Generate one or more xml files or command sets that conform to the current environment's virsh standard according to the content of the custom configuration file in yaml or json format

[0076] Detect the resources of the current environment, including but not limited to whether the resources such as CPU size, memory usage, remaining storage size, network specifications, etc. are sufficient and meet the resource size required by the current creation application.

[0077] Create and start a virtual machine according to a custom file in yaml or json format.

[0078] Detect whether the virtual machine is running normally, and whether the VNC port, network connectivity, and SSH port can be accessed normally.

[0079] Execute the startup commands (optional) defined in the custom configuration file in yaml or json format and return the overall result.

[0080] Design idea:

[0081] Pre-check the environment

[0082] Since the components run at the physical machine operating system level, it is necessary to adapt to different operating systems to a certain extent. Therefore, at the beginning of the program, the current environment will be detected, including virsh version, toolkits, system version, network conditions, CPU size, memory size, and disk size. Corresponding prompts will be given for unsupported or unadapted systems. A very crucial point is the virsh-related toolkits. The patent system can have built-in installation packages for the adapted operating systems. When the detection fails, the tool deployment can be carried out on the built-in installation packages according to the version correspondence relationship to make the environment have common command tools; if the physical machine itself can connect to the external network, automated installation packages can also be installed through apt or yum. Through a series of automated pre-check mechanisms, the error probability caused by manual operations can be greatly reduced, the basic conditions for product operation can be improved, and the consistency, maintenance, and management of the environment can be made more efficient.

[0083] Load the configuration

[0084] After reading the custom virtual machine configuration file in yaml or json format, convert the configuration information into an internal data structure for subsequent processing. Detect the file content, whether the yaml or json structure is correct, whether the parameter format and parameter values are correct, including but not limited to the integrity of configuration items, the validity of numerical values, and the rationality of dependency relationships. The configuration file should follow the principles of clarity, simplicity, and extensibility to ensure that it can comprehensively cover various configuration options required for virtual machine deployment and support new features that may be added in the future.

[0085] Create a virtual machine

[0086] After reading each parameter value, it will generate a matching virsh configuration file format or command according to the corresponding version of virsh in the current system environment. Before creation, it will also detect whether there is a virtual machine with the same name in the current environment to prevent creation failure. Execute the generated virsh command while monitoring the command execution status to ensure that the virtual machine is successfully started and in the expected state. During the deployment and operation of the virtual machine, continuously monitor the execution status of the virsh command and the running status of the virtual machine, and promptly discover and handle abnormal situations. For the case of command execution failure, record detailed error information. Provide error recovery strategies, such as automatically restarting the failed virtual machine, rolling back to the previous stable state, etc., to ensure the continuity and availability of the virtual machine service. After creation is completed, start the virtual machine and continuously monitor whether the virtual machine has started. After the virtual machine starts, according to the script parameter in the custom configuration file, execute custom startup commands, which can include simple operations such as initialization and starting services.

[0087] Embodiment 2, based on Embodiment 1, proposes a startup method for an automated virtual machine startup system based on a custom template. The method includes:

[0088] Define a configuration file in a standardized YAML or JSON format. The configuration file contains all key configuration items of the virtual machine, including but not limited to virtual machine name, image path, CPU size, memory size, disk information, VNC port, network configuration, and custom commands to be executed after startup.

[0089] Develop an automated deployment tool that reads and parses the YAML or JSON configuration file and automatically generates corresponding virtualization management commands according to the configuration information.

[0090] Perform environment detection through the automated deployment tool to confirm that the system environment meets the virtualization running conditions.

[0091] Generate and execute commands to create and start the virtual machine according to the content of the parsed configuration file.

[0092] Monitor the startup status of the virtual machine and execute the custom commands defined in the configuration file after the virtual machine starts.

[0093] It also includes: after reading the configuration file, perform integrity verification and parameter format verification of the configuration file to ensure that all required parameters are correctly set, and provide error prompt information and repair suggestions; before generating the command to create the virtual machine, check whether the current system resources are sufficient, including CPU, memory, storage, and network resources, to ensure that the resource requirements in the configuration file are met.

[0094] The automated deployment tool is written in Go language and shell commands, includes a virtual machine lifecycle management component, and supports the following operations:

[0095] An environment detection command, used to detect whether the system has the basic conditions for running virtualization;

[0096] A virtual machine creation command, which creates a virtual machine according to a custom configuration file;

[0097] A virtual machine viewing command, used to view the list of virtual machines in the current system;

[0098] A virtual machine deletion command, used to delete a specified virtual machine;

[0099] Other virtual machine management commands, including starting, stopping, and copying virtual machines.

[0100] The method also includes: integrating a monitoring and alarm mechanism, the automated deployment tool intermittently monitors the running status of virtual machines, and when it detects that a virtual machine cannot be accessed, it issues an alarm; provides docking interfaces with common monitoring components such as Zabbix and Prometheus, and reports monitoring and alarm information through the API.

[0101] The design of the configuration file follows the principles of clarity, simplicity, and extensibility, ensuring full coverage of various configuration options required for virtual machine deployment and supporting new features that may be added in the future; the automated deployment tool improves resource allocation efficiency by flexibly adapting to virtual machine clusters of different scales, significantly shortens the virtual machine deployment time, and enhances the stability and security of the virtualized environment.

[0102] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. An automated virtual machine startup system based on a custom template, characterized in that: The system includes: A custom configuration file design module for defining a standardized configuration file in YAML or JSON format, which covers all key configuration items of the virtual machine, including but not limited to the virtual machine name, image path, CPU size, memory size, disk information, VNC port, network configuration, and custom commands to be executed after startup; An automated deployment tool written in Go language and shell commands, which can automatically generate and execute corresponding virsh commands according to the YAML or JSON format configuration file to achieve the creation, startup, monitoring, and management of virtual machines; An error detection and handling mechanism that performs an integrity check on the configuration file before deployment to ensure that all required parameters are correctly set, and provides detailed error prompt information and repair suggestions when errors are detected.

2. The automated virtual machine startup system based on a custom template according to claim 1, wherein: The custom configuration file design module further includes: A configuration file template defined in YAML or JSON format, which contains the basic information and configuration details of the virtual machine; A parsing and execution tool that can accurately read and understand the configuration information in the configuration file template and convert it into an internal data structure of the system for subsequent processing.

3. The automated virtual machine startup system based on a custom template according to claim 2, characterized in that: The automated deployment tool includes: An environment detection component for detecting whether the current environment meets the conditions for running virtualization, including system support, tool kit integrity, and resource sufficiency; A command generator that generates an XML file or a set of commands that conform to the virsh standard of the current environment according to the configuration file content; A virtual machine lifecycle management component VLM that supports creating virtual machines by specifying a configuration file and performing management operations such as viewing, deleting, starting, and stopping virtual machines.

4. An automated virtual machine startup system based on a custom template according to claim 3, characterized in that: The virtual machine lifecycle management component VLM specifically includes: A creation command that creates a virtual machine according to the configuration file and detects whether a virtual machine with the same name already exists in the environment before creation; A monitoring and alarm function that intermittently monitors the status of each virtual machine, issues an alarm when a virtual machine cannot be accessed continuously for multiple times, and supports docking common monitoring components such as Zabbix and Prometheus, and provides an alarm monitoring reporting API; A function of executing commands after startup that executes custom startup commands according to the script parameter in the configuration file after the virtual machine starts up.

5. The automated virtual machine startup system based on a custom template according to claim 4, characterized in that: The system further includes: A system integration and testing module for integrating the automated deployment tool into an existing virtualization management system, performing multiple rounds of functional and performance tests to verify the stability, accuracy, and deployment efficiency of the system; A configuration file verification module that detects the structural correctness, parameter format, and value rationality of the file content after loading the configuration file, including but not limited to the integrity of configuration items, the validity of numerical values, and the rationality of dependency relationships, to ensure that the configuration file conforms to the predefined specifications.

6. A startup method for an automated virtual machine startup system based on a custom template according to claim 5, characterized in that: The method includes: Defining a standardized configuration file in YAML or JSON format, which contains all key configuration items of the virtual machine, including but not limited to the virtual machine name, image path, CPU size, memory size, disk information, VNC port, network configuration, and custom commands to be executed after startup; Develop an automated deployment tool that reads and parses the YAML or JSON configuration file and automatically generates corresponding virtualization management commands according to the configuration information; Perform environment detection through the automated deployment tool to confirm that the system environment meets the virtualization running conditions; Generate and execute commands to create and start virtual machines according to the content of the parsed configuration file; Monitor the startup status of the virtual machine and execute the custom commands defined in the configuration file after the virtual machine starts.

7. The starting method according to claim 6, characterized in that: The method further includes: After reading the configuration file, perform integrity check and parameter format verification of the configuration file to ensure that all required parameters are correctly set, and provide error prompt information and repair suggestions; Before generating the command to create a virtual machine, check whether the current system resources are sufficient, including CPU, memory, storage, and network resources, to ensure that the resource requirements in the configuration file are met.

8. A startup method according to claim 7, characterized in that: The automated deployment tool is written in Go language and shell commands and includes a virtual machine lifecycle management component that supports the following operations: An environment detection command used to detect whether the system has the basic conditions for running virtualization; A virtual machine creation command to create a virtual machine according to a custom configuration file; A virtual machine viewing command used to view the list of virtual machines in the current system; A virtual machine deletion command used to delete a specified virtual machine; Other virtual machine management commands, including starting, stopping, and copying virtual machines.

9. The starting method according to claim 8, characterized in that: The method further includes: Integrate a monitoring and alarm mechanism. The automated deployment tool intermittently monitors the running status of the virtual machine and issues an alarm when it detects that the virtual machine is inaccessible; Provide docking interfaces with common monitoring components such as Zabbix and Prometheus to report monitoring and alarm information through the API.

10. A startup method according to claim 9, characterized in that: The design of the configuration file follows the principles of clarity, simplicity, and extensibility to ensure full coverage of various configuration options required for virtual machine deployment and support for new features that may be added in the future; the automated deployment tool improves resource allocation efficiency by flexibly adapting to virtual machine clusters of different scales, significantly shortens the virtual machine deployment time, and enhances the stability and security of the virtualization environment.