A method, device and storage medium for constructing an environment based on virtualization technology
By using a drag-and-drop network graph approach based on virtualization technology and microservice management, the complexity of Kubernetes deployment and insufficient virtualization support in China have been resolved, enabling simple and efficient environment building and resource management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ROSE TREE TECH CO LTD
- Filing Date
- 2023-01-19
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, the use of Kubernetes in China is limited by factors such as the inability to download image packages due to overseas network conditions, the inability to support virtualization, the complexity of installation and deployment, the lack of network solutions, and the inability to deploy dependent components independently.
This approach utilizes virtualization technology to build environments, creating containers or virtual machines using a drag-and-drop network graph method. It combines JSON data format and microservices for component installation and code deployment, leveraging SDN to construct the network architecture and supporting the creation and management of containers and virtual machines.
It enables simple and rapid deployment of Kubernetes environments, reduces the learning cost, solves complex network configuration problems, and improves deployment efficiency and resource utilization.
Smart Images

Figure CN115934111B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software deployment technology, and in particular to a method, apparatus and storage medium for building an environment based on virtualization technology. Background Technology
[0002] The CNCF 2021 annual survey shows a growing number of people using cloud-native technologies and Kubernetes. As a cloud-native container orchestration tool, Kubernetes is used by 96% of people globally, and in recent years, some large companies and banks in China have also begun to adopt it. However, the following issues exist when using Kubernetes:
[0003] Kubernetes needs to communicate with CRI (Container Runtime Interface) at its underlying level, but the open-source application container engine Docker does not support CRI;
[0004] Kubernetes does not support virtualization and cannot create VMs; currently available virtualization support is the result of secondary development by other companies.
[0005] Kubernetes installation and deployment are complex;
[0006] Since Kubernetes is an open-source project by Google, due to network limitations abroad, it is normally impossible to download the native Kubernetes image package in China.
[0007] All Kubernetes components depend on Kubernetes; without deploying Kubernetes, components like the configuration center cannot be used.
[0008] Kubernetes itself does not provide networking solutions. Summary of the Invention
[0009] To address the aforementioned technical problems, this application provides a method, apparatus, and storage medium for constructing an environment based on virtualization technology.
[0010] Firstly, this application provides a method for building an environment based on virtualization technology, employing the following technical solution:
[0011] A method for building an environment based on virtualization technology, comprising:
[0012] The server obtains a network graph in JSON data format; wherein, the network graph is a network graph of the overall environment drawn by the user through the AntV-X6 framework on the web client;
[0013] The server uses a JSON parser to decompose the JSON string to obtain relevant parameters on the network graph, and stores the relevant parameters and the JSON string as a whole; among them, the relevant parameters on the network graph include network connection parameters, memory size of the container or virtual machine to be created, disk size, number of CPU cores, network type, installed components, and code version parameters;
[0014] The server receives instruction data from the web client to construct containers or virtual machines for nodes on the network graph, and queries and obtains the relevant parameter set for constructing the corresponding container or virtual machine based on the parameter type and parameter value in the instruction data; wherein, the relevant parameter set includes network graph ID, container or virtual machine identifier, container or virtual machine type, and relevant parameters on the network graph;
[0015] The server calls the command factory module, which, depending on the interface parameters called by the generator module, calls the virtual machine workshop module or the container workshop module. The virtual machine workshop module or the container workshop module then calls the corresponding adapter module to query the image of the corresponding repository and returns the result data.
[0016] The command factory module transmits the result data to the asynchronous communication controller and transmits the construction information data to the resource pool module.
[0017] The resource pool module selects the method of creating containers or virtual machines based on the construction information data, and uses the construction information data and the result data to create containers or virtual machines through the asynchronous communication controller.
[0018] The server uses the installation components and code version parameters obtained from the network graph data to install components and deploy code application packages to the created containers or virtual machines.
[0019] Preferably, the instruction data is an instruction to construct a container or virtual machine for multiple nodes on the network graph, or an instruction to construct a container or virtual machine for one node on the network graph.
[0020] Preferably, creating a container or virtual machine includes selecting a probe-free method and a probe method; wherein:
[0021] The probe-free method involves the resource pool module sending the build information data to the asynchronous communication controller. The asynchronous communication controller then contacts the physical computer managed by the resource pool module via SSH technology and sends a creation command to the physical computer based on the build information data and the result data. The physical computer then downloads the corresponding container or virtual machine image and performs the container or virtual machine creation operation based on the creation command.
[0022] The probe method involves the resource pool module sending the construction information data to the asynchronous communication controller. The asynchronous communication controller generates a creation command based on the construction information data and the result data, encrypts the creation command according to a specific format, and stores it in a cached Redis cluster. The probe agent retrieves the relevant data from the cached Redis, decrypts it, and executes the creation command.
[0023] Preferably, after the container or virtual machine is created, the resource pool module will continuously monitor the created container or virtual machine and transmit network data to the SDN. The SDN will then construct the network architecture between the containers or virtual machines based on the whitelist data sent.
[0024] The whitelist is generated by sending the IP addresses and port numbers of containers or virtual machines that can communicate to the SDN based on the network connection parameters in the drawn network graph.
[0025] Preferably, the server uses the installation components and code version parameters obtained from the network graph data to install components and deploy code application packages to the created container or virtual machine, including:
[0026] The server transmits the corresponding installation components from the network graph data to the remote installation microservice and transmits the code version parameters to the remote deployment microservice.
[0027] The remote installation microservice installs components in a container or virtual machine using the received installation components; the remote deployment microservice deploys the corresponding code application package in a container or virtual machine based on the code version parameters.
[0028] Preferred options also include:
[0029] The command parameters are sent to the main program on the server depending on whether the user selects to migrate all data from the database or to specify the data.
[0030] The main program calls the data migration microservice according to the instruction parameters. The data migration microservice reads the data from the database to be migrated through Spring Batch and Spark and writes it into the target database.
[0031] Preferably, it also includes: after the container or virtual machine is created, selecting the node to be suspended in the network graph, and suspending the container or virtual machine corresponding to the node by clicking the node;
[0032] After suspending a container or virtual machine, the resources occupied by the suspended container or virtual machine will be released. When suspended, the container or virtual machine records the current state of the virtual system, and the running state of the container or virtual machine when it was suspended can be restored by using Resume.
[0033] Secondly, this application provides an apparatus for building an environment based on virtualization technology, which adopts the following technical solution:
[0034] An apparatus for building an environment based on virtualization technology includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for building an environment based on virtualization technology as described in the first aspect.
[0035] Thirdly, this application provides a computer-readable storage medium, which adopts the following technical solution:
[0036] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for constructing an environment based on virtualization technology as described in the first aspect.
[0037] In summary, this application includes at least one of the following beneficial technical effects:
[0038] The embodiments of this application are simple to install and deploy, easy to operate, and have a low learning cost;
[0039] This application uses a network architecture diagram (network graph) or a version control method of the target system to suspend the image, which solves the problem of repeatedly requesting and reclaiming resources from the source, thereby alleviating this situation;
[0040] The network architecture diagram of this application corresponds to an image that can be suspended and resumed in batches. Version control of the target system can be integrated into this application, and it can be easily installed by dragging and dropping. This solves the problems of long deployment time and high complexity of the preparation environment based on the overall environment.
[0041] This application adopts a drag-and-drop method on the network graph for WYSIWYG deployment and generation of containers or virtual machines. Simply connect the container or virtual machine to be accessed at the front end by entering the port number (if no port number is entered, all ports will be open by default). The web client will send the IP address data to the main program of the server to call the SDN service. Then the two machines are configured with access control and can communicate with each other, regardless of whether the two machines are on the same network segment. It is very easy to set up the network and access control, thus solving the problems of low efficiency and errors caused by complex configuration. Attached Figure Description
[0042] Figure 1This is a block diagram illustrating a method for constructing an environment based on virtualization technology, as provided in an embodiment of this application.
[0043] Figure 2 This is a schematic diagram of a device for building an environment based on virtualization technology, provided in an embodiment of this application. Detailed Implementation
[0044] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1-2 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0045] The following provides explanations for some technical terms used in this application.
[0046] Microservices: A software development technique, a variant of Service-Oriented Architecture (SOA) that advocates dividing a single application into a set of small services that coordinate and cooperate with each other to provide end-user value. Each service runs in its own independent process, and services communicate with each other using lightweight communication mechanisms (usually HTTP-based RESTful APIs); each service is built around a specific business function and can be independently deployed to production, pre-production, etc.
[0047] SDN: A software-defined networking service.
[0048] This application uses the AntV-X6 framework (an open-source front-end framework) to implement drag-and-drop network graph drawing on the front end, and sends the graph to the backend service in JSON data format. After receiving the data, the backend service constructs the environment through a JSON parser, command factory, container workshop or virtual machine workshop, encryption module, SDN (a software-defined networking technology), and agent (a probe written in C language).
[0049] This application discloses a method for constructing an environment based on virtualization technology, referring to... Figure 1 ,include:
[0050] Step S100: The user draws the network graph of the overall environment using the AntV-X6 framework on the web, so as to create the corresponding containers or virtual machines on the graph; then the network graph is generated into a JSON string and sent to the server in JSON data format.
[0051] Step S200: The server uses a JSON parser to decompose the received JSON string to obtain relevant parameters on the network graph, realizing the serialization of network graph elements and converting the state information of relevant parameters on the network graph into a storable or transmittable form; then, the decomposed relevant parameters on the network graph and the complete JSON string are stored as a whole. In this embodiment, the relevant parameters on the network graph include, but are not limited to, network connection parameters, memory size of the container or virtual machine to be created, disk size, number of CPU cores, network type, installed components, code version parameters, etc.
[0052] Step S300: The user sends instruction data to the server via the web client to construct node containers or virtual machines on the network graph. The server parses the received instruction data to obtain the parameters of the container or virtual machine to be constructed on the network graph and transmits them to the generator. After receiving the parameters, the generator calls the combiner module according to the parameter type and parameter value (network graph ID). The combiner module queries and obtains the relevant parameter set for constructing the corresponding container or virtual machine based on the parameter value. In this embodiment, the instruction data sent by the user via the web client to construct node containers or virtual machines on the network graph can be an instruction to construct all node containers or virtual machines on the network graph as a whole, or it can be an instruction to construct a single node container or virtual machine on the network graph. There is no limitation here.
[0053] The relevant parameter set includes, but is not limited to, parameter values of the network graph, machine identifier (IP), type (virtual machine / container), and related parameters;
[0054] Step S400: Call the command factory module. The command factory module calls the virtual machine workshop module or the container workshop module according to the interface parameters called by the generator module (which the generator obtains by calling the combiner). The virtual machine workshop module or the container workshop module calls the corresponding adapter module to query the image of the corresponding repository and returns the result data. The result data mainly consists of container or virtual machine related information, including but not limited to the image address of the container or virtual machine, the image version number, and the operation command template data.
[0055] Step S500: The command factory module sends the result data returned by the container workshop or virtual machine workshop to the asynchronous communication controller (if the command is executed through the probe mode, the data needs to be stored in Redis; the asynchronous communication controller is a module of the main program that connects to Redis for communication), and transmits the build information data to the resource pool module.
[0056] In step S600, the resource pool module selects the method of creating a container or virtual machine based on the build information data, and creates the container or virtual machine using the build information data and result data through the asynchronous communication controller. In this embodiment, the resource pool module determines whether the existing resources meet the creation conditions of the container or virtual machine based on the build information data. Only if the conditions are met will the build information data be sent to the asynchronous communication controller. In this embodiment, the creation of containers or virtual machines includes selecting either a probe-free method or a probe-based method. In the probe-free method, the resource pool module sends build information data to the asynchronous communication controller. The asynchronous communication controller then contacts the physical computer managed by the resource pool module via SSH technology and sends a creation command to the physical computer based on the build information data and result data. This creation command is included in the build information data. The physical computer's creation command downloads the corresponding container or virtual machine image and performs operations such as creating the container or virtual machine; that is, the creation command at least includes instructions to download the corresponding container or virtual machine image and perform operations such as creating the container or virtual machine. In the probe-based method, the resource pool module sends build information data to the asynchronous communication controller. The asynchronous communication controller generates a creation command based on the build information data and result data, and encrypts the creation command according to a specific format (the specific format is customizable, such as storing the IP address as the key and the command data as the value) and stores it in the Redis cluster. The probe agent retrieves the relevant data from Redis, decrypts it, and executes the creation command.
[0057] After step S700, once the container or virtual machine is created, the resource pool module continuously monitors the created container or virtual machine and transmits network data (i.e., IP address and port number) to the SDN. The SDN constructs the network architecture between containers or virtual machines based on the whitelist data (IP address + port number). The whitelist is generated by sending the IP addresses and port numbers of containers or virtual machines that can communicate to the SDN based on the network connection parameters in the drawn network graph. The SDN stores this data and allows the corresponding containers or virtual machines to communicate according to the relationships given in the data. In this embodiment, the SDN is implemented through tunnel encapsulation technology using virtual network interface cards.
[0058] SDN stores this data and enables communication between corresponding containers or virtual machines according to the relationships given in the data. These relationships refer to the IP address mappings, such as 192.168.172.112 corresponding to 192.168.168.111. Once this IP address mapping is sent to SDN, the two containers or virtual machines can communicate. The port number specifies which port can be used for communication. For example, 192.168.172.112 corresponds to 192.168.168.111:880. After this mapping is sent to SDN, the container or virtual machine 192.168.172.112 can only access the container or virtual machine 192.168.168.111 through port 880; other ports are inaccessible.
[0059] In this embodiment, the resource pool module continuously monitors the created containers or virtual machines, primarily checking their online status and resource usage such as memory and disk usage. The data obtained from this monitoring determines the health of the containers or virtual machines and whether resource expansion is needed. The monitoring program is independent of the network architecture used to build the containers / virtual machines; the containers / virtual machines are created based on a pre-defined network architecture, and the resource pool module only monitors the created containers or virtual machines after they have been created.
[0060] In step S800, the server-side main program transmits the corresponding installation components from the network graph data (JSON string) to the remote installation microservice and the code version parameters to the remote deployment microservice. The remote installation microservice installs the components in a container or virtual machine using the received installation components; the remote deployment microservice deploys the corresponding code application package in a container or virtual machine according to the code version parameters. In this embodiment, the remote installation microservice is implemented using agent + shell script technology. The main program primarily interfaces with the web client, receiving and parsing data from the web client. The remote installation microservice and the remote deployment microservice are called by the main program and do not receive data from the web client.
[0061] The condition for triggering step S800 is that the user selects the installation component and the corresponding code version of the code application on the network graph. After the network graph is built, before generating the container or virtual machine, the user can select the middleware and code application. The main program will automatically execute step S800 after step S700. The user can also execute step S800 separately on the container or virtual machine that has been created before.
[0062] This application's embodiments simplify the operation of the web interface and reduce conceptual complexity, eliminating the need to learn specific concepts relevant to this method. For example, this embodiment divides users into four roles: operations and maintenance, phase leader, project leader, and project team user. The web interface operation and functionality for each role do not require extensive professional knowledge. The operations and maintenance role is designed for operations and maintenance personnel (the simplified interface allows even those with basic computer skills to operate it). The phase leader role is even simpler, requiring only a direct connection to the container or virtual machine to represent network communication. The project team leader role creates and deploys containers or virtual machines through drag-and-drop functionality. The project team user role can view the status of created containers or virtual machines, system user passwords, currently installed and deployed components, applications, and other information. Components and applications can be added or deleted by clicking.
[0063] In this embodiment, after the container or virtual machine is created, the user can select a node to be suspended in the network graph and suspend the container or virtual machine image of that node by clicking on the node. S800 mentions that code application packages can be deployed in the created container or virtual machine, i.e., deploying applications (the application deployed on each virtual machine can be different by selecting a version number). During the software development cycle, there is a SIT / UAT testing phase; this phase involves setting up a test environment for testing and bug fixing through repeated iterations. Due to the large number of versions and limited hardware resources, current practices involve redundant resource allocation or requiring a complete redeployment and setup of the machine environment each time a test version is switched. Suspending the container or virtual machine releases resources, allowing for the one-click generation of a new container or virtual machine for testing. Furthermore, suspending allows the container or virtual machine to record the current virtual system state, which can be restored to the running state selected when suspension was chosen, allowing for continued operation.
[0064] After suspending a container or virtual machine, the previously occupied CPU, memory, and other resources are released. For example, a physical computer might have 4 cores, 8GB of RAM, and 200GB of disk space. A virtual machine might be created with 2 cores, 4GB of RAM, and 100GB of disk space. At this point, the available resources on the physical computer equal the actual resources (4 cores, 8GB RAM, 200GB) minus the resources occupied by the virtual machine (2 cores, 4GB RAM, 100GB). After suspending the virtual machine image, the available resources on the physical computer return to the initial 4 cores, 8GB RAM, 200GB.
[0065] Container or virtual machine suspension and resumption are initiated after the container or virtual machine is created by clicking the suspension and resumption buttons on the web page. The server main program then notifies the corresponding server probe program, which in turn executes the suspension or resumption of the container or virtual machine.
[0066] This application embodiment also integrates a Git version repository and the Jenkins tool. It can extract the project code version number from the Git repository and display it on the web for users to select. After selecting the corresponding project version number, the program code corresponding to that version number will be retrieved from the Git repository, packaged (turned into an executable program) by the Jenkins tool, and then sent to the container or virtual machine to be deployed for execution.
[0067] In this embodiment, users can modify the configuration files of installation components and code application packages through a centralized configuration microservice. This centralized configuration microservice is implemented using agent, WebSocket, Redis, algorithm encryption, and file comparison technologies.
[0068] The data migration microservice is implemented using Spring Batch (a block-based batch framework) and Spark (a streaming batch framework). The main program sends command parameters to the selected database (either all data or specific data) based on the command parameters. The main program then calls the data migration microservice, which uses Spring Batch and Spark to read the data from the database to be migrated and write it to the target database.
[0069] This application also discloses an apparatus for building an environment based on virtualization technology, deployed in server-side and client-side systems; specifically, the apparatus includes: one or more processors and memory, such as... Figure 2 As shown, a processor 200 and a memory 100 are used as an example. The processor 200 and the memory 100 can be connected via a bus or other means, such as connecting via a bus.
[0070] The memory 100, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs, such as a method for building an environment based on virtualization technology in an embodiment of this application. The processor 200 implements the method for building an environment based on virtualization technology described in the embodiment of this application by running the non-transitory software program and instructions stored in the memory 100.
[0071] The memory 100 may include a program storage area and a data storage area. The program storage area may store applications required for operating the device and at least one function; the data storage area may store data required for executing a method for building an environment based on virtualization technology as described in the above embodiments. Furthermore, the memory 100 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0072] The non-transitory software programs and instructions required to implement the method for building an environment based on virtualization technology in the above embodiments are stored in memory. When executed by one or more processors, the method for building an environment based on virtualization technology in the above embodiments is executed, for example, the method described above is executed. Figure 1 The method steps S100 to S800.
[0073] In addition, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements steps S100 to S800, such as building an environment based on virtualization technology.
[0074] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features unless specifically stated otherwise. That is, unless specifically stated otherwise, each feature is only one example of a series of equivalent or similar features.
Claims
1. A method for constructing an environment based on virtualization technology, characterized in that, include: The server obtains a network graph in JSON data format; wherein, the network graph is a network graph of the overall environment drawn by the user through the AntV-X6 framework on the web client; The server uses a JSON parser to decompose the JSON string to obtain relevant parameters on the network graph, and stores the relevant parameters and the JSON string as a whole; among them, the relevant parameters on the network graph include network connection parameters, memory size of the container or virtual machine to be created, disk size, number of CPU cores, network type, installed components, and code version parameters; The server receives instruction data from the web client to construct containers or virtual machines for nodes on the network graph, and queries and obtains the relevant parameter set for constructing the corresponding container or virtual machine based on the parameter type and parameter value in the instruction data; wherein, the relevant parameter set includes network graph ID, container or virtual machine identifier, container or virtual machine type, and relevant parameters on the network graph; The server calls the command factory module, which, depending on the interface parameters called by the generator module, calls the virtual machine workshop module or the container workshop module. The virtual machine workshop module or the container workshop module then calls the corresponding adapter module to query the image of the corresponding repository and returns the result data. The command factory module transmits the result data to the asynchronous communication controller and transmits the construction information data to the resource pool module. The resource pool module selects the method for creating containers or virtual machines based on the build information data, and creates containers or virtual machines using the build information data and the result data through the asynchronous communication controller; the creation of containers or virtual machines includes selecting a probe-free method and a probe method; wherein: The probe-free method involves the resource pool module sending the build information data to the asynchronous communication controller. The asynchronous communication controller then contacts the physical computer managed by the resource pool module via SSH technology and sends a creation command to the physical computer based on the build information data and the result data. The physical computer then downloads the corresponding container or virtual machine image and performs the container or virtual machine creation operation based on the creation command. The probe method involves the resource pool module sending the construction information data to the asynchronous communication controller. The asynchronous communication controller generates a creation command based on the construction information data and the result data, encrypts the creation command according to a specific format, and stores it in the cached Redis cluster. The probe agent retrieves the relevant data from the cached Redis, decrypts it, and executes the creation command. The server uses the installation components and code version parameters obtained from the network graph data to install components and deploy code application packages to the created containers or virtual machines.
2. The method according to claim 1, characterized in that, The instruction data is an instruction to construct a container or virtual machine for multiple nodes on the network graph, or an instruction to construct a container or virtual machine for one node on the network graph.
3. The method according to claim 1, characterized in that, After the container or virtual machine is created, the resource pool module will continuously monitor the created container or virtual machine and transmit network data to the SDN. The SDN will then construct the network architecture between the containers or virtual machines based on the whitelist data sent. The whitelist is generated by sending the IP addresses and port numbers of containers or virtual machines that can communicate to the SDN based on the network connection parameters in the drawn network graph.
4. The method according to claim 1, characterized in that, The server uses the installation components and code version parameters obtained from network graph data to install components and deploy code application packages to the created containers or virtual machines, including: The server transmits the corresponding installation components from the network graph data to the remote installation microservice and transmits the code version parameters to the remote deployment microservice. The remote installation microservice installs components in a container or virtual machine using the received installation components; the remote deployment microservice deploys the corresponding code application package in a container or virtual machine based on the code version parameters.
5. The method according to claim 1, characterized in that, Also includes: The command parameters are sent to the main program on the server depending on whether the user selects to migrate all data from the database or to specify the data. The main program calls the data migration microservice according to the instruction parameters. The data migration microservice reads the data from the database to be migrated through Spring Batch and Spark and writes it into the target database.
6. The method according to claim 1, characterized in that, Also includes: After the container or virtual machine is created, select the node to be suspended in the network graph, and suspend the corresponding container or virtual machine by clicking on the node; After suspending a container or virtual machine, the resources occupied by the suspended container or virtual machine will be released. When suspended, the container or virtual machine records the current state of the virtual system, and the running state of the container or virtual machine when it was suspended can be restored by using Resume.
7. An apparatus for building an environment based on virtualization technology, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the program, it implements the method for constructing an environment based on virtualization technology as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method steps for building an environment based on virtualization technology as described in any one of claims 1-6.