Virtual machine creation method and device, electronic equipment and readable storage medium

By creating a mirror cloud disk and user cloud disk in a distributed storage system, the rapid creation of virtual machines is achieved, the problem of low efficiency of the virtual machine is lowered, the consumption of resource consumption is reduced, and the efficiency of creation is improved.

CN119376852AActive Publication Date: 2025-01-28BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411311714.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-28
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

In scenarios such as tidal services and scene rendering, a large number of virtual machines need to be created in a short time, resulting in low efficiency in batch creation of virtual machines and a high resource consumption for distributed block storage systems.

Method used

By creating a mirror cloud disk and user cloud disk in the distributed storage system, and store the target data to the mirror cloud disk, mount the user cloud disk to the target virtual machine, the corresponding relationship between the storage mirror cloud disk and the user cloud disk Realize the rapid creation of virtual machines.

Benefits of technology

The efficiency of the virtual machine's batch creation has been improved, the creation time and resource consumption is reduced, and the efficiency and resource utilization rate of virtual machine creation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376852A_ABST
    Figure CN119376852A_ABST
Patent Text Reader

Abstract

The invention provides a virtual machine creation method, and relates to the technical field of artificial intelligence such as big data, cloud services and virtual machines. The virtual machine creation method comprises the steps of creating a target virtual machine according to a virtual machine creation request; under the condition that the request type of the virtual machine creation request is determined to be a batch creation request type according to the virtual machine mirror image ID, obtaining the number of mirror image cloud disks according to a first preset number threshold and the number of cloud disks; in the distributed block storage system, creating at least one mirror image cloud disk according to the number of the mirror image cloud disks, and creating at least one user cloud disk corresponding to the at least one mirror image cloud disk according to the number of the cloud disks; downloading target data from the object storage system according to the object storage data information, and storing the target data to the at least one mirror image cloud disk; and mounting the at least one user cloud disk to the target virtual machine, and storing a corresponding relationship between the at least one user cloud disk and the at least one mirror image cloud disk to complete creation of the virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to the field of artificial intelligence technology such as big data, cloud services, virtual machines, etc. A method, device, electronic device, and readable storage medium for creating a virtual machine are provided. Background Art

[0002] In scenarios such as tidal services and scene rendering, a large number of virtual machines need to be created in a short period of time to perform related tasks. Therefore, how to improve the efficiency of batch creation of virtual machines is a technical problem that needs to be solved urgently. Summary of the invention

[0003] According to a first aspect of the present disclosure, a method for creating a virtual machine is provided, comprising: creating a target virtual machine according to a virtual machine creation request, the virtual machine creation request including a virtual machine image ID and a number of cloud disks; in a case where it is determined according to the virtual machine image ID that the request type of the virtual machine creation request is a batch creation request type, obtaining the number of mirror cloud disks according to a first preset number threshold and the number of cloud disks; in a distributed block storage system, creating at least one mirror cloud disk according to the number of mirror cloud disks, and creating at least one user cloud disk corresponding to the at least one mirror cloud disk according to the number of cloud disks; downloading target data from the object storage system according to object storage data information, and storing the target data in the at least one mirror cloud disk; mounting the at least one user cloud disk to the target virtual machine, and storing the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk, so as to complete the creation of the virtual machine.

[0004] According to a second aspect of the present disclosure, a virtual machine creation device is provided, comprising: a first creation unit, configured to create a target virtual machine according to a virtual machine creation request, wherein the virtual machine creation request includes a virtual machine image ID and a number of cloud disks; an acquisition unit, configured to acquire the number of mirror cloud disks according to a first preset number threshold and the number of cloud disks when it is determined that the request type of the virtual machine creation request is a batch creation request type according to the virtual machine image ID; a second creation unit, configured to create at least one mirror cloud disk according to the number of mirror cloud disks in a distributed block storage system, and to create at least one user cloud disk corresponding to the at least one mirror cloud disk according to the number of cloud disks; a download unit, configured to download target data from an object storage system according to object storage data information, and store the target data in the at least one mirror cloud disk; a mounting unit, configured to mount the at least one user cloud disk to the target virtual machine, and store the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk, so as to complete the creation of the virtual machine.

[0005] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0006] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method as described above.

[0007] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method as described above when executed by a processor.

[0008] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0010] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0011] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0012] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;

[0013] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0014] Figure 5 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0015] Figure 6 The present invention is a block diagram of an electronic device for implementing the method for creating a virtual machine according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0016] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and mechanisms is omitted in the following description.

[0017] Figure 1 Schematic diagram of the first embodiment of the present disclosure. Figure 1 As shown, the method for creating a virtual machine in this embodiment specifically includes the following steps:

[0018] S101, creating a target virtual machine according to a virtual machine creation request, wherein the virtual machine creation request includes a virtual machine image ID and a number of cloud disks;

[0019] S102: when it is determined according to the virtual machine image ID that the request type of the virtual machine creation request is a batch creation request type, obtaining the number of image cloud disks according to a first preset number threshold and the number of cloud disks;

[0020] S103. In the distributed block storage system, create at least one mirror cloud disk according to the number of mirror cloud disks, and create at least one user cloud disk corresponding to the at least one mirror cloud disk according to the number of cloud disks;

[0021] S104, downloading target data from the object storage system according to the object storage data information, and storing the target data in the at least one mirror cloud disk;

[0022] S105: Mount the at least one user cloud disk to the target virtual machine, and store the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk to complete the creation of the virtual machine.

[0023] The method for creating a virtual machine of this embodiment, when determining that the virtual machine creation request for creating a target virtual machine is a batch creation request, creates at least one mirror cloud disk in a distributed block storage system to store target data corresponding to the target virtual machine, without having to store the downloaded target data in different user cloud disks respectively, thereby achieving the purpose of quickly completing the creation of virtual machines in the scenario of batch creation of virtual machines, which can greatly reduce the time required for batch creation of virtual machines, thereby improving the creation efficiency of virtual machines, and can also greatly save the resource cost of the distributed block storage system when creating virtual machines.

[0024] The method for creating a virtual machine in this embodiment is applied to a distributed block storage system, that is, a cloud disk for mounting to a virtual machine is created in the distributed block storage system, thereby completing the creation of the virtual machine.

[0025] In this embodiment, the distributed block storage system is a storage architecture that allows multiple nodes to directly access block devices in the storage system, just as if these block devices were local disks, and has the characteristics of high reliability, high availability, high elasticity, etc.

[0026] In this embodiment, the distributed block storage system includes control nodes, storage nodes, task execution nodes, and computing nodes; the control node is used to manage metadata of the distributed block storage system, the storage node is used to create data blocks to store data, the task execution node is used to perform tasks such as creation, cloning, and deletion of virtual machines, and the computing node is used to forward read and write requests for virtual machines to the storage node, forward cloud disk creation requests, virtual machine creation requests, etc. to the control node.

[0027] When executing S101 to create a target virtual machine according to a virtual machine creation request, this embodiment can first obtain a target image file according to the virtual machine image ID included in the virtual machine creation request, and then use the obtained target image file to create the target virtual machine; in this embodiment, the task execution node in the distributed block storage system can complete the creation of the target virtual machine according to the virtual machine creation request forwarded by the computing node.

[0028] In this embodiment, different virtual machine image IDs correspond to different image files, and different image files are used to create different virtual machines, so different virtual machine image IDs correspond to different virtual machines; the target virtual machine created by executing S101 in this embodiment is a cloud virtual machine.

[0029] In this embodiment, the number of cloud disks included in the virtual machine creation request is used to create a corresponding number of user cloud disks in the distributed block storage system to be mounted to the target virtual machine.

[0030] In this embodiment, after executing S101 to create a target virtual machine according to a virtual machine creation request, executing S102, when determining that the request type of the virtual machine creation request is a batch creation request type according to the virtual machine image ID, obtains the number of image cloud disks according to a first preset number threshold and the number of cloud disks.

[0031] In this embodiment, the request type of the virtual machine creation request is a batch creation request type or a non-batch creation request type; if the request type is a batch creation request type, this embodiment executes S101 to obtain the virtual machine creation request for batch creation of the same virtual machine.

[0032] When executing S102 and determining that the request type of the virtual machine creation request is a batch creation request type according to the virtual machine image ID, this embodiment can adopt the following implementation method: according to the virtual machine image ID, obtain the number of requests for the same virtual machine creation request received within a preset time period; if the virtual machine image IDs of two virtual machine creation requests are the same, this embodiment determines that the two virtual machine creation requests are the same virtual machine creation requests; when it is determined that the number of requests obtained is greater than or equal to a second preset number threshold, determine that the request type of the virtual machine creation request is a batch creation request type.

[0033] That is to say, this embodiment determines whether the request type of the current virtual machine creation request is a batch creation request type based on the number of requests for the same virtual machine creation request received within a preset time period, which can improve the accuracy of determining the request type and thereby improve the accuracy of subsequent creation of the mirror cloud disk.

[0034] In this embodiment, the control node in the distributed block storage system completes the determination of the request type, and the control node may record the virtual machine image ID of each received virtual machine creation request.

[0035] In addition, when executing S102, this embodiment may also determine that the request type of the virtual machine creation request is a batch creation request type when it is determined that the virtual machine image ID is a preset ID.

[0036] In this embodiment, after executing S102 to determine that the request type of the virtual machine creation request is a batch creation request type, the number of mirrored cloud disks can be obtained according to the first preset number threshold and the cloud disk data. The obtained number of mirrored cloud disks is used to create a mirrored cloud disk in the distributed block storage system.

[0037] In this embodiment, when executing S102 to obtain the number of mirrored cloud disks according to the first preset number threshold and the number of cloud disks, the number of cloud disks can be divided by the first preset number threshold, and the number of mirrored cloud disks can be obtained based on the division result; the first number threshold in this embodiment is used to reflect the number of user cloud disks corresponding to one mirrored cloud disk.

[0038] For example, if the first preset quantity threshold is 2 and the number of cloud disks is 4, this embodiment uses 2 obtained by (4÷2) as the number of mirror cloud disks, that is, creates 2 mirror cloud disks, each mirror cloud disk corresponds to 2 user cloud disks; if the first preset quantity threshold is 2 and the number of cloud disks is 5, this embodiment uses 2.5 obtained by (5÷3) and uses the smallest integer 3 greater than the division result as the number of mirror cloud disks, that is, creates 3 mirror cloud disks.

[0039] That is, this embodiment determines the number of mirror cloud disks according to the number of cloud disks, thereby avoiding the problem of over-concentration of access caused by creating only one mirror cloud disk, thereby achieving the purpose of dispersing access pressure.

[0040] In this embodiment, after executing S102 to obtain the number of mirrored cloud disks according to the first preset number threshold and the number of cloud disks, executing S103, in the distributed block storage system, at least one mirrored cloud disk is created according to the number of mirrored cloud disks, and at least one user cloud disk corresponding to the at least one mirrored cloud disk is created according to the number of cloud disks.

[0041] In this embodiment, the number of user cloud disks corresponding to a mirror cloud disk is a first preset number threshold. For example, if there are mirror cloud disk 1 and mirror cloud disk 2, and there are user cloud disk 1, user cloud disk 2 and user cloud disk 3, then this embodiment can establish a corresponding relationship between mirror cloud disk 1 and (user cloud disk 1, user cloud disk 2), and establish a corresponding relationship between mirror cloud disk 2 and user cloud disk 3.

[0042] In this embodiment, the control node in the distributed block storage system schedules the task execution node according to the corresponding quantity obtained, so that the task execution node sends the number of mirror cloud disks and the number of cloud disks to the storage node, and then the storage node creates the mirror cloud disk and the user cloud disk respectively according to the corresponding quantity.

[0043] In this embodiment, after executing S103 to complete the creation of the mirror cloud disk and the user cloud disk in the distributed block storage system, executing S104 to download the target data from the object storage system according to the object storage data information, and store the target data in at least one mirror cloud disk.

[0044] In this embodiment, the task execution node in the distributed block storage system sends object storage data information to the storage node, so that the storage node downloads the corresponding target data from the object storage system according to the received object storage data information.

[0045] It can be understood that the object storage data information in this embodiment can be included in the virtual machine creation request or determined based on the virtual machine image ID; the object storage data information is used to reflect the relevant data stored in the object storage system corresponding to the target virtual machine.

[0046] In this embodiment, when executing S104, the downloaded target data is only stored in at least one mirror cloud disk, and the target data is not stored in at least one user cloud disk, that is, the user cloud disk does not contain any data. On the one hand, the resource cost of the distributed block storage system is greatly saved, and on the other hand, the process of storing the target data in the user cloud disk is not involved, which can greatly reduce the creation time of the target virtual machine.

[0047] After executing S104 to store the target data in at least one mirror cloud disk, this embodiment executes S105 to mount at least one user cloud disk to the target virtual machine and store the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk to complete the creation of the virtual machine.

[0048] That is to say, this embodiment can complete the batch creation of virtual machines after mounting the created user cloud disk to the created target virtual machine and storing the correspondence between the mounted user cloud disk and the mirror cloud disk in the target virtual machine.

[0049] It can be understood that if different virtual machine creation requests are received, this embodiment will complete the creation of the corresponding virtual machine for each virtual machine creation request. The different virtual machines created will respectively mount a corresponding number of user cloud disks, and will respectively store the correspondence between the mounted user cloud disks and the mirror cloud disks.

[0050] In this embodiment, at least one user cloud disk is visible to the user, while the mirror cloud disk used to store target data is invisible to the user; when data needs to be read or downloaded from the mirror cloud disk, the target virtual machine in this embodiment can find the corresponding mirror cloud disk based on the pre-stored correspondence.

[0051] Therefore, when this embodiment determines that the received virtual machine creation request is a batch creation request, the corresponding user cloud disk can be quickly established and mounted to the created virtual machine according to the above method. When it is necessary to respond to the read and write requests of the user cloud disk in the future, the purpose of quickly responding to the read and write requests can be achieved by using the mirror cloud disk corresponding to the user cloud disk based on the correspondence between the stored user cloud disk and the mirror cloud disk.

[0052] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure. Figure 2 As shown, this embodiment may also include the following contents:

[0053] S201, after receiving a read request from a user for a user cloud disk, determining a target mirror cloud disk from the at least one mirror cloud disk;

[0054] S202: Acquire data corresponding to the read request from the target mirror cloud disk, and display the data to the user.

[0055] That is to say, after receiving the user's read request, this embodiment obtains the corresponding data from the target mirror cloud disk and displays it to the user so that the user can view the displayed data. This avoids the problem in the prior art that read requests require multiple interactions between nodes to complete, and can improve the response speed of read requests, thereby enhancing the access performance of the cloud disk.

[0056] When executing S201, this embodiment can randomly select one of the at least one mirror cloud disk as the target mirror cloud disk, or can select a mirror cloud disk with the lowest current operating pressure as the target mirror cloud disk based on the operating properties of the at least one mirror cloud disk.

[0057] In this embodiment, the target mirror cloud disk is determined by the computing node in the distributed block storage system, and then the determined target mirror cloud disk is directly accessed to obtain data corresponding to the read request to display to the user.

[0058] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure. Figure 3 As shown, this embodiment may also include the following contents:

[0059] S301, after receiving a write request from a user to a user cloud disk, determining a target user cloud disk from the at least one user cloud disk;

[0060] S302: Determine a mirror cloud disk corresponding to the target user cloud disk according to a correspondence between the at least one user cloud disk and the at least one mirror cloud disk;

[0061] S303: Downloading data corresponding to the write request from the determined mirror cloud disk, and storing the downloaded data in the target user cloud disk, so that the user can add, modify or delete the data in the target user cloud disk.

[0062] That is to say, this embodiment downloads data from the corresponding mirror cloud disk in real time according to the user's write request and stores it to the target user's cloud disk, so that the user can write to the data stored in the target user's cloud disk, avoiding unnecessary data downloads and greatly reducing the amount of data downloaded. In addition, by downloading the corresponding data through the mirror cloud disk, the data download efficiency can be improved, thereby improving the response speed of the write request and enhancing the access performance of the cloud disk.

[0063] When executing S301, this embodiment can randomly select one from at least one user cloud disk as the target user cloud disk, or according to the operating properties of at least one user cloud disk, select a user cloud disk with the lowest current operating pressure as the target user cloud disk, or select a user cloud disk selected by the user as the target user cloud disk.

[0064] In this embodiment, when S302 is executed, the target virtual machine determines the mirror cloud disk corresponding to the target user cloud disk according to the pre-stored correspondence relationship.

[0065] In this embodiment, the computing node in the distributed block storage system determines the target user cloud disk and its corresponding mirror cloud disk, and then sends the write request and the determined cloud disk to the task execution node, and the task execution node forwards the received information to the storage node, so that the storage node downloads data from the corresponding mirror cloud disk according to the write request and stores it in the target user cloud disk, and then completes operations such as adding, modifying or deleting the stored data according to the user's write request.

[0066] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure. Figure 4 As shown in , this embodiment shows a schematic diagram of a user cloud disk mounted to a created target virtual machine and a mirror cloud disk corresponding to the user cloud disk; Figure 4 In the embodiment, the user cloud disks mounted to the target virtual machine include user cloud disk 1, user cloud disk 2, user cloud disk 3, and user cloud disk 4. Each user cloud disk mounted to the target virtual machine is visible to the user, and different user cloud disks can store different data according to the user's write request; the mirror cloud disk corresponding to user cloud disk 1 and user cloud disk 2 is mirror cloud disk 1, and the mirror cloud disk corresponding to user cloud disk 3 and user cloud disk 4 is mirror cloud disk 2. The mirror cloud disks are invisible to the user. When data needs to be read or downloaded from the mirror cloud disks, the target virtual machine determines the corresponding mirror cloud disk according to the pre-stored correspondence between the user cloud disks and the mirror cloud disks.

[0067] Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure. Figure 5 As shown, the virtual machine creation device 500 of this embodiment includes:

[0068] The first creation unit 501 is used to create a target virtual machine according to a virtual machine creation request, wherein the virtual machine creation request includes a virtual machine image ID and a cloud disk quantity;

[0069] An acquiring unit 502 is configured to acquire the number of image cloud disks according to a first preset number threshold and the number of cloud disks when it is determined according to the virtual machine image ID that the request type of the virtual machine creation request is a batch creation request type;

[0070] The second creation unit 503 is used to create at least one mirror cloud disk according to the number of mirror cloud disks in the distributed block storage system, and create at least one user cloud disk corresponding to the at least one mirror cloud disk according to the number of cloud disks;

[0071] A downloading unit 504 is used to download target data from the object storage system according to the object storage data information, and store the target data in the at least one mirror cloud disk;

[0072] The mounting unit 505 is used to mount the at least one user cloud disk to the target virtual machine and store the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk to complete the creation of the virtual machine.

[0073] When the first creation unit 501 creates a target virtual machine according to the virtual machine creation request, it can first obtain the target image file according to the virtual machine image ID included in the virtual machine creation request, and then use the obtained target image file to create the target virtual machine; in this embodiment, the task execution node in the distributed block storage system can complete the creation of the target virtual machine according to the virtual machine creation request forwarded by the computing node.

[0074] In this embodiment, different virtual machine image IDs correspond to different image files, and different image files are used to create different virtual machines, so different virtual machine image IDs correspond to different virtual machines.

[0075] In this embodiment, the number of cloud disks included in the virtual machine creation request is used to create a corresponding number of user cloud disks in the distributed block storage system to be mounted to the target virtual machine.

[0076] In this embodiment, after the first creation unit 501 creates the target virtual machine according to the virtual machine creation request, the acquisition unit 502 obtains the number of mirror cloud disks according to the first preset number threshold and the number of cloud disks when determining that the request type of the virtual machine creation request is a batch creation request type according to the virtual machine image ID.

[0077] In this embodiment, the request type of the virtual machine creation request is a batch creation request type or a non-batch creation request type; if the request type is a batch creation request type, the virtual machine creation request obtained by the first creation unit 501 is used for batch creation of the same virtual machine.

[0078] When the acquisition unit 502 determines that the request type of the virtual machine creation request is a batch creation request type based on the virtual machine image ID, the implementation method that can be adopted is: based on the virtual machine image ID, obtain the number of requests for the same virtual machine creation request received within a preset time period; when it is determined that the number of requests obtained is greater than or equal to a second preset number threshold, determine that the request type of the virtual machine creation request is a batch creation request type.

[0079] That is to say, this embodiment determines whether the request type of the current virtual machine creation request is a batch creation request type based on the number of requests for the same virtual machine creation request received within a preset time period, which can improve the accuracy of determining the request type and thereby improve the accuracy of subsequent creation of the mirror cloud disk.

[0080] In addition, the obtaining unit 502 may also determine that the request type of the virtual machine creation request is a batch creation request type when determining that the virtual machine image ID is a preset ID.

[0081] After determining that the request type of the virtual machine creation request is a batch creation request type, the acquisition unit 502 can obtain the number of mirror cloud disks according to the first preset number threshold and the cloud disk data. The obtained number of mirror cloud disks is used to create a mirror cloud disk in the distributed block storage system.

[0082] When the acquisition unit 502 obtains the number of mirror cloud disks based on the first preset number threshold and the number of cloud disks, the number of cloud disks can be divided by the first preset number threshold, and the number of mirror cloud disks can be obtained based on the division result; the first number threshold in this embodiment is used to reflect the number of user cloud disks corresponding to a mirror cloud disk.

[0083] That is, this embodiment determines the number of mirror cloud disks according to the number of cloud disks, thereby avoiding the problem of over-concentration of access caused by creating only one mirror cloud disk, thereby achieving the purpose of dispersing access pressure.

[0084] In this embodiment, after the acquisition unit 502 acquires the number of mirrored cloud disks according to the first preset number threshold and the number of cloud disks, the second creation unit 503 creates at least one mirrored cloud disk according to the number of mirrored cloud disks in the distributed block storage system, and creates at least one user cloud disk corresponding to the at least one mirrored cloud disk according to the number of cloud disks.

[0085] In this embodiment, the number of user cloud disks corresponding to a mirror cloud disk is a first preset number threshold. For example, if there are mirror cloud disk 1 and mirror cloud disk 2, and there are user cloud disk 1, user cloud disk 2 and user cloud disk 3, then this embodiment can establish a corresponding relationship between mirror cloud disk 1 and (user cloud disk 1, user cloud disk 2), and establish a corresponding relationship between mirror cloud disk 2 and user cloud disk 3.

[0086] In this embodiment, after the second creation unit 503 completes the creation of the mirror cloud disk and the user cloud disk in the distributed block storage system, the download unit 504 downloads the target data from the object storage system according to the object storage data information and stores the target data in at least one mirror cloud disk.

[0087] It can be understood that the object storage data information in this embodiment can be included in the virtual machine creation request or determined based on the virtual machine image ID; the object storage data information is used to reflect the relevant data stored in the object storage system corresponding to the target virtual machine.

[0088] The downloading unit 504 only stores the downloaded target data in at least one mirror cloud disk, but does not store the target data in at least one user cloud disk, that is, the user cloud disk does not contain any data. On the one hand, it greatly saves the resource cost of the distributed block storage system, and on the other hand, it does not involve the process of storing the target data in the user cloud disk, which can greatly reduce the creation time of the target virtual machine.

[0089] In this embodiment, after the download unit 504 stores the target data in at least one mirror cloud disk, the mounting unit 505 mounts at least one user cloud disk to the target virtual machine and stores the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk to complete the creation of the virtual machine.

[0090] That is to say, this embodiment can complete the batch creation of virtual machines after mounting the created user cloud disk to the created target virtual machine and storing the correspondence between the mounted user cloud disk and the mirror cloud disk in the target virtual machine.

[0091] The virtual machine creation device 500 of this embodiment may also include a first processing unit 506, which is used to execute: after receiving a user's read request for a user cloud disk, determine a target mirror cloud disk from at least one mirror cloud disk; obtain data corresponding to the read request from the target mirror cloud disk, and display it to the user.

[0092] That is to say, after receiving the user's read request, this embodiment obtains the corresponding data from the target mirror cloud disk and displays it to the user so that the user can view the displayed data. This avoids the need for multiple interactions between nodes to complete the read request in the prior art, and can improve the response speed of the read request, thereby enhancing the access performance of the cloud disk.

[0093] The first processing unit 506 may randomly select one of the at least one mirror cloud disk as the target mirror cloud disk, or may select a mirror cloud disk with the lowest current operating pressure as the target mirror cloud disk according to the operating properties of the at least one mirror cloud disk.

[0094] The virtual machine creation device 500 of this embodiment may further include a second processing unit 507, which is used to execute: after receiving a user's write request for a user cloud disk, determine a target user cloud disk from at least one user cloud disk; determine a mirror cloud disk corresponding to the target user cloud disk according to a correspondence between at least one user cloud disk and at least one mirror cloud disk; download data corresponding to the write request from the determined mirror cloud disk, and store the downloaded data in the target user cloud disk, so that the user can add, modify or delete data in the target user cloud disk.

[0095] That is to say, this embodiment downloads data from the corresponding mirror cloud disk in real time according to the user's write request and stores it in the target user cloud disk, avoiding unnecessary data downloading and greatly reducing the amount of data downloaded. In addition, by responding to data downloads through the mirror cloud disk, the data download efficiency can be improved, thereby improving the response speed of write requests and enhancing the access performance of the cloud disk.

[0096] The second processing unit 507 may randomly select one from at least one user cloud disk as the target user cloud disk, or may select a user cloud disk with the lowest current operating pressure as the target user cloud disk based on the operating properties of at least one user cloud disk, or may select a user cloud disk selected by the user as the target user cloud disk.

[0097] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0098] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0099] like Figure 6 , is a block diagram of an electronic device according to a method for creating a virtual machine according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0100] like Figure 6As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0101] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0102] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a method for creating a virtual machine. For example, in some embodiments, the method for creating a virtual machine may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608.

[0103] In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the method for creating a virtual machine described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the method for creating a virtual machine in any other appropriate manner (e.g., by means of firmware).

[0104] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0105] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable virtual machine creation device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0106] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0107] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0108] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0109] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.

[0110] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0111] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for creating a virtual machine, comprising: Create a target virtual machine according to a virtual machine creation request, wherein the virtual machine creation request includes a virtual machine image ID and a cloud disk quantity; In a case where it is determined according to the virtual machine image ID that the request type of the virtual machine creation request is a batch creation request type, obtaining the number of image cloud disks according to a first preset number threshold and the number of cloud disks; In the distributed block storage system, at least one mirror cloud disk is created according to the number of mirror cloud disks, and at least one user cloud disk corresponding to the at least one mirror cloud disk is created according to the number of cloud disks; Downloading target data from the object storage system according to the object storage data information, and storing the target data in the at least one mirror cloud disk; The at least one user cloud disk is mounted to the target virtual machine, and a corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk is stored to complete the creation of the virtual machine.

2. The method according to claim 1, wherein: The step of determining, according to the virtual machine image ID, that the request type of the virtual machine creation request is a batch creation request type comprises: According to the virtual machine image ID, the number of requests for creating the same virtual machine received within a preset period of time is obtained; When it is determined that the request quantity is greater than or equal to a second preset quantity threshold, it is determined that the request type of the virtual machine creation request is a batch creation request type.

3. The method according to claim 1, wherein: The obtaining the number of mirrored cloud disks according to the first preset number threshold and the number of cloud disks includes: Dividing the number of cloud disks by the first preset number threshold to obtain a division result; The number of the mirrored cloud disks is obtained according to the division result.

4. The method according to claim 1, further comprising: After receiving a read request from a user for a user cloud disk, determining a target mirror cloud disk from the at least one mirror cloud disk; The data corresponding to the read request is obtained from the target mirror cloud disk, and displayed to the user.

5. The method according to claim 1, further comprising: After receiving a write request from the user to the user cloud disk, determining a target user cloud disk from the at least one user cloud disk; Determine, according to the correspondence between the at least one user cloud disk and the at least one mirror cloud disk, a mirror cloud disk corresponding to the target user cloud disk; Downloading data corresponding to the write request from the determined mirror cloud disk, and storing the downloaded data in the target user cloud disk, so that the user can add, modify or delete the data in the target user cloud disk.

6. A device for creating a virtual machine, comprising: A first creation unit, configured to create a target virtual machine according to a virtual machine creation request, wherein the virtual machine creation request includes a virtual machine image ID and a number of cloud disks; an acquiring unit, configured to acquire the number of image cloud disks according to a first preset number threshold and the number of cloud disks when it is determined according to the virtual machine image ID that the request type of the virtual machine creation request is a batch creation request type; A second creation unit is configured to create, in a distributed block storage system, at least one mirror cloud disk according to the number of mirror cloud disks, and at least one user cloud disk corresponding to the at least one mirror cloud disk according to the number of cloud disks; A downloading unit, configured to download target data from the object storage system according to the object storage data information, and store the target data in the at least one mirror cloud disk; The mounting unit is used to mount the at least one user cloud disk to the target virtual machine and store the corresponding relationship between the at least one user cloud disk and the at least one mirror cloud disk to complete the creation of the virtual machine.

7. The device according to claim 6, wherein: When the acquisition unit determines, according to the virtual machine image ID, that the request type of the virtual machine creation request is a batch creation request type, specifically performs: According to the virtual machine image ID, the number of requests for creating the same virtual machine received within a preset period of time is obtained; When it is determined that the request quantity is greater than or equal to a second preset quantity threshold, it is determined that the request type of the virtual machine creation request is a batch creation request type.

8. The device according to claim 6, wherein: When the acquisition unit acquires the number of mirrored cloud disks according to the first preset number threshold and the number of cloud disks, the acquisition unit specifically performs: Dividing the number of cloud disks by the first preset number threshold to obtain a division result; The number of the mirrored cloud disks is obtained according to the division result.

9. The apparatus according to claim 6, further comprising a first processing unit, configured to execute: After receiving a read request from a user for a user cloud disk, determining a target mirror cloud disk from the at least one mirror cloud disk; The data corresponding to the read request is obtained from the target mirror cloud disk, and displayed to the user.

10. The apparatus according to claim 6, further comprising a second processing unit, configured to execute: After receiving a write request from the user to the user cloud disk, determining a target user cloud disk from the at least one user cloud disk; Determine, according to the correspondence between the at least one user cloud disk and the at least one mirror cloud disk, a mirror cloud disk corresponding to the target user cloud disk; Downloading data corresponding to the write request from the determined mirror cloud disk, and storing the downloaded data in the target user cloud disk, so that the user can add, modify or delete the data in the target user cloud disk.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.

13. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Shared virtualized resource management method and shared virtualized resource management device under shared virtualized resource pool environment

    CN104331375A

  • Block device storage cluster capability expansion system and method

    CN106383671A

  • Method and device for creating virtual machines in cloud storage system

    CN107423117A

  • Method and device for creating virtual machines on batch, equipment and storage medium

    CN108170508A

  • Cloud disk mounting quantity scheduling method, system and device and storage medium

    CN114697331A