Virtual machine startup methods based on container images, server clusters, and servers.

By using a custom virtual machine controller and agent components, container images are converted into virtual machine images, solving the problem of low resource utilization due to fixed virtual machine image formats, and achieving efficient resource sharing and the integrity of virtual machine functions.

CN118227266BActive Publication Date: 2026-11-17XFUSION DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410399688.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-03
Publication Date
2026-11-17
Estimated Expiration
2044-04-03

AI Technical Summary

Technical Problem

In existing technologies, virtual machine image formats are fixed and cannot be used directly as container images, resulting in low resource utilization and increased development and maintenance costs due to repeated image creation.

Method used

By using custom virtual machine controllers and virtual machine agent components, the conversion from container images to virtual machine images can be achieved, container image resources can be shared, and resource utilization can be improved.

Benefits of technology

It achieves complete virtual machine functionality and rational utilization of resources, avoids resource duplication and waste, and improves virtual machine startup speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118227266B_ABST
    Figure CN118227266B_ABST
Patent Text Reader

Abstract

This application discloses a method for starting a virtual machine based on a container image, a server cluster, and a server. The method includes: a first server obtaining a first virtual machine startup request, the first virtual machine startup request being used to request starting a virtual machine based on a container image; the first server responding to the first virtual machine startup request, determining a second server, and sending a second virtual machine startup request to the second server, the second virtual machine startup request being used to instruct the second server to respond to the second virtual machine startup request, obtain a container image, create a virtual machine image based on the container image, and start the virtual machine based on the virtual machine image. In this way, virtual machines can share container images, improving resource utilization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of server technology, specifically to a virtual machine startup method based on container images, server clusters, and servers. Background Technology

[0002] While an increasing number of applications are being deployed in containers, a significant number still require virtual machines to run due to security or operating system version issues. Therefore, to facilitate easier virtual machine deployment, images can be used for rapid deployment.

[0003] Currently, deploying virtual machines via images involves starting a streamlined virtual machine using a fixed format. Virtual machines deployed in this way lack complete functionality, and because the virtual machine image format is fixed, existing container images cannot be used directly.

[0004] Therefore, how to achieve complete virtual machine deployment and improve resource utilization through container images has become an urgent technical problem to be solved. Summary of the Invention

[0005] This application provides a virtual machine startup method based on container images, a server cluster, and a server, which can enable virtual machines to share container images and improve resource utilization.

[0006] In a first aspect, embodiments of this application disclose a virtual machine startup method based on a container image, applied to a first server. The method includes: the first server obtaining a first virtual machine startup request, the first virtual machine startup request being used to request startup of a virtual machine based on a container image; the first server responding to the first virtual machine startup request, determining a second server, and sending a second virtual machine startup request to the second server, the second virtual machine startup request being used to instruct the second server to start a virtual machine, wherein the second server responding to the second virtual machine startup request, obtaining a container image, creating a virtual machine image based on the container image, and starting the virtual machine based on the virtual machine image.

[0007] In this technical solution, a virtual machine image can be created from a container image using a second server, thereby enabling virtual machines to share the container image and improving resource utilization.

[0008] In one embodiment, the first virtual machine startup request includes one or more of the following: container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information.

[0009] This technical solution can clearly indicate the commands output by the user, which may include container image instruction information, making it easier to share container images.

[0010] In one embodiment, the first server responds to the first virtual machine startup request, determines a second server, and sends a second virtual machine startup request to the second server, including: the first server determines the second server from a server cluster, the server cluster running a container cluster management system Kubernetes (K8S); the first server sends a second virtual machine startup request to the K8S, the second virtual machine startup request being determined based on the first virtual machine startup request; the first server sends the second virtual machine startup request to the K8S, so that the second server listens to the K8S to obtain the second virtual machine startup request.

[0011] In this technical solution, the second server can be flexibly determined from the server cluster, improving the virtual machine startup speed. At the same time, the second virtual machine request is determined based on the first virtual machine request, ensuring data integrity and enabling the second server to start the virtual machine more quickly, thus achieving rational utilization of resources.

[0012] In one embodiment, the first server receives a virtual machine deletion request; the first server responds to the virtual machine deletion request by sending a deletion command to Kubernetes, so that the second server listens to the deletion command sent to Kubernetes and deletes the virtual machine.

[0013] In this technical solution, virtual machines can be deleted by user-inputted virtual machine deletion requests, thereby releasing resources in a timely manner.

[0014] In one embodiment, the first server obtaining the first virtual machine startup request includes: the first server obtaining the first virtual machine startup request when it hears a user inputting a command into K8S.

[0015] In this technical solution, the first virtual machine startup request is obtained by listening to the user's input commands into K8S, so the obtained requests are relatively comprehensive.

[0016] Secondly, this application discloses a virtual machine startup method based on a container image, applied to a second server. The method includes: the second server receiving a second virtual machine startup request sent by a first server, the second virtual machine startup request instructing the second server to start a virtual machine; the second server responding to the second virtual machine startup request, obtaining a container image, and creating a virtual machine image based on the container image; and the second server starting the virtual machine according to the virtual machine image.

[0017] In this technical solution, a virtual machine image can be created from a container image using a second server, thereby enabling virtual machines to share the container image and improving resource utilization.

[0018] In one embodiment, the second virtual machine startup request includes container image indication information. The second server responds to the second virtual machine startup request by obtaining a container image and creating a virtual machine image based on the container image, including: the second server obtaining the corresponding container image from an image repository according to the container image indication information; and the second server creating a virtual machine image based on the container image.

[0019] This technical solution mainly explains how to create virtual machine images, thereby enabling container image sharing and resource sharing.

[0020] In one embodiment, the second virtual machine startup request includes virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information. The second server starts the virtual machine according to the virtual machine image, including: the second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information according to the format requirements of the virtual machine startup software to obtain converted parameters; the second server calls the virtual machine startup software to start the virtual machine according to the converted parameters and the virtual machine image.

[0021] In this technical solution, the virtual machine startup software can quickly start the virtual machine using the configured instructions and the virtual machine image, providing more complete virtual machine functionality.

[0022] Thirdly, embodiments of this application disclose a virtual machine startup device based on a container image, applied to a first server, the device comprising:

[0023] The acquisition unit is used by the first server to acquire a first virtual machine startup request, wherein the first virtual machine startup request is used to request to start a virtual machine based on a container image;

[0024] A determining unit is used to determine a second server in response to the first virtual machine startup request from the first server.

[0025] The transceiver unit is used to send a second virtual machine startup request to the second server. The second virtual machine startup request is used to instruct the second server to respond to the second virtual machine startup request. In response to the second virtual machine startup request, the second server obtains a container image, creates a virtual machine image based on the container image, and starts the virtual machine according to the virtual machine image.

[0026] Fourthly, embodiments of this application disclose a virtual machine startup device based on a container image, applied to a second server, the device comprising:

[0027] The receiving unit is configured to receive a second virtual machine startup request sent by the first server, wherein the second virtual machine startup request instructs the second server to start the virtual machine;

[0028] The image acquisition unit is used by the second server to acquire the container image in response to the second virtual machine startup request.

[0029] The processing unit is used by the second server to create a virtual machine image based on the container image and start the virtual machine according to the virtual machine image.

[0030] Fifthly, this application discloses a server cluster, including a first server and a second server. The first server is used to obtain a first virtual machine startup request, which requests to start a virtual machine based on a container image. In response to the first virtual machine startup request, the first server sends a second virtual machine startup request to the second server, which requests the second server to start a virtual machine. The second server is used to obtain a container image in response to the second virtual machine startup request, create a virtual machine image based on the container image, and start a virtual machine based on the virtual machine image.

[0031] In a sixth aspect, embodiments of this application disclose a server, comprising: a processor adapted to implement one or more computer programs; and a computer-readable storage medium storing one or more computer programs, the one or more computer programs being adapted to be loaded by the processor and executed by the processor to implement the container image-based virtual machine startup method described in the first and second aspects above.

[0032] In a seventh aspect, embodiments of this application disclose a computer-readable storage medium storing one or more computer programs adapted for loading by a processor and executing the container image-based virtual machine startup method described in the first and second aspects. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1This is an architecture diagram of a server cluster disclosed in an embodiment of this application;

[0035] Figure 2 This is a schematic diagram of the structure of a virtual machine controller disclosed in an embodiment of this application;

[0036] Figure 3 This is a schematic diagram of the structure of a virtual machine wrapper disclosed in an embodiment of this application;

[0037] Figure 4 This is a flowchart illustrating a virtual machine startup method based on a container image disclosed in an embodiment of this application;

[0038] Figure 5 This is a flowchart illustrating another virtual machine startup method based on a container image disclosed in an embodiment of this application;

[0039] Figure 6 This is a schematic diagram illustrating a virtual machine startup scenario disclosed in an embodiment of this application;

[0040] Figure 7 This is a schematic diagram of the structure of a virtual machine startup device disclosed in an embodiment of this application;

[0041] Figure 8 This is a schematic diagram of another virtual machine startup device disclosed in an embodiment of this application;

[0042] Figure 9 This is a schematic diagram of the structure of a server disclosed in an embodiment of this application. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] To better understand the technical solutions provided in the embodiments of this application, the scenarios of the embodiments of this application will be introduced first.

[0045] Virtual machines: Virtual machines are large software packages that can fully emulate low-level hardware devices such as CPUs (Central Processing Units), disks, and network devices. Virtual machines may also include a supplementary software stack running on the emulated hardware. These hardware and software packages, combined, can create snapshots of fully functional computing systems.

[0046] Containers: Containers are lightweight software packages that contain all the dependencies required to execute the included software application. These dependencies include system libraries, external third-party code packages, and other operating system-level applications. The dependencies contained in a container exist at a higher level than the operating system's stack.

[0047] Image: An image is a file storage format where data from one disk is copied exactly to another disk. Virtual machines have their own image formats, such as qcow2 and raw. Containers also use their own image formats, such as Docker images.

[0048] While an increasing number of applications are being deployed in containers, a significant portion still require virtual machines (VMs) due to security or operating system version issues. VMs have their own image formats, such as qcow2 and raw. Containers also use their own image format (Docker images). In VM scenarios, users cannot use container images, leading to inefficient use of existing resources and redundant image creation. Furthermore, the existence of two different image management methods significantly increases development, operation, and usage costs.

[0049] For example, traditionally, when starting a virtual machine from a container image file, control is achieved through the CRI interface (a plugin interface that enables kubelet (a proxy component on the virtual machine system worker node) to use various container runtimes without recompiling cluster components), which cannot provide the complete control parameters required by the virtual machine. Furthermore, the traditional method implements disk functionality by packaging the disk into a raw or qcow2 image. Due to the inconsistency with container image formats, existing container images cannot be used directly, resulting in low virtual machine resource utilization. Therefore, to address these two issues, this application develops two components for the virtual machine: a virtual machine controller and a virtual machine agent (also known as a virtual machine wrapper). Through these two components, complete virtual machine parameter control can be achieved, allowing the image file to be used as the virtual machine's file system without packaging, thereby enabling virtual machines to share container image resources and improving resource utilization.

[0050] like Figure 1The diagram shown is an architecture diagram of a server cluster provided in an embodiment of this application. The server cluster includes multiple servers, such as a first server 101 and a second server 102, where the first server can be a management node and the second server 102 can be a processing node. The first server 101 and the second server 102 can be independent physical servers, or they can be a server cluster or a distributed system composed of multiple physical servers. They can also be cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This embodiment of the application does not limit the scope of these services.

[0051] The virtual machine startup method based on a container image provided in this application embodiment may include the following steps: A first server 101 obtains a first virtual machine startup request, which may be input through a virtual machine startup interface. The first virtual machine startup request is used to request the startup of a virtual machine based on a container image. In response to the first virtual machine startup request, the first server 101 determines a second server 102, which may specifically be a virtual machine processing node, and sends a second virtual machine startup request to the second server 102. The second virtual machine startup request is used to request the second server 102 to start the virtual machine. The second server 102 responds to the second virtual machine startup request, obtains a target container image, and creates a virtual machine image based on the target container image, and starts the virtual machine based on the virtual machine image. Using this method to start the virtual machine, the container image can be used by the virtual machine, achieving resource interoperability and avoiding resource duplication and waste.

[0052] It should be specifically noted that the embodiments in this application involve data related to the virtual machine startup process, such as various parameters in the virtual machine request. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards, conforming to the principles of legality, legitimacy, and necessity, and not involving the acquisition of data types prohibited or restricted by laws and regulations. In some optional embodiments, the related data involved in the embodiments of this application are obtained after separate authorization from the object. In addition, when obtaining separate authorization from the object, the purpose of the related data is indicated to the object.

[0053] To achieve complete virtual machine parameter control, this application embodiment defines two custom components in Kubernetes: a virtual machine controller and a virtual machine agent. In addition to the virtual machine controller and virtual machine agent, it also includes an image repository. Kubernetes (K8S) is a container cluster management system used for automatically deploying, scaling, and managing containerized applications; it can also be called the K8S platform. The image repository (Imager Registry) is used to store and retrieve image files. The virtual machine controller is a custom extension of Kubernetes, used to control virtual machine master / slave operations, creation, and deletion. The virtual machine wrapper is a custom extension of Kubernetes, used to receive commands from the virtual machine controller regarding container image processing and process the container images to meet the requirements of a file system for virtual machine booting.

[0054] Please see Figure 2 This is a schematic diagram of the structure of a virtual machine controller disclosed in an embodiment of this application. It mainly includes a message listening module, a lifecycle management module, a command issuing module, and an image control module. The specific functions of each module are as follows:

[0055] Message listening module: Listens for virtual machine control commands (i.e., virtual machine startup requests) sent by users to the K8S platform, and parses the first parameter information in the virtual machine startup request;

[0056] Lifecycle Management Module: Performs virtual machine lifecycle management based on user commands, including creation, startup, and deletion;

[0057] Command delivery module: Delivers control commands to Kubernetes;

[0058] Image control module: Converts user commands into the target image required by the virtual machine, including the virtual machine kernel, startup parameters, etc.

[0059] Please see Figure 3 This is a schematic diagram of the structure of a virtual machine wrapper disclosed in an embodiment of this application. It mainly includes a message listening module, an image pulling module, an image creation module, and a virtual machine control module. The specific functions of each module are as follows:

[0060] Message listening module: Listens for commands sent by the virtual machine controller and parses the relevant commands;

[0061] Image pull module: Pulls the corresponding image file from the image repository;

[0062] Image creation module: Parses user commands and uses virtfs or nfsmount technology to create a rootfs (a virtual machine file system) that can be used by virtual machines; virtfs or nfsmount technology are two virtual machine technologies that provide image files to virtual machines.

[0063] Virtual machine control module: Parses user commands, uses the prepared boot image, boot parameters, etc., and instructs other agents to call QEMU to start the virtual machine (QEMU is a virtual machine boot software).

[0064] The virtual machine startup method disclosed in this application embodiment may include the following steps: 1. The user sets a first virtual machine startup request through the virtual machine startup interface. The first virtual machine startup request is configured with various parameters, including container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information, etc.; 2. The virtual machine controller in the first server listens to this request and converts the data in the request into a format that the virtual machine wrapper can recognize, i.e., a second virtual machine request. At the same time, the virtual machine controller determines the second server (virtual machine processing node) to start the virtual machine request; 3. The virtual machine wrapper of the second server treats the container image file as a system file of virtfs or nfs, specifically a virtual machine image file; 4. The virtual machine wrapper of the second server converts the format of the configured virtual machine emulation device, passthrough device, specified kernel file, etc., and the second server calls the virtual machine startup software to start the virtual machine according to the converted data and system files.

[0065] The virtual machine startup method disclosed in this application can enable virtual machines to share container image resources, thereby improving resource utilization.

[0066] The virtual machine startup method based on container images proposed in this application will be described in detail below.

[0067] Please see Figure 4 This is a flowchart illustrating a virtual machine startup method based on a container image disclosed in an embodiment of this application. The execution entity of this virtual machine startup method can be a first server, such as... Figure 1 The virtual machine startup method based on a container image for the first server 101 shown may include, but is not limited to, the following steps:

[0068] S401: The first server obtains the first virtual machine startup request, which is used to request the startup of the virtual machine based on the container image.

[0069] The first virtual machine startup request includes one or more of the following: container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information. The first virtual machine startup request is used to request the startup of a virtual machine based on the container image.

[0070] In one possible implementation, the first server receives a first virtual machine startup request upon receiving a user's input command to the Kubernetes platform. The process of receiving the user's input command to the Kubernetes platform can be as follows: Before starting the virtual machine, the user inputs corresponding parameters (i.e., first parameter information) in the terminal interface. A command is generated based on the first parameter information and published to the Kubernetes platform. When the first server receives the user's input command to the Kubernetes platform, it receives the first virtual machine startup request based on the first parameter information.

[0071] Among them, the container image indication information in the first parameter information refers to which container image is used to start the virtual machine. The container image indication information can help to better obtain the corresponding image file from the image repository.

[0072] The virtual machine kernel version information in the first parameter information indicates which version of the kernel of the virtual machine being started. The virtual machine kernel plays an important role in virtual machine technology and is the infrastructure of the virtual machine. In this embodiment of the application, the user can customize the kernel version and configure corresponding parameters for the corresponding kernel version, namely kernel parameter information. These parameters include, but are not limited to, CPU parameters, memory parameters, storage parameters, network parameters, etc.

[0073] The virtual machine emulation device indication information in the first parameter information is used to indicate information such as virtual network cards and USB.

[0074] The pass-through device indication information in the first parameter information is used to indicate the devices that the virtual machine can directly connect to. For example, if it is connected to device A via USB, then device A is a pass-through device.

[0075] S402: The first server responds to the first virtual machine startup request, determines the second server, and sends a second virtual machine startup request to the second server; the second virtual machine startup request is used to instruct the second server to respond to the second virtual machine startup request, obtain the container image, create a virtual machine image based on the container image, and start the virtual machine according to the virtual machine image.

[0076] In one possible implementation, the specific steps performed by the modules included in the virtual controller of the first server during the implementation process are as follows:

[0077] 1. The virtual machine controller's message listening module listens for the first virtual machine startup request through the K8S notification mechanism.

[0078] 2. The image control module of the virtual machine controller responds to the first virtual machine startup request, parses the first parameter information to obtain the second virtual machine request. The specific parsing process includes reading the corresponding parameters, executing the user-specified parameters, and obtaining the execution result. For example, it determines the storage location of the image file and obtains the storage path for quick subsequent image file retrieval. Multiple parameters can be converted in data format, or multiple scattered data can be aggregated to obtain the second parameter information, which can be recognized by the virtual machine wrapper. Since the virtual machine wrapper has a preset data format, data format conversion is necessary. In short, the second virtual machine request includes the second parameter information and the execution result.

[0079] 3. The virtual machine controller's lifecycle module identifies a second server from the server cluster. The server cluster runs a container cluster management system—Kubernetes (K8S), such as... Figure 1 The second server 102 shown is the virtual machine processing node used to start virtual machines. The second server can be determined based on the server's status; for example, if server 1 is relatively idle, server 1 can be designated as the server for starting virtual machines to improve processing efficiency.

[0080] 4. The command delivery module of the virtual machine controller sends the second virtual machine startup request to the K8S platform.

[0081] In one possible implementation, the first server sends the second virtual machine request to the second server to facilitate faster access to the second server's virtual machine wrapper. This allows the second server's virtual machine wrapper to parse the second virtual machine startup request, obtain the container image according to the container image indication information, create a virtual machine image based on the container image, and then start the virtual machine based on the virtual machine image. See [link to virtual machine wrapper execution process] for details. Figure 5 .

[0082] In one alternative implementation, the first server can also receive virtual machine deletion requests. The first server responds to the virtual machine deletion request by sending a deletion command to Kubernetes (K8S), enabling the second server to listen for the deletion command sent to K8S and delete the virtual machine. Virtual machine deletion can be achieved through user-inputted deletion requests, thereby releasing resources promptly.

[0083] Please see Figure 5This is a flowchart illustrating another virtual machine startup method based on a container image disclosed in an embodiment of this application. The execution entity of this virtual machine startup method can be a second server, such as... Figure 1 The virtual machine startup method based on a container image for the second server 102 shown may include, but is not limited to, the following steps:

[0084] S501: The second server receives the second virtual machine startup request sent by the first server. The second virtual machine startup request is obtained by the first server in response to the first virtual machine startup request.

[0085] S502: The second server responds to the second virtual machine startup request, obtains the container image, and creates a virtual machine image based on the container image.

[0086] S503: The second server starts the virtual machine based on the virtual machine image.

[0087] In one possible implementation, steps S501-S503 above can be executed by various modules of the virtual machine wrapper of the second server, as follows:

[0088] 1. When the virtual wrapper's message listening module detects the second virtual machine startup request issued by the virtual machine controller through the K8S notification mechanism (an existing mechanism provided by K8S), it obtains the second virtual machine request. Then, it parses the second virtual machine startup request to obtain the second parameter information, which includes container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information, etc. The content of the second parameter information is the same as that of the first parameter information, but the format is different.

[0089] 2. The virtual machine wrapper's image pull module pulls container image files from the image repository based on the container image instruction information and through pull commands; the image repository stores various image files.

[0090] 3. The image creation module of the virtual machine wrapper uses technologies such as virtfs or NFS to create virtual machine image files from container image files. Virtfs or NFS are virtual machine file systems used to create virtual machine image files from container image files.

[0091] 4. The virtual machine control module of the virtual machine wrapper converts the corresponding information in the virtual machine emulation device indication information, passthrough device indication information, and virtual machine kernel version indication information according to the format of the virtual machine boot software. This conversion is then performed to the format set by QEMU, yielding the converted second parameter information. The virtual machine boot software format can be QEMU format. QEMU stands for Quick Emulator, an open-source virtual machine software that can emulate various hardware platforms, including x86, ARM, MIPS, and SPARC, and supports multiple operating systems such as Linux, Windows, Mac OSX, and FreeBSD.

[0092] 5. The second server (virtual machine processing node) calls the virtual machine startup software to start the virtual machine. The virtual machine startup software can be, for example, QEMU. QEMU is a virtual machine startup software. The second parameter information after format conversion and the virtual machine image file are input parameters. QEMU can automatically recognize these parameters and start the virtual machine.

[0093] exist Figure 4 and Figure 5 In the relevant embodiments, the modules and functions of the virtual machine controller and the virtual machine wrapper are described. Through these two newly developed components, the full functionality of the virtual machine after startup can be achieved. The virtual machine wrapper can also be used to share container image resources, avoid resource duplication and waste, and improve resource utilization.

[0094] Please see Figure 6 This is a schematic diagram illustrating a virtual machine startup scenario provided in an embodiment of this application. Figure 6 The direction of the middle arrow can be used to summarize the method into the following steps:

[0095] S61 and K8S send the first virtual machine startup request to the virtual machine controller.

[0096] In response to the first virtual machine startup request, the virtual machine controller determines the second server, parses and processes the parameters in the first virtual machine startup request, and obtains the second virtual machine startup request.

[0097] The parameters in the second virtual machine request are formatted so that they can be recognized by the virtual machine wrapper. At the same time, the virtual machine controller also needs to determine the second server that will start the virtual machine and send this information to the K8S platform.

[0098] The first virtual machine request is configured by the user through the K8S platform. After the configuration is completed, the first virtual machine startup request is published on the K8S platform. The virtual machine startup request is configured with a variety of parameters, including container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine simulation device indication information, and passthrough device indication information, etc.

[0099] S62, The virtual machine controller sends the second virtual machine startup request to the virtual machine wrapper of the second server.

[0100] S63, the virtual machine wrapper obtains the container image from the image repository based on the second virtual machine startup request.

[0101] S64, the virtual machine wrapper creates a virtual machine image based on the container image.

[0102] After the virtual machine wrapper listens for the second virtual machine's request through the Kubernetes notification mechanism, it retrieves the container image file from the image repository based on the information carried in the second virtual machine's startup request. The virtual machine wrapper then uses virtfs or nfs technology to create a virtual machine image file from the container image file.

[0103] S65. The virtual machine wrapper creates a virtual machine file system on the second server based on the virtual machine image. Since the virtual machine image is determined based on virtfs or nfs technology, the corresponding file system (rootfs) can be generated directly.

[0104] S66, the virtual machine wrapper starts the virtual machine on the second server.

[0105] The virtual machine wrapper will also perform format conversion on the virtual machine simulation device indication information and pass-through device indication information carried in the second virtual machine startup request, and then the second server will call the virtual machine startup software to start the virtual machine based on the file system and image file generated by the virtual machine image file.

[0106] The methods of the embodiments of this application have been described in detail above. In order to facilitate better implementation of the above solutions of the embodiments of this application, the apparatus of the embodiments of this application is provided below.

[0107] Please see Figure 7 , Figure 7 This is a schematic diagram of a virtual machine startup device provided in an embodiment of this application. The virtual machine startup device can be set in the first server provided in the embodiment of this application. Figure 7 The virtual machine boot device shown can be a computer program (including program code) running on the first server, which can be used to execute... Figure 4 Some or all of the steps in the method embodiments shown. Please refer to [link / reference]. Figure 7 The virtual machine startup device may include the following units:

[0108] The acquisition unit 701 is used for the first server to acquire a first virtual machine startup request, wherein the first virtual machine startup request is used to request to start a virtual machine based on a container image;

[0109] Determining unit 702 is used to determine the second server in response to the first virtual machine startup request;

[0110] The transceiver unit 703 is used to send a second virtual machine startup request to the second server. The second virtual machine startup request is used to instruct the second server to respond to the second virtual machine startup request and obtain a container image. The second server responds to the second virtual machine startup request and creates a virtual machine image based on the container image, and starts the virtual machine according to the virtual machine image.

[0111] In one possible implementation, the first virtual machine startup request includes one or more of the following: container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information.

[0112] In one possible implementation, when the determining unit 702 responds to the first virtual machine startup request, determines the second server, and sends the second virtual machine startup request to the second server, it specifically performs the following steps:

[0113] The first server determines the second server from the server cluster, which runs a container cluster management system Kubernetes (K8S); the first server sends a second virtual machine startup request to the K8S, the second virtual machine startup request being determined based on the first virtual machine startup request;

[0114] The first server sends the second virtual machine startup request to the Kubernetes cluster, so that the second server listens for the second virtual machine startup request on the Kubernetes cluster.

[0115] In one possible implementation, the acquisition unit 701 is further configured to allow the first server to acquire a virtual machine deletion request;

[0116] The transceiver unit 703 is further configured to respond to the virtual machine deletion request by the first server and send a deletion command to K8S, so that the second server can listen to the deletion command sent to K8S and delete the virtual machine.

[0117] In one possible implementation, when the first server obtains the first virtual machine startup request, the acquisition unit 701 is specifically used to perform the following steps:

[0118] The first server receives a first virtual machine startup request upon receiving a command input by the user into K8S.

[0119] According to another embodiment of this application, Figure 7 The virtual machine booting device shown can be constructed by combining each unit individually or entirely into one or more other units, or one or more of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the virtual machine booting device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0120] In this embodiment of the application, a virtual machine startup device for a first server is described. Through the acquisition unit, the determination unit, and the sending and receiving unit, the complete functionality of the virtual machine after startup can be achieved. It can also realize the sharing of container image resources through the virtual machine wrapper, avoid resource duplication and waste, and improve resource utilization.

[0121] Please see Figure 8 , Figure 8 This is a schematic diagram of a virtual machine startup device provided in an embodiment of this application. The virtual machine startup device can be set in the second server provided in this embodiment of the application. Figure 8 The virtual machine boot device shown can be a computer program (including program code) running on a second server, which can be used to execute... Figure 5 Some or all of the steps in the method embodiments shown. Please refer to [link / reference]. Figure 8 The virtual machine startup device may include the following units:

[0122] The receiving unit 801 is used for the second server to receive a second virtual machine startup request sent by the first server, wherein the second virtual machine startup request instructs the second server to start the virtual machine;

[0123] Image acquisition unit 802 is used by the second server to acquire the container image in response to the second virtual machine startup request;

[0124] The processing unit 803 is used to create a virtual machine image based on the container image by the second server, and start the virtual machine according to the virtual machine image.

[0125] In one possible implementation, the second virtual machine startup request includes container image indication information. The image acquisition unit 802, when the second server responds to the second virtual machine startup request, acquires the container image, and creates a virtual machine image based on the container image, specifically performs the following steps:

[0126] The second server retrieves the corresponding container image from the image repository based on the container image indication information;

[0127] The second server creates a virtual machine image based on the container image.

[0128] In one possible implementation, the second virtual machine startup request includes virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information. The processing unit 803, when the second server starts the virtual machine based on the virtual machine image, specifically performs the following steps:

[0129] The second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information according to the format requirements of the virtual machine boot software to obtain the converted parameters;

[0130] The second server uses the converted parameters and the virtual machine image to launch the virtual machine using the virtual machine startup software.

[0131] According to another embodiment of this application, Figure 8 The virtual machine booting device shown can be constructed by combining each unit individually or entirely into one or more other units, or one or more of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the virtual machine booting device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0132] In this embodiment of the application, a virtual machine startup device for a second server is described. Through a transceiver unit, an image acquisition unit, and a processing unit, the device can ensure the complete functionality of the virtual machine after startup. It can also achieve the sharing of container image resources through the virtual machine wrapper, avoiding resource duplication and waste, and improving resource utilization.

[0133] Based on the above methods and apparatus embodiments, this application provides a server. Please refer to... Figure 9 , Figure 9 This is a schematic diagram of the structure of a server provided in an embodiment of this application. The server can be... Figure 1 The first server 101 shown can also be the second server 102. Figure 9 The server shown includes at least a processor 901, an input interface 902, an output interface 903, and a computer-readable storage medium 904. The processor 901, input interface 902, output interface 903, and computer-readable storage medium 904 can be connected via a bus or other means.

[0134] The computer-readable storage medium 904 can be stored in the memory of a computer device. The computer-readable storage medium 904 is used to store computer programs, and the processor 901 is used to execute the computer programs stored in the computer-readable storage medium 904. The processor 901 (or CPU (Central Processing Unit)) is the computing and control core of the processing device. It is suitable for implementing one or more computer programs, specifically for loading and executing one or more computer programs to achieve corresponding method flows or corresponding functions.

[0135] This application also provides a computer-readable storage medium (Memory), which is a memory device in a processing device used to store programs and data. It is understood that the computer-readable storage medium here may include both built-in storage media in the processing device and extended storage media supported by the processing device. The computer-readable storage medium provides storage space that stores the operating system of the processing device. Furthermore, the storage space also stores one or more computer programs (including program code) suitable for loading and execution by a processor. It should be noted that the computer-readable storage medium here may be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it may also be at least one computer-readable storage medium located remotely from the aforementioned processor.

[0136] In some embodiments, when the server is a first server, the processor 901 may load and execute one or more computer programs stored in the computer-readable storage medium 904 to achieve the above. Figure 4 The corresponding steps of the virtual machine startup method based on the container image are shown. In specific implementation, the computer program in the computer-readable storage medium 904 is loaded by the processor 901 and executed as follows:

[0137] The first server obtains a first virtual machine startup request, which is used to request the startup of a virtual machine based on a container image.

[0138] The first server responds to the first virtual machine startup request and determines the second server;

[0139] A second virtual machine startup request is sent to the second server. The second virtual machine startup request is used to instruct the second server to respond to the second virtual machine startup request, obtain the container image, create a virtual machine image based on the container image, and start the virtual machine according to the virtual machine image.

[0140] In one possible implementation, the first virtual machine startup request includes one or more of the following: container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information.

[0141] In one possible implementation, the computer program in the computer-readable storage medium 904, loaded and executed by the processor 901, is used to perform the following steps when the first server responds to the first virtual machine startup request, determines the second server, and sends a second virtual machine startup request to the second server:

[0142] The first server determines the second server from the server cluster, which runs a container cluster management system Kubernetes (K8S); the first server sends a second virtual machine startup request to the K8S, the second virtual machine startup request being determined based on the first virtual machine startup request;

[0143] The first server sends the second virtual machine startup request to the Kubernetes cluster, so that the second server listens for the second virtual machine startup request on the Kubernetes cluster.

[0144] In one possible implementation, the computer program in the computer-readable storage medium 904 is further loaded by the processor 901 and executed in the following steps:

[0145] The first server receives the virtual machine deletion request;

[0146] The first server responds to the virtual machine deletion request by sending a deletion command to Kubernetes, so that the second server can hear the deletion command sent to Kubernetes and delete the virtual machine.

[0147] In one possible implementation, the computer program in the computer-readable storage medium 904 is loaded and executed by the processor 901 for performing the following steps when the first server obtains the first virtual machine startup request:

[0148] The first server receives a first virtual machine startup request upon receiving a command input by the user into K8S.

[0149] In one embodiment, when the server is a second server, the processor 901 may load and execute one or more computer programs stored in the computer-readable storage medium 904 to achieve the above. Figure 5 The corresponding steps of the virtual machine startup method based on the container image are shown. In specific implementation, the computer program in the computer-readable storage medium 904 is loaded by the processor 901 and executed as follows:

[0150] The second server receives a second virtual machine startup request sent by the first server, the second virtual machine startup request being obtained by the first server in response to the first virtual machine startup request;

[0151] The second server responds to the second virtual machine startup request and obtains the container image;

[0152] A virtual machine image is created based on the container image, and the virtual machine is started based on the virtual machine image.

[0153] In one possible implementation, the second virtual machine startup request includes container image indication information. The computer program in the computer-readable storage medium 904 is loaded and executed by the processor 901. Specifically, when the second server responds to the second virtual machine startup request, obtains the container image, and creates a virtual machine image based on the container image, it performs the following steps:

[0154] The second server retrieves the corresponding container image from the image repository based on the container image indication information;

[0155] The second server creates a virtual machine image based on the container image.

[0156] In one possible implementation, the second virtual machine startup request includes virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information. The computer program in the computer-readable storage medium 904 is loaded and executed by the processor 901 for performing the following steps when the second server starts the virtual machine based on the virtual machine image:

[0157] The second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information according to the format requirements of the virtual machine boot software to obtain the converted parameters;

[0158] The second server uses the converted parameters and the virtual machine image to launch the virtual machine using the virtual machine startup software.

[0159] According to one aspect of this application, a computer program product or computer program is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the container image-based virtual machine startup method provided in the various alternative embodiments described above.

[0160] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0161] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and the division of modules described above is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0162] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A virtual machine startup method based on a container image, applied to a first server, characterized in that, The method includes: The first server obtains a first virtual machine startup request, which is used to request the startup of a virtual machine based on a container image. The first server responds to the first virtual machine startup request, determines the second server, and sends a second virtual machine startup request to the second server. The second virtual machine startup request instructs the second server to start the virtual machine. The second server responds to the second virtual machine startup request by retrieving the corresponding container image from the image repository based on the container image indication information included in the second virtual machine startup request, and creating a virtual machine image based on the container image. The second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information included in the second virtual machine startup request according to the format requirements of the virtual machine startup software to obtain converted parameters. Based on the converted parameters and the virtual machine image, the second server calls the virtual machine startup software to start the virtual machine.

2. The method according to claim 1, characterized in that, The first virtual machine startup request includes one or more of the following: container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information.

3. The method according to claim 1 or 2, characterized in that, The first server responds to the first virtual machine startup request, determines the second server, and sends a second virtual machine startup request to the second server, including: The first server determines the second server from the server cluster, which runs a container cluster management system Kubernetes (K8S); the first server sends a second virtual machine startup request to the K8S, the second virtual machine startup request being determined based on the first virtual machine startup request; The first server sends the second virtual machine startup request to the Kubernetes cluster, so that the second server listens for the second virtual machine startup request on the Kubernetes cluster.

4. The method according to claim 1 or 2, characterized in that, The method further includes: The first server receives the virtual machine deletion request; The first server responds to the virtual machine deletion request by sending a deletion command to Kubernetes, so that the second server can hear the deletion command sent to Kubernetes and delete the virtual machine.

5. The method according to claim 1 or 2, characterized in that, The first server obtains the first virtual machine startup request, including: The first server receives a first virtual machine startup request upon receiving a command input by the user into K8S.

6. A virtual machine startup method based on a container image, applied to a second server, characterized in that, The method includes: The second server receives a second virtual machine startup request sent by the first server. The second virtual machine startup request instructs the second server to start the virtual machine. The second virtual machine startup request includes container image indication information, virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information. The second server responds to the second virtual machine startup request, retrieves the corresponding container image from the image repository according to the container image indication information, and creates a virtual machine image based on the container image; The second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information, and passthrough device indication information according to the format requirements of the virtual machine boot software to obtain the converted parameters; The second server, based on the converted parameters and the virtual machine image, calls the virtual machine startup software to start the virtual machine.

7. A server cluster, characterized in that, It includes a first server and a second server, wherein the first server is used to obtain a first virtual machine startup request, which is used to request to start a virtual machine based on a container image; in response to the first virtual machine startup request, it sends a second virtual machine startup request to the second server, which is used to request the second server to start a virtual machine; The second server is used to respond to the second virtual machine startup request, obtain the corresponding container image from the image repository according to the container image indication information included in the second virtual machine startup request, and create a virtual machine image based on the container image; the second server converts the virtual machine kernel version indication information, kernel parameter information, virtual machine emulation device indication information and passthrough device indication information included in the second virtual machine startup request according to the format requirements of the virtual machine startup software to obtain the converted parameters, and calls the virtual machine startup software to start the virtual machine according to the converted parameters and the virtual machine image.

8. A server, characterized in that, The server includes: A processor, suitable for implementing one or more computer programs; and, A computer-readable storage medium storing one or more computer programs adapted to be loaded by the processor and executed as described in any one of claims 1-5 or 6, for a virtual machine startup method based on a container image.

Citation Information

Patent Citations

  • Mirror image management method and device for cross-cloud servers and server

    CN108132826A

  • Method and device for adding GPU resources in virtual machine

    CN113849272A