Method, device, electronic device and readable storage medium for creating a virtual machine
By creating a mapping between mirror cloud disks and user cloud disks in a distributed block storage system, target data can be directly stored in the mirror cloud disks, solving the problem of low efficiency in batch virtual machine creation and achieving the effects of rapid creation and reduced resource costs.
Patent Information
- Application Number
- CN202411311714.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-09-19
AI Technical Summary
In scenarios such as tidal operations and scene rendering, how can we improve the efficiency of creating virtual machines in batches, especially the efficiency of creating a large number of virtual machines in a short period of time?
By creating a mapping between mirror cloud disks and user cloud disks in a distributed block storage system, the target data is directly stored in the mirror cloud disk, avoiding the storage of data in the user cloud disk. The target data is downloaded from the object storage system using object storage data information, and the user cloud disk is mounted to the target virtual machine, thus storing the mapping between the mirror cloud disk and the user cloud disk.
It enables rapid completion of batch virtual machine creation, reduces virtual machine creation time and resource costs of distributed block storage systems, and improves virtual machine creation efficiency and cloud disk access performance.
Smart Images

Figure CN119376852B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to the fields of big data, cloud services, virtual machines, and other artificial intelligence technologies. It provides a method, apparatus, electronic device, and readable storage medium for creating a virtual machine. Background Technology
[0002] In scenarios such as tidal operations and scene rendering, it is necessary to create a large number of virtual machines in a short period of time to perform related tasks. Therefore, how to improve the efficiency of batch virtual machine creation is a technical problem that urgently needs to be solved. Summary of the Invention
[0003] According to a first aspect of this 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; if the request type of the virtual machine creation request is determined to be a batch creation request type based on the virtual machine image ID, obtaining a number of image cloud disks based on a first preset quantity threshold and the number of cloud disks; in a distributed block storage system, creating at least one image cloud disk based on the number of image cloud disks, and creating at least one user cloud disk corresponding to the at least one image cloud disk based on the number of cloud disks; downloading target data from an object storage system based on object storage data information, and storing the target data in the at least one image cloud disk; mounting the at least one user cloud disk to the target virtual machine, and storing the correspondence between the at least one user cloud disk and the at least one image cloud disk to complete the creation of the virtual machine.
[0004] According to a second aspect of this disclosure, a virtual machine creation apparatus is provided, comprising: a first creation unit, configured to create 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; an acquisition unit, configured to, when determining that the request type of the virtual machine creation request is a batch creation request type based on the virtual machine image ID, acquire a number of image cloud disks based on a first preset quantity threshold and the number of cloud disks; a second creation unit, configured to, in a distributed block storage system, create at least one image cloud disk according to the number of image cloud disks, and create at least one user cloud disk corresponding to the at least one image 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 image cloud disk; and a mounting unit, configured to mount the at least one user cloud disk to the target virtual machine, and store the correspondence between the at least one user cloud disk and the at least one image cloud disk, thereby completing the creation of the virtual machine.
[0005] According to a third aspect of this 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, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described above.
[0006] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described above.
[0007] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described above.
[0008] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0010] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0011] Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure;
[0012] Figure 3 This is a schematic diagram according to the third embodiment of the present disclosure;
[0013] Figure 4 This is a schematic diagram according to the fourth embodiment of the present disclosure;
[0014] Figure 5 This is a schematic diagram according to the fifth embodiment of the present disclosure;
[0015] Figure 6 This is a block diagram of an electronic device used to implement the virtual machine creation method of the embodiments of this disclosure. Detailed Implementation
[0016] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and mechanisms are omitted in the following description.
[0017] Figure 1 This is a schematic diagram based on the first embodiment of this disclosure. (See diagram below.) Figure 1 As shown, the virtual machine creation method in this embodiment specifically includes the following steps:
[0018] S101. Create the target virtual machine according to the virtual machine creation request, wherein the virtual machine creation request includes the virtual machine image ID and the number of cloud disks;
[0019] S102. If the virtual machine creation request is determined to be a batch creation request type based on the virtual machine image ID, the number of image cloud disks is obtained based on the first preset quantity threshold and the number of cloud disks.
[0020] S103. 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.
[0021] S104. Download target data from the object storage system according to object storage data information, and store 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 correspondence between the at least one user cloud disk and the at least one image cloud disk to complete the creation of the virtual machine.
[0023] The virtual machine creation method in this embodiment, when it is determined that the virtual machine creation request used to create the target virtual machine is a batch creation request, stores the target data corresponding to the target virtual machine by creating at least one mirror cloud disk in the distributed block storage system. This eliminates the need to store the downloaded target data separately to different user cloud disks, thereby achieving the goal of quickly creating virtual machines in the scenario of batch creation. It 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 virtual machine creation method in this embodiment is applied to a distributed block storage system, that is, a cloud disk is created in the distributed block storage system for mounting to the virtual machine, 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 as if these block devices were local disks, and features high reliability, high availability, and high elasticity.
[0026] In this embodiment, the distributed block storage system includes nodes such as control nodes, storage nodes, task execution nodes, and compute nodes. The control node is used to manage the 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 execute tasks such as creating, cloning, and deleting virtual machines, and the compute node is used to forward read and write requests for virtual machines to the storage node, and forward cloud disk creation requests and virtual machine creation requests to the control node.
[0027] In this embodiment, when executing S101 to create a target virtual machine based on a virtual machine creation request, the target image file can first be obtained based on the virtual machine image ID included in the virtual machine creation request, and then the obtained target image file can be used 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 based on 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. Therefore, 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 the target virtual machine according to the virtual machine creation request, S102 is executed. If the virtual machine creation request type is determined to be a batch creation request type according to the virtual machine image ID, the number of image cloud disks is obtained according to the first preset quantity threshold and the number of cloud disks.
[0031] In this embodiment, the virtual machine creation request type is either a batch creation request type or a non-batch creation request type; if the request type is a batch creation request type, then the virtual machine creation request obtained by executing S101 in this embodiment is used for the batch creation of the same virtual machine.
[0032] In this embodiment, when executing S102 to determine that the request type of the virtual machine creation request is a batch creation request type based on the virtual machine image ID, the following implementation method can be adopted: Based on the virtual machine image ID, obtain the number of identical virtual machine creation requests 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 identical virtual machine creation requests; if it is determined that the number of requests obtained is greater than or equal to the second preset number threshold, the request type of the virtual machine creation request is determined to be a batch creation request type.
[0033] In other words, this embodiment determines whether the current virtual machine creation request is a batch creation request type based on the number of identical virtual machine creation requests received within a preset time period. This can improve the accuracy of request type determination and thus improve the accuracy of subsequent creation of image cloud disks.
[0034] In this embodiment, the control node in the distributed block storage system determines the request type. The control node can record the virtual machine image ID of each virtual machine creation request it receives.
[0035] In addition, when executing S102 in this embodiment, if the virtual machine image ID is determined to be a preset ID, the request type of the virtual machine creation request can also be determined to be a batch creation request type.
[0036] In this embodiment, after executing S102 to determine that the virtual machine creation request is a batch creation request type, the number of mirror cloud disks can be obtained based on the first preset quantity threshold and cloud disk data. The obtained number of mirror cloud disks is used to create mirror cloud disks in the distributed block storage system.
[0037] In this embodiment, when executing S102 to obtain the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks, the number of cloud disks can be divided by the first preset quantity threshold, and the number of mirror cloud disks can be obtained based on the division result. In this embodiment, the first quantity threshold is used to reflect the number of user cloud disks corresponding to one mirror cloud disk.
[0038] For example, if the first preset quantity threshold is 2 and the number of cloud disks is 4, then in this embodiment, the 2 obtained by (4÷2) is used as the number of mirror cloud disks, that is, 2 mirror cloud disks are created, and 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, then in this embodiment, the smallest integer 3 greater than the result of the division, 2.5 obtained by (5÷3), is used as the number of mirror cloud disks, that is, 3 mirror cloud disks are created.
[0039] In other words, this embodiment determines the number of mirror cloud disks based on the number of cloud disks, thereby avoiding the problem of overly concentrated access caused by creating only one mirror cloud disk, and thus achieving the purpose of distributing access pressure.
[0040] In this embodiment, after executing S102 to obtain the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks, S103 is executed to create at least one mirror cloud disk in the distributed block storage system based on the number of mirror cloud disks, and to create at least one user cloud disk corresponding to the at least one mirror cloud disk based on the number of cloud disks.
[0041] In this embodiment, the number of user cloud disks corresponding to one mirror cloud disk is a first preset number threshold. For example, if there is mirror cloud disk 1 and mirror cloud disk 2, and user cloud disk 1, user cloud disk 2 and user cloud disk 3, then this embodiment can establish a correspondence between mirror cloud disk 1 and (user cloud disk 1, user cloud disk 2), and establish a correspondence 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 mirror cloud disks and user cloud disks respectively according to the corresponding quantity.
[0043] In this embodiment, after S103 completes the creation of the mirror cloud disk and the user cloud disk in the distributed block storage system, S104 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.
[0044] In this embodiment, the task execution node in the distributed block storage system sends object storage data information to the storage node, enabling the storage node to download the corresponding target data from the object storage system based on the received object storage data information.
[0045] It is understood that the object storage data information in this embodiment may be included in the virtual machine creation request or may be 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 that corresponds to the target virtual machine.
[0046] In this embodiment, when executing S104, the downloaded target data is 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, this 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.
[0047] In this embodiment, after executing S104 to store the target data into at least one mirror cloud disk, S105 is executed to mount at least one user cloud disk onto the target virtual machine and store the correspondence between at least one user cloud disk and at least one mirror cloud disk to complete the creation of the virtual machine.
[0048] In other words, this embodiment completes the batch creation of virtual machines by mounting the created user cloud disk to the created target virtual machine and storing the correspondence between the mounted user cloud disk and the image cloud disk in the target virtual machine.
[0049] It is understandable that if different virtual machine creation requests are received, this embodiment will create the corresponding virtual machine for each virtual machine creation request. The different virtual machines created will each mount a corresponding number of user cloud disks, and will each store the correspondence between the mounted user cloud disks and the image 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 the target data is invisible to the user. When it is necessary to read or download data from the mirror cloud disk, the target virtual machine in this embodiment can find the corresponding mirror cloud disk according to the pre-stored correspondence.
[0051] Therefore, in this embodiment, when it is determined that the received virtual machine creation request is a batch creation request, the corresponding user cloud disk can be quickly established and mounted on 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 corresponding relationship between the stored user cloud disk and the mirror cloud disk can be used to achieve the purpose of quickly responding to the read and write requests by means of the mirror cloud disk corresponding to the user cloud disk.
[0052] Figure 2 This is a schematic diagram according to the second embodiment of this disclosure. (See diagram below.) Figure 2 As shown, this embodiment may also include the following:
[0053] S201. After receiving a user's read request for the user's cloud disk, determine the target mirror cloud disk from the at least one mirror cloud disk.
[0054] S202. Obtain the data corresponding to the read request from the target image cloud disk and display it to the user.
[0055] In other words, after receiving a user's read request, this embodiment displays the corresponding data to the user by retrieving it from the target mirror cloud disk, allowing the user to view the displayed data. This avoids the problem in the prior art where read requests require multiple interactions between nodes to complete, thus improving the response speed of read requests and enhancing the access performance of the cloud disk.
[0056] In this embodiment, when executing S201, one can be randomly selected from at least one mirror cloud disk as the target mirror cloud disk, or the mirror cloud disk with the lowest current operating pressure can be selected as the target mirror cloud disk based on the operating attributes of at least one mirror cloud disk.
[0057] In this embodiment, the computing nodes in the distributed block storage system determine the target mirror cloud disk, and then directly access the determined target mirror cloud disk to obtain the data corresponding to the read request in order to display it to the user.
[0058] Figure 3 This is a schematic diagram according to the third embodiment of this disclosure. (See diagram below.) Figure 3 As shown, this embodiment may also include the following:
[0059] S301. After receiving a write request from a user to a user cloud disk, determine the target user cloud disk from the at least one user cloud disk.
[0060] S302. Based on the correspondence between the at least one user cloud disk and the at least one mirror cloud disk, determine the mirror cloud disk corresponding to the target user cloud disk;
[0061] S303. Download the 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.
[0062] In other words, this embodiment downloads data from the corresponding mirrored cloud disk in real time and stores it to the target user's cloud disk according to the user's write request. This allows the user to perform write operations on the data stored in the target user's cloud disk, avoiding unnecessary data downloads and greatly reducing the amount of data downloaded. Furthermore, downloading data through the mirrored cloud disk can improve data download efficiency, thereby increasing the response speed of write requests and enhancing the access performance of the cloud disk.
[0063] In this embodiment, when executing S301, one can be randomly selected from at least one user cloud disk as the target user cloud disk, or the user cloud disk with the lowest current operating pressure can be selected as the target user cloud disk based on the operating attributes of at least one user cloud disk, or the user cloud disk selected by the user can be selected 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's cloud disk based on the pre-stored correspondence.
[0065] In this embodiment, the computing nodes in the distributed block storage system determine the target user's cloud disk and its corresponding mirror cloud disk. Then, the computing nodes send the write request and the determined cloud disk to the task execution node, which then forwards the received information to the storage node. This allows the storage node to download data from the corresponding mirror cloud disk according to the write request and store it in the target user's cloud disk. Subsequently, the storage node can perform operations such as adding, modifying, or deleting the stored data according to the user's write request.
[0066] Figure 4 This is a schematic diagram according to the fourth embodiment of this disclosure. (See diagram below.) Figure 4 As shown in the illustration, this embodiment depicts a user cloud disk mounted to the created target virtual machine, and a corresponding image cloud disk; Figure 4 In this context, 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 requests. 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 not visible to the user. When it is necessary to read or download data from the mirror cloud disk, the target virtual machine determines the corresponding mirror cloud disk according to the pre-stored correspondence between user cloud disks and mirror cloud disks.
[0067] Figure 5 This is a schematic diagram according to the fifth embodiment of this disclosure. (See diagram below.) Figure 5 As shown, the virtual machine creation apparatus 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 number of cloud disks.
[0069] The acquisition unit 502 is used to acquire the number of image cloud disks based on a first preset quantity threshold and the number of cloud disks when the request type of the virtual machine creation request is determined to be a batch creation request type based on the virtual machine image ID.
[0070] The second creation unit 503 is used to create at least one mirror cloud disk in the distributed block storage system according to the number of mirror cloud disks, 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.
[0071] Download unit 504 is used to download target data from the object storage system according to object storage data information, and store the target data in the at least one mirror cloud disk;
[0072] Mounting unit 505 is used to mount the at least one user cloud disk to the target virtual machine and store the correspondence between the at least one user cloud disk and the at least one image 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. Therefore, 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, after determining that the request type of the virtual machine creation request is a batch creation request type based on the virtual machine image ID, obtains the number of image cloud disks based on the first preset quantity threshold and the number of cloud disks.
[0077] In this embodiment, the virtual machine creation request type is either 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 the 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 acquisition unit 502 can adopt the following implementation method: based on the virtual machine image ID, acquire the number of requests for the same virtual machine creation request received within a preset time period; if the acquired number of requests 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] In other words, this embodiment determines whether the current virtual machine creation request is a batch creation request type based on the number of identical virtual machine creation requests received within a preset time period. This can improve the accuracy of request type determination and thus improve the accuracy of subsequent creation of image cloud disks.
[0080] In addition, the acquisition unit 502 can also determine that the virtual machine creation request type is a batch creation request type if the virtual machine image ID is determined to be a preset ID.
[0081] After determining that the virtual machine creation request is a batch creation request type, the acquisition unit 502 can obtain the number of mirror cloud disks based on the first preset quantity threshold and cloud disk data. The obtained number of mirror cloud disks is used to create mirror cloud disks in the distributed block storage system.
[0082] When the acquisition unit 502 obtains the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks, it can divide the number of cloud disks by the first preset quantity threshold and obtain the number of mirror cloud disks based on the division result. In this embodiment, the first quantity threshold is used to reflect the number of user cloud disks corresponding to one mirror cloud disk.
[0083] In other words, this embodiment determines the number of mirror cloud disks based on the number of cloud disks, thereby avoiding the problem of overly concentrated access caused by creating only one mirror cloud disk, and thus achieving the purpose of distributing access pressure.
[0084] In this embodiment, after the acquisition unit 502 obtains the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks, the second creation unit 503 creates at least one mirror cloud disk in the distributed block storage system based on the number of mirror cloud disks, and creates at least one user cloud disk corresponding to the at least one mirror cloud disk based on the number of cloud disks.
[0085] In this embodiment, the number of user cloud disks corresponding to one mirror cloud disk is a first preset number threshold. For example, if there is mirror cloud disk 1 and mirror cloud disk 2, and user cloud disk 1, user cloud disk 2 and user cloud disk 3, then this embodiment can establish a correspondence between mirror cloud disk 1 and (user cloud disk 1, user cloud disk 2), and establish a correspondence 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 is understood that the object storage data information in this embodiment may be included in the virtual machine creation request or may be 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 that corresponds to the target virtual machine.
[0088] The download unit 504 stores the downloaded target data to at least one mirror cloud disk, but not to at least one user cloud disk. That is, the user cloud disk does not contain any data. On the one hand, this greatly saves the resource cost of the distributed block storage system, and on the other hand, it avoids the process of storing the target data to 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 into 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 correspondence between at least one user cloud disk and at least one mirror cloud disk to complete the creation of the virtual machine.
[0090] In other words, this embodiment completes the batch creation of virtual machines by mounting the created user cloud disk to the created target virtual machine and storing the correspondence between the mounted user cloud disk and the image cloud disk in the target virtual machine.
[0091] The virtual machine creation apparatus 500 in this embodiment may further include a first processing unit 506, which is used to perform the following: after receiving a user's read request for a user's cloud disk, determine a target mirror cloud disk from at least one mirror cloud disk; obtain the data corresponding to the read request from the target mirror cloud disk and display it to the user.
[0092] In other words, after receiving a user's read request, this embodiment displays the corresponding data to the user by retrieving it from the target image cloud disk, allowing the user to view the displayed data. This avoids the need for multiple interactions between nodes to complete a read request, as is required in the prior art, thus improving the response speed of read requests and enhancing the access performance of the cloud disk.
[0093] The first processing unit 506 may randomly select one from at least one mirror cloud disk as the target mirror cloud disk, or it may select the mirror cloud disk with the lowest current operating pressure as the target mirror cloud disk based on the operating attributes of at least one mirror cloud disk.
[0094] The virtual machine creation apparatus 500 of this embodiment may further include a second processing unit 507, configured to perform the following: after receiving a write request from a user to 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 based on the 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] In other words, this embodiment downloads data from the corresponding mirror cloud disk to the target user's cloud disk in real time according to the user's write request, avoiding unnecessary data downloads and greatly reducing the amount of data downloaded. Furthermore, downloading response data through the mirror cloud disk can also improve data download efficiency, thereby increasing the response speed of write requests and enhancing the access performance of the cloud disk.
[0096] The second processing unit 507 can randomly select one from at least one user cloud disk as the target user cloud disk, or select the user cloud disk with the lowest current operating pressure as the target user cloud disk based on the operating attributes of at least one user cloud disk, or select the user cloud disk selected by the user as the target user cloud disk.
[0097] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0098] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0099] like Figure 6 The diagram shown is a block diagram of an electronic device for a method of 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, workstations, 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 processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0100] like Figure 6As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0101] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0102] The computing unit 601 can be a variety of general-purpose and / or special-purpose 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 special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as methods for creating virtual machines. For example, in some embodiments, the methods for creating virtual machines may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 608.
[0103] In some embodiments, part or all of the computer program may be loaded and / or installed onto the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by computing unit 601, one or more steps of the virtual machine creation method described above may be performed. Alternatively, in other embodiments, computing unit 601 may be configured to perform the virtual machine creation method by any other suitable means (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-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.
[0105] Program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other means of creating a programmable virtual machine, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0106] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, 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 for showing information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).
[0108] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0109] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the management difficulties and weak business scalability inherent in traditional physical hosts and VPS (Virtual Private Server) services. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0110] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0111] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for creating a virtual machine, comprising: Create the target virtual machine according to the virtual machine creation request, wherein the virtual machine creation request includes the virtual machine image ID and the number of cloud disks; If the virtual machine creation request is determined to be a batch creation request type based on the virtual machine image ID, the number of image cloud disks is obtained based on the first preset quantity threshold and the number of cloud disks. In a distributed block storage system, at least one mirror cloud disk is created based on the number of mirror cloud disks, and at least one user cloud disk corresponding to the at least one mirror cloud disk is created based on the number of cloud disks. Download target data from the object storage system based on object storage data information, and store 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 the correspondence between the at least one user cloud disk and the at least one image cloud disk is stored to complete the creation of the virtual machine; The step of obtaining the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks includes: Divide the number of cloud disks by the first preset number threshold to obtain the division result; Based on the division result, obtain the number of mirror cloud disks; The method further includes: After receiving a write request from a user to a user cloud disk, the target user cloud disk is determined from the at least one user cloud disk. Based on the correspondence between the at least one user cloud disk and the at least one mirror cloud disk, determine the mirror cloud disk corresponding to the target user cloud disk; Download the 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.
2. The method according to claim 1, wherein, The step of determining the virtual machine creation request type as a batch creation request type based on the virtual machine image ID includes: Based on the virtual machine image ID, obtain the number of requests for the same virtual machine creation received within a preset time period; If the number of requests is greater than or equal to the second preset threshold, the request type of the virtual machine creation request is determined to be a batch creation request type.
3. The method according to claim 1, further comprising: After receiving a read request from a user for a user cloud disk, the target mirror cloud disk is determined from the at least one mirror cloud disk; The data corresponding to the read request is retrieved from the target image cloud disk and displayed to the user.
4. A virtual machine creation apparatus, comprising: The first creation unit 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 number of cloud disks; The acquisition unit is used to acquire the number of image cloud disks based on a first preset quantity threshold and the number of cloud disks when the request type of the virtual machine creation request is determined to be a batch creation request type based on the virtual machine image ID. The second creation unit is used to create at least one mirror cloud disk in the distributed block storage system according to the number of mirror cloud disks, 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. The download unit is used to download target data from the object storage system according to 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 correspondence between the at least one user cloud disk and the at least one image cloud disk to complete the creation of the virtual machine; Specifically, when the acquisition unit acquires the number of mirror cloud disks based on the first preset quantity threshold and the number of cloud disks, it performs the following: Divide the number of cloud disks by the first preset number threshold to obtain the division result; Based on the division result, obtain the number of mirror cloud disks; The device further includes a second processing unit for performing: After receiving a write request from a user to a user cloud disk, the target user cloud disk is determined from the at least one user cloud disk. Based on the correspondence between the at least one user cloud disk and the at least one mirror cloud disk, determine the mirror cloud disk corresponding to the target user cloud disk; Download the 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.
5. The apparatus according to claim 4, wherein, When the acquisition unit determines that the request type of the virtual machine creation request is a batch creation request type based on the virtual machine image ID, it specifically performs the following: Based on the virtual machine image ID, obtain the number of requests for the same virtual machine creation received within a preset time period; If the number of requests is greater than or equal to the second preset threshold, the request type of the virtual machine creation request is determined to be a batch creation request type.
6. The apparatus according to claim 4, further comprising a first processing unit for performing: After receiving a read request from a user for a user cloud disk, the target mirror cloud disk is determined from the at least one mirror cloud disk; The data corresponding to the read request is retrieved from the target image cloud disk and displayed to the user.
7. 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 to enable the at least one processor to perform the method of any one of claims 1-3.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-3.
9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-3.
Citation Information
Patent Citations
Method and device for creating virtual machines on batch, equipment and storage medium
CN108170508A
Virtual machine creation method, and remote device, server device and storage medium
WO2023236744A1