Virtual machine template generation method and device, equipment, medium and program product

By dynamically generating and updating virtual machine templates in container clusters, the problem of cumbersome deployment process of container clusters is solved, and a plug-and-play deployment method is realized, which significantly accelerates the expansion of clusters and services.

CN119127404APending Publication Date: 2024-12-13CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411312283.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When the existing technology incorporates new container nodes into the container cluster, the expansion speed of the cluster and business is significantly limited due to the cumbersome deployment process.

Method used

By obtaining the virtual machine templates that the target container cluster depends on when it runs when it runs on, creating a virtual machine instance and building an isolated environment inside it, integrating container information and component information into the template, and generating plug-and-play virtual machines Template, dynamically update the template to adapt to cluster changes.

Benefits of technology

It simplifies the deployment process of container nodes, improves the expansion speed of clusters and services, and ensures that the templates always keep up with the latest status of container clusters and flexibly respond to business changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127404A_ABST
    Figure CN119127404A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual machine template generation method and device, equipment, a medium and a program product. The method comprises the following steps: acquiring a first virtual machine template from a virtual machine template warehouse and creating a first virtual machine instance; creating an isolation environment in the first virtual machine instance, and mounting the first virtual machine template to a root directory of the isolation environment; updating information of a first container and information of a first component which the target container cluster depends on when the target container cluster runs into a first virtual machine template under a root directory to obtain a second virtual machine template; and updating information of a second container and information of a second component which are newly added when the target container cluster runs into a second virtual machine template under the root directory to obtain a third virtual machine template. According to the embodiment of the invention, a dynamic virtual machine template generation mechanism is introduced, so that the complex process of incorporating the newly added container node into the container cluster is effectively simplified, the container expansion time is greatly shortened by a plug-and-play deployment mode, and the expansion speed of the cluster and the business is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer science and information technology, and in particular, relates to a method, device, equipment, medium and program product for generating a virtual machine template. Background Art

[0002] As a key infrastructure supporting large-scale distributed applications, the efficiency and flexibility of container cluster deployment, configuration and management have become the focus of enterprise attention. Container clusters are usually composed of multiple containers, each of which encapsulates an independent part of the application and its operating environment, and the container cluster is responsible for the orchestration, scheduling and resource allocation of these containers.

[0003] Currently, adding new container nodes to a container cluster involves tedious initialization and configuration work, including environment settings and installation of key components. When these container nodes are officially put into service, it takes time to initialize and pull container images. These operations inevitably slow down the expansion of clusters and services.

[0004] Therefore, when adding new container nodes to a container cluster, the existing technology has a cumbersome deployment process, which significantly limits the expansion speed of the cluster and business. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device, medium and program product for generating a virtual machine template, which can solve the problem in the prior art that when adding new container nodes to a container cluster, the expansion speed of the cluster and business is significantly limited due to the cumbersome deployment process.

[0006] In a first aspect, an embodiment of the present application provides a method for generating a virtual machine template, comprising:

[0007] Obtain a first virtual machine template from a virtual machine template repository, wherein the first virtual machine template is a virtual machine template that the target container cluster depends on when running;

[0008] Creating a first virtual machine instance based on the first virtual machine template;

[0009] Creating an isolated environment within the first virtual machine instance, and mounting the first virtual machine template to a root directory of the isolated environment;

[0010] Update the information of the first container and the first component that the target container cluster depends on at runtime to the first virtual machine template in the root directory to obtain a second virtual machine template, wherein the first component is the component that the first container depends on at runtime;

[0011] The information of the second container and the second component newly added during the operation of the target container cluster is updated to the second virtual machine template in the root directory to obtain a third virtual machine template, wherein the second component is a component that the second container depends on during operation.

[0012] In a possible embodiment of the first aspect, information about a second container and a second component newly added when the target container cluster is running is updated to a second virtual machine template in a root directory to obtain a third virtual machine template, including:

[0013] Setting the first version information corresponding to the second virtual machine template;

[0014] The second virtual machine template and its first version information are stored in the virtual machine template repository, and the second virtual machine template is unmounted in the root directory;

[0015] When a second container is added to the target container cluster, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository;

[0016] Mount the target second virtual machine template to the root directory;

[0017] The information of the second container and the second component newly added when the target container cluster is running is updated to the target second virtual machine template in the root directory to obtain a third virtual machine template.

[0018] In a possible embodiment of the first aspect, when a second container is added to a target container cluster, obtaining a target second virtual machine template corresponding to the latest first version information in a virtual machine template repository includes:

[0019] Obtain the container list of the target container cluster at runtime according to the preset period;

[0020] When there is a newly added second container in the container list, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository.

[0021] In a possible embodiment of the first aspect, obtaining a container list of a target container cluster when it is running according to a preset period includes:

[0022] According to the preset cycle, a request for obtaining the container list of the target container cluster when it is running is sent to the container management platform;

[0023] In response to the identity authentication instruction, sending identity authentication information to the container management platform, wherein the identity authentication instruction is generated by the container management platform after receiving the acquisition request;

[0024] When the container management platform passes the authentication information verification, obtain the container list of the target container cluster at runtime from the container management platform.

[0025] In a possible embodiment of the first aspect, the present invention further includes:

[0026] Setting the second version information corresponding to the third virtual machine template;

[0027] The third virtual machine template and its second version information are stored in the virtual machine template repository, and the third virtual machine template is unmounted in the root directory.

[0028] In a possible embodiment of the first aspect, the present invention further includes:

[0029] In response to the capacity expansion request, obtaining a target third virtual machine template corresponding to the latest second version information from a virtual machine template repository;

[0030] A second virtual machine instance is created based on the target third virtual machine template.

[0031] In a possible embodiment of the first aspect, before obtaining the first virtual machine template from the virtual machine template repository, the method further includes:

[0032] Obtain the image file of the operating system that the target container cluster depends on when running, and obtain the basic virtual machine template that the target container cluster depends on when running from the virtual machine template repository;

[0033] Create a basic virtual machine instance based on the basic virtual machine template;

[0034] Installing the image file of the operating system in the basic virtual machine instance and converting the basic virtual machine instance into a first virtual machine template;

[0035] The first virtual machine template is stored in a virtual machine template repository.

[0036] In a possible embodiment of the first aspect, obtaining a basic virtual machine template that a target container cluster depends on when running from a virtual machine template repository includes:

[0037] Get the identification information of the target container cluster;

[0038] In the virtual machine template repository, obtain the basic virtual machine template corresponding to the identification information.

[0039] In a possible embodiment of the first aspect, before installing the image file of the operating system in the basic virtual machine instance and converting the basic virtual machine instance into the first virtual machine template, the method further includes:

[0040] Get the basic configuration information of the virtual machines that the target container cluster depends on when running.

[0041] Configure the basic virtual machine instance based on the basic configuration information of the virtual machine.

[0042] In a possible embodiment of the first aspect, the information of the container includes image information of the container and parameter configuration information of the container.

[0043] Based on the same inventive concept, in a second aspect, an embodiment of the present application further provides a device for generating a virtual machine template, including:

[0044] An acquisition module, used to acquire a first virtual machine template from a virtual machine template repository, wherein the first virtual machine template is a virtual machine template that a target container cluster depends on when running;

[0045] A creation module, configured to create a first virtual machine instance based on the first virtual machine template;

[0046] A mounting module, used to create an isolated environment inside the first virtual machine instance and mount the first virtual machine template to the root directory of the isolated environment;

[0047] An update module, used to update information of a first container and information of a first component that the target container cluster depends on at runtime to a first virtual machine template under a root directory, to obtain a second virtual machine template, wherein the first component is a component that the first container depends on at runtime;

[0048] The update module is also used to update the information of the second container and the second component newly added when the target container cluster is running to the second virtual machine template under the root directory to obtain a third virtual machine template, wherein the second component is the component that the second container depends on when running.

[0049] Based on the same inventive concept, in the third aspect, an embodiment of the present application also provides a device for generating a virtual machine template, the device comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method for generating a virtual machine template in the first aspect or any embodiment of the first aspect is implemented.

[0050] Based on the same inventive concept, in the fourth aspect, an embodiment of the present application further provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method for generating a virtual machine template in the first aspect or any embodiment of the first aspect is implemented.

[0051] Based on the same inventive concept, in the fifth aspect, an embodiment of the present application also provides a computer program product. When the instructions in the computer program product are executed by the processor of the device, the device can execute the method for generating a virtual machine template in the first aspect or any embodiment of the first aspect.

[0052] The method, device, equipment, medium and program product for generating a virtual machine template of the embodiment of the present application retrieves and obtains a basic virtual machine template from a virtual machine template repository, which can be called a first virtual machine template. The first virtual machine template is designed for the operation requirements of a specific target container cluster. Subsequently, the first virtual machine template can be used to create a first virtual machine instance, and an independent isolation environment is constructed inside it, which effectively prevents system conflicts and resource contention. Next, the first virtual machine template is mounted to the root directory of the isolation environment, and further, according to the actual operation requirements of the container cluster, the information of the first container and its dependent components is integrated into the first virtual machine template to generate a second virtual machine template. The second virtual machine template directly maps the current operation status of the cluster, so that the virtual machine instance derived from the second virtual machine template can directly carry the container application, realize plug-and-play, and greatly improve the deployment efficiency and flexibility. At the same time, since the container dependency information has been integrated in the second virtual machine template, the system problems caused by missing dependencies or version mismatches are effectively avoided. Then, as the container cluster continues to develop and expand, the information of the newly added container and its dependent components (the second container and the second component) can be incorporated into and updated in the second virtual machine template, promoting the continuous iteration and optimization of the second virtual machine template, ensuring that the template always keeps up with the latest status of the container cluster and flexibly responds to business changes. Therefore, this application effectively simplifies the complex process of incorporating new container nodes into the container cluster by introducing a dynamic virtual machine template generation mechanism. The plug-and-play deployment method greatly shortens the time for container expansion and speeds up the expansion of clusters and businesses. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Other features, objects and advantages of the present application will become more apparent by reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings, in which the same or similar reference numerals represent the same or similar features and the accompanying drawings are not drawn to scale.

[0054] Figure 1 It is a flow chart of a method for generating a virtual machine template provided in an embodiment of the present application;

[0055] Figure 2 This is another flow chart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0056] Figure 3 It is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0057] Figure 4 This is another flow chart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0058] Figure 5 This is another flow chart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0059] Figure 6 It is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0060] Figure 7 It is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application;

[0061] Figure 8 It is a structural schematic diagram of a device for generating a virtual machine template provided in an embodiment of the present application;

[0062] Fig. 9 It is a structural diagram of a device for generating a virtual machine template provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0064] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0065] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0066] It is obvious to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit or scope of the present application. Therefore, the present application is intended to cover modifications and changes of the present application that fall within the scope of the corresponding claims (technical solutions for protection) and their equivalents. It should be noted that the implementation methods provided in the embodiments of the present application can be combined with each other without contradiction.

[0067] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0068] As a key infrastructure supporting large-scale distributed applications, the efficiency and flexibility of container cluster deployment, configuration and management have become the focus of enterprise attention. Container clusters are usually composed of multiple containers, each of which encapsulates an independent part of the application and its operating environment, and the container cluster is responsible for the orchestration, scheduling and resource allocation of these containers.

[0069] At present, incorporating new container nodes into a container cluster involves tedious initialization and configuration work, including but not limited to customization of the operating system, configuration of the network environment, setting of security policies, and installation and configuration of key components (such as databases, message queues, etc.). These steps usually need to be completed manually, which is time-consuming and error-prone. Including environment settings and installation of key components. When these container nodes are officially put into business carrying, it is still necessary to spend time to initialize and pull the container image. Since the container image required for the application needs to be pulled and initialized from the remote warehouse, for large applications, this may involve multiple images and a large amount of data, resulting in a long pulling process. These operations inevitably slow down the expansion of the cluster and business, and cannot quickly expand business needs. Therefore, when the relevant technology incorporates new container nodes into the container cluster, the expansion speed of the cluster and business is significantly limited due to the cumbersome deployment process.

[0070] Based on this, the embodiments of the present application provide a method, device, equipment, medium and program product for generating a virtual machine template, which can avoid cumbersome deployment processes through a plug-and-play deployment method when incorporating new container nodes into a container cluster, thereby improving the expansion speed of the cluster and business and meeting the needs of rapid business expansion.

[0071] The following is a detailed description of the method for generating a virtual machine template provided in an embodiment of the present application in conjunction with the accompanying drawings.

[0072] Figure 1 is a flow chart of a method for generating a virtual machine template provided in an embodiment of the present application, such as Figure 1 As shown, the method may include steps S110 to S150.

[0073] S110: Obtain a first virtual machine template from a virtual machine template repository, wherein the first virtual machine template is a virtual machine template that the target container cluster depends on during runtime.

[0074] The virtual machine template repository is a centralized repository for storing and managing virtual machine templates. The virtual machine template repository can be local or remote, such as in a cloud environment.

[0075] The first virtual machine template is a virtual machine template required by the target container cluster when running. The first virtual machine template is a pre-configured virtual machine image with an installed operating system, which is used to quickly deploy a new virtual machine instance.

[0076] A container cluster consists of multiple container nodes that work together to provide services.

[0077] Specifically, a first virtual machine template required by the target container cluster during runtime may be obtained from the virtual machine template repository.

[0078] S120: Create a first virtual machine instance based on the first virtual machine template.

[0079] The first virtual machine instance is a virtual machine instance created and run according to the first virtual machine template. A virtual machine instance is a complete computing system running in a virtual environment, which has its own processor, memory, storage and network resources, etc., and can be simulated on a physical machine through virtualization technology.

[0080] Specifically, based on the first virtual machine template, a virtual machine instance can be generated and started, and the virtual machine instance can be referred to as the first virtual machine instance. For example, the first virtual machine template pre-includes all necessary elements such as an operating system, software configuration, and network settings, so when the first virtual machine template is directly created based on the first virtual machine template, there is no need to manually install the operating system, configure the software, and set up the network.

[0081] S130: Create an isolation environment inside the first virtual machine instance, and mount the first virtual machine template to the root directory of the isolation environment.

[0082] An isolated environment refers to a logically independent, non-interfering operating environment created within a virtual machine instance. For example, the change root (chroot) technology can create an isolated operating environment so that processes running in the environment can only access files in its root directory and its subdirectories, but cannot access other files on the system.

[0083] Specifically, a logically independent and mutually non-interfering isolation environment can be created within the first virtual machine instance, providing an independent and secure workspace within the first virtual machine instance. Subsequently, the physical file system of the first virtual machine template is mounted to the root directory of the isolation environment, for example, the file information of the first virtual machine template is copied to the root directory of the isolation environment, so that the template configuration can be directly accessed and modified in the isolation environment.

[0084] S140, update the information of the first container and the first component that the target container cluster depends on during runtime to the first virtual machine template in the root directory to obtain a second virtual machine template, wherein the first component is the component that the first container depends on during runtime.

[0085] Among them, the system-level container can be called the first container.

[0086] The component that the first container depends on when running can be called the first component. The container dependent component (such as the first component) is a necessary external component or service that the container depends on when running normally, such as a database, a message queue, a cache service, etc.

[0087] The system-level container and its dependent components (such as the first container and its dependent first component) are relatively fixed and unchanged, and are used to provide a stable operating environment.

[0088] Specifically, the information of the system-level first container and its dependent components (i.e., the first component) required for its runtime in the target container cluster is integrated and updated into the physical file system of the first virtual machine template located in the root directory, thereby generating a second virtual machine template. This ensures that the second virtual machine instance created based on the second virtual machine template can directly support and run the first container, thereby simplifying the deployment and configuration process.

[0089] S150, update the information of the second container and the second component added during the operation of the target container cluster to the second virtual machine template in the root directory to obtain a third virtual machine template, wherein the second component is a component that the second container depends on during operation.

[0090] The newly added service-level container may be referred to as a second container.

[0091] The component that the second container runtime depends on may be referred to as a second component.

[0092] The newly added business-level container and its dependent components (such as the second container and its dependent second component) are relatively changed to flexibly respond to changes in business requirements.

[0093] Specifically, when the target container cluster is running, when a new container (i.e., the second container) and its dependent component (i.e., the second component) are added, the newly added second container information and second component information can be integrated and updated into the physical file system of the second virtual machine template that already exists in the root directory, thereby generating a new virtual machine template, i.e., the third virtual machine template.

[0094] The method for generating a virtual machine template provided in an embodiment of the present application retrieves and obtains a basic virtual machine template from a virtual machine template repository. The virtual machine template can be called a first virtual machine template, and the first virtual machine template is designed for the operation requirements of a specific target container cluster. Subsequently, the first virtual machine template can be used to create a first virtual machine instance, and an independent isolation environment is constructed inside it, effectively preventing system conflicts and resource contention. Next, the first virtual machine template is mounted to the root directory of the isolation environment, and further, according to the actual operation requirements of the container cluster, the information of the first container and its dependent components is integrated into the first virtual machine template to generate a second virtual machine template. The second virtual machine template directly maps the current operation status of the cluster, so that the virtual machine instance derived from the second virtual machine template can directly carry the container application, realize plug-and-play, and greatly improve the deployment efficiency and flexibility. At the same time, since the container dependency information has been integrated in the second virtual machine template, it effectively avoids system problems caused by missing dependencies or version mismatches. Then, as the container cluster continues to develop and expand, the information of the newly added container and its dependent components (the second container and the second component) can be incorporated into and updated in the second virtual machine template, promoting the continuous iteration and optimization of the second virtual machine template, ensuring that the template always keeps up with the latest status of the container cluster and flexibly responds to business changes. Therefore, this application effectively simplifies the complex process of incorporating new container nodes into the container cluster by introducing a dynamic virtual machine template generation mechanism. The plug-and-play deployment method greatly shortens the time for container expansion and speeds up the expansion of clusters and businesses.

[0095] Figure 2 This is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application.

[0096] In some embodiments, Figure 2 As shown, step S150 updates the information of the second container and the second component newly added when the target container cluster is running to the second virtual machine template under the root directory to obtain a third virtual machine template, which may include steps S151 to S155.

[0097] S151: Set first version information corresponding to the second virtual machine template.

[0098] The first version information is a version identifier allocated or specified for the second virtual machine template.

[0099] Specifically, assigning a version number or version identifier to the existing second virtual machine template can ensure that the correct second virtual machine template can be identified and applied when the second virtual machine template is used to deploy a virtual machine instance.

[0100] S152: Store the second virtual machine template and its first version information in the virtual machine template repository, and unmount the second virtual machine template in the root directory.

[0101] Specifically, the configured second virtual machine template and its version information are saved in the virtual machine template warehouse, and plug-and-play can be achieved if there is a need for expansion. At the same time, the physical file system of the second virtual machine template can be removed from the root directory of the isolation environment.

[0102] S153: When a second container is added to the target container cluster, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository.

[0103] Specifically, after a service-level second container is added to the target container cluster, a target second virtual machine template matching the latest first version information may be retrieved from the virtual machine template repository.

[0104] S154: Mount the target second virtual machine template to the root directory.

[0105] Specifically, the physical file system of the target second virtual machine template may be copied to the root directory of the isolation environment.

[0106] S155: Update the information of the second container and the second component newly added when the target container cluster is running to the target second virtual machine template in the root directory to obtain a third virtual machine template.

[0107] Specifically, after adding a business-level second container and its dependent second component to the target container cluster, the information of these newly added second containers and second components can be updated to the physical file system of the target second virtual machine template that has been mounted in the root directory, such as modifying the configuration file in the physical file system of the second virtual machine template, adding necessary software or library files, etc., to ensure that the second virtual machine template can support the operation of the new second container. After the update is completed, the original target second virtual machine template becomes a third virtual machine template containing the new second container and component information, providing the latest template foundation for subsequent virtual machine deployment.

[0108] The embodiment of the present application, through a series of steps such as setting version information, storing templates, obtaining the latest templates, mounting templates and updating template information, can automatically and efficiently generate virtual machine templates containing the latest container and component information as the container cluster continues to develop and expand, and obtain the third virtual machine template, thereby ensuring that the latest and most accurate template can be used when deploying new virtual machine instances, maintaining the consistency and latest status of the system, and improving the efficiency and accuracy of virtual machine deployment.

[0109] For example, after generating the second virtual machine template, save it to the virtual machine template warehouse first, and unmount the file in the root directory of the isolated environment. If there is a need to expand capacity at this time, you can directly obtain the second virtual machine template from the virtual machine template warehouse to achieve plug-and-play. When a new container is added, mount the second virtual machine template to the root directory, update the second virtual machine template, and obtain the third virtual machine template, ensuring that the template always keeps up with the latest status of the container cluster and flexibly responds to business changes.

[0110] It should be noted that, in the embodiment of the present application, since the isolation environment is deployed in the first virtual machine instance, and the first virtual machine instance is created by the first virtual machine template that the target container cluster depends on during runtime, the generated third virtual machine template has better compatibility and can be more smoothly integrated into the target container cluster and support the operation of new containers and components.

[0111] In some embodiments, when a second container is added to the target container cluster, step S153 obtains a target second virtual machine template corresponding to the latest first version information in the virtual machine template repository, which may include steps S1531 and S1532.

[0112] S1531, according to a preset period, obtain a container list when the target container cluster is running.

[0113] Specifically, according to a pre-set time period (such as every minute, hour, day, week, or month, etc.), the current container list can be automatically retrieved and obtained from the operating environment of the target container cluster. The container list can be a container list that records in detail the information of all containers running in the target container cluster, including but not limited to the name, version, operating status, dependencies, etc. of the container. In this way, the system can regularly monitor and understand the composition and changes of the container cluster.

[0114] S1532: When there is a newly added second container in the container list, obtain a target second virtual machine template corresponding to the latest first version information in the virtual machine template repository.

[0115] Specifically, when regularly checking the container list of the target container cluster, if it is found that a new container that did not exist before (i.e., the second container) is added to the container list, the target second virtual machine template corresponding to the latest first version information will be automatically searched from the virtual machine template repository to ensure that the latest version of the second virtual machine template is retrieved from the virtual machine template repository.

[0116] The embodiment of the present application can easily monitor the composition changes of the container cluster, including the addition of new containers, the removal of old containers, and the change of container status, by obtaining a real-time or regularly updated, detailed container inventory record, so as to trigger the execution of steps S154 and S155 when the status changes, mount the target second virtual machine template to the root directory, and update the information of the second container and the second component added when the target container cluster is running to the target second virtual machine template under the root directory. If the old container is removed, it can also be removed from the target second virtual machine template accordingly, so as to obtain the third virtual machine template. Therefore, with the continuous development and expansion of the container cluster, the continuous iteration and optimization of the second virtual machine template can be promoted, ensuring that the template always keeps up with the latest status of the container cluster and flexibly responds to the needs of business changes.

[0117] Figure 3 This is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application.

[0118] In some embodiments, Figure 3 As shown, step S1531 obtains the container list of the target container cluster when it is running according to a preset period, and may include steps S15311 to S15313.

[0119] S15311: Send a request to the container management platform for obtaining the container list of the target container cluster when it is running according to a preset period.

[0120] Specifically, a request may be automatically sent to the container management platform according to a preset time period to request a container list of the target container cluster during the current runtime.

[0121] S15312, in response to the identity authentication instruction, sending identity authentication information to the container management platform, wherein the identity authentication instruction is generated by the container management platform after receiving the acquisition request.

[0122] When the container management platform receives a request to obtain the runtime container list of the target container cluster, the container management platform generates an authentication instruction to confirm the identity and authority of the requester.

[0123] Specifically, upon receiving the authentication instruction returned by the container management platform, the authentication information can be sent to the container management platform, which can ensure that only authorized users or systems can successfully obtain the container list of the container cluster, thereby protecting the data security and privacy of the cluster.

[0124] S15313, when the container management platform passes the authentication information verification, obtain the container list of the target container cluster when it is running from the container management platform.

[0125] Specifically, when the container management platform receives the authentication information, it will conduct a strict check to confirm whether the identity and permissions of the requester meet the requirements. If the check passes, that is, it confirms that the requester has the right to access the container list of the target container cluster, then the container management platform will allow the requester to retrieve and obtain the container list of the target container cluster at the current runtime from the container management platform. Among them, the requester is the system that generates the virtual machine template.

[0126] The embodiment of the present application ensures that only authorized systems or users can obtain the real-time container list of the target container cluster through the identity authentication information verification process, which not only ensures the real-time and accuracy of the data, but also enhances the security of data access and effectively prevents unauthorized access and data leakage.

[0127] Figure 4 This is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application.

[0128] In some embodiments, Figure 4 As shown, the method for generating a virtual machine template may further include steps S161 and S162.

[0129] S161: Set second version information corresponding to the third virtual machine template.

[0130] Specifically, version information is configured for the third virtual machine template, and the version information may be referred to as second version information.

[0131] S162: Store the third virtual machine template and its second version information in the virtual machine template repository, and unmount the third virtual machine template in the root directory.

[0132] Specifically, the set third virtual machine template and its corresponding second version information are stored in the virtual machine template warehouse for subsequent use in capacity expansion. At the same time, in order to keep the file system clean and avoid potential conflicts, the third virtual machine template will be unmounted in the root directory to ensure that the data in the template warehouse will not be affected by misoperation, which helps maintain the integrity and consistency of the virtual machine template version and improves the security and efficiency of template management.

[0133] In some embodiments, you can continue to see Figure 4 The method for generating a virtual machine template may further include steps S171 and S172.

[0134] S171, in response to the capacity expansion request, obtaining a target third virtual machine template corresponding to the latest second version information from a virtual machine template repository.

[0135] Specifically, when a capacity expansion request of a target container cluster is received, the latest version of the target third virtual machine template may be retrieved and obtained from the warehouse storing the third virtual machine template.

[0136] S172: Create a second virtual machine instance based on the target third virtual machine template.

[0137] Specifically, a new virtual machine instance is created based on the target third virtual machine template, and the virtual machine instance may be referred to as a second virtual machine instance.

[0138] When receiving a request to expand the target container cluster, the embodiment of the present application automatically obtains the latest target third virtual machine template from the virtual machine template repository and creates a new third virtual machine instance accordingly. It can simplify the complex process of incorporating new container nodes into the container cluster, and the plug-and-play deployment method greatly shortens the time for container expansion and speeds up the expansion of clusters and businesses.

[0139] Figure 5 This is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application.

[0140] In some embodiments, Figure 5 As shown, before obtaining the first virtual machine template from the virtual machine template repository in step S110, the method for generating a virtual machine template may further include steps S181 to S184.

[0141] S181, obtain an image file of the operating system that the target container cluster depends on when running, and obtain a basic virtual machine template that the target container cluster depends on when running from a virtual machine template repository.

[0142] Among them, the basic virtual machine template provides predefined configurations, software, and hardware resources for creating virtual machine instances, and is the basis for the virtualization environment required to deploy container clusters.

[0143] The image file of the operating system that the target container cluster depends on during operation contains the operating system itself and its necessary configurations, and is the basic environment for the container cluster to run.

[0144] Specifically, an image file of an operating system that the target container cluster depends on when running is obtained, and a basic virtual machine template that the target container cluster depends on when running is selected from a virtual machine template repository.

[0145] S182: Create a basic virtual machine instance based on the basic virtual machine template.

[0146] Specifically, a new virtual machine instance is quickly generated using a predefined basic virtual machine template that includes specific configurations, software environment, and hardware resources. The virtual machine instance may be referred to as a basic virtual machine instance.

[0147] S183: Install the image file of the operating system in the basic virtual machine instance, and convert the basic virtual machine instance into a first virtual machine template.

[0148] Specifically, after the basic virtual machine instance is created, the operating system image file is installed into the basic virtual machine instance, and then it can be converted into a first virtual machine template. The first virtual machine template not only contains the basic virtual machine configuration, but also integrates the operating system environment required for the target container cluster to run, providing a standardized foundation for subsequent rapid deployment and expansion of container clusters.

[0149] S184: Store the first virtual machine template in a virtual machine template repository.

[0150] Specifically, the first virtual machine template is stored in a virtual machine template repository.

[0151] The embodiment of the present application can significantly improve the efficiency and standardization of container cluster deployment by obtaining a basic virtual machine template from a virtual machine template repository, creating a basic virtual machine instance, installing an operating system image and converting it into a first virtual machine template, and then storing the first virtual machine template back to the virtual machine template repository.

[0152] In some embodiments, obtaining the basic virtual machine template that the target container cluster depends on at runtime from the virtual machine template repository in step S181 may include steps S1811 and S1812.

[0153] S1811. Obtain identification information of the target container cluster.

[0154] Specifically, identification information for uniquely identifying the target container cluster is obtained.

[0155] S1812: Obtain a basic virtual machine template corresponding to the identification information in a virtual machine template repository.

[0156] Specifically, in the virtual machine template warehouse, obtain the basic virtual machine template corresponding to the identification information. For example, in the virtual machine template warehouse, obtain the basic virtual machine template corresponding to the target container cluster IP.

[0157] The embodiment of the present application first obtains identification information of the target container cluster, which is used to uniquely identify the target container cluster; then based on the identification information, the corresponding basic virtual machine template can be quickly searched and obtained in the virtual machine template repository.

[0158] Figure 6 This is another flowchart of the method for generating a virtual machine template provided in an embodiment of the present application.

[0159] In some embodiments, Figure 6 As shown, before installing the image file of the operating system in the basic virtual machine instance and converting the basic virtual machine instance into the first virtual machine template in step S183, the method for generating the virtual machine template may further include steps S185 and S186.

[0160] S185, obtaining basic configuration information of virtual machines that the target container cluster depends on during runtime.

[0161] Specifically, obtaining the basic configuration information of the virtual machines that the target container cluster relies on during runtime means collecting or determining the underlying virtual machine settings and parameters necessary for the target container cluster to run smoothly, such as CPU, memory, storage resource allocation, network configuration, security settings, and other options. It can provide appropriate resource guarantees and configuration support for the virtual machine environment deployed in the container cluster, thereby meeting various requirements of the container cluster during runtime.

[0162] S186: Configure the basic virtual machine instance based on the basic configuration information of the virtual machine.

[0163] Specifically, based on the basic configuration information of the virtual machine, the basic virtual machine instance is configured, such as allocating necessary computing resources (such as CPU and memory), configuring storage and network interfaces, and installing or enabling necessary operating system components and services, etc., to ensure that the virtual machine instance can meet the specific requirements of the target container cluster during runtime.

[0164] The embodiment of the present application obtains the basic configuration information of the virtual machine of the target container cluster and performs basic configuration on the basic virtual machine instance accordingly, thereby ensuring that the virtual machine template can provide resource guarantee and configuration support for the container cluster.

[0165] In some embodiments, the container information includes image information of the container and parameter configuration information of the container.

[0166] In the embodiment of the present application, the information of the container covers the image information of the container and the parameter configuration information of the container. The image information of the container refers to the basic image required for the container to run, which contains the necessary elements such as application code, dependent libraries, and environment variables required for the container to run. The parameter configuration information of the container refers to the settings used to customize the running behavior of the container, such as CPU and memory resource limits, port mappings, environment variable configurations, startup commands, etc. These parameters enable the container to run as expected and meet certain application or service requirements.

[0167] In one example, if Figure 7 As shown, the method for generating a virtual machine template may include steps S01 to S11.

[0168] S01, obtaining the image file of the operating system, the basic virtual machine template, and the basic configuration information of the virtual machine that the target container cluster depends on when running.

[0169] S02, based on the basic configuration information of the virtual machine, configure the basic virtual machine instance, and install the image file of the operating system in the basic virtual machine instance, complete the initialization of the basic environment and components of the virtual machine, generate a first virtual machine template and store it in the virtual machine template warehouse.

[0170] S03: Obtain, from a virtual machine template repository, a first virtual machine template that the target container cluster depends on when running.

[0171] S04: Create an isolation environment inside the first virtual machine instance, and mount the first virtual machine template to the root directory of the isolation environment.

[0172] In an isolated environment, the virtual machine template file is mounted based on the file system level to directly modify the physical file system of the virtual system without actually running the virtual machine image template. For example, a change root (chroot) isolation environment is built inside the first virtual machine instance. The first virtual machine instance is a virtual machine with an operating system consistent with the container cluster platform. An isolated file system environment is created based on chroot to dynamically generate virtual machine templates. The chroot environment allows multiple isolated file system environments to be simulated on the same virtual machine instance, so that different isolation environments can be used to generate virtual machine templates for different target container clusters.

[0173] S05: Update information about the first container that the target container cluster depends on during runtime and information about the first component that it depends on to the first virtual machine template in the root directory to obtain a second virtual machine template.

[0174] In one example, the second virtual machine template may be packaged according to timestamps and stored in a virtual machine template repository.

[0175] S06: Store the second virtual machine template and its first version information in the virtual machine template repository, and unmount the second virtual machine template in the root directory.

[0176] S07: When a second container is added to the target container cluster, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository and the target second virtual machine template is mounted to the root directory.

[0177] S08: Update the information of the second container and the second component newly added when the target container cluster is running to the target second virtual machine template in the root directory to obtain a third virtual machine template.

[0178] S09: Store the third virtual machine template and its second version information in the virtual machine template repository, unmount the third virtual machine template in the root directory, and exit the chroot isolation environment.

[0179] S10, in response to the capacity expansion request, obtaining a target third virtual machine template corresponding to the latest second version information from a virtual machine template repository.

[0180] S11, creating a second virtual machine instance based on the target third virtual machine template.

[0181] For example, by integrating the resources of the Infrastructure as a Service (IaaS) platform and the Platform as a Service (PaaS), uploading virtual machine templates to the virtual machine template repository of the Infrastructure as a Service (IaaS) platform, combining virtual machine template generation with container cluster expansion optimization, breaking through the boundaries of the IaaS platform and the PaaS platform, and implementing an integrated, cross-platform cluster node deployment method to improve overall efficiency.

[0182] The embodiment of the present application realizes efficient and flexible container cluster node deployment and expansion by dynamically generating and updating virtual machine templates and combining the resources of IaaS and PaaS platforms, which can significantly improve cluster deployment efficiency and quickly respond to changes in business needs, while reducing operation and maintenance costs and resource waste, and improving business stability and user experience.

[0183] Based on the same inventive concept, the embodiment of the present application also provides a device for generating a virtual machine template, such as Figure 8 As shown, the device 800 may include an acquisition module 810 , a creation module 820 , a mounting module 830 and an update module 840 .

[0184] The acquisition module 810 is used to acquire a first virtual machine template from a virtual machine template repository, wherein the first virtual machine template is a virtual machine template that the target container cluster depends on when running;

[0185] A creation module 820, configured to create a first virtual machine instance based on the first virtual machine template;

[0186] The mounting module 830 is used to create an isolation environment inside the first virtual machine instance and mount the first virtual machine template to the root directory of the isolation environment;

[0187] An update module 840 is used to update information of a first container and information of a first component that the target container cluster depends on at runtime to a first virtual machine template in a root directory, to obtain a second virtual machine template, wherein the first component is a component that the first container depends on at runtime;

[0188] The update module 840 is also used to update the information of the second container and the second component added when the target container cluster is running to the second virtual machine template under the root directory to obtain a third virtual machine template, wherein the second component is the component that the second container depends on when running.

[0189] The virtual machine template generation device provided in the embodiment of the present application retrieves and obtains a basic virtual machine template from the virtual machine template repository. The virtual machine template can be called a first virtual machine template. The first virtual machine template is designed for the operation requirements of a specific target container cluster. Subsequently, the first virtual machine template can be used to create a first virtual machine instance, and an independent isolation environment is constructed inside it, which effectively prevents system conflicts and resource contention. Next, the first virtual machine template is mounted to the root directory of the isolation environment, and further according to the actual operation requirements of the container cluster, the information of the first container and its dependent components is integrated into the first virtual machine template to generate a second virtual machine template. The second virtual machine template directly maps the current operation status of the cluster, so that the virtual machine instance derived from the second virtual machine template can directly carry the container application, realize plug-and-play, and greatly improve the deployment efficiency and flexibility. At the same time, since the container dependency information has been integrated in the second virtual machine template, it effectively avoids system problems caused by missing dependencies or version mismatches. Then, as the container cluster continues to develop and expand, the information of the newly added container and its dependent components (the second container and the second component) can be incorporated into and updated in the second virtual machine template, promoting the continuous iteration and optimization of the second virtual machine template, ensuring that the template always keeps up with the latest status of the container cluster and flexibly responds to business changes. Therefore, this application effectively simplifies the complex process of incorporating new container nodes into the container cluster by introducing a dynamic virtual machine template generation mechanism. The plug-and-play deployment method greatly shortens the time for container expansion and speeds up the expansion of clusters and businesses.

[0190] In some embodiments, the update module is used to update the information of the second container and the second component added when the target container cluster is running to the second virtual machine template under the root directory to obtain a third virtual machine template, which can be specifically used to:

[0191] Setting the first version information corresponding to the second virtual machine template;

[0192] The second virtual machine template and its first version information are stored in the virtual machine template repository, and the second virtual machine template is unmounted in the root directory;

[0193] When a second container is added to the target container cluster, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository;

[0194] Mount the target second virtual machine template to the root directory;

[0195] The information of the second container and the second component newly added when the target container cluster is running is updated to the target second virtual machine template in the root directory to obtain a third virtual machine template.

[0196] In some embodiments, the update module is used to obtain the target second virtual machine template corresponding to the latest first version information in the virtual machine template repository when a second container is added to the target container cluster. Specifically, it can be used to:

[0197] Obtain the container list of the target container cluster at runtime according to the preset period;

[0198] When there is a newly added second container in the container list, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository.

[0199] In some embodiments, the update module is used to obtain a container list of the target container cluster when it is running according to a preset period, which can be specifically used to:

[0200] According to the preset cycle, a request for obtaining the container list of the target container cluster when it is running is sent to the container management platform;

[0201] In response to the identity authentication instruction, sending identity authentication information to the container management platform, wherein the identity authentication instruction is generated by the container management platform after receiving the acquisition request;

[0202] When the container management platform passes the authentication information verification, obtain the container list of the target container cluster at runtime from the container management platform.

[0203] In some embodiments, a setting module and a release module are also included:

[0204] A setting module, used to set the second version information corresponding to the third virtual machine template;

[0205] The release module is used to store the third virtual machine template and its second version information in the virtual machine template repository, and release the mounting of the third virtual machine template in the root directory.

[0206] In some embodiments, it also includes:

[0207] The acquisition module is further used to obtain, in response to the capacity expansion request, a target third virtual machine template corresponding to the latest second version information from the virtual machine template repository;

[0208] The creation module is also used to create a second virtual machine instance based on the target third virtual machine template.

[0209] In some embodiments, before the acquisition module is used to acquire the first virtual machine template from the virtual machine template warehouse, the device further includes an installation module and a storage module:

[0210] The acquisition module is also used to obtain the image file of the operating system that the target container cluster depends on when running, and obtain the basic virtual machine template that the target container cluster depends on when running from the virtual machine template repository;

[0211] The creation module is also used to create a basic virtual machine instance based on the basic virtual machine template;

[0212] An installation module, used to install the image file of the operating system in the basic virtual machine instance and convert the basic virtual machine instance into a first virtual machine template;

[0213] The storage module is used to store the first virtual machine template in a virtual machine template repository.

[0214] In some embodiments, the acquisition module is used to acquire the basic virtual machine template that the target container cluster depends on when running from the virtual machine template repository, and can be specifically used to:

[0215] Get the identification information of the target container cluster;

[0216] In the virtual machine template repository, obtain the basic virtual machine template corresponding to the identification information.

[0217] In some embodiments, before the installation module is used to install the image file of the operating system in the basic virtual machine instance and convert the basic virtual machine instance into the first virtual machine template, the apparatus further includes:

[0218] The acquisition module is also used to obtain the basic configuration information of the virtual machines that the target container cluster depends on when running;

[0219] The configuration module is used to configure the basic virtual machine instance based on the basic configuration information of the virtual machine.

[0220] In some embodiments, the container information includes image information of the container and parameter configuration information of the container.

[0221] Each module in the device for generating a virtual machine template provided in the embodiment of the present application can realize Figures 1 to 7 The functions of each step of the provided method for generating a virtual machine template and the ability to achieve the corresponding technical effects are described briefly and will not be repeated here.

[0222] Fig. 9 A schematic diagram of the hardware structure of a device for generating a virtual machine template provided in an embodiment of the present application is shown.

[0223] The virtual machine template generation device may include a processor 901 and a memory 902 storing computer program instructions.

[0224] Specifically, the processor 901 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0225] The memory 902 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 902 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 902 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 902 may be inside or outside the generation device of the virtual machine template. In a particular embodiment, the memory 902 is a non-volatile solid-state memory.

[0226] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.

[0227] The processor 901 implements any one of the methods for generating a virtual machine template in the above embodiments by reading and executing computer program instructions stored in the memory 902 .

[0228] In one example, the virtual machine template generation device may further include a communication interface 903 and a bus 904. Fig. 9 As shown, the processor 901, the memory 902, and the communication interface 903 are connected via a bus 904 and communicate with each other.

[0229] The communication interface 903 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0230] Bus 904 includes hardware, software or both, and couples the components of the generation device of the virtual machine template to each other. For example, but not limitation, the bus may include an accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, a front side bus (Front Side Bus, FSB), a hypertransport (Hyper Transport, HT) interconnection, an industry standard architecture (Industry Standard Architecture, ISA) bus, an infinite bandwidth interconnection, a low pin count (Linear Predictive Coding, LPC) bus, a memory bus, a micro channel architecture (MicroChannel Architecture, MCA) bus, a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a serial advanced technology attachment (Serial Advanced Technology Attachment, SATA) bus, a video electronics standard association local (VESA Local Bus, VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, bus 904 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0231] The device can execute the method for generating a virtual machine template in the embodiment of the present application based on each unit / component in the generation device of the virtual machine template, thereby realizing the combination of Figures 1 to 7 Describes a method for generating a virtual machine template.

[0232] In addition, in combination with the method for generating a virtual machine template in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any method for generating a virtual machine template in the above embodiment is implemented.

[0233] The present application also provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes each process of implementing any one of the above-mentioned embodiments of the method for generating a virtual machine template.

[0234] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0235] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (Read-Only Memory, ROM), flash memory, erasable read-only memory (Erasable Read Only Memory, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0236] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0237] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0238] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A method for generating a virtual machine template, characterized in that: include: Obtain a first virtual machine template from a virtual machine template repository, wherein the first virtual machine template is a virtual machine template that the target container cluster depends on when running; Creating a first virtual machine instance based on the first virtual machine template; Creating an isolated environment within the first virtual machine instance, and mounting the first virtual machine template to a root directory of the isolated environment; Update the information of the first container and the first component that the target container cluster depends on at runtime to the first virtual machine template under the root directory to obtain a second virtual machine template, wherein the first component is the component that the first container depends on at runtime; Update the information of the second container and the second component newly added when the target container cluster is running to the second virtual machine template under the root directory to obtain a third virtual machine template, wherein the second component is the component that the second container depends on when running.

2. The method according to claim 1, characterized in that The updating of the information of the second container and the second component added when the target container cluster is running to the second virtual machine template under the root directory to obtain the third virtual machine template includes: Setting first version information corresponding to the second virtual machine template; Storing the second virtual machine template and the first version information thereof in the virtual machine template repository, and unmounting the second virtual machine template in the root directory; When a second container is added to the target container cluster, obtaining a target second virtual machine template corresponding to the latest first version information in the virtual machine template repository; Mounting the target second virtual machine template into the root directory; Update the information of the second container and the second component newly added when the target container cluster is running to the target second virtual machine template under the root directory to obtain a third virtual machine template.

3. The method according to claim 2, characterized in that In the case where a second container is added to the target container cluster, obtaining a target second virtual machine template corresponding to the latest first version information in the virtual machine template repository includes: Obtaining a container list of the target container cluster when it is running according to a preset period; When there is a newly added second container in the container list, a target second virtual machine template corresponding to the latest first version information is obtained in the virtual machine template repository.

4. The method according to claim 3, characterized in that The obtaining, according to a preset period, a container list of the target container cluster when it is running, includes: Sending a request for obtaining a container list of the target container cluster when it is running to the container management platform according to a preset period; In response to the identity authentication instruction, sending identity authentication information to the container management platform, wherein the identity authentication instruction is generated by the container management platform after receiving the acquisition request; When the container management platform verifies the identity authentication information successfully, a container list of the target container cluster when it is running is obtained from the container management platform.

5. The method according to claim 1, characterized in that Also includes: Setting the second version information corresponding to the third virtual machine template; The third virtual machine template and the second version information thereof are stored in the virtual machine template repository, and the third virtual machine template is unmounted from the root directory.

6. The method according to claim 5, characterized in that Also includes: In response to the capacity expansion request, obtaining, from the virtual machine template repository, a target third virtual machine template corresponding to the latest second version information; A second virtual machine instance is created based on the target third virtual machine template.

7. The method according to claim 1, characterized in that Before obtaining the first virtual machine template from the virtual machine template repository, the method further includes: Obtain an image file of the operating system that the target container cluster depends on when running, and obtain a basic virtual machine template that the target container cluster depends on when running from the virtual machine template repository; Creating a basic virtual machine instance based on the basic virtual machine template; Installing the image file of the operating system in the basic virtual machine instance, and converting the basic virtual machine instance into a first virtual machine template; The first virtual machine template is stored in the virtual machine template repository.

8. The method according to claim 7, characterized in that The obtaining, from the virtual machine template repository, a basic virtual machine template on which the target container cluster depends when running, includes: Obtaining identification information of the target container cluster; In the virtual machine template repository, a basic virtual machine template corresponding to the identification information is obtained.

9. The method according to claim 7, characterized in that: Before installing the image file of the operating system in the basic virtual machine instance and converting the basic virtual machine instance into a first virtual machine template, the method further includes: Obtain basic configuration information of virtual machines that the target container cluster depends on when running; Based on the basic virtual machine configuration information, the basic virtual machine instance is configured.

10. The method according to any one of claims 1 to 9, characterized in that: The container information includes container image information and container parameter configuration information.

Citation Information

Cited By

  • Virtual machine template library construction method and system for active medical instrument software detection

    CN121996357A