Method for creating virtual machine in distributed cloud environment, electronic equipment and storage medium

By obtaining and distributing image files from the central cloud in local data centers in edge regions, and using distributed storage to create virtual machines on multiple physical machine nodes, the problem of slow virtual machine creation speed in distributed cloud environments is solved, achieving savings in image retrieval time and reduction in storage costs.

CN120994300APending Publication Date: 2025-11-21TENCENT CLOUD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410649921.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Virtual machine creation is slow in distributed cloud environments, especially in small data centers in edge availability zones where image retrieval is slow, leading to VPN channel congestion and high storage costs.

Method used

When the target image file is not cached in the local data center in the edge region, it is obtained from the central cloud image repository and distributed to multiple physical machine nodes. The distributed storage is used to create virtual machines on multiple physical machine nodes, and the transmission and creation of image files are accelerated by sharding and merging image fragments.

Benefits of technology

It improves the overall creation speed of distributed cloud virtual machines, reduces image pull time, lowers storage costs, and avoids VPN channel congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994300A_ABST
    Figure CN120994300A_ABST
Patent Text Reader

Abstract

The invention discloses a method for creating a virtual machine in a distributed cloud environment, electronic equipment and a storage medium, which can be applied to a cloud technology scene. In the application, when a virtual machine creation request of a first physical machine node is received, if a local machine room to which the first physical machine node belongs is located in an edge area and all physical machine nodes in the local machine room do not cache a target mirror image file, the target mirror image file is acquired from a mirror image warehouse of a central cloud; storing the data to a plurality of physical machine nodes of a local machine room in a distributed manner; creating a virtual machine on the first physical machine node based on a target mirror image file stored in a distributed manner; and when a virtual machine creation request of a second physical machine node in the local machine room is received, if the second physical machine node does not cache the target mirror image file, creating a virtual machine on the second physical machine node based on the distributed storage target mirror image file. According to the scheme, the overall creation speed of the distributed cloud virtual machine is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud technology, and in particular to a virtual machine creation method and device in a distributed cloud environment, electronic equipment, computer storage medium and computer program product. BACKGROUND

[0002] An image file is a complete copy or image stored in a computer, usually used for backup, copying or distributing software, operating systems or data. In the field of computers, image files can be disk images, optical disk images, virtual machine images, etc. These image files can be used to create a copy that is exactly the same as the original. In cloud applications, image files are generally stored in a distributed file system, or in the case of cloud disks, combined with the snapshot rollback function of object storage to pull images.

[0003] In related technologies, when a central cloud creates a virtual machine, the image is pulled from the image repository of the central cloud. The central cloud has a large internal bandwidth, so it can quickly pull the image to create a virtual machine. For remote rooms of a distributed cloud, the image can reuse the image repository of the central cloud, and the image is pulled through a VPN (Virtual Private Network) channel to create a virtual machine; or a local image repository can be built in the remote room, and the image is pre-synchronized to the local repository, and the remote room directly pulls the image from the local image repository to create a virtual machine.

[0004] However, for image pulling of a distributed cloud, the reuse of the central cloud image repository is prone to slow image pulling speed due to small VPN bandwidth, thereby affecting the creation speed of the virtual machine. In addition, concurrent machine creation can cause congestion of the VPN channel, thereby affecting the management and control services from the center to the remote room. For the method of building a local image repository in a remote room, a certain number of large storage physical machines are needed to build a separate image repository, and for small machine rooms in edge zones, the storage cost is high.

[0005] Therefore, the creation speed of the virtual machine of the related technology is slow, and improvement is urgently needed. SUMMARY

[0006] The embodiments of the present application provide a virtual machine creation method and device in a distributed cloud environment, electronic equipment, computer readable storage medium and computer program product, which can improve the overall creation speed of the virtual machine of the distributed cloud.

[0007] A virtual machine creation method in a distributed cloud environment includes:

[0008] receive a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file;

[0009] if the local computer room to which the first physical machine node belongs is located in an edge area and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from an image repository of a central cloud and is distributed stored to a plurality of physical machine nodes in the local computer room;

[0010] based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node;

[0011] when receiving a second virtual machine creation request initiated by a second physical machine node in the local computer room, if the second physical machine node does not cache the target image file, then based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the second physical machine node, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

[0012] Correspondingly, the embodiment of the application further provides a virtual machine creation device in a distributed cloud environment, comprising:

[0013] a receiving unit, configured to receive a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file;

[0014] a first obtaining unit, configured to if the local computer room to which the first physical machine node belongs is located in an edge area and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from an image repository of a central cloud and is distributed stored to a plurality of physical machine nodes in the local computer room;

[0015] a first creating unit, configured to based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node;

[0016] a second creating unit, configured to when receiving a second virtual machine creation request initiated by a second physical machine node in the local computer room, if the second physical machine node does not cache the target image file, then based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the second physical machine node, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

[0017] Optionally, in some embodiments, the target image file is divided into a plurality of different image segments and distributed in the plurality of physical machine nodes;

[0018] When creating a virtual machine on the first physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes, the first creating unit is specifically configured to:

[0019] synchronize the plurality of different image segments distributed in the plurality of physical machine nodes to the first physical machine node; merge the plurality of different image segments in the first physical machine node to obtain the target image file; and create a virtual machine on the first physical machine node based on the target image file;

[0020] When creating a virtual machine on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes, the second creating unit is specifically configured to:

[0021] synchronize the plurality of different image segments distributed in the plurality of physical machine nodes to the second physical machine node; merge the plurality of different image segments in the second physical machine node to obtain the target image file; and create a virtual machine on the second physical machine node based on the target image file.

[0022] Optionally, in some embodiments, when merging the plurality of different image segments in the first physical machine node or the second physical machine node to obtain the target image file, the first creating unit or the second creating unit is specifically configured to:

[0023] determine a position offset corresponding to each image segment of the plurality of different image segments; and merge the plurality of different image segments according to the position offset to obtain the target image file.

[0024] Optionally, in some embodiments, the local computer room and the central cloud communicate through a virtual private network; when obtaining the target image file from the image warehouse of the central cloud and distributing and storing the target image file in the plurality of physical machine nodes of the local computer room, the first obtaining unit is specifically configured to:

[0025] obtain the target image file from the image warehouse of the central cloud; perform fragmentation processing on the obtained target image file to obtain a plurality of different image segments; and transmit the plurality of different image segments through the virtual private network and store the plurality of different image segments in the plurality of physical machine nodes of the local computer room.

[0026] Optionally, in some embodiments, when transmitting the plurality of different image segments through the virtual private network, the first obtaining unit is further configured to:

[0027] obtain a first bandwidth currently available for the virtual private network, and determine a first number of image transmission tasks that can be executed in parallel currently according to the first bandwidth; obtain a second number of the plurality of different image segments; if the first number is greater than or equal to the second number, transmit the plurality of different image segments in parallel through the virtual private network; if the first number is less than the second number, transmit the first number of image segments in the plurality of different image segments in parallel through the virtual private network, and add the remaining image segments to a queue of image transmission tasks for transmission.

[0028] Optionally, in some embodiments, when transmitting the plurality of different image segments through the virtual private network, the first obtaining unit is further configured to:

[0029] obtain a first bandwidth currently available for the virtual private network and a second number of the plurality of different image segments; determine a second bandwidth according to the first bandwidth and the second number; and transmit each of the plurality of different image segments in parallel through the virtual private network according to the second bandwidth.

[0030] Optionally, in some embodiments, the apparatus further comprises:

[0031] a generating unit configured to, after transmitting the plurality of different image segments through the virtual private network and storing the plurality of different image segments at the plurality of physical machine nodes of the local computer room, generate, for each of the plurality of different image segments, a corresponding image segment copy on a corresponding physical machine node of the local computer room, wherein the image segment copy and the corresponding image segment are stored at different physical machine nodes.

[0032] Optionally, in some embodiments, when creating a virtual machine on the first physical machine node based on the target image file stored in a distributed manner at the plurality of physical machine nodes, the first creating unit can be specifically configured to:

[0033] obtaining first load information of the plurality of physical machine nodes and the corresponding physical machine nodes; obtaining a first data amount of each of the plurality of different image segments and the corresponding image segment copy; assigning each of the plurality of different image segments a segment identifier, wherein each of the image segments and the corresponding image segment copy share the same segment identifier; matching a first target physical machine node for each of the segment identifiers according to the first load information and the first data amount; obtaining the image segment or the image segment copy corresponding to the segment identifier from the first target physical machine node, and creating a virtual machine on the first physical machine node based on all the obtained image segments and / or image segment copies;

[0034] When creating the virtual machine on the second physical machine node based on the distributed storage of the target image file on the plurality of physical machine nodes, the second creating unit can be specifically configured to:

[0035] obtaining second load information of the plurality of physical machine nodes and the corresponding physical machine nodes; matching a second target physical machine node for each of the segment identifiers according to the second load information and the first data amount; obtaining the image segment or the image segment copy corresponding to the segment identifier from the second target physical machine node, and creating a virtual machine on the second physical machine node based on all the obtained image segments and / or image segment copies.

[0036] Optionally, in some embodiments, the apparatus further comprises:

[0037] a first determining unit configured to determine a second data amount of the target image file before obtaining the target image file from an image warehouse of a central cloud and distributing the target image file to the plurality of physical machine nodes of the local computer room;

[0038] a second determining unit configured to determine available storage space for image caching of each physical machine node in the local computer room;

[0039] a third determining unit configured to determine the plurality of physical machine nodes from the local computer room according to the size of the available storage space and the second data amount.

[0040] Optionally, in some embodiments, the apparatus further comprises:

[0041] a statistical unit configured to, after creating the virtual machine on the second physical machine node based on the distributed storage of the target image file on the plurality of physical machine nodes, perform information statistics on the image file used for creating the virtual machine on each physical machine node in the local computer room, to obtain first statistical result information;

[0042] The fourth determining unit is configured to determine a first mirror file meeting the first preset condition from the mirror files according to the information statistics result.

[0043] The second obtaining unit is configured to synchronize the first mirror file to physical machine nodes of other machine rooms in the distributed cloud environment.

[0044] Optionally, in some embodiments, the apparatus further comprises:

[0045] The fifth determining unit is configured to, after information statistics on the mirror files used for creating virtual machines on the physical machine nodes in the local machine room, determine a second mirror file or a target mirror segment with the longest time distance from a current time point when an available storage space for mirror caching of the physical machine node detected to be less than a preset value.

[0046] The removing unit is configured to remove the second mirror file from the detected physical machine node, or remove the target mirror segment from the detected physical machine node and remove associated mirror segments of the target mirror segment from other physical machine nodes in the local machine room.

[0047] Optionally, in some embodiments, the apparatus further comprises:

[0048] The third creating unit is configured to, after creating a virtual machine on the second physical machine node based on the target mirror file stored in the plurality of physical machine nodes, receive a third virtual machine creation request initiated by a third physical machine node in the local machine room, and create a virtual machine on the third physical machine node based on the target mirror file if the target mirror file is cached in the third physical machine node, wherein the third virtual machine creation request indicates to create a virtual machine based on the target mirror file.

[0049] Embodiments of the present application also provide an electronic device comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to run the computer program in the memory to execute the steps in the method for creating a virtual machine in a distributed cloud environment according to any one of the preceding embodiments.

[0050] Embodiments of the present application also provide a computer readable storage medium storing a plurality of instructions, wherein the instructions are adapted to be loaded by a processor to execute the steps in the method for creating a virtual machine in a distributed cloud environment according to any one of the preceding embodiments.

[0051] The embodiment of the present application further provides a computer program product comprising a computer program or instructions, which, when executed by a processor, implement the steps in the method for creating a virtual machine in a distributed cloud environment according to any one of the preceding embodiments.

[0052] In the present application, by receiving a first virtual machine creation request initiated by a first physical machine node, if the local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache a target image file, the target image file is obtained from an image repository of a central cloud according to the first virtual machine creation request, and is distributed and stored to a plurality of physical machine nodes in the local computer room; then, based on the target image file distributed and stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node; when receiving a second virtual machine creation request initiated by a second physical machine node in the local computer room, if the second physical machine node does not cache the target image file, a virtual machine is created on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes. In the present scheme, the image file in the central cloud is directly cached in the physical machine nodes in the edge area computer room in the distributed cloud environment, which saves the image pulling time for the creation of the virtual machine on the related physical machine nodes in the subsequent edge area computer room, and further improves the overall creation speed of the distributed cloud virtual machine. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.

[0054] Figure 1 is a scene schematic diagram of the method for creating a virtual machine in a distributed cloud environment provided by the embodiment of the present application;

[0055] Figure 2 is a flow schematic diagram of the method for creating a virtual machine in a distributed cloud environment provided by the embodiment of the present application;

[0056] Figure 3 is an operation interface schematic diagram of a preheating image provided by the embodiment of the present application;

[0057] Figure 4 is another operation interface schematic diagram of a preheating image provided by the embodiment of the present application;

[0058] Figure 5 is another operation interface schematic diagram of a preheating image provided by the embodiment of the present application;

[0059] Figure 6is a time consumption analysis comparison schematic diagram of different level mirror pulling manners provided by an embodiment of the present application.

[0060] Figure 7 is an architecture schematic diagram of a mirror preheating system provided by an embodiment of the present application.

[0061] Figure 8 is a multi-copy distributed storage schematic diagram of a mirror file provided by an embodiment of the present application.

[0062] Figure 9 is a flow schematic diagram of a distributed cloud virtual machine creation method provided by an embodiment of the present application.

[0063] Figure 10 is a structure schematic diagram of a virtual machine creation device in a distributed cloud environment provided by an embodiment of the present application.

[0064] Figure 11 is a structure schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0065] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0066] The embodiments of the present application provide a virtual machine creation method and device in a distributed cloud environment, an electronic device, a computer readable storage medium and a computer program product, which can improve the overall creation speed of the distributed cloud virtual machine. The virtual machine creation device in the distributed cloud environment can be integrated in an electronic device, which can be a server or a terminal or the like.

[0067] The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, network acceleration service, and big data and artificial intelligence platform.

[0068] For example, referring to Figure 1For example, the device for creating a virtual machine in a distributed cloud environment is integrated in an electronic device. The electronic device receives a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file. If the local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from the image repository of the center cloud and is distributed and stored to the plurality of physical machine nodes in the local computer room. Then, based on the target image file distributed and stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node. When a second virtual machine creation request initiated by a second physical machine node in the local computer room is received, if the second physical machine node does not cache the target image file, then based on the target image file distributed and stored in the plurality of physical machine nodes, a virtual machine is created on the second physical machine node, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

[0069] The method for creating a virtual machine in a distributed cloud environment provided by the embodiments of the present application relates to the cloud technology field. The embodiments of the present application cache the image file in the center cloud directly in the physical machine nodes in the edge area computer room in the distributed cloud environment, which saves the image pulling time for the creation of virtual machines on the related physical machine nodes in the edge area computer room, and further improves the overall creation speed of the distributed cloud virtual machine.

[0070] Cloud technology refers to the integration of hardware, software, network and other series of resources in a wide area network or local area network to realize the calculation, storage, processing and sharing of data. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology and other technologies based on cloud computing business model applications, which can form a resource pool, and can be used on demand, flexibly and conveniently. Cloud computing technology will become an important support. The background service of the technical network system needs a large amount of calculation and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, every item may have its own identification mark in the future, and needs to be transmitted to the background system for logical processing. Different levels of data will be processed separately, and various industry data need strong system support, which can only be realized through cloud computing.

[0071] Cloud computing refers to a delivery and use model of IT infrastructure where IT resources are accessed over the network as a service, and are available on demand, easily scalable, and manageable. Broadly, cloud computing refers to the delivery and use of services over the network as a service, and is available on demand, easily scalable, and manageable. Such services can be IT and software, Internet related, or other services. Cloud computing is the product of the development of grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, load balancing, and other traditional computer and network technologies.

[0072] With the development of the Internet, real-time data flow, and the diversification of connected devices, and the promotion of search services, social networks, mobile commerce, and open collaboration, cloud computing has rapidly developed. Unlike previous parallel distributed computing, the generation of cloud computing will revolutionize the entire Internet model and enterprise management model.

[0073] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that cooperatively works together to provide data storage and business access functions by collecting a large number of various types of storage devices (storage nodes) in the network through cluster applications, grid technologies, and distributed storage file systems, and the like.

[0074] At present, the storage method of the storage system is to create a logical volume, and when the logical volume is created, a physical storage space is allocated to each logical volume, which can be a disk of a certain storage device or a disk group of several storage devices. The user end stores data on a certain logical volume, that is, stores data on the file system, the file system divides the data into many parts, each part is an object, the object contains not only data but also additional information such as data identification (ID, ID entity), the file system writes each object to the physical storage space of the logical volume, and the file system records the storage location information of each object, so that when the user end requests to access the data, the file system can access the data according to the storage location information of each object.

[0075] The process by which a storage system allocates physical storage space to a logical volume is as follows: the physical storage space is pre-divided into strips according to the capacity estimate of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of Redundant Array of Independent Disks (RAID). A logical volume can be understood as a strip, thus allocating physical storage space to the logical volume.

[0076] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0077] This embodiment will describe the corner information of the virtual machine creation device in the distributed cloud environment. The virtual machine creation device in the distributed cloud environment can be integrated into an electronic device, which can be a server or a terminal, etc. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), or other smart devices that can perform data processing.

[0078] This application provides a method for creating a virtual machine in a distributed cloud environment, comprising: receiving a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates that a virtual machine is created based on a target image file; if the local data center to which the first physical machine node belongs is located in an edge region, and none of the physical machine nodes in the local data center have cached the target image file, then, according to the first virtual machine creation request, obtaining the target image file from the image repository of the central cloud and distributively storing it to multiple physical machine nodes in the local data center; then, creating a virtual machine on the first physical machine node based on the target image file distributedly stored on the multiple physical machine nodes; when a second virtual machine creation request initiated by a second physical machine node in the local data center is received, if the second physical machine node has not cached the target image file, then creating a virtual machine on the second physical machine node based on the target image file distributedly stored on the multiple physical machine nodes, wherein the second virtual machine creation request indicates that a virtual machine is created based on the target image file.

[0079] like Figure 2 As shown, the specific process for creating a virtual machine in this distributed cloud environment is as follows:

[0080] 101. Receive the first virtual machine creation request initiated by the first physical machine node, wherein the first virtual machine creation request indicates that a virtual machine is created based on the target image file.

[0081] In the embodiments of the present application, the first physical machine node is a physical machine node in a distributed cloud environment. The distributed cloud is an extension of cloud computing, and refers to a cloud computing platform or system with distributed characteristics based on distributed computing and cloud computing technology, which extends cloud computing to remote machine rooms or user machine rooms. In the distributed cloud environment, computing, storage and network resources are distributed in multiple geographic locations or data centers and are connected and managed through the Internet or a dedicated network. When a virtual machine needs to be created on the first physical machine node, the first physical machine node can initiate a virtual machine creation request based on the target image file (i.e., a first virtual machine creation request) and trigger the distributed cloud system to receive the request.

[0082] In addition, the target image file is a pre-configured virtual machine template, which contains operating system, software environment and configuration information. In specific implementation, the target image file can be directly used to create a new virtual machine instance.

[0083] 102. If the local machine room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local machine room do not cache the target image file, the target image file is obtained from the image repository of the center cloud according to the first virtual machine creation request and is distributed and stored to the plurality of physical machine nodes in the local machine room.

[0084] In the embodiments of the present application, there are centralized data centers and distributed resource deployment in the distributed cloud environment, and the center cloud is a component in the distributed cloud architecture. The distributed cloud and the center cloud can communicate with each other using public Internet, a dedicated network or a VPN (Virtual Private Network), etc. The communication can be bidirectional for the purpose of data transmission, resource management, load balancing, etc. In addition, the image repository is a repository or storage specially used for storing and managing virtual machine images, and provides a platform for centralized management, sharing and distribution of virtual machine images.

[0085] Specifically, after receiving the first virtual machine creation request, it will be determined whether the local machine room to which the first physical machine node belongs is located in an edge area in the distributed cloud environment, that is, whether the local machine room is a remote machine room or an edge area machine room. If the local machine room is located in an edge area, it will be detected whether the first physical machine node caches the target image file. If it is detected that the first physical machine node does not cache the target image file, it will be further detected whether other physical machine nodes in the local machine room to which the first physical machine node belongs cache the target image file. If it is detected that other physical machine nodes in the local machine room also do not cache the target image file, the target image file is obtained from the image repository of the center cloud according to the first virtual machine creation request, and the obtained target image file is distributed and stored to the plurality of physical machine nodes in the local machine room.

[0086] It should be noted that in the embodiments of the present application, the physical machine nodes in the local computer room are all divided a part of disk space for caching virtual machine images.

[0087] In an embodiment, the local computer room and the central cloud communicate through a virtual private network. The step of "obtaining a target image file from the image repository of the central cloud and distributing and storing the target image file to multiple physical machine nodes of the local computer room in a distributed manner" can include the following processes:

[0088] Obtaining a target image file from the image repository of the central cloud;

[0089] Fragmenting the obtained target image file to obtain multiple different image fragments;

[0090] Transmitting the multiple different image fragments through the virtual private network and storing the multiple different image fragments in multiple physical machine nodes of the local computer room.

[0091] Specifically, in order to speed up the pulling speed of the target image file, the target image file can be fragmented according to a certain data size to obtain multiple different image fragments, and the multiple different image fragments constitute a complete target image file. Then, the multiple different image fragments are transmitted to the local computer room through the virtual private network in a concurrent manner, so as to distribute and store the multiple different image fragments in multiple physical machine nodes of the local computer room. In specific implementation, a consistent hashing algorithm can be used to determine which physical machine node in the local computer room each image fragment needs to be stored in.

[0092] In an embodiment, due to the limited bandwidth of the virtual private network between the local computer room and the central cloud, it is impossible to transmit an unlimited number of image fragments in parallel. Therefore, the number of parallel transmission of image fragments can be limited. That is, in an embodiment, the step of "transmitting the multiple different image fragments through the virtual private network" can specifically include the following processes:

[0093] Obtaining a first bandwidth currently available to the virtual private network, and determining a first number of image transmission tasks that can be executed in parallel according to the first bandwidth;

[0094] Obtaining a second number of the multiple different image fragments;

[0095] If the first number is greater than or equal to the second number, the multiple different image fragments are transmitted in parallel through the virtual private network;

[0096] If the first number is less than the second number, the first number of image fragments in the multiple different image fragments are transmitted in parallel through the virtual private network, and the remaining image fragments are added to the image transmission task queue for transmission.

[0097] Specifically, if the number of the to-be-executed mirror image transmission tasks (i.e., the second number) is less than or equal to the limited number (i.e., the first number), all the to-be-executed mirror image transmission tasks can be executed in parallel; if the number of the to-be-executed mirror image transmission tasks (i.e., the second number) is greater than the limited number (i.e., the first number), a certain number of to-be-executed mirror image transmission tasks are executed in parallel to the maximum extent, and the remaining to-be-executed mirror image transmission tasks are added to the task queue for execution, thereby avoiding data transmission channel congestion and ensuring the stability of the virtual private network.

[0098] In an embodiment, in addition to limiting the number of parallel transmission of mirror image segments, the bandwidth occupied by a single mirror image transmission task can also be limited. That is, the step of "transmitting a plurality of different mirror image segments through a virtual private network" can include the following processes:

[0099] obtaining a first bandwidth currently available to the virtual private network and a second number of the plurality of different mirror image segments;

[0100] determining a second bandwidth according to the first bandwidth and the second number;

[0101] transmitting each of the plurality of different mirror image segments through the virtual private network in parallel and according to the second bandwidth.

[0102] Specifically, the bandwidth (i.e., the second bandwidth) occupied by a single mirror image transmission task can be dynamically adjusted according to the first bandwidth currently available to the virtual private network and the second number of the plurality of different mirror image segments. In this embodiment, by limiting the bandwidth occupied by a single mirror image transmission task, data transmission channel congestion is avoided, and the stability of the virtual private network is ensured.

[0103] In an embodiment, in order to cope with the failure of a physical machine node (such as node failure), multiple copies of each mirror image segment can be made for disaster recovery in the local computer room. That is, after transmitting a plurality of different mirror image segments through a virtual private network and storing them on a plurality of physical machine nodes in the local computer room, a corresponding mirror image segment copy can also be generated for each mirror image segment in the plurality of different mirror image segments on the corresponding physical machine node in the local computer room. Each mirror image segment can correspond to one or more mirror image segment copies, and each mirror image segment copy and its corresponding mirror image segment are stored on different physical machine nodes in the local computer room, and the same mirror image segment copy is also stored on different physical machine nodes in the local computer room.

[0104] 103. Based on the target mirror image file stored in a plurality of physical machine nodes in a distributed manner, a virtual machine is created on a first physical machine node.

[0105] Specifically, the target image file is divided into multiple parts and stored in multiple physical machine nodes. When a virtual machine is created on the first physical machine node, the multiple parts of the target image file stored in the multiple physical machine nodes are obtained to constitute a complete target image file for creating the virtual machine on the first physical machine node. That is, in an embodiment, the target image file is divided into multiple different image segments and distributed in multiple physical machine nodes. The step of "creating a virtual machine on the first physical machine node based on the target image file stored in the multiple physical machine nodes in a distributed manner" can include the following processes:

[0106] synchronizing the multiple different image segments distributed in the multiple physical machine nodes to the first physical machine node;

[0107] merging the multiple different image segments in the first physical machine node to obtain the target image file;

[0108] creating a virtual machine on the first physical machine node based on the target image file.

[0109] Specifically, in the local computer room, each physical machine node performs synchronization operation of image segments in a peer-to-peer manner, and each physical machine node can act as both a data receiving end and a data sending end.

[0110] In the specific implementation process, when the multiple different image segments in the first physical machine node are merged, the position offset corresponding to each image segment in the multiple different image segments can be determined, and then the multiple different image segments are merged according to the position offset to obtain a complete target image file. Wherein, when the target image file is fragmented, the position of each image segment in the target image file can be determined, and the position offset corresponding to each image segment is set according to the position.

[0111] In an embodiment, in order to realize the load balancing of each physical machine node in the local computer room, the image segments or image segment copies that need to be pulled from which physical machine nodes to the first physical machine node can be determined according to the current load conditions of the multiple physical machine nodes in the local computer room. That is, the step of "creating a virtual machine on the first physical machine node based on the target image file stored in the multiple physical machine nodes in a distributed manner" can include the following processes:

[0112] obtaining the first load information of the current multiple physical machine nodes and the corresponding physical machine nodes;

[0113] obtaining the first data amount of each image segment in the multiple different image segments and the corresponding image segment copy;

[0114] each of the plurality of different image segments is assigned a segment identifier, wherein each image segment and its corresponding image segment copy share the same segment identifier;

[0115] a first target physical machine node is matched for each segment identifier according to the first load information and the first data amount;

[0116] the image segment or image segment copy corresponding to the segment identifier is obtained from the first target physical machine node, and a virtual machine is created on the first physical machine node based on all the obtained image segments and / or image segment copies.

[0117] Specifically, the current load information (i.e., the first load information) of the physical machine node storing the image segment or image segment copy of the target image file is obtained, and the first data amount of each image segment or image segment copy of the target image file is obtained, and each image segment is assigned a segment identifier. The segment identifier is unique, and each image segment and its corresponding image segment copy share the same segment identifier. Then, the load balancing strategy is executed under the condition that the current load information of the physical machine node and the first data amount of each image segment (or image segment copy) are known, so as to calculate which physical machine node needs to pull the image segment or image segment copy (i.e., determine the first target physical machine node) to balance the load of each physical machine node in the local computer room. Finally, the image segment or image segment copy corresponding to the segment identifier is pulled from the determined physical machine node, and all the pulled image segments and / or image segment copies are merged to obtain a complete target image file, and a virtual machine is created on the first physical machine node based on the target image file.

[0118] Similarly, in an embodiment, the step of "creating a virtual machine on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes", can include the following processes:

[0119] the second load information of the current plurality of physical machine nodes and the corresponding physical machine nodes is obtained;

[0120] a second target physical machine node is matched for each segment identifier according to the second load information and the first data amount;

[0121] the image segment or image segment copy corresponding to the segment identifier is obtained from the second target physical machine node, and a virtual machine is created on the second physical machine node based on all the obtained image segments and / or image segment copies.

[0122] Specifically, current load information (i.e., second load information) of the physical machine node storing the image segment or the image segment copy of the target image file is acquired, and the second data volume of each image segment or image segment copy of the target image file is acquired. Then, the load balancing strategy is executed in the case of knowing the current load information of the physical machine node and the second data volume of each image segment (or image segment copy), so as to calculate which physical machine node needs to pull the image segment or image segment copy (i.e., determine the second target physical machine node) to balance the load of each physical machine node in the local computer room. Finally, the image segment or image segment copy corresponding to the segment identifier is pulled from the determined physical machine node, and all the pulled image segments and / or image segment copies are merged to obtain the complete target image file, and then the virtual machine is created on the second physical machine node based on the target image file.

[0123] 104、When receiving the second virtual machine creation request initiated by the second physical machine node in the local computer room, if the second physical machine node does not cache the target image file, the virtual machine is created on the second physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes, wherein the second virtual machine creation request indicates to create the virtual machine based on the target image file.

[0124] Specifically, when receiving the virtual machine creation request (i.e., the second virtual machine creation request) initiated by the second physical machine node in the local computer room, it will be detected whether the second physical machine node caches the target image file. If it is detected that the second physical machine node does not cache the target image file, the virtual machine can be directly created on the second physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes in the local computer room, without the need to pull the target image file from the center cloud again. Since the target image file is cached in the local computer room, the pulling time of the virtual machine image is saved, thereby improving the creation speed of the virtual machine.

[0125] Similarly, in an embodiment, the step of "creating the virtual machine on the second physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes" can include the following processes:

[0126] Synchronizing a plurality of different image segments distributed in a plurality of physical machine nodes to the second physical machine node;

[0127] Merging the plurality of different image segments in the second physical machine node to obtain the target image file;

[0128] Creating the virtual machine on the second physical machine node based on the target image file.

[0129] In the implementation, when the multiple different image segments in the second physical machine node are merged, the position offset corresponding to each image segment in the multiple different image segments is determined, and the multiple different image segments are merged according to the position offset to obtain the complete target image file. When the target image file is fragmented, the position of each image segment in the target image file is determined, and the position offset corresponding to each image segment is set according to the position.

[0130] Similarly, in order to realize the load balancing of the physical machine nodes in the local machine room, the image segments or image segment copies that need to be pulled from which physical machine nodes to the second physical machine node can be determined according to the current load conditions of the multiple physical machine nodes in the local machine room. That is, in an embodiment, the step of "creating a virtual machine on the second physical machine node based on the target image file of the distributed storage on the multiple physical machine nodes" can include the following processes:

[0131] Obtaining the second load information of the current multiple physical machine nodes and the corresponding physical machine nodes;

[0132] According to the second load information and the first data amount, identifying a second target physical machine node for each segment;

[0133] Obtaining the image segment or image segment copy corresponding to the segment identifier from the second target physical machine node, and creating a virtual machine on the second physical machine node based on all the obtained image segments and / or image segment copies.

[0134] Specifically, the current load information (i.e., the second load information) of the physical machine node storing the image segment or image segment copy of the target image file, and the second data amount of each image segment or image segment copy of the target image file are obtained. Then, the load balancing strategy is executed in the case of knowing the current load information of the physical machine node and the second data amount of each image segment (or image segment copy), so as to calculate which physical machine node to pull the image segment or image segment copy from (i.e., to determine the second target physical machine node) to balance the load of the physical machine nodes in the local machine room. Finally, the image segment or image segment copy corresponding to the segment identifier is pulled from the determined physical machine node, and all the pulled image segments and / or image segment copies are merged to obtain the complete target image file, and then a virtual machine is created on the second physical machine node based on the target image file.

[0135] As can be seen from the above, the method for creating a virtual machine in a distributed cloud environment provided by the embodiments of the present application receives a first virtual machine creation request initiated by a first physical machine node. If the local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache a target image file, the target image file is obtained from an image repository of a central cloud according to the first virtual machine creation request, and is distributed and stored to a plurality of physical machine nodes in the local computer room. Then, based on the target image file distributed and stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node. When a second virtual machine creation request initiated by a second physical machine node in the local computer room is received, if the second physical machine node does not cache the target image file, a virtual machine is created on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes. In the present solution, the image file in the central cloud is directly cached in the physical machine nodes in the edge area computer room in the distributed cloud environment, which saves the image pulling time for the creation of the virtual machine on the related physical machine nodes in the subsequent edge area computer room, and thus improves the overall creation speed of the distributed cloud virtual machine.

[0136] In specific implementation, in order to balance the available storage space of each physical machine node in the local computer room for virtual machine image caching, the target image file can be preferentially distributed to the physical machine nodes with larger current available storage space. That is, in an embodiment, before the target image file is obtained from the image repository of the central cloud and distributed and stored to the plurality of physical machine nodes in the local computer room, the following process can also be included:

[0137] determining a second data amount of the target image file;

[0138] determining the available storage space of each physical machine node in the current local computer room for image caching;

[0139] determining the plurality of physical machine nodes from the local computer room according to the size of the available storage space and the second data amount.

[0140] Specifically, according to the data amount of the target image file and the size of the available storage space of each physical machine node in the local computer room for image caching, the plurality of physical machine nodes are determined from the local computer room in the order of the size of the available storage space from large to small, so that the available storage space of each physical machine node in the local computer room for virtual machine image caching can reach a balanced state after the relevant data of the target image file is stored.

[0141] In actual application, in order to further improve the creation speed of the whole virtual machine, the related image files can be synchronized to other edge area machine rooms in the distributed cloud environment in advance according to the usage of the virtual machine image in the local machine room. That is, in an embodiment, after creating the virtual machine based on the target image file stored in the plurality of physical machine nodes in the distributed storage on the second physical machine node, the following process can also be included:

[0142] statistic information of the image files used when creating the virtual machines on each physical machine node in the local machine room to obtain a first statistical result information;

[0143] determine a first image file meeting a first preset condition from the used image files according to the information statistical result;

[0144] synchronize the first image file to the physical machine nodes of other machine rooms in the distributed cloud environment.

[0145] Specifically, the usage of the virtual machine image on each physical machine node in the local machine room is counted, and a first image file meeting a first preset condition is selected therefrom and synchronized to other edge area machine rooms in the distributed cloud environment. The first preset condition can be set according to actual needs, for example, the first preset condition can be set according to the usage frequency or the usage times of the image file, and the image file with higher usage frequency or more usage times is selected for cross-machine room synchronization.

[0146] In actual application, since the storable space allocated to the virtual machine image cache of each physical machine node in the local machine room is limited, it is necessary to set relevant strategies to clean up the cache space regularly to ensure that the storable space provided by each physical machine node for the virtual machine image cache is sufficient. That is, in an embodiment, after counting the information of the image files used when creating the virtual machines on each physical machine node in the local machine room, the following process can also be included:

[0147] when it is detected that the available storage space of the physical machine node for image cache in the local machine room is less than a preset value, determine a second image file or a target image segment with the longest time distance from the current time point from the image files stored in the detected physical machine node;

[0148] remove the second image file from the detected physical machine node, or remove the target image segment from the detected physical machine node and remove the associated image segment of the target image segment from other physical machine nodes in the local machine room.

[0149] Specifically, when it is detected that the available storage space for image caching of the physical machine nodes in the local computer room is insufficient, the second image file or the target image segment that meets the second preset condition is selected according to the usage of the virtual machine images on the physical machine nodes in the local computer room, and the second image file or the target image segment is removed from the related physical machine node. It should be noted that the selected is the image segment, and therefore the associated image segment of the target image segment needs to be removed from the other physical machine nodes in the local computer room. The associated image segment of the target image segment and the target image segment constitute a complete image file (i.e., the second image file).

[0150] The second preset condition can be set according to actual conditions. For example, the image file that is not needed or rarely used can be removed from the physical machine node with insufficient available storage space, or the image file that has not been used for the longest time can be removed.

[0151] In an embodiment, after the target image file is distributedly stored on the plurality of physical machine nodes and the virtual machine is created on the second physical machine node based on the target image file, when a third virtual machine creation request initiated by a third physical machine node in the local computer room is received, if the target image file is cached on the third physical machine node, the virtual machine can be created on the third physical machine node based on the target image file. The third virtual machine creation request indicates that the virtual machine is created based on the target image file.

[0152] Specifically, when the virtual machine creation request (i.e., the third virtual machine creation request) initiated by the third physical machine node in the local computer room is received, it will be detected whether the target image file is cached on the third physical machine node. If it is detected that the target image file is cached on the third physical machine node, the virtual machine can be directly created on the third virtual machine node based on the target image file stored in the local computer room, without the need to pull the target image file from the center cloud or other physical machine nodes in the local computer room. Since the target image file is cached in the local computer room, the pulling time of the virtual machine image is completely omitted, thereby improving the creation speed of the virtual machine.

[0153] If the plurality of physical machine nodes in the same computer room use the same image file to create virtual machines in batches, at this time, only one of the physical machine nodes will initiate a task of pulling the image from the center cloud, and the other physical machine nodes only need to wait for the completion of the task of pulling the image from the center cloud, thereby effectively reducing the image pulling task across the computer rooms and avoiding the problem of traffic traversal.

[0154] According to the method described in the above embodiment, the following examples will be further described in detail. In another embodiment of the present application, an image caching scheme for improving the creation speed of distributed cloud virtual machines is provided.

[0155] In actual application, to improve the virtual machine creation speed of the remote machine room in the distributed cloud, the image needs to be cached in the remote machine room as much as possible. However, if the image storage cluster is separately established in the remote machine room, the storage cost is high due to the small scale of the edge area machine room, and therefore the image storage cluster establishment scheme is not applicable to the small-scale edge area machine room.

[0156] To solve the problem of slow image pulling in the small-scale remote machine room, in the present scheme, the image is preheated to the physical machine in the local machine room as much as possible, and then the image is synchronized between the physical machines in the machine room in point-to-point mode. In the present scheme, the image preheating is divided into two modes: user self-preheating of the image and triggering of the image preheating when creating a child machine (i.e. a virtual machine).

[0157] The user self-preheating of the image is a function provided by the cloud computing product side, and the user can select the image to be preheated in the console, and specify the remote machine room to be preheated to initiate the preheating; meanwhile, the user can also check the preheating progress of each machine room. Referring to Figure 3 , Figure 4 and Figure 5 , first, the image is selected from the image list for preheating, then the node (i.e. the remote machine room node) to be preheated is selected, and the preheating progress of each machine room node can be checked on the image preheating page. After the image preheating is completed, if it is detected that there is a physical machine in the machine room node that needs to create a virtual machine based on the image, the image cached in the local machine room is directly pulled to execute the virtual machine creation process.

[0158] In the present embodiment, for the scheme of triggering the image preheating when creating a child machine, the image caching can be realized without user awareness, and the creation speed of the child machine in the subsequent remote machine room is improved. In the present scheme, the image pulling mode is not limited to pulling from the local machine room, and when the image is not preheated in the local machine room, the image can be pulled from the image warehouse of the central cloud machine room. Referring to Figure 6 , according to the distance of the image cache area, the image pulling mode is divided into the following three levels:

[0159] Parent machine cache: the related image has been cached on the parent machine where the virtual machine is produced, and then the image is directly copied to the hard disk of the virtual machine. For example, for the Linux system, the image is directly copied from the parent machine to the hard disk of the virtual machine by executing the dd command; for a 5GB image, the image pulling time is about 4s.

[0160] Local machine room cache: if the relevant image is not cached on the host machine where the production virtual machine is located, but the relevant image is cached on other physical machines in the local machine room, then the image is pulled from the other physical machines in the local machine room to the host machine first, and then the image is copied to the virtual machine hard disk. For example, taking the Linux system as an example, the nc command is executed to pull the image from the other physical machines in the local machine room to the host machine, and then the dd command is executed to copy the image from the host machine to the hard disk of the virtual machine; taking a 5GB image as an example, the image pulling time is about 50s.

[0161] Central cloud image warehouse: when the local machine room does not cache the relevant image, the image needs to be pulled from the central cloud image warehouse (such as the cos library) to the local machine room through the VPN channel, and then the relevant image is pulled from the relevant physical machine in the local machine room to the host machine, and finally the image is copied to the virtual machine hard disk. Taking a 5GB image as an example, the image pulling time is about 150s.

[0162] In this scheme, a part of the disk space of the physical machine in the remote machine room is divided in advance for caching the image. Referring to Figure 7 , Figure 7 The overall architecture diagram of the image preheating system provided by the embodiment of the present application is shown in FIG. 1. As shown in Figure 7 , the image preheating system includes a central cloud and a remote machine room, and the central cloud and the remote machine room communicate through a VPN channel. The central cloud deploys an image warehouse and an image preheating center management component (ImageCacheManager). The ImageCacheManager is used to determine which physical machine in the remote machine room to preheat the image to, and it maintains two queues, namely an image preheating task queue and a cache-server image synchronization task queue, and related resource allocation and task scheduling are performed through a task scheduler (scheduler).

[0163] Referring to Figure 7 , a plurality of physical machines are deployed in the remote machine room, and the plurality of physical machines can communicate through the internal network of the machine room. Each physical machine (i.e. host machine) divides a part of the disk space as an image cache space for caching images, and a part of the disk space as a virtual machine hard disk space for storing virtual machine related data. In addition, the host machine also deploys related computing resources and an image cache service (cache-server) program. The cache-server is a program running on the host machine in the remote machine room, which is responsible for receiving control instructions from the ImageCacheManager to pull the image from the image warehouse of the central cloud to the host machine. In addition, the cache-server is also responsible for the point-to-point transmission of the image in the local machine room.

[0164] In the scheme, the purpose of maintaining the image preheating task queue and the cache-server image synchronization task queue is to limit the number of tasks to protect the stable operation of the system.

[0165] Specifically, the image preheating task queue records the task of pulling the image from the image warehouse of the center cloud to the local computer room. Since the VPN bandwidth between the center cloud and the local computer room is limited, it is impossible to perform the image preheating task without limit. Therefore, by setting the image preheating task queue, the task buffer function can be achieved. In specific implementation, the number of concurrent image pulling tasks can be limited. If the number of tasks exceeds the set number of tasks, the tasks initiated later are added to the image preheating task queue for queuing and processing, thereby effectively ensuring the stability of the VPN channel to prevent the channel from being blocked by a large number of image pulling tasks.

[0166] In addition, in the scheme, the number of preheating tasks can be used to limit the speed to relieve the traffic traversal. That is, in addition to limiting the number of tasks, the bandwidth of each preheating task when pulling the image from the center cloud can also be limited. For example, the VPN channel provides a control bandwidth of 500 Mbps, and there are 10 preheating tasks, so the bandwidth of each preheating task can be limited to 10 Mbps.

[0167] Specifically, the cache-server image synchronization task is a point-to-point image pulling task of the physical machine in the local computer room. Here, an image synchronization task queue is maintained, which records how many point-to-point image pulling tasks a mother machine as an image source has. Similarly, the image synchronization task queue also has the function of buffering and queuing. Since the main function of the mother machine is to provide virtual machines, the number of point-to-point image pulling tasks performed by each mother machine needs to be limited, otherwise a large amount of network bandwidth and CPU will be occupied, affecting the use of virtual machines.

[0168] In practical application, usually an image file is between 2GB and 50GB in size. In order to speed up the image pulling speed, the image file can be divided into pieces of 2GB size before performing the image pulling. For example, for a 10GB image file, it can be divided into 5 image pieces of 2GB size, and the pulling tasks of the 5 image pieces can be performed concurrently, thereby improving the overall image pulling speed.

[0169] In specific implementation, the consistent hashing algorithm can be used to determine which physical machine in the remote computer room stores the image piece, so as to reduce the file migration of the image piece caused by the change of the cache-server node (such as expanding the node or deleting the node).

[0170] In this embodiment, in order to cope with the failure of cache-serve, the multi-copy mode can be used to create a copy of each mirror slice on other physical machines in the local room, so as to play a disaster recovery role. Referring to Figure 8 A 10GB size mirror file is divided into 5 mirror slices according to a size of 2GB, each mirror slice is set to 2 copies, and is distributed in the mirror cache space of 3 physical machines in the local room for storage. It should be noted that the 2 copies of the same mirror slice need to be distributed on different physical machines to play a disaster recovery role. As shown in Figure 8 Imgfile-part1-r1, Imgfile-part4-r1, Imgfile-part2-r2, Imgfile-part5-r2, and the like 4 mirror slice copies are distributed on the physical machine where cache-server1 is located; Imgfile-part2-r1, Imgfile-part5-r1, Imgfile-part3-r2, and the like 3 mirror slice copies are distributed on the physical machine where cache-server2 is located; and Imgfile-part3-r1, Imgfile-part1-r2, and Imgfile-part4-r2, and the like 3 mirror slice copies are distributed on the physical machine where cache-server3 is located.

[0171] When pulling the mirror in the local room point-to-point, ImageCacheManager is used to determine which cache-server should be pulled from. ImageCacheManager will send mirror slice information to the physical machine pulling the mirror according to the task load of the current cache-server. ImageCacheManager maintains an overall task data, which can obtain which tasks are being executed by the cache-server, and ImageCacheManager will select the cache-server located on the physical machine with fewer tasks according to the task load of the current cache-server. The mother machine executing the mirror pulling is also concurrent to pull slices from multiple physical machines, and after the mirror slice pulling task is completed, the pulled mirror slices are merged into a complete mirror file. In order to speed up the merging of the file, as many mirror slices need to be pulled, the mother machine will start as many mirror pulling tasks to execute concurrently.

[0172] In specific implementation, the position offset (offset) of each mirror slice corresponding to the overall mirror file can be calculated in advance, and the copied mirror slices are copied to the corresponding position according to the offset, so as to realize data merging, thereby obtaining a complete mirror file.

[0173] In this embodiment, when a child machine is created on the parent machine, different strategies can be used to copy the image according to the cache condition of the image in the local machine room. When the required image is not cached in the local machine room where the parent machine (i.e. the physical machine on which the virtual machine is to be created) is located, an image preheating task is triggered, and the child machine (i.e. the virtual machine) is created after the image preheating is successful. For reference Figure 9 The embodiment provides a distributed cloud virtual machine creation method, and the specific process is as follows:

[0174] (11) Start creating a child machine;

[0175] (12) Detect whether the parent machine has cached the image; if yes, execute step (17); if no, execute step (13);

[0176] (13) Detect whether the local machine room has cached the image; if yes, execute step (16); if no, execute step (14);

[0177] (14) Initiate an image preheating task;

[0178] Specifically, after the image preheating task is initiated, first, image preheating is started; then ImageCacheManager deployed in the center cloud determines the number of shards and shard download tasks; then multiple shard download tasks are executed in parallel to preheat the image shards to multiple physical machines in the local machine room; finally, when all the shard download tasks are completed, it is determined that the image preheating is completed.

[0179] (15) Detect whether the image preheating task is completed; if yes, execute step (16); if no, continue to detect whether the image preheating task is completed;

[0180] (16) Point-to-point pulling of image shards between physical machines in the local machine room;

[0181] (17) Copy the image to the virtual machine hard disk;

[0182] (18) End the creation of the child machine.

[0183] As can be seen from the above, in the scheme, the image file is directly cached on the physical machine of the remote machine room, and the physical machines of the machine room synchronize the image in a point-to-point manner. It is tested that about 20% of the child machines need to wait for the image preheating task to be completed before being created, about 40% of the child machines are created by point-to-point pulling of the image in the local machine room, and about 40% of the child machines are created in the case that the parent machine has cached the image. The image preheating accelerates the creation speed of the subsequent child machines.

[0184] In an embodiment, the mirror image that can be used by other machine rooms can be predicted according to the use of the mirror image by the user in the edge area, and the mirror image of the user can be preheated to other edge available areas. For example, the user often uses mirror image X in machine room 1 and machine room 2, so mirror image X can be preheated in machine room 3 and machine room 4. In addition, it can also be counted which mirror image is used the most, and all machine rooms in the distributed cloud environment are preheated.

[0185] In an embodiment, since the cache space in the cache-server is limited, it is necessary to delete the mirror image that is not needed and rarely used regularly to free up disk space. The ImageCacheManager records the use time of each mirror image in the machine room, and when the cache-server space is insufficient, the mirror image that has not been used for the longest time can be selected for deletion.

[0186] In summary, the mirror image caching scheme provided by the embodiments of the present application can cache the mirror image file directly on the physical machine of the remote machine room, synchronize the mirror image between the physical machines of the machine room in a point-to-point manner, accelerate the creation speed of the subsequent virtual machine through mirror image preheating, reduce the large flow transmission from the local machine room to the center machine room, avoid the congestion of the virtual private network channel, and ensure the stability of the management and control system. In addition, the present scheme adopts a point-to-point sharding storage technology, effectively utilizes the storage resources on the physical machine, does not need to invest in special storage equipment to build a storage cluster, and reduces the storage cost.

[0187] In order to better implement the above method, the embodiments of the present application also provide a virtual machine creation device in a distributed cloud environment. The virtual machine creation device in the distributed cloud environment can be integrated in an electronic device, such as a server or a terminal device. The terminal device can include a tablet computer, a notebook computer, and / or a personal computer, etc.

[0188] For example, as shown in Figure 10 The virtual machine creation device in the distributed cloud environment can include a receiving unit 301, a first obtaining unit 302, a first creation unit 303, and a second creation unit 304, as follows:

[0189] The receiving unit 301 is configured to receive a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target mirror image file;

[0190] The first obtaining unit 302 is configured to, if a local machine room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local machine room do not cache the target mirror image file, obtain the target mirror image file from an image repository of a center cloud and distribute the target mirror image file to a plurality of physical machine nodes of the local machine room according to the first virtual machine creation request;

[0191] The first creating unit 303 is configured to create a virtual machine on the first physical machine node based on the target image file distributed on the plurality of physical machine nodes.

[0192] The second creating unit 304 is configured to, when receiving a second virtual machine creating request initiated by a second physical machine node in the local computer room, create a virtual machine on the second physical machine node based on the target image file distributed on the plurality of physical machine nodes if the second physical machine node does not cache the target image file, wherein the second virtual machine creating request indicates to create a virtual machine based on the target image file.

[0193] Optionally, in some embodiments, the target image file is divided into a plurality of different image segments and distributed on the plurality of physical machine nodes.

[0194] When creating the virtual machine on the first physical machine node based on the target image file distributed on the plurality of physical machine nodes, the first creating unit 303 is specifically configured to:

[0195] synchronize the plurality of different image segments distributed on the plurality of physical machine nodes to the first physical machine node; merge the plurality of different image segments in the first physical machine node to obtain the target image file; and create the virtual machine on the first physical machine node based on the target image file.

[0196] When creating the virtual machine on the second physical machine node based on the target image file distributed on the plurality of physical machine nodes, the second creating unit 304 is specifically configured to:

[0197] synchronize the plurality of different image segments distributed on the plurality of physical machine nodes to the second physical machine node; merge the plurality of different image segments in the second physical machine node to obtain the target image file; and create the virtual machine on the second physical machine node based on the target image file.

[0198] Optionally, in some embodiments, when merging the plurality of different image segments in the first physical machine node or the second physical machine node to obtain the target image file, the first creating unit 303 or the second creating unit 304 is specifically configured to:

[0199] determine a position offset corresponding to each image segment of the plurality of different image segments; and merge the plurality of different image segments according to the position offset to obtain the target image file.

[0200] Optionally, in some embodiments, the local data center and the central cloud communicate through a virtual private network; when obtaining the target image file from the image repository of the central cloud and storing the target image file in the multiple physical machine nodes of the local data center in a distributed manner, the first obtaining unit 302 is specifically configured to:

[0201] obtain the target image file from the image repository of the central cloud;

[0202] perform fragmentation processing on the obtained target image file to obtain multiple different image segments;

[0203] transmit the multiple different image segments through the virtual private network and store the multiple different image segments in the multiple physical machine nodes of the local data center in a distributed manner.

[0204] Optionally, in some embodiments, when transmitting the multiple different image segments through the virtual private network, the first obtaining unit 302 is further configured to:

[0205] obtain a first bandwidth currently available for the virtual private network, and determine a first number of image transmission tasks that can be executed in parallel currently according to the first bandwidth; obtain a second number of the multiple different image segments; if the first number is greater than or equal to the second number, transmit the multiple different image segments in parallel through the virtual private network; if the first number is less than the second number, transmit the first number of image segments in the multiple different image segments in parallel through the virtual private network, and add the remaining image segments to a queue of image transmission tasks for transmission.

[0206] Optionally, in some embodiments, when transmitting the multiple different image segments through the virtual private network, the first obtaining unit 302 is further configured to:

[0207] obtain a first bandwidth currently available for the virtual private network and a second number of the multiple different image segments; determine a second bandwidth according to the first bandwidth and the second number; and transmit each of the multiple different image segments in parallel through the virtual private network according to the second bandwidth.

[0208] Optionally, in some embodiments, the apparatus further comprises:

[0209] a generating unit configured to, after transmitting the multiple different image segments through the virtual private network and storing the multiple different image segments in the multiple physical machine nodes of the local data center in a distributed manner, generate, for each of the multiple different image segments, a corresponding image segment copy on a corresponding physical machine node of the local data center, wherein the image segment copy and the corresponding image segment are stored in different physical machine nodes.

[0210] Optionally, in some embodiments, when creating a virtual machine on the first physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes, the first creating unit 303 can be specifically configured to:

[0211] obtain first load information of the plurality of physical machine nodes and the corresponding physical machine node; obtain a first data amount of each of the plurality of different image segments and its corresponding image segment copy; allocate a segment identifier to each of the plurality of different image segments, wherein each image segment and its corresponding image segment copy share the same segment identifier; match a first target physical machine node for each segment identifier according to the first load information and the first data amount; obtain the image segment or the image segment copy corresponding to the segment identifier from the first target physical machine node, and create a virtual machine on the first physical machine node based on all the obtained image segments and / or image segment copies;

[0212] In some embodiments, when creating a virtual machine on the second physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes, the second creating unit 304 can be specifically configured to:

[0213] obtain second load information of the plurality of physical machine nodes and the corresponding physical machine node; match a second target physical machine node for each segment identifier according to the second load information and the first data amount; obtain the image segment or the image segment copy corresponding to the segment identifier from the second target physical machine node, and create a virtual machine on the second physical machine node based on all the obtained image segments and / or image segment copies.

[0214] Optionally, in some embodiments, the apparatus further comprises:

[0215] a first determining unit configured to determine a second data amount of the target image file before obtaining the target image file from an image repository of a central cloud and distributing the target image file to the plurality of physical machine nodes of the local computer room;

[0216] a second determining unit configured to determine an available storage space for image caching of each physical machine node in the local computer room;

[0217] a third determining unit configured to determine the plurality of physical machine nodes from the local computer room according to a size of the available storage space and the second data amount.

[0218] Optionally, in some embodiments, the apparatus further comprises:

[0219] a statistics unit configured to, after creating the virtual machine on the second physical machine node based on the target image file stored in the plurality of physical machine nodes in a distributed manner, perform information statistics on the image files used by the virtual machines created on the physical machine nodes in the local computer room, to obtain first statistics result information;

[0220] a fourth determination unit configured to, according to the information statistics result, determine a first image file meeting a first preset condition from the image files used;

[0221] a second acquisition unit configured to synchronize the first image file to the physical machine nodes of other computer rooms in the distributed cloud environment.

[0222] Optionally, in some embodiments, the apparatus further includes:

[0223] a fifth determination unit configured to, after performing information statistics on the image files used by the virtual machines created on the physical machine nodes in the local computer room, when detecting that the available storage space of the physical machine node for image caching in the local computer room is less than a preset value, determine, from the image files stored in the detected physical machine node, a second image file or a target image segment that has the longest time distance from the current time point;

[0224] a removal unit configured to remove the second image file from the detected physical machine node, or remove the target image segment from the detected physical machine node and remove the associated image segments of the target image segment from other physical machine nodes in the local computer room.

[0225] Optionally, in some embodiments, the apparatus further includes:

[0226] a third creation unit configured to, after creating the virtual machine on the second physical machine node based on the target image file stored in the plurality of physical machine nodes in a distributed manner, when receiving a third virtual machine creation request initiated by a third physical machine node in the local computer room, if the third physical machine node caches the target image file, create a virtual machine on the third physical machine node based on the target image file, wherein the third virtual machine creation request indicates to create a virtual machine based on the target image file.

[0227] As can be seen from the above, the virtual machine creation apparatus in the distributed cloud environment provided in this application embodiment receives a first virtual machine creation request initiated by a first physical machine node. If the local data center to which the first physical machine node belongs is located in an edge region, and none of the physical machine nodes in the local data center have cached the target image file, then the target image file is obtained from the image repository of the central cloud according to the first virtual machine creation request and distributed and stored in multiple physical machine nodes in the local data center. Then, based on the target image file distributed and stored in multiple physical machine nodes, a virtual machine is created on the first physical machine node. When a second virtual machine creation request is received from a second physical machine node in the local data center, if the second physical machine node has not cached the target image file, then the virtual machine is created on the second physical machine node based on the target image file distributed and stored in multiple physical machine nodes. In this scheme, the image file in the central cloud is directly cached in the physical machine nodes of the edge region data center in the distributed cloud environment, saving image retrieval time for the subsequent creation of virtual machines on relevant physical machine nodes in the edge region data center, thereby improving the overall creation speed of distributed cloud virtual machines.

[0228] This application also provides an electronic device, such as... Figure 11 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:

[0229] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 11 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0230] The processor 401 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and computer programs, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.

[0231] The memory 402 can be used to store software programs and modules, and the processor 401 executes various functions and creation of virtual machines in a distributed cloud environment by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, computer programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the electronic device, etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 402 can also include a memory controller to provide access for the processor 401 to the memory 402.

[0232] The electronic device also includes a power supply 403 for powering various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 403 can also include one or more direct current or alternating current power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.

[0233] The electronic device can also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0234] Although not shown, the electronic device can also include a display unit and the like, which will not be described here. Specifically, in the present embodiment, the processor 401 in the electronic device loads executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and runs the computer programs stored in the memory 402 by the processor 401, so as to realize various functions, as follows:

[0235] Receiving a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file;

[0236] If the local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from an image repository of a central cloud and distributed stored to a plurality of physical machine nodes in the local computer room;

[0237] Based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node.

[0238] When receiving a second virtual machine creation request initiated by a second physical machine node in the local machine room, if the second physical machine node does not cache the target image file, a virtual machine is created on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

[0239] In an embodiment, when creating a virtual machine on the first physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes, the processor 401 is specifically configured to:

[0240] synchronize the plurality of different image segments distributed in the plurality of physical machine nodes to the first physical machine node; merge the plurality of different image segments in the first physical machine node to obtain the target image file; and create a virtual machine on the first physical machine node based on the target image file;

[0241] In an embodiment, when creating a virtual machine on the second physical machine node based on the target image file distributed and stored in the plurality of physical machine nodes, the processor 401 is specifically configured to:

[0242] synchronize the plurality of different image segments distributed in the plurality of physical machine nodes to the second physical machine node; merge the plurality of different image segments in the second physical machine node to obtain the target image file; and create a virtual machine on the second physical machine node based on the target image file.

[0243] In an embodiment, when merging the plurality of different image segments in the first physical machine node or the second physical machine node to obtain the target image file, the processor 401 is specifically configured to:

[0244] determine a position offset corresponding to each image segment of the plurality of different image segments; and merge the plurality of different image segments according to the position offset to obtain the target image file.

[0245] In an embodiment, the local machine room and the central cloud communicate through a virtual private network; when obtaining the target image file from the image warehouse of the central cloud and distributing and storing it to the plurality of physical machine nodes of the local machine room, the processor 401 is specifically configured to:

[0246] obtain the target image file from the image warehouse of the central cloud; perform fragmentation processing on the obtained target image file to obtain a plurality of different image segments; transmit the plurality of different image segments through the virtual private network and store them in the plurality of physical machine nodes of the local machine room.

[0247] In an embodiment, when transmitting the plurality of different image segments through the virtual private network, the processor 401 is specifically configured to:

[0248] obtain a first bandwidth currently available for the virtual private network, and determine a first number of image transmission tasks that can be executed in parallel currently according to the first bandwidth; obtain a second number of the plurality of different image segments; if the first number is greater than or equal to the second number, transmit the plurality of different image segments in parallel through the virtual private network; if the first number is less than the second number, transmit the first number of image segments in the plurality of different image segments in parallel through the virtual private network, and add the remaining image segments to a queue of image transmission tasks for transmission.

[0249] In an embodiment, when transmitting the plurality of different image segments through the virtual private network, the processor 401 is specifically configured to:

[0250] obtain a first bandwidth currently available for the virtual private network and a second number of the plurality of different image segments; determine a second bandwidth according to the first bandwidth and the second number; and transmit each of the plurality of different image segments in parallel through the virtual private network according to the second bandwidth.

[0251] In an embodiment, after transmitting the plurality of different image segments through the virtual private network and storing them on the plurality of physical machine nodes in the local computer room, the processor 401 is further configured to:

[0252] for each of the plurality of different image segments, generate a corresponding image segment copy on the corresponding physical machine node in the local computer room, wherein the image segment copy and its corresponding image segment are stored on different physical machine nodes.

[0253] In an embodiment, when creating a virtual machine on the first physical machine node based on the target image file stored in a distributed manner on the plurality of physical machine nodes, the processor 401 is specifically configured to:

[0254] obtain first load information of the plurality of physical machine nodes and the corresponding physical machine node; obtain a first data amount of each of the plurality of different image segments and its corresponding image segment copy; allocate a segment identifier to each of the plurality of different image segments, wherein each image segment and its corresponding image segment copy share the same segment identifier; match a first target physical machine node for each segment identifier according to the first load information and the first data amount; obtain the image segment or image segment copy corresponding to the segment identifier from the first target physical machine node, and create a virtual machine on the first physical machine node based on all the obtained image segments and / or image segment copies.

[0255] In the embodiment, the processor 401 is further configured to:

[0256] obtain second load information of the plurality of physical machine nodes and the corresponding physical machine node; identify a second target physical machine node for each segment according to the second load information and the first data amount; obtain the image segment or the image segment copy corresponding to the segment identification from the second target physical machine node, and create the virtual machine on the second physical machine node based on all the obtained image segments and / or image segment copies.

[0257] In an embodiment, before obtaining the target image file from the image warehouse of the central cloud and distributing the target image file to the plurality of physical machine nodes of the local computer room, the processor 401 is further configured to:

[0258] determine a second data amount of the target image file; determine available storage space for image caching of each physical machine node in the local computer room; and determine the plurality of physical machine nodes from the local computer room according to the size of the available storage space and the second data amount.

[0259] In an embodiment, after creating the virtual machine on the second physical machine node based on the distributed storage of the target image file on the plurality of physical machine nodes, the processor 401 is further configured to:

[0260] statistically analyze the image files used by the virtual machines created on the physical machine nodes in the local computer room to obtain first statistical result information; determine a first image file satisfying a first preset condition from the used image files according to the statistical result; and synchronize the first image file to the physical machine nodes of other computer rooms in the distributed cloud environment.

[0261] In an embodiment, after statistically analyzing the image files used by the virtual machines created on the physical machine nodes in the local computer room, the processor 401 is further configured to:

[0262] when it is detected that the available storage space for image caching of the physical machine node in the local computer room is less than a preset value, determine a second image file or a target image segment with the longest time distance from the current time point from the image files stored in the detected physical machine node; remove the second image file from the detected physical machine node, or remove the target image segment from the detected physical machine node and remove the associated image segment of the target image segment from other physical machine nodes in the local computer room.

[0263] In an embodiment, after creating the virtual machine on the second physical machine node based on the target image file distributed stored on the plurality of physical machine nodes, the processor 401 is further configured to:

[0264] When receiving a third virtual machine creation request initiated by a third physical machine node in the local computer room, if the target image file is cached by the third physical machine node, a virtual machine is created on the third physical machine node based on the target image file, wherein the third virtual machine creation request indicates to create a virtual machine based on the target image file.

[0265] The specific implementation of the above operations can refer to the previous embodiments, which will not be repeated here.

[0266] As can be seen from the above, in the embodiments of the present application, the electronic device receives a first virtual machine creation request initiated by a first physical machine node, if the local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache a target image file, the target image file is obtained from an image repository of a central cloud according to the first virtual machine creation request and is distributed stored to a plurality of physical machine nodes in the local computer room; then, a virtual machine is created on the first physical machine node based on the target image file distributed stored on the plurality of physical machine nodes; when receiving a second virtual machine creation request initiated by a second physical machine node in the local computer room, if the second physical machine node does not cache the target image file, a virtual machine is created on the second physical machine node based on the target image file distributed stored on the plurality of physical machine nodes. In the present scheme, the image file in the central cloud is directly cached in the physical machine node of the edge area computer room under the distributed cloud environment, which saves the image pulling time for the creation of the virtual machine on the related physical machine node in the subsequent edge area computer room, and thus improves the overall creation speed of the distributed cloud virtual machine.

[0267] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by instructions controlling related hardware, which can be stored in a computer readable storage medium and loaded and executed by a processor.

[0268] Therefore, the embodiments of the present application provide a computer readable storage medium, which stores a plurality of instructions. The instructions can be loaded by a processor to execute the steps in any of the creation methods of the virtual machine in the distributed cloud environment provided by the embodiments of the present application. For example, the instructions can execute the following steps:

[0269] receive a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file; if a local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from an image warehouse of a central cloud and is distributed stored to a plurality of physical machine nodes in the local computer room; based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node; when a second virtual machine creation request initiated by a second physical machine node in the local computer room is received, if the second physical machine node does not cache the target image file, then based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the second physical machine node, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

[0270] The specific implementation of each operation can refer to the foregoing embodiments, and will not be described here.

[0271] The computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0272] Due to the instructions stored in the computer readable storage medium, the steps in the virtual machine creation method in the distributed cloud environment provided by the embodiments of the present application can be executed, and thus the beneficial effects of the virtual machine creation method in the distributed cloud environment provided by the embodiments of the present application can be achieved. Details are described in the foregoing embodiments, and will not be described here.

[0273] According to an aspect of the present application, a computer program product or computer program is provided, which includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the various optional implementation manners of the virtual machine creation in the distributed cloud environment.

[0274] The above describes in detail the method and device for creating a virtual machine in a distributed cloud environment, the electronic device, the computer readable storage medium and the computer program product provided by the embodiments of the present application. The principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the idea of the present application. In conclusion, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A method for creating a virtual machine in a distributed cloud environment, characterized by, The method comprises: receiving a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file; if a local computer room to which the first physical machine node belongs is located in an edge area, and all physical machine nodes in the local computer room do not cache the target image file, then according to the first virtual machine creation request, the target image file is obtained from an image repository of a central cloud and is distributed stored to a plurality of physical machine nodes of the local computer room; based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the first physical machine node; when a second virtual machine creation request initiated by a second physical machine node in the local computer room is received, if the second physical machine node does not cache the target image file, then based on the target image file distributed stored in the plurality of physical machine nodes, a virtual machine is created on the second physical machine node, wherein the second virtual machine creation request indicates to create a virtual machine based on the target image file.

2. The method of claim 1, wherein, The target image file is divided into a plurality of different image segments and distributed in the plurality of physical machine nodes; The method of creating a virtual machine on the first physical machine node based on the target image file distributed stored in the plurality of physical machine nodes comprises: synchronizing the plurality of different image segments distributed in the plurality of physical machine nodes to the first physical machine node; merging the plurality of different image segments in the first physical machine node to obtain the target image file; creating a virtual machine on the first physical machine node based on the target image file; The method of creating a virtual machine on the second physical machine node based on the target image file distributed stored in the plurality of physical machine nodes comprises: synchronizing the plurality of different image segments distributed in the plurality of physical machine nodes to the second physical machine node; merging the plurality of different image segments in the second physical machine node to obtain the target image file; creating a virtual machine on the second physical machine node based on the target image file. 3.The method of claim 2, wherein, The method of merging the plurality of different image segments in the first physical machine node or the second physical machine node to obtain the target image file comprises: determining a position offset corresponding to each image segment in the plurality of different image segments; merging the plurality of different image segments according to the position offset to obtain the target image file.

4. The method of claim 1, wherein, The local computer room and the central cloud communicate through a virtual private network; The method of obtaining the target image file from an image repository of a central cloud and distributing storing the target image file to a plurality of physical machine nodes of the local computer room comprises: obtaining the target image file from the image repository of the central cloud; performing fragmentation processing on the obtained target image file to obtain a plurality of different image segments; transmitting the plurality of different image segments through the virtual private network and storing the plurality of different image segments in the plurality of physical machine nodes of the local computer room.

5. The method of claim 4, wherein, The method of transmitting the plurality of different image segments through the virtual private network comprises: acquiring a first bandwidth currently available for the virtual private network, and determining a first number of mirroring transmission tasks that can be executed in parallel according to the first bandwidth; acquiring a second number of the plurality of different image segments; if the first number is greater than or equal to the second number, transmitting the plurality of different image segments in parallel through the virtual private network; if the first number is less than the second number, transmitting the first number of image segments in parallel through the virtual private network, and adding the remaining image segments to a mirroring transmission task queue for transmission.

6. The method of claim 4, wherein, The transmitting the plurality of different image segments through the virtual private network comprises: acquiring a first bandwidth currently available for the virtual private network and a second number of the plurality of different image segments; determining a second bandwidth according to the first bandwidth and the second number; transmitting each of the plurality of different image segments in parallel through the virtual private network according to the second bandwidth.

7. The method of claim 4, wherein, After the plurality of different image segments are transmitted through the virtual private network and stored on the plurality of physical machine nodes in the local computer room, the method further comprises: for each of the plurality of different image segments, generating a corresponding image segment copy on the corresponding physical machine node in the local computer room, wherein the image segment copy and the corresponding image segment are stored on different physical machine nodes.

8. The method of claim 7, wherein, The creating a virtual machine on the first physical machine node based on the distributed storage of the target image file on the plurality of physical machine nodes comprises: acquiring first load information of the plurality of physical machine nodes and the corresponding physical machine nodes; acquiring a first data amount of each of the plurality of different image segments and the corresponding image segment copy thereof; allocating a segment identifier to each of the plurality of different image segments, wherein each image segment and the corresponding image segment copy thereof share the same segment identifier; matching a first target physical machine node for each segment identifier according to the first load information and the first data amount; acquiring the image segment or the image segment copy corresponding to the segment identifier from the first target physical machine node, and creating a virtual machine on the first physical machine node based on all the acquired image segments and / or image segment copies; The creating a virtual machine on the second physical machine node based on the distributed storage of the target image file on the plurality of physical machine nodes comprises: acquiring second load information of the plurality of physical machine nodes and the corresponding physical machine nodes; matching a second target physical machine node for each segment identifier according to the second load information and the first data amount; acquiring the image segment or the image segment copy corresponding to the segment identifier from the second target physical machine node, and creating a virtual machine on the second physical machine node based on all the acquired image segments and / or image segment copies.

9. The method of claim 1, wherein, Before the target image file is acquired from the image repository of the central cloud and distributed stored on the plurality of physical machine nodes in the local computer room, the method further comprises: determining a second data amount of the target image file; determining available storage spaces of each physical machine node in the local computer room for image caching; determining the plurality of physical machine nodes from the local computer room according to sizes of the available storage spaces and the second data amount. 10.The method of Claim 1, wherein, after creating the virtual machine on the second physical machine node based on the target image file distributed stored on the plurality of physical machine nodes, further comprising: performing information statistics on the image file used when creating the virtual machine on each physical machine node in the local computer room to obtain first statistical result information; determining a first image file meeting a first preset condition from the image file according to the information statistics result; synchronizing the first image file to physical machine nodes of other computer rooms in the distributed cloud environment.

11. The method of claim 10, wherein, after performing information statistics on the image file used when creating the virtual machine on each physical machine node in the local computer room, further comprising: when detecting that the available storage space of the physical machine node for image caching in the local computer room is less than a preset value, determining a second image file or a target image segment with the longest time distance from a current time point from among image files stored in the detected physical machine node and not used for a long time; removing the second image file from the detected physical machine node, or removing the target image segment from the detected physical machine node and removing associated image segments of the target image segment from other physical machine nodes in the local computer room.

12. The method of claim 1-11, wherein, after creating the virtual machine on the second physical machine node based on the target image file distributed stored on the plurality of physical machine nodes, further comprising: when receiving a third virtual machine creation request initiated by a third physical machine node in the local computer room, if the third physical machine node caches the target image file, creating a virtual machine on the third physical machine node based on the target image file, wherein the third virtual machine creation request indicates to create a virtual machine based on the target image file.

13. An apparatus for creating a virtual machine in a distributed cloud environment, the apparatus comprising: comprising: a receiving unit configured to receive a first virtual machine creation request initiated by a first physical machine node, wherein the first virtual machine creation request indicates to create a virtual machine based on a target image file; a first obtaining unit configured to, if a local computer room to which the first physical machine node belongs is located in an edge area and all physical machine nodes in the local computer room do not cache the target image file, obtain the target image file from an image warehouse of a center cloud and distribute store the target image file to a plurality of physical machine nodes of the local computer room according to the first virtual machine creation request; a first creating unit configured to create a virtual machine on the first physical machine node based on the target image file distributed stored on the plurality of physical machine nodes. A second creating unit is configured to, when receiving a second virtual machine creating request initiated by a second physical machine node in the local machine room, create a virtual machine on the second physical machine node based on the target image file distributedly stored in the plurality of physical machine nodes if the second physical machine node does not cache the target image file, wherein the second virtual machine creating request indicates to create a virtual machine based on the target image file.

14. An electronic device, comprising: The computer program is stored in the memory and comprises a plurality of instructions, and the processor is configured to execute the instructions to perform the steps of the method for creating a virtual machine in a distributed cloud environment according to any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a plurality of instructions adapted to be loaded by the processor to perform the steps of the method for creating a virtual machine in a distributed cloud environment according to any one of claims 1-12.

16. A computer program product comprising computer programs or instructions, characterized in that, The computer program or the instructions, when executed by the processor, implement the steps of the method for creating a virtual machine in a distributed cloud environment according to any one of claims 1-12.