WO2018094649A1 - Method for acquiring data during startup of virtual machine, and cloud computing system - Google Patents

Method for acquiring data during startup of virtual machine, and cloud computing system Download PDF

Info

Publication number
WO2018094649A1
WO2018094649A1 PCT/CN2016/107112 CN2016107112W WO2018094649A1 WO 2018094649 A1 WO2018094649 A1 WO 2018094649A1 CN 2016107112 W CN2016107112 W CN 2016107112W WO 2018094649 A1 WO2018094649 A1 WO 2018094649A1
Authority
WO
WIPO (PCT)
Prior art keywords
read
data block
virtual machine
data
operating system
Prior art date
Application number
PCT/CN2016/107112
Other languages
French (fr)
Chinese (zh)
Inventor
邬肖元
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2016/107112 priority Critical patent/WO2018094649A1/en
Priority to CN201680003333.7A priority patent/CN108475201B/en
Publication of WO2018094649A1 publication Critical patent/WO2018094649A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • the present invention relates to the field of computer virtualization technologies, and in particular, to a data acquisition method and a cloud computing system in a virtual machine startup process.
  • cloud computing systems can provide services to enterprises in all walks of life. Because corporate activities tend to have seasonal changes, such as retail e-commerce seasonal promotions, a large amount of computing resources are needed in a short period of time. This means that customers need to quickly deploy a large number of virtual machines when they need them. When the business volume drops, they need to release resources such as redundant virtual machines to save money.
  • the automatic creation and startup of virtual machines according to requirements is the key technology for cloud computing systems to meet user needs.
  • the embodiment of the present invention discloses a method for acquiring data in a virtual machine startup process and a cloud computing system, and storing necessary data of an operating system that needs to be read when the virtual machine is started in the cache area, in the startup process.
  • the necessary data of the operating system is obtained from the cache area, thereby saving the time required for the virtual machine to start, and realizing the rapid startup of the virtual machine in the cloud computing system.
  • the present application provides a data acquisition method in a virtual machine startup process, where the method is applied to a cloud computing system, where the cloud computing system includes a server and a second storage device, and the second storage device is a mirror storage device.
  • the device runs the virtualization platform on the server.
  • the method includes the following steps: the virtual disk driver of the virtualization platform receives the read data request sent by the virtual machine; and the virtual disk driver determines whether the cache area needs to be read according to the read data request.
  • the buffer area is configured to store necessary data used by the operating system that the virtual machine needs to read to start the virtual machine; if the data block to be read is stored in the buffer area, the virtual disk The driver reads the data block to be read from the buffer area and returns the virtual machine; if the data block to be read is not stored in the buffer area, the virtual disk driver requests according to the read data Locating the data block to be read in the second storage device, and returning the searched data block to be read to the virtual machine.
  • the virtual machine stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and can obtain the operation of starting the required reading in the cache area.
  • the necessary data of the system greatly saves the time required for the virtual machine to start.
  • the method further includes: if the data block to be read found in the second storage device is used by the operating system The necessary data of the virtual machine is started, and the virtual disk drive writes the found data block into the buffer area.
  • the data that the operating system found in the second storage device is used for starting the virtual machine during the startup of the virtual machine is the necessary data used by the operating system to start the virtual machine, and the necessary data is stored in the cache area as virtual data, so that When the same type of virtual machine is started, the necessary data of the operating system for starting the virtual machine can be read into the cache area, and the second storage device is not required to be read, which greatly saves the virtual machine startup. time.
  • the second aspect is In an implementation manner, the method further includes: the read data request carries a first virtual disk identifier, a size value of the data block to be read, and an offset of the data block to be read, where the first virtual disk A virtual disk allocated for the virtual machine in the first storage device.
  • the virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier, where the first operating system identifier is an identifier of the operating system that the virtual machine needs to be installed. .
  • the virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the buffer area, specifically: the virtual disk drive according to the first operating system identifier, the size value of the data block to be read, and the requirement
  • the offset of the read data block determines whether the data block to be read is stored in the buffer area.
  • the virtual disk drive searches for the data block to be read in the second storage device according to the read data request, specifically: when there is no storage in the buffer area, the data block needs to be read.
  • the virtual disk drive searches for the data to be read in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Piece.
  • the virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier in the read data request, and may be based on the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read.
  • the quantity is searched in the buffer area for data to be read; if the data to be read is not stored in the buffer area, the virtual disk drive is based on the first operating system identifier, the size value of the data block to be read, and the quantity to be read. Offset of the data block to the second storage device to find the data to be read without first reading the data of the first operating system in the second storage device to the first virtual disk in advance, thereby greatly speeding up the virtual machine The speed of startup.
  • the first operating system identifier is an operating system virtual disk of the virtual machine template corresponding to the virtual machine Logo.
  • the virtual disk drive can be based on the An operating system identifier, a size value of the data block to be read, and an offset of the data block to be read are searched for data to be read in the second storage device, and the identifier is not converted.
  • the necessary data that is used by the operating system to start the virtual machine is that the virtual machine is in startup
  • the data of the operating system that has been read in the state, the startup completion state includes: the number of data of the operating system written in the buffer area is greater than a predetermined number, and the CPU usage of the virtual machine is less than a predetermined The threshold, or the number of operation requests by the virtual disk drive to receive the virtual machine to read and write a non-operating system virtual disk exceeds a predetermined threshold.
  • the data of the operating system that is read when the virtual machine is in the startup completion state is the necessary data of the operating system, which can greatly reduce the data that the virtual machine needs to read at startup, and saves the time taken for the virtual machine to start.
  • the method further includes The following steps:
  • the virtual disk drive writes the data block to be read to the first virtual disk.
  • the virtual disk drive writes unnecessary data of the operating system to the first virtual disk.
  • the cache The zone is located in the server or in the first storage device.
  • the necessary data for the operating system to start the virtual machine is stored in the cache.
  • the virtual machine can quickly read the necessary data of the operating system required for booting from the server.
  • the buffer area may also be divided in the first storage device, and the virtual machine is started. It is also possible to quickly read the necessary data of the operating system required for booting from the first storage device.
  • the virtual disk drive uses a buffering linked list to record the data block written in the buffer area.
  • the method further includes: recording, by the description object corresponding to the buffer linked list of the operating system, the found The size value of the data block and the offset of the data block, and the address in which the searched data block is saved in the buffer area is saved to the last description object of the buffer linked list corresponding to the operating system.
  • the embodiment of the present invention provides a server for acquiring data during a virtual machine startup process, where the server is connected to the second storage device, and the second storage device is a mirror storage device, wherein the server includes a processor and processes The device runs a virtualization platform, and the virtualized platform runs a virtual disk drive.
  • the virtual disk driver is configured to: receive a read data request of the virtual machine; and determine, according to the read data request, whether the data block to be read is stored in the cache area,
  • the cache area is used to store necessary data of an operating system that the virtual machine needs to read for starting the virtual machine; the necessary data is data of the operating system that is read when the virtual machine is in a startup completion state;
  • the data block to be read is stored, the data block to be read is read from the buffer area and returned to the virtual machine; when there is no data block to be read stored in the buffer area, according to the read data request
  • the data block to be read is searched in the second storage device, and the found data block to be read is returned to the virtual machine.
  • the server provided by the embodiment of the present invention stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and the virtual machine can obtain the operating system in the cache area during the startup process.
  • the necessary data greatly saves the time it takes for the virtual machine to start.
  • the virtual disk drive is further configured to: if the data block to be read found in the second storage device is used by the operating system to start the The necessary data of the virtual machine writes the found data block into the buffer area.
  • the necessary data used by the operating system to start the virtual machine is stored in the cache area, and the same type of virtual machine is started, the necessary data of the operating system can be read in the cache area, which greatly saves the virtual machine startup. time.
  • the read data request carries the first virtual disk identifier, and the size value of the data block to be read And an offset of the data block to be read, wherein the first virtual disk is a virtual disk allocated for the virtual machine in the first storage device.
  • the virtual disk drive is further configured to find the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier, where the first operating system identifier is an identifier of the operating system that the virtual machine needs to be installed. .
  • the virtual disk driver is configured to determine, according to the read data request, whether a data block to be read is stored in the buffer area, where the virtual disk driver is configured to use the size of the data block to be read according to the first operating system identifier and needs to be read.
  • the offset of the data block determines whether the data block to be read is stored in the buffer area.
  • the virtual disk drive is configured to: when the data block to be read is not stored in the buffer area, search for the data block to be read in the second storage device according to the read data request, specifically: when the cache area does not store the required data
  • the virtual disk driver is configured to search for the read in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Data block.
  • the virtual disk drive is further configured to: determine whether the virtual machine is in a startup completion state, in a third possible implementation manner of the second aspect.
  • the startup completion status includes: the data of the operating system written in the buffer is greater than the predetermined number
  • the amount of CPU usage of the virtual machine is less than a predetermined threshold, or the number of operation requests that the virtual disk drive receives the virtual machine to read and write non-operating system virtual disks exceeds a predetermined threshold.
  • the data of the operating system that is read when the virtual machine is in the startup completion state is the necessary data of the operating system, which can greatly reduce the data that the virtual machine needs to read at startup, and saves the time taken for the virtual machine to start.
  • the cloud system further includes a first storage device, and the virtual disk drive is further configured to read the The data block is written to the first virtual disk.
  • the virtual disk drive is further configured to write non-essential data of the operating system to the first virtual disk. .
  • the virtual disk drive is further configured to determine, according to the read data request, that the cache area does not have the storage to be read.
  • Data block, and the data of the data block to be read found in the second storage device is a description object of the buffer linked list corresponding to the operating system when the data used by the operating system to start the virtual machine is Recording the size value of the found data block and the offset of the data block, and saving the address in the buffer area of the found data block to the buffer linked list corresponding to the operating system The last description of the object.
  • the buffer area is located in the server or in the first storage device.
  • an embodiment of the present invention provides a cloud computing system, including a first storage device, And a second storage device, wherein the server is connected to the second storage device, and the second storage device is a mirror storage device, and the second storage device is connected to the second storage device.
  • a storage device may be in the server or connected to the server, and the first storage device is a virtual machine storage device.
  • the server stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and the virtual machine can obtain the required read start in the cache area during the startup process.
  • the necessary data for the operating system greatly saves the time required for the virtual machine to boot.
  • FIG. 1 is a schematic structural diagram of a cloud computing system according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for acquiring data during a virtual machine startup process according to an embodiment of the present invention
  • FIG. 3 is a flowchart of another method for acquiring data during a virtual machine startup process according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a buffer link list according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a server according to an embodiment of the present invention.
  • FIG. 6 is another schematic structural diagram of a server according to an embodiment of the present invention.
  • FIG. 7 is another schematic structural diagram of a de-computing system according to an embodiment of the present invention.
  • the structure of the cloud computing system for creating a virtual machine is as shown in FIG. 1.
  • the cloud computing system includes a server, a first storage device, and a second storage. device.
  • the server can be a normal server with a processor.
  • the processor is used to create a virtual machine and run a virtualization platform. For ease of viewing, the virtual machine created by the processor and the running virtualization platform are shown separately in FIG.
  • a virtual disk drive runs in the virtualization platform, and a virtual disk drive is used to manage virtual machines.
  • the first storage device is configured to provide a storage space for the created virtual machine, that is, a virtual disk is allocated for the created virtual machine, and thus the first storage device may also be referred to as a virtual machine storage device.
  • the first storage device may be a hard disk of the server itself or an external disk array.
  • the first storage device has higher performance requirements.
  • the second storage device is used to store information such as a virtual machine template, an operating system of the virtual machine, and the like, and the second storage device may also be referred to as a mirror storage device.
  • the second storage device has higher reliability requirements.
  • the first storage device and the second storage device are two storage devices that are physically independent.
  • a virtual machine template is a pre-created and not running virtual machine that is stored in a mirrored storage device.
  • the virtual machine template has a virtual CPU, virtual memory, and at least one virtual disk.
  • a virtual disk with an operating system installed is called an operating system virtual disk and can be used as a boot disk for booting a virtual machine.
  • a virtual disk with only an application installed and no operating system installed is called a non-operating system virtual disk.
  • Multiple virtual machines created from a virtual machine template are virtual machines of the same type. For the same type of virtual machine, the virtual disk allocated, the data of the read operating system, and the order in which the operating system is read are the same when created and started.
  • the user selects a virtual machine template to create a new virtual machine, that is, the type of virtual machine that the user selects to create.
  • the virtual machine manager in the cloud computing system creates a virtual machine that notifies the disk manager in the cloud computing system that creates an empty virtual disk in the virtual machine storage device for the newly created virtual machine.
  • the newly created virtual machine sends a read data request to the virtual disk drive, and the virtual disk drive receives the virtual data template of the virtual machine template after receiving the read data request.
  • the data is copied to the empty virtual disk. After copying the data of the virtual disk of the virtual machine template, a virtual machine can be successfully started on this basis.
  • the virtual disk of the virtual machine template generally has a data size of 10 G or more.
  • the virtual machine storage device and the mirrored storage device are generally two independent storage systems, when the new virtual machine is started, the data of the virtual disk in the virtual machine template needs to be copied from the mirror storage device to the virtual machine storage device. Due to the performance of the mirrored storage device and the network bandwidth between the mirrored storage device and the server, when the number of virtual machines started is large, the startup speed is slow.
  • a link cloning technology is used for creating a virtual machine of the same type on the same virtual machine storage device.
  • the specific way is: when creating the first virtual machine of a certain type, creating a first virtual disk in the virtual machine storage device, where the first virtual disk is allocated to the first virtual machine in the virtual machine storage device.
  • a virtual disk after copying the data of the virtual disk of the virtual machine template to the first virtual disk, creating a snapshot of the first virtual disk, using the snapshot as a linked clone, and using the snapshot to create a second and more virtual machines of the same type.
  • the link cloning technology When the link cloning technology is used, the data of the virtual disk of the virtual machine template needs to be copied to the first virtual disk, and the number of virtual machines created simultaneously by the link cloning is limited by the performance of the virtual machine storage device.
  • the performance of the read When reading data from a common linked clone volume, as the number of virtual machines increases, the performance of the read will decrease linearly.
  • the number of virtual machines exceeds a certain number, the virtual machine creation will become slower and it will be difficult to respond to the user's operation.
  • the number of virtual machines created by linked clones is limited. When the limit is exceeded, a new linked clone needs to be created.
  • the embodiment of the invention provides an implementation scheme for quickly acquiring data during the startup process of the virtual machine, and the flow of the implementation method is as shown in FIG. 2 .
  • the method is applied to a cloud computing system.
  • the cloud computing system includes a server and a second storage device.
  • the second storage device is a mirrored storage device.
  • the server runs a virtualization platform, and the virtual disk platform runs a virtual disk drive, such as Figure 1 shows.
  • Step 201 The virtual disk drive of the virtualization platform receives the read data request sent by the virtual machine to be started.
  • the cloud computing system further includes a first storage device, where the first storage device is a virtual machine storage device, and is configured to provide a virtual disk for the created virtual machine.
  • the disk manager receives the notification message, it creates an empty volume on the virtual machine storage device as the virtual disk of the first virtual machine.
  • the created virtual disk is referred to as a first virtual disk. This step is the same as the existing implementation and will not be described in detail.
  • the functions of the virtual machine manager and the disk manager in the cloud computing system are the same as those in the prior art and will not be described separately.
  • the virtual machine template can have an operating system virtual disk and a non-operating system virtual disk, and there can be multiple non-operating system virtual disks. If the virtual machine template selected by the user has multiple virtual disks, in this step, the virtual disk drive creates multiple first virtual disks on the first storage device, corresponding to multiple virtual disks in the virtual machine template.
  • the first virtual disk After the first virtual disk is created, it triggers the operation of starting the virtual machine. After the virtual machine starts to boot and reads the data in the basic input/output system (BIOS), the virtual machine sends a read data request to the virtualization platform.
  • the read data request carries the first virtual disk label The size of the data block to be read and the offset of the data block to be read, where the first virtual disk identifier refers to the virtual disk identifier of the first virtual disk.
  • the virtual machine manager When a virtual machine is created, after the user selects the virtual machine template, the virtual machine manager creates a virtual machine based on the virtual machine template and notifies the disk manager to allocate a virtual disk for the created virtual machine in the virtual machine storage device. Disk Manager returns the virtual disk ID of the created virtual disk to the virtual machine manager. Because the virtual machine template contains the information of the operating system that the created virtual machine needs to read, the virtual machine manager can obtain the operating system identifier of the operating system that the created virtual machine needs to read after creating the virtual machine. The virtual machine manager sends the obtained operating system ID and virtual disk ID to the virtual disk drive of the server's virtualization platform. After the virtual disk drive is received, the mapping between the operating system identifier and the virtual disk identifier is established, and the correspondence between the operating system identifier and the virtual disk identifier is stored in the server's memory.
  • the virtual disk drive After receiving the read data request sent by the virtual machine to be started, the virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier stored in the memory.
  • the first operating system identifier is an identifier of an operating system that the virtual machine needs to be installed.
  • the virtual machine is created according to a virtual machine template. Therefore, the first operating system identifier can be the same as the operating system virtual disk of the virtual machine template corresponding to the virtual machine.
  • the virtual machine determines the size value of the data block that needs to be read and the offset of the data block.
  • the virtual machine sends multiple read data requests to the virtual disk drive to read the data of the operating system, and the virtual machine completes the boot after reading the data of the required operating system.
  • the data of the operating system virtual disk of the virtual template corresponding to the virtual machine is first read into the first virtual disk of the virtual machine, and when the virtual machine is started, the data is read.
  • the request carries the virtual disk identifier of the first virtual disk.
  • the virtual disk drive reads the data of the operating system into the first virtual disk.
  • the virtual disk drive converts the virtual disk identifier of the first virtual disk in the read data request into a corresponding first operating system identifier, and the virtual disk driver can be identified in the cache area according to the first operating system identifier.
  • the data of the operating system required for booting can be directly obtained from the cache area without virtualizing the operating system of the virtual machine template in advance.
  • the data of the disk is read into the first virtual disk of the virtual machine, which greatly speeds up the startup of other virtual machines.
  • Step 203 The virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the cache area, where the cache area is used to store necessary data used by the operating system to start the virtual machine.
  • the cache area is located in the server, and may be located in a memory of the server or in a local storage medium of the server.
  • the buffer area may also be located in the first storage device, where the buffer area may be located in a controller of the first storage device, or may be used as a buffer area by a high-performance storage device (for example, an SSD disk).
  • the virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the buffer area, specifically: the virtual disk drive according to the first operating system identifier, the size value of the data block to be read, and the requirement
  • the offset of the read data block determines whether the data block to be read is stored in the buffer area.
  • the inventor found that in the process of starting the virtual machine, the virtual machine does not need to read all the data of the operating system to complete the startup of the virtual machine, but only needs to read part of the data of the operating system.
  • the virtual machine is read when the startup is completed.
  • the data of the operating system is the data necessary to start the virtual machine, so the data of the operating system that has been read when the virtual machine is in the startup completion state is called the necessary data of the operating system.
  • the size of the data of the operating system generally has a dozen G, and the necessary data for the operating system required to start the virtual machine is much smaller.
  • the virtual disk drive can record the data of the operating system that has been read when the first virtual machine of a certain type is in the startup completion state.
  • the data of these operating systems must also be the second and subsequent created virtual machines of the same type.
  • the data of the operating system to be read at startup, and the order of reading is the same.
  • the data read after the virtual machine is booted is called non-essential data of the operating system. If all the data of the operating system is cached, the memory requirements will be greatly increased, and the cost will increase dramatically. Therefore, the virtual disk drive needs to judge the data of the operating system that the virtual machine has read when the virtual machine is in the startup completion state.
  • the embodiment of the present invention provides three ways to determine whether the virtual machine is in the startup completion state.
  • the first way is when the number of data of the operating system written in the buffer is greater than a predetermined number.
  • the predetermined number can be determined by an experienced engineer based on the amount of data of the operating system that the virtual machine has read when the virtual machine is in the boot completion state. Since the order of reading the operating system data when the same type of virtual machine is started is the same, the data size of the operating system that has been read when the virtual machine is in the startup completion state can be used as a predetermined schedule by an experienced engineer. Quantity. When creating a virtual machine of the same type, the virtual machine can be started when the data of the operating system read by the virtual machine is greater than the predetermined number.
  • the second way is that the virtual disk drive determines that the read and write operations to the non-operating system virtual disk are Whether the predetermined threshold is exceeded.
  • the virtual disk other than the operating system virtual disk that is, the non-operating system disk
  • the virtual machine startup can be judged.
  • the data of the operating system that has been read when the virtual machine is in the startup completion state is the necessary data of the operating system.
  • the third way is to determine whether the occupancy rate of the CPU of the virtual machine is less than a predetermined threshold. In a certain period of time, if the CPU usage is less than a certain value, it can be judged that the virtual machine startup is completed. At this time, the data of the operating system that the virtual machine has read is the necessary data of the operating system.
  • those skilled in the art can also judge whether the virtual machine is in the startup completion state by other similar manners. For example, an experienced engineer can count the time when the virtual machine is in the startup completion state in some cases, and the time obtained by the statistics is taken as the predetermined time threshold. When the virtual machine is started, the virtual machine startup is completed when the time for reading the operating system reaches the predetermined time threshold under the same conditions.
  • the necessary data of the operating system may also be identified, and the necessary data of the operating system is pre-stored in the buffer before the virtual machine is created.
  • the virtual disk drive After receiving the read data request sent by the virtual machine, the virtual disk drive determines whether the data block to be read is stored in the buffer area, and the buffer area is used to store necessary data used by the operating system to start the virtual machine.
  • the virtual disk drive can also create separate caches for each operating system's necessary data.
  • the virtual disk drive can use the buffered linked list to record related information. For example, using a buffered linked list The way to record the operating system ID of the data block written to the buffer, the size value of the data block, and the offset of the data block.
  • other methods such as a tree structure
  • Which method is used can be set according to the needs of the business or the user.
  • the following uses the method of using a linked list as an example to explain how to store and utilize the information necessary for the operating system.
  • the structure of the linked list provided by the embodiment of the present invention is as shown in FIG. 3.
  • the virtual disk drive creates a global pointer to the buffered linked list. Before the virtual machine is created, there is no data stored in the cache, and the buffer list pointer is empty. Therefore, when the first virtual machine is created, the pointer to the buffer list in the virtual disk driver is empty. In this case, an image buffer object needs to be created in the buffer list, and the operating system identifier (that is, the identifier of the operating system) is recorded in the image buffer object. The amount of buffered data is 0, the next mirror buffer object pointer is set to null, and the buffered data block list pointer is empty.
  • the data when the data is to be read, first look for the corresponding image buffer object (that is, the necessary data of the operating system) in the mirror linked list according to the operating system identifier in the read data request. After the image buffer object is found, it searches for the corresponding data block in the data block linked list of the image buffer object according to the size value of the data block in the read data request and the offset of the data block. If there is a corresponding data block, it indicates that the data block to be read is stored in the buffer area, and the data block corresponding to the location in the buffer area is returned to the virtual machine.
  • the specific operating system data can be stored in the buffer list (as shown in Attachment 4), or a pointer can be added to the location of the operating system data store.
  • the corresponding image ID is not found in the mirror list according to the operating system ID, or According to the size value of the data block and the offset of the data block, the corresponding data block is not found in the mirror linked list, indicating that there is no data block in the buffer area for storing the read data request, and the virtual disk drive needs to be
  • the data block to be read is read in the image storage. If the data to be read at this time is the necessary data of the operating system, write the necessary data of the operating system into the buffer area, and newly create an image buffer object in the buffer list, and record the operating system on the image buffer object.
  • Step 205 When it is determined that the data block to be read is stored in the buffer area according to the read data request, the virtual disk drive reads the data block to be read from the buffer area, Return to the virtual machine.
  • the virtual disk drive can find the data block to be read in the cache according to the read data request. Specifically, when the data stored in the cache area is recorded in the mirror buffer linked list, the virtual disk drive finds the operating system identifier in the mirror buffer list according to the operating system identifier in the read data request, and then requests according to the read data. If the size value of the data block to be read and the offset of the data block to be read find the corresponding object in the mirror buffer linked list, the data block to be read is stored in the buffer area. . The virtual disk drive reads the data block from the cache and returns it to the virtual machine. After the virtual machine reads the necessary data of the operating system that needs to be read, it can complete the startup.
  • the necessary data of the operating system required to start the virtual machine is already in the cache area, when the same type of virtual machine is created, the necessary data of the operating system can be directly read from the buffer area without The necessary data of the operating system is read from the second storage device to the virtual disk, and the data of the operating system is read from the virtual disk, thereby greatly speeding up the startup of the virtual machine. And the number of virtual machines of the same type is unlimited, so when you create a large number of virtual machines, the time to start the virtual machine is greatly reduced.
  • Step 207 When the data block to be read is not stored in the buffer area, the virtual disk driver searches for the data block to be read in the second storage device according to the read data request, and The found data block to be read is returned to the virtual machine.
  • the virtual disk drive When the data block to be read is not stored in the buffer area, the virtual disk drive is in the second storage according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Find the data block to be read in the device. If the data block to be read is not stored in the buffer area, the virtual disk driver searches the second storage device for the data block to be read according to the read data request. The virtual disk drive searches for the data block after finding the corresponding data block in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Return to the virtual machine.
  • the virtual machine After the virtual machine reads the necessary data of the operating system, it can complete the startup. In this way, when the virtual machine starts, it only needs to read the necessary data of the operating system from the second storage device, and does not need to read all the data of the operating system, which can greatly save the startup time of the virtual machine.
  • Step 209 If the data block to be read found in the second storage device is requested according to the read data as the necessary data used by the operating system to start the virtual machine, the virtual disk drive will search the data block that is found. Write to the buffer area.
  • the recording method can be recorded in the form of a linked list, or can be recorded in other ways (for example, a tree structure).
  • the linked list is recorded as described above and will not be further described herein.
  • the method may further include the following steps, as shown in FIG. 3:
  • Step 311 The virtual disk drive writes the data block to be read to the first virtual disk.
  • the virtual disk drive writes the data block to be read by the virtual machine during the startup process to the first virtual disk, where the first virtual disk is a virtual disk allocated by the disk manager in the cloud storage system to the virtual machine in the first storage device.
  • the virtual disk drive may write the data block to the first virtual disk while returning the data block to be read to the virtual machine, or The data block is written to the first virtual disk when the system is idle.
  • the virtual disk drive may write the data block into the first virtual disk while writing the data block into the buffer area, and may also be virtual to When the machine returns the data, the data block is written into the first virtual disk, and the data block can also be written to the first virtual disk when the system is idle.
  • the method may further include the following steps, as shown in FIG. 3:
  • Step 313 The virtual disk drive writes unnecessary data of the operating system to the first virtual disk.
  • the data block to be read is non-essential data of the operating system
  • only the Non-essential data of the operating system is written to the first virtual disk without being written to the buffer. Since the non-essential data of the operating system does not affect the startup of the virtual machine, the non-essential data of the operating system can be written to the first virtual disk when the system is idle after the virtual machine is started. This allows the system to operate again when it is relatively idle, reducing the impact on system performance.
  • the embodiment of the present invention provides a method for acquiring data during a virtual machine startup process.
  • the search and read data request is performed.
  • the first virtual disk identifier corresponds to the first operating system identifier, and determines whether the buffer needs to be read in the buffer according to the first operating system identifier, the size value of the data block to be read, and the offset of the data to be read.
  • the data block is taken.
  • the virtual disk drive returns the data block to be read to the virtual machine.
  • the cache area is used to store the necessary data used by the operating system that the virtual machine needs to read to start the virtual machine.
  • the prior art needs to first put the image storage device in the virtual machine startup process.
  • the data of the operating system is read into the first storage device, so that the solution provided by the embodiment of the present invention greatly saves the startup time of the virtual machine.
  • the necessary data of the operating system is required to be read in the mirror storage device, so that the solution provided by the embodiment of the present invention can save the data.
  • the startup time of the virtual machine is required to be read in the mirror storage device, so that the solution provided by the embodiment of the present invention can save the data.
  • the method provided by the embodiment of the present invention is not limited by the number of virtual machines, and the necessary data of the virtual machine to read the operating system can be started, and the startup time of the virtual machine is also greatly shortened. .
  • the embodiment of the invention further provides a cloud computing system (as shown in FIG. 1 ), comprising a server 11 , a first storage device 13 and a second storage device 15 .
  • the server 11 is connected to the second storage device 15;
  • the storage device 13 may be connected to the server 11 or may be a hard disk in the server 11.
  • the first storage device 13 is configured to provide a storage space for the created virtual machine, that is, a virtual disk is allocated for the created virtual machine 1011, and thus the first storage device 13 may also be referred to as a virtual machine storage device.
  • the first storage device 13 may be a disk array external to the server.
  • the second storage device 15 is configured to store information such as a virtual machine template, a virtual disk of the virtual machine, and the like, and the second storage device 15 may also be referred to as a mirror storage device.
  • the first storage device 13 and the second storage device 15 are two storage devices that are physically independent.
  • the server is configured to implement the foregoing method for acquiring data in a virtual machine startup, and the structure of the server is as shown in FIG. 5.
  • the server includes a processor 51 for creating a virtual machine 511 and running a virtualization platform 513.
  • a virtual disk drive 5131 is running in the virtualization platform 513, and the virtual disk drive 5131 is used to implement the following solutions:
  • the read data request carries a first virtual disk identifier, a size value of the data block to be read, and an offset of the data block to be read, where
  • the first virtual disk is a virtual disk allocated to the virtual machine in the first storage device;
  • the first operating system identifier corresponding to the first virtual disk identifier, where the first operating system identifier is an identifier of an operating system that the virtual machine needs to be installed;
  • the buffer area 54 is configured to store necessary data used by the operating system that the virtual machine needs to read to start the virtual machine; and the necessary data is the operation that has been read when the virtual machine is in a startup completion state. System data.
  • the virtual disk drive is configured to determine, according to the read data request, whether a data block to be read is stored in the cache area, where the virtual disk drive is configured to read according to the first operating system identifier.
  • the size value of the fetched data block and the offset of the data block to be read are determined to be slow Whether the data block to be read is stored in the storage area.
  • the cache area 54 may be located in a server (such as the server shown in FIG. 6), such as in the memory of the server, or in a local storage medium of the server.
  • the buffer area 54 may also be located in the first storage device 13 (such as the cloud computing system shown in FIG. 7), for example, may be located in the controller of the first storage device 13, or may be high-performance.
  • a storage device (such as an SSD) provides a buffer.
  • the virtual disk drive 5131 is configured to read the data block to be read from the buffer area 54 and return it to the virtual machine.
  • the virtual disk drive 5131 is further configured to: in the second storage device, search for the data block to be read according to the read data request, when the data block to be read is not stored in the buffer area 54. And returning the found data block to be read back to the virtual machine 511.
  • the virtual disk drive is configured to: when the data block to be read is not stored in the buffer area, search for the data block to be read in the second storage device according to the read data request, Specifically, when the data block to be read is not stored in the buffer area, the virtual disk driver is configured to determine, according to the first operating system identifier, a size value and a size of the data block to be read. An offset of the data block to be read is searched for in the second storage device for the data block to be read.
  • the virtual disk drive 5131 can be read from the cache during the startup process of the virtual machine. Taking the data block to be read without reading the data block to be read from the second storage device to the virtual disk and reading the data to be read from the virtual disk, thereby greatly speeding up The startup speed of the virtual machine. And the number of virtual machines of the same type is unlimited, so when you create a large number of virtual machines, the time to start the virtual machine is greatly reduced.
  • the virtual disk drive 5131 is further configured to: if the data block to be read found in the second storage device is necessary data used by the operating system to start the virtual machine, the searching The resulting data block is written to the buffer area 54.
  • the virtual disk drive 5131 is further configured to: determine whether the virtual machine 511 is in a startup completion state; the startup completion state includes: the data of the operating system written in the cache area is greater than a predetermined number; The CPU usage of the machine is less than a predetermined threshold; or the number of operation requests by the virtual disk drive to receive the virtual machine to read and write a non-operating system virtual disk exceeds a predetermined threshold.
  • the server is further connected to the first storage device, and the virtual disk drive 5131 is further configured to: write the data block to be read into the first virtual disk.
  • the virtual disk drive 5131 is further configured to: write non-essential data of the operating system to the first virtual disk.
  • the virtual disk drive 5131 is further configured to: determine, according to the read data request, that the data block to be read is not stored in the buffer area 54, and the read data is found in the second storage device
  • the size value and the data block of the searched data block are recorded on the description object corresponding to the buffer linked list of the operating system.
  • An offset, and the address in which the found data block is saved in the buffer is saved to the last description object of the buffer linked list corresponding to the operating system.
  • Meta and algorithm steps can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can select different methods for implementing the described functions for a particular application, but such implementation should not be considered to be beyond the scope of the present invention.
  • the function is implemented in the form of computer software and sold or used as a stand-alone product, it is considered to some extent that all or part of the technical solution of the present invention (for example, a part contributing to the prior art) is It is embodied in the form of computer software products.
  • the computer software product is typically stored in a computer readable storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the present invention provide a method for acquiring data during startup of a virtual machine, and a cloud computing system. During startup of a virtual machine, a virtual disk driver of a virtualization platform receives a data reading request sent by the virtual machine, and determines, according to the data reading request, whether a data block to be read is stored in a cache area, the cache area being used for storing necessary data of an operating system; when a data block to be read is stored in the cache area, the virtual disk driver reads the data block to be read from the cache area and returns the data block to the virtual machine; when no data block to be read is stored in the cache area, the virtual disk driver searches a second storage device for a data block to be read according to the data reading request, and returns the found data block to be read to the virtual machine. The method provided in the embodiments of the present invention enables large number of virtual machines to start up quickly.

Description

一种虚拟机启动过程中的数据获取方法和云计算***Data acquisition method and cloud computing system in virtual machine startup process 技术领域Technical field
本发明涉及计算机虚拟化技术领域,尤其涉及一种虚拟机启动过程中的数据获取方法和云计算***。The present invention relates to the field of computer virtualization technologies, and in particular, to a data acquisition method and a cloud computing system in a virtual machine startup process.
背景技术Background technique
通过软件来定义计算机基础架构越来越成为一种趋势,相应地,企业IT架构也从企业独自建设、独自维护向共享资源、维护外包发展。云计算***就是适应这种变化,为企业提供基础IT设施的服务。The definition of computer infrastructure through software is becoming a trend. Accordingly, the enterprise IT architecture is also built from the enterprise alone, maintenance to shared resources, and maintenance outsourcing. Cloud computing systems are services that adapt to this change and provide enterprises with basic IT facilities.
云计算***作为可供公众使用的IT基础设施服务,可以向各行各业的企业提供服务。由于企业活动往往具有季节性变化规律,比如零售电商季节性促销,在某个时间段需要短期大量的计算资源。这就意味着,客户需要在业务需要时,能够快速部署大量虚拟机;而业务量下降后,又需要释放多余的虚拟机等资源来节约资金。As an IT infrastructure service that can be used by the public, cloud computing systems can provide services to enterprises in all walks of life. Because corporate activities tend to have seasonal changes, such as retail e-commerce seasonal promotions, a large amount of computing resources are needed in a short period of time. This means that customers need to quickly deploy a large number of virtual machines when they need them. When the business volume drops, they need to release resources such as redundant virtual machines to save money.
虚拟机按照需求自动快速创建并启动是云计算***适应用户需求的关键技术。The automatic creation and startup of virtual machines according to requirements is the key technology for cloud computing systems to meet user needs.
发明内容Summary of the invention
有鉴于此,本发明实施例公开了一种在虚拟机启动过程中获取数据的方法和云计算***,通过在缓存区中存储虚拟机启动时需要读取的操作***的必要数据,在启动过程中从缓存区中获取操作***的必要数据,从而节省虚拟机启动需花费的时间,实现了云计算***中虚拟机的快速启动。 In view of this, the embodiment of the present invention discloses a method for acquiring data in a virtual machine startup process and a cloud computing system, and storing necessary data of an operating system that needs to be read when the virtual machine is started in the cache area, in the startup process. The necessary data of the operating system is obtained from the cache area, thereby saving the time required for the virtual machine to start, and realizing the rapid startup of the virtual machine in the cloud computing system.
第一方面,本申请提供了一种虚拟机启动过程中的数据获取方法,该方法应用于云计算***,所述云计算***包括服务器和第二存储设备,所述第二存储设备为镜像存储设备,该服务器上运行虚拟化平台,方法包括以下步骤:虚拟化平台的虚拟磁盘驱动接收虚拟机发送的读数据请求;虚拟磁盘驱动根据读数据请求,确定缓存区中是否存储有需读取的数据块,该缓存区用于存储所述虚拟机需要读取的操作***用于启动所述虚拟机的必要数据;若该缓存区中存储有所述需读取的数据块,所述虚拟磁盘驱动从缓存区中读取该需读取的数据块,并返回所述虚拟机;若所述缓存区中没有存储所述需读取的数据块,所述虚拟磁盘驱动根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块,并将查找到的所述需读取的数据块返回给所述虚拟机。In a first aspect, the present application provides a data acquisition method in a virtual machine startup process, where the method is applied to a cloud computing system, where the cloud computing system includes a server and a second storage device, and the second storage device is a mirror storage device. The device runs the virtualization platform on the server. The method includes the following steps: the virtual disk driver of the virtualization platform receives the read data request sent by the virtual machine; and the virtual disk driver determines whether the cache area needs to be read according to the read data request. a data block, the buffer area is configured to store necessary data used by the operating system that the virtual machine needs to read to start the virtual machine; if the data block to be read is stored in the buffer area, the virtual disk The driver reads the data block to be read from the buffer area and returns the virtual machine; if the data block to be read is not stored in the buffer area, the virtual disk driver requests according to the read data Locating the data block to be read in the second storage device, and returning the searched data block to be read to the virtual machine.
通过本发明实施例提供的方法,虚拟机在启动过程中,在缓存区中存储有虚拟机启动时需要读取的操作***的必要数据,可以到缓存区中获取到启动所需读取的操作***的必要数据,大大节省了虚拟机启动所需的时间。According to the method provided by the embodiment of the present invention, during the startup process, the virtual machine stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and can obtain the operation of starting the required reading in the cache area. The necessary data of the system greatly saves the time required for the virtual machine to start.
结合第一方面,在第一方面第一种可能的实现方式中,该方法还包括:若在所述第二存储设备中查找到的所述需读取的数据块为所述操作***用于启动所述虚拟机的必要数据,所述虚拟磁盘驱动将所述查找到的数据块写入所述缓存区。With reference to the first aspect, in a first possible implementation manner of the first aspect, the method further includes: if the data block to be read found in the second storage device is used by the operating system The necessary data of the virtual machine is started, and the virtual disk drive writes the found data block into the buffer area.
在虚拟机启动过程中在第二存储设备中查找到的操作***用于虚拟机启动的数据为操作***用于启动虚拟机的必要数据,将该必要数据为虚拟数据存储到缓存区中,这样后面再有同类型的虚拟机启动时,可以到缓存区中读取到操作***用于启动虚拟机的必要数据,无需再到第二存储设备中读取,大大节省了虚拟机启动所需的时间。The data that the operating system found in the second storage device is used for starting the virtual machine during the startup of the virtual machine is the necessary data used by the operating system to start the virtual machine, and the necessary data is stored in the cache area as virtual data, so that When the same type of virtual machine is started, the necessary data of the operating system for starting the virtual machine can be read into the cache area, and the second storage device is not required to be read, which greatly saves the virtual machine startup. time.
结合第一方面或第一方面第一种可能的实现方式,在第一方面第二种可 能的实现方式中,该方法还包括:读数据请求中携带有第一虚拟磁盘标识、需读取的数据块的大小值和需读取的数据块的偏移量,其中,第一虚拟磁盘为第一存储设备中为所述虚拟机分配的虚拟磁盘。虚拟磁盘驱动根据虚拟磁盘标识与操作***标识之间的对应关系查找到所述第一虚拟磁盘标识对应的第一操作***标识,第一操作***标识是所述虚拟机需要安装的操作***的标识。虚拟磁盘驱动根据读数据请求确定缓存区中是否存储有需读取的数据块具体为:虚拟磁盘驱动根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,确定缓存区中是否存储有所述需读取的数据块。当所述缓存区中没有存储所述需读取的数据块时,虚拟磁盘驱动根据读数据请求在述第二存储设备中查找需读取的数据块具体为:当缓存区中没有存储需读取的数据块时,虚拟磁盘驱动根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量在第二存储设备中查找所述需读取的数据块。In combination with the first aspect or the first possible implementation of the first aspect, the second aspect is In an implementation manner, the method further includes: the read data request carries a first virtual disk identifier, a size value of the data block to be read, and an offset of the data block to be read, where the first virtual disk A virtual disk allocated for the virtual machine in the first storage device. The virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier, where the first operating system identifier is an identifier of the operating system that the virtual machine needs to be installed. . The virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the buffer area, specifically: the virtual disk drive according to the first operating system identifier, the size value of the data block to be read, and the requirement The offset of the read data block determines whether the data block to be read is stored in the buffer area. When the data block to be read is not stored in the buffer area, the virtual disk drive searches for the data block to be read in the second storage device according to the read data request, specifically: when there is no storage in the buffer area, the data block needs to be read. When the data block is fetched, the virtual disk drive searches for the data to be read in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Piece.
虚拟磁盘驱动查找到读数据请求中的第一虚拟磁盘标识对应的第一操作***标识,可以根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量在缓存区中查找是否有需读取的数据;如果缓存区中没有存储该需读取的数据,虚拟磁盘驱动根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量到第二存储设备中查找需读取的数据,而无需将第二存储设备中的第一操作***的数据提前读取到第一虚拟磁盘中,大大加快了虚拟机启动的速度。The virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier in the read data request, and may be based on the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. The quantity is searched in the buffer area for data to be read; if the data to be read is not stored in the buffer area, the virtual disk drive is based on the first operating system identifier, the size value of the data block to be read, and the quantity to be read. Offset of the data block to the second storage device to find the data to be read without first reading the data of the first operating system in the second storage device to the first virtual disk in advance, thereby greatly speeding up the virtual machine The speed of startup.
结合第一方面或第一方面第一种可能的实现方式,在第一方面第三种可能的实现方式中,第一操作***标识为所述虚拟机对应的虚拟机模板的操作***虚拟磁盘的标识。With reference to the first aspect or the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the first operating system identifier is an operating system virtual disk of the virtual machine template corresponding to the virtual machine Logo.
这样如果缓存区中没有存储该需读取的数据,虚拟磁盘驱动可以根据第 一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量到第二存储设备中查找需读取的数据,不用再转换标识。So if the data to be read is not stored in the buffer area, the virtual disk drive can be based on the An operating system identifier, a size value of the data block to be read, and an offset of the data block to be read are searched for data to be read in the second storage device, and the identifier is not converted.
结合第一方面或第一方面以上任一种可能的实现方式,在第一方面第四种可能的实现方式中,操作***用于启动所述虚拟机的必要数据为所述虚拟机处于启动完成状态时已读取的所述操作***的数据,所述启动完成状态包括:所述缓存区中写入的所述操作***的数据的数量大于预定数量,所述虚拟机的CPU占用率小于预定阈值,或者所述虚拟磁盘驱动接收到所述虚拟机读写非操作***虚拟磁盘的操作请求数量超过预定阈值。With reference to the first aspect or any one of the foregoing possible implementation manners, in a fourth possible implementation manner of the first aspect, the necessary data that is used by the operating system to start the virtual machine is that the virtual machine is in startup The data of the operating system that has been read in the state, the startup completion state includes: the number of data of the operating system written in the buffer area is greater than a predetermined number, and the CPU usage of the virtual machine is less than a predetermined The threshold, or the number of operation requests by the virtual disk drive to receive the virtual machine to read and write a non-operating system virtual disk exceeds a predetermined threshold.
确定虚拟机处于启动完成状态时已读取的操作***的数据为操作***的必要数据,可以大大减少虚拟机在启动时需要读取的数据,节省了虚拟机启动所花费的时间。The data of the operating system that is read when the virtual machine is in the startup completion state is the necessary data of the operating system, which can greatly reduce the data that the virtual machine needs to read at startup, and saves the time taken for the virtual machine to start.
结合第一方面第二种可能的实现方式或第一方面第三种可能的实现方式或者第一方面第四种可能的实现方式,在第一方面第五种可能的实现方式中,方法还包括以下步骤:虚拟磁盘驱动将需读取的数据块写入第一虚拟磁盘。With reference to the second possible implementation of the first aspect or the third possible implementation of the first aspect or the fourth possible implementation of the first aspect, in a fifth possible implementation manner of the first aspect, the method further includes The following steps: The virtual disk drive writes the data block to be read to the first virtual disk.
结合第一方面第五种可能的实现方式,在第一方面第六种可能的实现方式中,所述虚拟磁盘驱动将所述操作***的非必要数据写入所述第一虚拟磁盘。In conjunction with the fifth possible implementation of the first aspect, in a sixth possible implementation manner of the first aspect, the virtual disk drive writes unnecessary data of the operating system to the first virtual disk.
结合第一方面第二种可能的实现方式或第一方面第三种可能的实现方式或者第一方面第四种可能的实现方式,在第一方面第七种可能的实现方式中,所述缓存区位于所述服务器中或者位于所述第一存储设备中。With reference to the second possible implementation of the first aspect, or the third possible implementation of the first aspect, or the fourth possible implementation of the first aspect, in the seventh possible implementation manner of the first aspect, the cache The zone is located in the server or in the first storage device.
缓存区中存储有操作***用于启动虚拟机的必要数据,当缓存区在服务器中时,虚拟机启动时可以快速的从服务器中读取到启动所需要的操作***的必要数据。可选的,也可以在第一存储设备中划分出缓存区,虚拟机启动 时也可以很快的从第一存储设备中读取到启动所需要的操作***的必要数据。The necessary data for the operating system to start the virtual machine is stored in the cache. When the cache is in the server, the virtual machine can quickly read the necessary data of the operating system required for booting from the server. Optionally, the buffer area may also be divided in the first storage device, and the virtual machine is started. It is also possible to quickly read the necessary data of the operating system required for booting from the first storage device.
结合第一方面或第一方面以上任一种可能的实现方式,在第一方面第八种可能的实现方式中,虚拟磁盘驱动采用缓冲链表的方式来记录写入所述缓存区的数据块的操作***标识、数据块的大小值和数据块的偏移量。With reference to the first aspect, or any one of the foregoing possible implementation manners of the first aspect, in the eighth possible implementation manner of the first aspect, the virtual disk drive uses a buffering linked list to record the data block written in the buffer area. The operating system ID, the size value of the data block, and the offset of the data block.
将操作***的必要数据存储到缓存区的同时,需要记录存储的数据的信息,便于后续读取时方便查找虚拟机启动时需读取的数据。While storing the necessary data of the operating system to the buffer area, it is necessary to record the information of the stored data, so that it is convenient to find the data to be read when the virtual machine starts up during subsequent reading.
结合第一方面第八种可能的实现方式,在第一方面第九种可能的实现方式中,所述方法还包括:在对应所述操作***的缓冲链表的描述对象上记录所述查找到的数据块的大小值和数据块的偏移量,并把所述查找到的数据块保存在所述缓存区中的地址保存到对应所述操作***的所述缓冲链表的最后一个描述对象上。With reference to the eighth possible implementation manner of the first aspect, in a ninth possible implementation manner of the first aspect, the method further includes: recording, by the description object corresponding to the buffer linked list of the operating system, the found The size value of the data block and the offset of the data block, and the address in which the searched data block is saved in the buffer area is saved to the last description object of the buffer linked list corresponding to the operating system.
第二方面,本发明实施例提供了一种用于在虚拟机启动过程中获取数据的服务器,服务器与第二存储设备相连,第二存储设备为镜像存储设备,其中,服务器包括处理器,处理器运行有虚拟化平台,虚拟化平台中运行有虚拟磁盘驱动,虚拟磁盘驱动用于:接收虚拟机的读数据请求;根据读数据请求确定缓存区中是否存储有该需读取的数据块,缓存区用于存储虚拟机需要读取的操作***用于启动所述虚拟机的必要数据;该必要数据为该虚拟机处于启动完成状态时已读取的所述操作***的数据;当缓存区中存储有该需读取的数据块时,从缓存区中读取该需读取的数据块,并返回虚拟机;当缓存区中没有存储有需读取的数据块时,根据读数据请求在第二存储设备中查找该需读取的数据块,并将查找到的需读取的数据块返回给所述虚拟机。In a second aspect, the embodiment of the present invention provides a server for acquiring data during a virtual machine startup process, where the server is connected to the second storage device, and the second storage device is a mirror storage device, wherein the server includes a processor and processes The device runs a virtualization platform, and the virtualized platform runs a virtual disk drive. The virtual disk driver is configured to: receive a read data request of the virtual machine; and determine, according to the read data request, whether the data block to be read is stored in the cache area, The cache area is used to store necessary data of an operating system that the virtual machine needs to read for starting the virtual machine; the necessary data is data of the operating system that is read when the virtual machine is in a startup completion state; When the data block to be read is stored, the data block to be read is read from the buffer area and returned to the virtual machine; when there is no data block to be read stored in the buffer area, according to the read data request The data block to be read is searched in the second storage device, and the found data block to be read is returned to the virtual machine.
本发明实施例提供的服务器,在缓存区中存储虚拟机启动时需要读取的操作***的必要数据,虚拟机在启动过程中可以在缓存区中获取操作***的 必要数据,大大节省了虚拟机启动需花费的时间。The server provided by the embodiment of the present invention stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and the virtual machine can obtain the operating system in the cache area during the startup process. The necessary data greatly saves the time it takes for the virtual machine to start.
结合第二方面,在第二方面第一种可能的实现方式中,虚拟磁盘驱动还用于:若在第二存储设备中查找到的该需读取的数据块为操作***用于启动所述虚拟机的必要数据,将查找到的数据块写入所述缓存区。With reference to the second aspect, in a first possible implementation manner of the second aspect, the virtual disk drive is further configured to: if the data block to be read found in the second storage device is used by the operating system to start the The necessary data of the virtual machine writes the found data block into the buffer area.
将操作***用于启动虚拟机的必要数据存储到缓存区中,再启动相同类型的虚拟机时,就可以在缓存区中读取到操作***的必要数据,大大节省了虚拟机启动所需的时间。When the necessary data used by the operating system to start the virtual machine is stored in the cache area, and the same type of virtual machine is started, the necessary data of the operating system can be read in the cache area, which greatly saves the virtual machine startup. time.
结合第二方面或第二方面第一种可能的实现方式,在第二方面第二种可能的实现方式中,读数据请求中携带有第一虚拟磁盘标识、需读取的数据块的大小值和需读取的数据块的偏移量,其中,第一虚拟磁盘为第一存储设备中为该虚拟机分配的虚拟磁盘。虚拟磁盘驱动还用于根据虚拟磁盘标识与操作***标识之间的对应关系查找到第一虚拟磁盘标识对应的第一操作***标识,第一操作***标识是该虚拟机需要安装的操作***的标识。虚拟磁盘驱动用于根据读数据请求确定缓存区中是否存储有需读取的数据块具体为:虚拟磁盘驱动用于根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量,确定缓存区中是否存储有该需读取的数据块。虚拟磁盘驱动用于当缓存区中没有存储有该需读取的数据块时,根据读数据请求在第二存储设备中查找该需读取的数据块具体为:当缓存区中没有存储该需读取的数据块时,虚拟磁盘驱动用于根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量在第二存储设备中查找该需读取的数据块。With reference to the second aspect or the first possible implementation manner of the second aspect, in the second possible implementation manner of the second aspect, the read data request carries the first virtual disk identifier, and the size value of the data block to be read And an offset of the data block to be read, wherein the first virtual disk is a virtual disk allocated for the virtual machine in the first storage device. The virtual disk drive is further configured to find the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier, where the first operating system identifier is an identifier of the operating system that the virtual machine needs to be installed. . The virtual disk driver is configured to determine, according to the read data request, whether a data block to be read is stored in the buffer area, where the virtual disk driver is configured to use the size of the data block to be read according to the first operating system identifier and needs to be read. The offset of the data block determines whether the data block to be read is stored in the buffer area. The virtual disk drive is configured to: when the data block to be read is not stored in the buffer area, search for the data block to be read in the second storage device according to the read data request, specifically: when the cache area does not store the required data When the data block is read, the virtual disk driver is configured to search for the read in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Data block.
结合第二方面或第二方面以上任一种可能的实现方式,在第二方面第三种可能的实现方式中,虚拟磁盘驱动还用于:判断所述虚拟机是否处于启动完成状态。启动完成状态包括:缓存区中写入的操作***的数据大于预定数 量,虚拟机的CPU占用率小于预定阈值,或者虚拟磁盘驱动接收到虚拟机读写非操作***虚拟磁盘的操作请求数量超过预定阈值。In combination with the second aspect or the second aspect, the virtual disk drive is further configured to: determine whether the virtual machine is in a startup completion state, in a third possible implementation manner of the second aspect. The startup completion status includes: the data of the operating system written in the buffer is greater than the predetermined number The amount of CPU usage of the virtual machine is less than a predetermined threshold, or the number of operation requests that the virtual disk drive receives the virtual machine to read and write non-operating system virtual disks exceeds a predetermined threshold.
确定虚拟机处于启动完成状态时已读取的操作***的数据为操作***的必要数据,可以大大减少虚拟机在启动时需要读取的数据,节省了虚拟机启动所花费的时间。The data of the operating system that is read when the virtual machine is in the startup completion state is the necessary data of the operating system, which can greatly reduce the data that the virtual machine needs to read at startup, and saves the time taken for the virtual machine to start.
结合第二方面或第二方面以上任一种可能的实现方式,在第二方面第四种可能的实现方式中,云***还包括第一存储设备,虚拟磁盘驱动还用于将该需读取的数据块写入第一虚拟磁盘。With reference to the second aspect, or any one of the foregoing possible implementation manners, in a fourth possible implementation manner of the second aspect, the cloud system further includes a first storage device, and the virtual disk drive is further configured to read the The data block is written to the first virtual disk.
结合第二方面或第二方面以上任一种可能的实现方式,在第二方面第五种可能的实现方式中,虚拟磁盘驱动还用于将该操作***的非必要数据写入第一虚拟磁盘。With reference to the second aspect, or any one of the foregoing possible implementation manners, in the fifth possible implementation manner of the second aspect, the virtual disk drive is further configured to write non-essential data of the operating system to the first virtual disk. .
结合第二方面或第二方面以上任一种可能的实现方式,在第二方面第六种可能的实现方式中,虚拟磁盘驱动还用于根据读数据请求确定缓存区中没有存储该需读取的数据块,且在第二存储设备中查找到的该需读取的数据块的数据为操作***用于启动所述虚拟机的必要数据时,在对应所述操作***的缓冲链表的描述对象上记录所述查找到的数据块的大小值和数据块的偏移量,并把所述查找到的数据块保存在所述缓存区中的地址保存到对应所述操作***的所述缓冲链表的最后一个描述对象上。With reference to the second aspect, or any one of the foregoing possible implementation manners of the second aspect, in the sixth possible implementation manner of the second aspect, the virtual disk drive is further configured to determine, according to the read data request, that the cache area does not have the storage to be read. Data block, and the data of the data block to be read found in the second storage device is a description object of the buffer linked list corresponding to the operating system when the data used by the operating system to start the virtual machine is Recording the size value of the found data block and the offset of the data block, and saving the address in the buffer area of the found data block to the buffer linked list corresponding to the operating system The last description of the object.
将操作***的必要数据存储到缓存区的同时,需要记录存储的数据的信息,便于后续读取时方便查找虚拟机启动时需读取的数据。While storing the necessary data of the operating system to the buffer area, it is necessary to record the information of the stored data, so that it is convenient to find the data to be read when the virtual machine starts up during subsequent reading.
结合第二方面或第二方面以上任一种可能的实现方式,在第二方面第七种可能的实现方式中,所述缓存区位于所述服务器中或者位于所述第一存储设备中。With reference to the second aspect, or any one of the foregoing possible implementation manners, in the seventh possible implementation manner of the second aspect, the buffer area is located in the server or in the first storage device.
第三方面,本发明实施例提供了一种云计算***,包括第一存储设备、 第二存储设备和如第二方面或第二方面第一种至第六种任一种可能的实现方式所述的服务器,服务器与第二存储设备相连,第二存储设备为镜像存储设备,第一存储设备可以在服务器中,也可以与服务器相连,第一存储设备为虚拟机存储设备。In a third aspect, an embodiment of the present invention provides a cloud computing system, including a first storage device, And a second storage device, wherein the server is connected to the second storage device, and the second storage device is a mirror storage device, and the second storage device is connected to the second storage device. A storage device may be in the server or connected to the server, and the first storage device is a virtual machine storage device.
本发明实施例提供的云计算***,服务器在缓存区中存储有虚拟机启动时需要读取的操作***的必要数据,虚拟机在启动过程中可以到缓存区中获取到启动所需读取的操作***的必要数据,大大节省了虚拟机启动所需的时间。In the cloud computing system provided by the embodiment of the present invention, the server stores the necessary data of the operating system that needs to be read when the virtual machine is started in the cache area, and the virtual machine can obtain the required read start in the cache area during the startup process. The necessary data for the operating system greatly saves the time required for the virtual machine to boot.
附图说明DRAWINGS
包含在说明书中并且构成说明书的一部分的附图与说明书一起示出了本发明的示例性实施例、特征和方面,并且用于解释本发明的原理。The accompanying drawings, which are incorporated in FIG
图1为本发明实施例的云计算***的结构示意图;1 is a schematic structural diagram of a cloud computing system according to an embodiment of the present invention;
图2为本发明实施例的虚拟机启动过程中获取数据的方法流程图;2 is a flowchart of a method for acquiring data during a virtual machine startup process according to an embodiment of the present invention;
图3为本发明实施例的虚拟机启动过程中获取数据的另一方法流程图;3 is a flowchart of another method for acquiring data during a virtual machine startup process according to an embodiment of the present invention;
图4为本发明实施例的缓冲链表的结构示意图;4 is a schematic structural diagram of a buffer link list according to an embodiment of the present invention;
图5为本发明实施例的服务器的结构示意图;FIG. 5 is a schematic structural diagram of a server according to an embodiment of the present invention; FIG.
图6为本发明实施例的服务器的另一结构示意图;6 is another schematic structural diagram of a server according to an embodiment of the present invention;
图7为本发明实施例的去计算***的另一结构示意图。FIG. 7 is another schematic structural diagram of a de-computing system according to an embodiment of the present invention.
具体实施方式detailed description
在虚拟化场景下,无论是单纯的虚拟化平台还是在虚拟化平台基础上的云服务,都需要提供一种虚拟机创建启动机制。创建虚拟机的云计算***的结构如附图1所示,所述云计算***包括服务器、第一存储设备和第二存储 设备。服务器可以为一个普通的服务器,包含处理器。处理器用于创建虚拟机,运行虚拟化平台。为了方便查看,将处理器创建的虚拟机以及运行的虚拟化平台单独在图1中示出。虚拟化平台中运行有虚拟磁盘驱动,虚拟磁盘驱动用于管理虚拟机。第一存储设备用于为创建的虚拟机提供存储空间,即为创建的虚拟机分配虚拟磁盘,因此所述第一存储设备也可以称为虚拟机存储设备。第一存储设备可以是服务器本机的硬盘,也可以是外挂的磁盘阵列,第一存储设备对性能要求比较高。第二存储设备用于存储虚拟机模板、虚拟机的操作***等信息,第二存储设备也可以称为镜像存储设备。第二存储设备对可靠性要求较高。一般情况下,第一存储设备和第二存储设备是物理上独立的两个存储设备。In a virtualization scenario, whether it is a pure virtualization platform or a cloud service based on a virtualization platform, a virtual machine creation startup mechanism needs to be provided. The structure of the cloud computing system for creating a virtual machine is as shown in FIG. 1. The cloud computing system includes a server, a first storage device, and a second storage. device. The server can be a normal server with a processor. The processor is used to create a virtual machine and run a virtualization platform. For ease of viewing, the virtual machine created by the processor and the running virtualization platform are shown separately in FIG. A virtual disk drive runs in the virtualization platform, and a virtual disk drive is used to manage virtual machines. The first storage device is configured to provide a storage space for the created virtual machine, that is, a virtual disk is allocated for the created virtual machine, and thus the first storage device may also be referred to as a virtual machine storage device. The first storage device may be a hard disk of the server itself or an external disk array. The first storage device has higher performance requirements. The second storage device is used to store information such as a virtual machine template, an operating system of the virtual machine, and the like, and the second storage device may also be referred to as a mirror storage device. The second storage device has higher reliability requirements. In general, the first storage device and the second storage device are two storage devices that are physically independent.
虚拟机模板是预先创建并且未运行的虚拟机,存储在镜像存储设备中。虚拟机模板有虚拟CPU、虚拟内存和至少一块虚拟磁盘。安装了操作***的虚拟磁盘称之为操作***虚拟磁盘,可以做为启动虚拟机的引导磁盘。仅安装了应用程序而未安装操作***的虚拟磁盘称之为非操作***虚拟磁盘。根据某个虚拟机模板创建的多个虚拟机为同一个类型的虚拟机。同一类型的虚拟机,在创建和启动时,分配的虚拟磁盘、读取的操作***的数据以及读取操作***的顺序等等均相同。A virtual machine template is a pre-created and not running virtual machine that is stored in a mirrored storage device. The virtual machine template has a virtual CPU, virtual memory, and at least one virtual disk. A virtual disk with an operating system installed is called an operating system virtual disk and can be used as a boot disk for booting a virtual machine. A virtual disk with only an application installed and no operating system installed is called a non-operating system virtual disk. Multiple virtual machines created from a virtual machine template are virtual machines of the same type. For the same type of virtual machine, the virtual disk allocated, the data of the read operating system, and the order in which the operating system is read are the same when created and started.
创建虚拟机时,用户选择一个虚拟机模板来创建一个新的虚拟机,即用户选择要创建的虚拟机的类型。云计算***中的虚拟机管理器创建一个虚拟机,通知云计算***中的磁盘管理器,所述磁盘管理器在虚拟机存储设备中为新创建的虚拟机创建空的虚拟磁盘。新创建的虚拟机向虚拟磁盘驱动发送读数据请求,虚拟磁盘驱动接收到读数据请求后把虚拟机模板的虚拟磁盘的 数据拷贝到所述空的虚拟磁盘中。拷贝完虚拟机模板的虚拟磁盘的数据后,在此基础上即可成功启动一个虚拟机。虚拟机模板的虚拟磁盘的数据大小一般在10G以上,将这些数据拷贝到所述空的虚拟磁盘中需要的时间比较长,因此创建虚拟机的速度比较慢。而且由于虚拟机存储设备与镜像存储设备一般是两个独立的存储***,因此启动新的虚拟机时,需要从镜像存储设备将虚拟机模板中虚拟磁盘的数据复制到虚拟机存储设备上。受到镜像存储设备的性能和镜像存储设备与服务器之间的网络带宽原因的影响,当启动的虚拟机数量较多时,启动速度慢。When creating a virtual machine, the user selects a virtual machine template to create a new virtual machine, that is, the type of virtual machine that the user selects to create. The virtual machine manager in the cloud computing system creates a virtual machine that notifies the disk manager in the cloud computing system that creates an empty virtual disk in the virtual machine storage device for the newly created virtual machine. The newly created virtual machine sends a read data request to the virtual disk drive, and the virtual disk drive receives the virtual data template of the virtual machine template after receiving the read data request. The data is copied to the empty virtual disk. After copying the data of the virtual disk of the virtual machine template, a virtual machine can be successfully started on this basis. The virtual disk of the virtual machine template generally has a data size of 10 G or more. It takes a long time to copy the data to the empty virtual disk, so the virtual machine is created at a slower speed. Moreover, since the virtual machine storage device and the mirrored storage device are generally two independent storage systems, when the new virtual machine is started, the data of the virtual disk in the virtual machine template needs to be copied from the mirror storage device to the virtual machine storage device. Due to the performance of the mirrored storage device and the network bandwidth between the mirrored storage device and the server, when the number of virtual machines started is large, the startup speed is slow.
为了提高启动虚拟机的速度,现有技术中针对在同一个虚拟机存储设备上创建同类型的虚拟机的情况,使用链接克隆技术。具体方式为:创建某种类型的第一个虚拟机时,在虚拟机存储设备中创建第一虚拟磁盘,这里的第一虚拟磁盘是指在虚拟机存储设备中为第一个虚拟机分配的虚拟磁盘,将虚拟机模板的虚拟磁盘的数据拷贝到第一虚拟磁盘之后,对第一虚拟磁盘创建快照,将快照作为链接克隆,利用快照创建同种类型的第二个以及更多的虚拟机。采用链接克隆技术时,仍然需要把虚拟机模板的虚拟磁盘的数据拷贝到第一虚拟磁盘,另外通过链接克隆同时创建的虚拟机数量要受限于虚拟机存储设备的性能。从共同的链接克隆卷上读取数据时,随着虚拟机个数的增加,读取的性能会线性下降,当超过一定数量后,虚拟机创建就会变慢,难以响应用户的操作,因此通过链接克隆创建的虚拟机数量要受到限制。当超过限制的数量时,需要创建新的链接克隆。In order to increase the speed of starting a virtual machine, in the prior art, a link cloning technology is used for creating a virtual machine of the same type on the same virtual machine storage device. The specific way is: when creating the first virtual machine of a certain type, creating a first virtual disk in the virtual machine storage device, where the first virtual disk is allocated to the first virtual machine in the virtual machine storage device. A virtual disk, after copying the data of the virtual disk of the virtual machine template to the first virtual disk, creating a snapshot of the first virtual disk, using the snapshot as a linked clone, and using the snapshot to create a second and more virtual machines of the same type. . When the link cloning technology is used, the data of the virtual disk of the virtual machine template needs to be copied to the first virtual disk, and the number of virtual machines created simultaneously by the link cloning is limited by the performance of the virtual machine storage device. When reading data from a common linked clone volume, as the number of virtual machines increases, the performance of the read will decrease linearly. When the number of virtual machines exceeds a certain number, the virtual machine creation will become slower and it will be difficult to respond to the user's operation. The number of virtual machines created by linked clones is limited. When the limit is exceeded, a new linked clone needs to be created.
总之,使用目前技术方案,当需要创建的虚拟机数量较大时,无法快速创建和启动虚拟机以满足用户业务的增长需要。 In summary, with the current technical solution, when the number of virtual machines that need to be created is large, the virtual machine cannot be quickly created and started to meet the growth of user services.
本发明实施例提供一种在虚拟机启动过程中快速获取数据的实现方案,实现方法的流程如附图2所示。所述方法应用于云计算***,云计算***包括服务器和第二存储设备,所述第二存储设备为镜像存储设备,所述服务器上运行虚拟化平台,虚拟化平台中运行虚拟磁盘驱动,如附图1所示。The embodiment of the invention provides an implementation scheme for quickly acquiring data during the startup process of the virtual machine, and the flow of the implementation method is as shown in FIG. 2 . The method is applied to a cloud computing system. The cloud computing system includes a server and a second storage device. The second storage device is a mirrored storage device. The server runs a virtualization platform, and the virtual disk platform runs a virtual disk drive, such as Figure 1 shows.
步骤201:虚拟化平台的虚拟磁盘驱动接收待启动虚拟机发送的读数据请求。Step 201: The virtual disk drive of the virtualization platform receives the read data request sent by the virtual machine to be started.
需要创建虚拟机时,用户选择待创建的虚拟机的类型,即选择虚拟机模板,云计算***中的虚拟机管理器创建第一虚拟机,并向云计算***中的磁盘管理器发送通知消息。可选的,云计算***还包括第一存储设备,第一存储设备为虚拟机存储设备,用于为创建的虚拟机提供虚拟磁盘。磁盘管理器接收到通知消息之后在虚拟机存储设备上创建一个空卷,作为第一虚拟机的虚拟磁盘。为了后续描述方便,在本发明实施例中,将创建的虚拟磁盘称为第一虚拟磁盘。此步骤与已有的实现方式相同,因此不再详细描述。云计算***中的虚拟机管理器和磁盘管理器的功能与现有技术中的功能相同,不再另行描述。When a virtual machine needs to be created, the user selects the type of the virtual machine to be created, that is, selects the virtual machine template, and the virtual machine manager in the cloud computing system creates the first virtual machine and sends a notification message to the disk manager in the cloud computing system. . Optionally, the cloud computing system further includes a first storage device, where the first storage device is a virtual machine storage device, and is configured to provide a virtual disk for the created virtual machine. After the disk manager receives the notification message, it creates an empty volume on the virtual machine storage device as the virtual disk of the first virtual machine. For the convenience of the following description, in the embodiment of the present invention, the created virtual disk is referred to as a first virtual disk. This step is the same as the existing implementation and will not be described in detail. The functions of the virtual machine manager and the disk manager in the cloud computing system are the same as those in the prior art and will not be described separately.
可选的,虚拟机模板可以有操作***虚拟磁盘和非操作***虚拟磁盘,并且非操作***虚拟磁盘可以有多个。如果用户选择的虚拟机模板有多个虚拟磁盘,则在本步骤中,虚拟磁盘驱动在第一存储设备上创建多个第一虚拟磁盘,分别与虚拟机模板中的多个虚拟磁盘对应。Optionally, the virtual machine template can have an operating system virtual disk and a non-operating system virtual disk, and there can be multiple non-operating system virtual disks. If the virtual machine template selected by the user has multiple virtual disks, in this step, the virtual disk drive creates multiple first virtual disks on the first storage device, corresponding to multiple virtual disks in the virtual machine template.
第一虚拟磁盘创建完后,会触发启动虚拟机的操作。虚拟机开始启动,读取基本输入/输出***(Basic Input/Output System,BIOS)中的数据后,虚拟机向虚拟化平台发送读数据请求。读数据请求中携带有第一虚拟磁盘标 识,需读取的数据块的大小值和需读取的数据块的偏移量,这里的第一虚拟磁盘标识即指第一虚拟磁盘的虚拟磁盘标识。After the first virtual disk is created, it triggers the operation of starting the virtual machine. After the virtual machine starts to boot and reads the data in the basic input/output system (BIOS), the virtual machine sends a read data request to the virtualization platform. The read data request carries the first virtual disk label The size of the data block to be read and the offset of the data block to be read, where the first virtual disk identifier refers to the virtual disk identifier of the first virtual disk.
创建虚拟机时,用户选择虚拟机模板后,虚拟机管理器根据虚拟机模板创建虚拟机,并通知磁盘管理器在虚拟机存储设备中为创建的虚拟机分配虚拟磁盘。磁盘管理器将创建的虚拟磁盘的虚拟磁盘标识返回给虚拟机管理器。由于虚拟机模板中包含了创建的虚拟机需读取的操作***的信息,因此虚拟机管理器创建虚拟机后可以获得创建的虚拟机需读取的操作***的操作***标识。虚拟机管理器将获得的操作***标识和虚拟磁盘标识发送给服务器的虚拟化平台的虚拟磁盘驱动。虚拟磁盘驱动收到之后,建立操作***标识与虚拟磁盘标识之间的对应关系,并将操作***标识与虚拟磁盘标识之间的对应关系存储到服务器的内存中。When a virtual machine is created, after the user selects the virtual machine template, the virtual machine manager creates a virtual machine based on the virtual machine template and notifies the disk manager to allocate a virtual disk for the created virtual machine in the virtual machine storage device. Disk Manager returns the virtual disk ID of the created virtual disk to the virtual machine manager. Because the virtual machine template contains the information of the operating system that the created virtual machine needs to read, the virtual machine manager can obtain the operating system identifier of the operating system that the created virtual machine needs to read after creating the virtual machine. The virtual machine manager sends the obtained operating system ID and virtual disk ID to the virtual disk drive of the server's virtualization platform. After the virtual disk drive is received, the mapping between the operating system identifier and the virtual disk identifier is established, and the correspondence between the operating system identifier and the virtual disk identifier is stored in the server's memory.
虚拟磁盘驱动接收到待启动虚拟机发送的读数据请求后,根据内存中存储的虚拟磁盘标识与操作***标识之间的对应关系查找到所述第一虚拟磁盘标识对应的第一操作***标识,所述第一操作***标识是所述虚拟机需要安装的操作***的标识。由于虚拟机是根据某个虚拟机模板来创建的,因此这里的第一操作***标识可以与虚拟机对应的虚拟机模板的操作***虚拟磁盘的标识相同。After receiving the read data request sent by the virtual machine to be started, the virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier stored in the memory. The first operating system identifier is an identifier of an operating system that the virtual machine needs to be installed. The virtual machine is created according to a virtual machine template. Therefore, the first operating system identifier can be the same as the operating system virtual disk of the virtual machine template corresponding to the virtual machine.
虚拟机在启动的过程中,会确定此次需要读取的数据块的大小值和数据块的偏移量。在启动过程中,虚拟机会向虚拟磁盘驱动发送多个读数据请求来读取操作***的数据,虚拟机读取到需要的操作***的数据之后完成启动。During the startup process, the virtual machine determines the size value of the data block that needs to be read and the offset of the data block. During the startup process, the virtual machine sends multiple read data requests to the virtual disk drive to read the data of the operating system, and the virtual machine completes the boot after reading the data of the required operating system.
在现有技术中,虚拟机创建后,会把虚拟机对应的虚拟模板的操作***虚拟磁盘的数据先读取到虚拟机的第一虚拟磁盘中,虚拟机启动时,读数据 请求中携带的是第一虚拟磁盘的虚拟磁盘标识,这时虚拟磁盘驱动是到第一虚拟磁盘中读取操作***的数据。而本发明实施例中,虚拟磁盘驱动会将读数据请求中的第一虚拟磁盘的虚拟磁盘标识转换为对应的第一操作***标识,虚拟磁盘驱动就可以根据第一操作***标识在缓存区中查找,这样只要在缓存区中存储有第一操作***标识对应的操作***的数据,就可以直接从缓存区中获取启动所需的操作***的数据,而无需提前将虚拟机模板的操作***虚拟磁盘的数据读取到虚拟机的第一虚拟磁盘中,大大加快其他虚拟机启动的速度。In the prior art, after the virtual machine is created, the data of the operating system virtual disk of the virtual template corresponding to the virtual machine is first read into the first virtual disk of the virtual machine, and when the virtual machine is started, the data is read. The request carries the virtual disk identifier of the first virtual disk. At this time, the virtual disk drive reads the data of the operating system into the first virtual disk. In the embodiment of the present invention, the virtual disk drive converts the virtual disk identifier of the first virtual disk in the read data request into a corresponding first operating system identifier, and the virtual disk driver can be identified in the cache area according to the first operating system identifier. Search, so that as long as the data of the operating system corresponding to the first operating system identifier is stored in the cache area, the data of the operating system required for booting can be directly obtained from the cache area without virtualizing the operating system of the virtual machine template in advance. The data of the disk is read into the first virtual disk of the virtual machine, which greatly speeds up the startup of other virtual machines.
步骤203:虚拟磁盘驱动根据所述读数据请求确定缓存区中是否存储有所述需读取的数据块,所述缓存区用于存储所述操作***用于启动所述虚拟机的必要数据。Step 203: The virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the cache area, where the cache area is used to store necessary data used by the operating system to start the virtual machine.
所述缓存区位于所述服务器中,可以位于服务器的内存中,也可以位于服务器的本机存储介质中。可选的,所述缓存区也可以位于第一存储设备中,所述缓存区可以位于第一存储设备的控制器中,也可以由高性能的存储设备(例如SSD盘)来作为缓存区。The cache area is located in the server, and may be located in a memory of the server or in a local storage medium of the server. Optionally, the buffer area may also be located in the first storage device, where the buffer area may be located in a controller of the first storage device, or may be used as a buffer area by a high-performance storage device (for example, an SSD disk).
虚拟磁盘驱动根据读数据请求确定缓存区中是否存储有需读取的数据块具体为:虚拟磁盘驱动根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,确定缓存区中是否存储有所述需读取的数据块。The virtual disk drive determines, according to the read data request, whether the data block to be read is stored in the buffer area, specifically: the virtual disk drive according to the first operating system identifier, the size value of the data block to be read, and the requirement The offset of the read data block determines whether the data block to be read is stored in the buffer area.
发明人在发明过程中发现,在启动虚拟机的过程中,虚拟机并不需要读取操作***的全部数据才能完成虚拟机的启动,而是只需要读取操作***的部份数据即可。在本发明实施例中,确认虚拟机处于启动完成状态时已读取 的操作***的数据就是启动虚拟机所必需的数据,所以将虚拟机处于启动完成状态时已读取的操作***的数据称为操作***的必要数据。操作***的数据的大小一般会有十几个G,而启动虚拟机所需的操作***的必要数据要小得多。During the process of inventing, the inventor found that in the process of starting the virtual machine, the virtual machine does not need to read all the data of the operating system to complete the startup of the virtual machine, but only needs to read part of the data of the operating system. In the embodiment of the present invention, it is confirmed that the virtual machine is read when the startup is completed. The data of the operating system is the data necessary to start the virtual machine, so the data of the operating system that has been read when the virtual machine is in the startup completion state is called the necessary data of the operating system. The size of the data of the operating system generally has a dozen G, and the necessary data for the operating system required to start the virtual machine is much smaller.
相同类型的虚拟机的创建和启动过程完全一致。基于这个发现,虚拟磁盘驱动可以记录某种类型第一个虚拟机处于启动完成状态时已读取的操作***的数据,这些操作***的数据也必然是第二个以及后续创建的相同类型虚拟机启动时要读取的操作***的数据,而且读取的顺序也一样。The creation and startup of the same type of virtual machine is exactly the same. Based on this discovery, the virtual disk drive can record the data of the operating system that has been read when the first virtual machine of a certain type is in the startup completion state. The data of these operating systems must also be the second and subsequent created virtual machines of the same type. The data of the operating system to be read at startup, and the order of reading is the same.
操作***大部分的数据是在虚拟机启动完成后读取的,在本发明实施例中,将虚拟机启动完成后读取的数据称为操作***的非必要数据。如果缓存操作***的全部数据会大大增加内存的需求,成本急剧增加。因此虚拟磁盘驱动要判断虚拟机处于启动完成状态时虚拟机已经读取的操作***的数据。Most of the data of the operating system is read after the virtual machine is booted. In the embodiment of the present invention, the data read after the virtual machine is booted is called non-essential data of the operating system. If all the data of the operating system is cached, the memory requirements will be greatly increased, and the cost will increase dramatically. Therefore, the virtual disk drive needs to judge the data of the operating system that the virtual machine has read when the virtual machine is in the startup completion state.
本发明实施例提供有三种方式来判断虚拟机是否处于启动完成状态。The embodiment of the present invention provides three ways to determine whether the virtual machine is in the startup completion state.
第一种方式是当缓存区中写入的操作***的数据的数量大于预定数量时。预定数量可以由经验丰富的工程师根据虚拟机处于启动完成状态时虚拟机已经读取的操作***的数据的数量来确定。由于同一种类型的虚拟机启动时读取操作***数据的顺序是一样的,因此,可以由经验丰富的工程师将统计得到的虚拟机处于启动完成状态时已读取的操作***的数据大小作为预定数量。在创建同类型的虚拟机时,虚拟机读取的操作***的数据大于预定数量时,虚拟机即可完成启动。The first way is when the number of data of the operating system written in the buffer is greater than a predetermined number. The predetermined number can be determined by an experienced engineer based on the amount of data of the operating system that the virtual machine has read when the virtual machine is in the boot completion state. Since the order of reading the operating system data when the same type of virtual machine is started is the same, the data size of the operating system that has been read when the virtual machine is in the startup completion state can be used as a predetermined schedule by an experienced engineer. Quantity. When creating a virtual machine of the same type, the virtual machine can be started when the data of the operating system read by the virtual machine is greater than the predetermined number.
第二种方式是,虚拟磁盘驱动判断对非操作***虚拟磁盘的读写操作是 否超过预定阈值。当虚拟机启动完成后,才能对操作***虚拟磁盘以外的虚拟磁盘(即非操作***磁盘)进行读写操作。因此可以设定对非操作***虚拟磁盘的读写操作超过一定的数量时或者是对非操作***虚拟磁盘的读写操作达到总读写操作一定的比例时,就可以判断虚拟机启动完成。将虚拟机处于启动完成状态时已经读取的操作***的数据即为操作***的必要数据。The second way is that the virtual disk drive determines that the read and write operations to the non-operating system virtual disk are Whether the predetermined threshold is exceeded. When the virtual machine is booted, the virtual disk other than the operating system virtual disk (that is, the non-operating system disk) can be read and written. Therefore, when the read/write operation of the non-operating system virtual disk exceeds a certain amount or the read/write operation of the non-operating system virtual disk reaches a certain proportion of the total read/write operation, the virtual machine startup can be judged. The data of the operating system that has been read when the virtual machine is in the startup completion state is the necessary data of the operating system.
第三种方式是,判断虚拟机的CPU的占用率是否小于预定的阈值。在一定时间周期内,CPU占用率小于一定的数值,就可以判断虚拟机启动完成,此时虚拟机已读取的操作***的数据即为操作***的必要数据。The third way is to determine whether the occupancy rate of the CPU of the virtual machine is less than a predetermined threshold. In a certain period of time, if the CPU usage is less than a certain value, it can be judged that the virtual machine startup is completed. At this time, the data of the operating system that the virtual machine has read is the necessary data of the operating system.
除了以上提到的判断虚拟机是否处于启动完成状态的三种方式,本领域技术人员也可以通过其他类似的方式来判断虚拟机是否处于启动完成状态。例如,可以由经验丰富的工程师统计在某些情况下虚拟机处于启动完成状态时读取操作***的时间,将统计得到的时间作为预定时间阈值。当虚拟机启动时,在同样的情况下读取操作***的时间达到预定的时间阈值时虚拟机启动完成。In addition to the above three methods for judging whether the virtual machine is in the startup completion state, those skilled in the art can also judge whether the virtual machine is in the startup completion state by other similar manners. For example, an experienced engineer can count the time when the virtual machine is in the startup completion state in some cases, and the time obtained by the statistics is taken as the predetermined time threshold. When the virtual machine is started, the virtual machine startup is completed when the time for reading the operating system reaches the predetermined time threshold under the same conditions.
可选的,也可以识别出操作***的必要数据,在创建虚拟机之前预先将操作***的必要数据存入缓存区。Optionally, the necessary data of the operating system may also be identified, and the necessary data of the operating system is pre-stored in the buffer before the virtual machine is created.
虚拟磁盘驱动在接收到虚拟机发送的读数据请求之后,确定缓存区中是否存储有所述需读取的数据块,缓存区用于存储所述操作***用于启动虚拟机的必要数据。可选的,虚拟磁盘驱动还可以为每种操作***的必要数据创建单独的缓存区分别存储。对于缓存区存储的操作***的必要数据,虚拟磁盘驱动可以使用缓冲链表的方式来记录相关的信息。例如,采用缓冲链表的 方式来记录写入缓存区的数据块的操作***标识,数据块的大小值和数据块的偏移量。可选的,也可以使用其他方式(例如树状结构)来记录缓存区中存储的操作***的必要数据的信息。具体采用哪种方式,可以根据业务或者用户的需要来设置。After receiving the read data request sent by the virtual machine, the virtual disk drive determines whether the data block to be read is stored in the buffer area, and the buffer area is used to store necessary data used by the operating system to start the virtual machine. Alternatively, the virtual disk drive can also create separate caches for each operating system's necessary data. For the necessary data of the operating system stored in the cache, the virtual disk drive can use the buffered linked list to record related information. For example, using a buffered linked list The way to record the operating system ID of the data block written to the buffer, the size value of the data block, and the offset of the data block. Optionally, other methods (such as a tree structure) may also be used to record information about necessary data of an operating system stored in the cache. Which method is used can be set according to the needs of the business or the user.
下面以使用链表的方式为例来说明是如何存储以及利用操作***必要数据的信息的。本发明实施例提供的链表的结构如附图3所示。The following uses the method of using a linked list as an example to explain how to store and utilize the information necessary for the operating system. The structure of the linked list provided by the embodiment of the present invention is as shown in FIG. 3.
虚拟磁盘驱动创建一个缓冲链表的全局指针。在创建虚拟机之前,缓存区中没有存储数据,此时缓冲链表指针为空。因此创建第一个虚拟机时,虚拟磁盘驱动中指向缓冲链表指针为空,此时需要在缓冲链表中创建一个镜像缓冲对象,在镜像缓冲对象处记录操作***标识(即操作***的标识),已经缓冲数据量为0,下一个镜像缓冲对象指针设置为空,缓冲的数据块链表指针为空。在虚拟机启动过程中,要读取数据时,先根据读数据请求中的操作***标识在镜像链表中查找是否有对应的镜像缓冲对象(即操作***的必要数据)。找到镜像缓冲对象后,再根据读数据请求中的数据块的大小值和数据块的偏移量在镜像缓冲对象的数据块链表中查找是否存在对应的数据块。如果存在对应的数据块,则表明缓存区中存储有需读取的数据块,则将缓存区中对应位置的数据块返回给虚拟机。具体的操作***数据可以存储在缓冲链表中(如附件4所示),也可以添加指针指向该操作***数据存储的位置。具体实现方式可以采用已知的实现方式,在本发明实施例中不再详细说明。对于虚拟机来说,就如同从虚拟磁盘上读取到了操作***的必要数据。相对从镜像磁盘上读取操作***的数据,大大节省了时间。The virtual disk drive creates a global pointer to the buffered linked list. Before the virtual machine is created, there is no data stored in the cache, and the buffer list pointer is empty. Therefore, when the first virtual machine is created, the pointer to the buffer list in the virtual disk driver is empty. In this case, an image buffer object needs to be created in the buffer list, and the operating system identifier (that is, the identifier of the operating system) is recorded in the image buffer object. The amount of buffered data is 0, the next mirror buffer object pointer is set to null, and the buffered data block list pointer is empty. During the startup process of the virtual machine, when the data is to be read, first look for the corresponding image buffer object (that is, the necessary data of the operating system) in the mirror linked list according to the operating system identifier in the read data request. After the image buffer object is found, it searches for the corresponding data block in the data block linked list of the image buffer object according to the size value of the data block in the read data request and the offset of the data block. If there is a corresponding data block, it indicates that the data block to be read is stored in the buffer area, and the data block corresponding to the location in the buffer area is returned to the virtual machine. The specific operating system data can be stored in the buffer list (as shown in Attachment 4), or a pointer can be added to the location of the operating system data store. The specific implementation manners may be implemented in a known manner, and are not described in detail in the embodiments of the present invention. For a virtual machine, it is like reading the necessary data from the virtual disk to the operating system. Significant time savings compared to reading operating system data from a mirrored disk.
如果根据操作***标识没有在镜像链表中找到对应的镜像标识,或者根 据数据块的大小值和数据块的偏移量在镜像链表中没有找到对应的数据块,则说明缓存区中没有存储所述读数据请求需读取的数据块,这时虚拟磁盘驱动需要从镜像存储中读取所述需读取的数据块。如果此时需读取的数据为操作***的必要数据,则将所述操作***的必要数据写入缓存区,并在在缓冲链表中新创建一个镜像缓冲对象,在镜像缓冲对象上记录操作***的镜像标识、数据块的大小值和数据块的偏移量,并把数据块保存新在缓存区中的地址保存到操作***的数据链表的最后一个对象上。如何判断读取的数据是否为操作***的必要数据,在前文已进行了相应的描述,在此不再另行说明。If the corresponding image ID is not found in the mirror list according to the operating system ID, or According to the size value of the data block and the offset of the data block, the corresponding data block is not found in the mirror linked list, indicating that there is no data block in the buffer area for storing the read data request, and the virtual disk drive needs to be The data block to be read is read in the image storage. If the data to be read at this time is the necessary data of the operating system, write the necessary data of the operating system into the buffer area, and newly create an image buffer object in the buffer list, and record the operating system on the image buffer object. The image ID, the size value of the data block, and the offset of the data block, and save the data block to the last address in the data link list of the operating system. How to judge whether the read data is the necessary data of the operating system has been described in the foregoing, and will not be further described here.
步骤205:当根据所述读数据请求确定所述缓存区中存储有所述需读取的数据块时,所述虚拟磁盘驱动从所述缓存区中读取所述需读取的数据块,返回所述虚拟机。Step 205: When it is determined that the data block to be read is stored in the buffer area according to the read data request, the virtual disk drive reads the data block to be read from the buffer area, Return to the virtual machine.
由于在创建同种类型的第一个虚拟机时,已经将操作***的必要数据缓冲在缓存区中。因此,在创建同种类型的第二个虚拟机时,虚拟磁盘驱动根据读数据请求可以在缓存中查找到所述需读取的数据块。具体来说,当以镜像缓冲链表的方式记录缓存区中存储的数据时,虚拟磁盘驱动根据读数据请求中的操作***标识在镜像缓冲链表中查找到所述操作***标识,再根据读数据请求中的需读取的数据块的大小值和需读取的数据块的偏移量在所述镜像缓冲链表中查找到对应的对象,则说明缓存区中存储有所述需读取的数据块。虚拟磁盘驱动从缓存区中读取所述数据块,并返回给所述虚拟机。当虚拟机读取完需要读取的操作***的必要数据后,即可完成启动。Since the first virtual machine of the same type is created, the necessary data of the operating system has been buffered in the buffer. Therefore, when creating a second virtual machine of the same type, the virtual disk drive can find the data block to be read in the cache according to the read data request. Specifically, when the data stored in the cache area is recorded in the mirror buffer linked list, the virtual disk drive finds the operating system identifier in the mirror buffer list according to the operating system identifier in the read data request, and then requests according to the read data. If the size value of the data block to be read and the offset of the data block to be read find the corresponding object in the mirror buffer linked list, the data block to be read is stored in the buffer area. . The virtual disk drive reads the data block from the cache and returns it to the virtual machine. After the virtual machine reads the necessary data of the operating system that needs to be read, it can complete the startup.
由于启动虚拟机所需的操作***的必要数据已经在缓存区内,再创建同种类型的虚拟机时可以直接从缓存区中读取操作***的必要数据,而不需要 从第二存储设备中读取操作***的必要数据到虚拟磁盘再从虚拟磁盘中读取操作***的数据,从而大大加快了虚拟机的启动速度。并且创建同类型的虚拟机的数量不受限制,这样在创建大量的虚拟机时,启动虚拟机的时间大大缩短。Since the necessary data of the operating system required to start the virtual machine is already in the cache area, when the same type of virtual machine is created, the necessary data of the operating system can be directly read from the buffer area without The necessary data of the operating system is read from the second storage device to the virtual disk, and the data of the operating system is read from the virtual disk, thereby greatly speeding up the startup of the virtual machine. And the number of virtual machines of the same type is unlimited, so when you create a large number of virtual machines, the time to start the virtual machine is greatly reduced.
步骤207:当所述缓存区中没有存储所述所述需读取的数据块时,虚拟磁盘驱动根据所述读数据请求在第二存储设备中查找所述需读取的数据块,并将查找到的所述需读取的数据块返回给虚拟机。Step 207: When the data block to be read is not stored in the buffer area, the virtual disk driver searches for the data block to be read in the second storage device according to the read data request, and The found data block to be read is returned to the virtual machine.
当所述缓存区中没有存储需读取的数据块时,虚拟磁盘驱动根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量在第二存储设备中查找所述需读取的数据块。如果缓存区中没有存储所述需读取的数据块,虚拟磁盘驱动则到第二存储设备中根据所述读数据请求查找需要读取的数据块。虚拟磁盘驱动根据第一操作***标识、需读取的数据块的大小值和需读取的数据块的偏移量在第二存储设备中查找到对应的数据块之后,将查找到的数据块返回给虚拟机。When the data block to be read is not stored in the buffer area, the virtual disk drive is in the second storage according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Find the data block to be read in the device. If the data block to be read is not stored in the buffer area, the virtual disk driver searches the second storage device for the data block to be read according to the read data request. The virtual disk drive searches for the data block after finding the corresponding data block in the second storage device according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read. Return to the virtual machine.
虚拟机读取完操作***的必要数据之后,即可完成启动。这样,虚拟机在启动时,只需要从第二存储设备中读取操作***的必要数据,而不需要读取操作***的全部数据,可以大大节省虚拟机的启动时间。After the virtual machine reads the necessary data of the operating system, it can complete the startup. In this way, when the virtual machine starts, it only needs to read the necessary data of the operating system from the second storage device, and does not need to read all the data of the operating system, which can greatly save the startup time of the virtual machine.
步骤209:若根据所述读数据请求在第二存储设备中查找到的所述需读取的数据块为操作***用于启动虚拟机的必要数据,虚拟磁盘驱动将所述查找到的数据块写入所述缓存区。Step 209: If the data block to be read found in the second storage device is requested according to the read data as the necessary data used by the operating system to start the virtual machine, the virtual disk drive will search the data block that is found. Write to the buffer area.
虚拟磁盘驱动将所述查找到的数据块写入缓存区之后,记录所述查找到的数据块的操作***标识,所述查找到的数据块的大小值和所述查找到的数 据块的偏移量。记录方式可以是链表的方式记录,也可以是其他的方式(例如树状结构)来记录。可选的,链表的记录方式如前文所述,在此不再另行说明。After the virtual disk drive writes the found data block to the buffer area, records an operating system identifier of the found data block, and the size value of the found data block and the found number According to the offset of the block. The recording method can be recorded in the form of a linked list, or can be recorded in other ways (for example, a tree structure). Optionally, the linked list is recorded as described above and will not be further described herein.
将操作***的必要数据写入缓存区中,当有同种类型的虚拟机需要启动时,可以根据读数据请求在缓存区中查找到启动虚拟机的操作***的必要数据,这样就无需去第二存储设备中读取数据,大大节省了虚拟机的启动时间。当待启动的虚拟机数量较多时,效果更明显。Write the necessary data of the operating system to the cache area. When a virtual machine of the same type needs to be started, the necessary data of the operating system for starting the virtual machine can be found in the cache area according to the read data request, so that there is no need to go to the first The data is read in the second storage device, which greatly saves the startup time of the virtual machine. When the number of virtual machines to be started is large, the effect is more obvious.
在前述方法的基础上,所述方法还可以包括以下步骤,如附图3所示:Based on the foregoing method, the method may further include the following steps, as shown in FIG. 3:
步骤311:虚拟磁盘驱动将所述需读取的数据块写入第一虚拟磁盘。Step 311: The virtual disk drive writes the data block to be read to the first virtual disk.
虚拟磁盘驱动将虚拟机在启动过程中需读取的数据块写入第一虚拟磁盘中,第一虚拟磁盘是云计算***中磁盘管理器在第一存储设备中为虚拟机分配的虚拟磁盘。当缓存区中存储有所述需读取的数据块时,虚拟磁盘驱动可以在向虚拟机返回所述需读取的数据块的同时将所述数据块写入第一虚拟磁盘,也可以在***空闲时将所述数据块写入第一虚拟磁盘。当缓存区中没有存储所述需读取的数据块时,虚拟磁盘驱动可以在将所述数据块写入缓存区的同时将所述数据块写入第一虚拟磁盘中,还可以在向虚拟机返回所述数据时将所述数据块写入第一虚拟磁盘中,还可以在***空闲时将所述数据块写入第一虚拟磁盘。The virtual disk drive writes the data block to be read by the virtual machine during the startup process to the first virtual disk, where the first virtual disk is a virtual disk allocated by the disk manager in the cloud storage system to the virtual machine in the first storage device. When the data block to be read is stored in the buffer area, the virtual disk drive may write the data block to the first virtual disk while returning the data block to be read to the virtual machine, or The data block is written to the first virtual disk when the system is idle. When the data block to be read is not stored in the buffer area, the virtual disk drive may write the data block into the first virtual disk while writing the data block into the buffer area, and may also be virtual to When the machine returns the data, the data block is written into the first virtual disk, and the data block can also be written to the first virtual disk when the system is idle.
可选的,所述方法还可以包括以下步骤,如附图3所示:Optionally, the method may further include the following steps, as shown in FIG. 3:
步骤313:所述虚拟磁盘驱动将所述操作***的非必要数据写入所述第一虚拟磁盘。Step 313: The virtual disk drive writes unnecessary data of the operating system to the first virtual disk.
当所述需读取的数据块是所述操作***的非必要数据时,只需要将所述 操作***的非必要数据写入所述第一虚拟磁盘,而不写入缓存区。由于操作***的非必要数据不影响虚拟机的启动,因此,可以在虚拟机启动之后***空闲时再将操作***的非必要数据写入第一虚拟磁盘中。这样可以在***相对空闲时再操作,减小对***性能的影响。When the data block to be read is non-essential data of the operating system, only the Non-essential data of the operating system is written to the first virtual disk without being written to the buffer. Since the non-essential data of the operating system does not affect the startup of the virtual machine, the non-essential data of the operating system can be written to the first virtual disk when the system is idle after the virtual machine is started. This allows the system to operate again when it is relatively idle, reducing the impact on system performance.
本发明实施例提供的一种在虚拟机启动过程中获取数据的方法,在虚拟机启动过程中,虚拟化平台的虚拟磁盘驱动接收到虚拟机发送的读数据请求之后,查找与读数据请求中的第一虚拟磁盘标识对应的第一操作***标识,根据第一操作***标识、需读取的数据块的大小值和需读取的数据的偏移量确定缓存区中是否存储有该需读取的数据块,当缓存区中存储有该需读取数据块时,虚拟磁盘驱动向虚拟机返回需读取的数据块。缓存区是用来存储虚拟机需读取的操作***用于启动虚拟机的必要数据的。这样,在虚拟机的启动过程中,如果可以在缓存区中读取到虚拟机启动所需的操作***的必要数据,而现有技术是在虚拟机启动过程中需要先把镜像存储设备中的操作***的数据读取到第一存储设备中,这样本发明实施例提供的方案大大节省了虚拟机的启动时间。即使在缓存区中没有存储虚拟机启动所需的操作***的必要数据,在本发明实施例中需要到镜像存储设备中去读取操作***的必要数据,因此本发明实施例提供的方案可以节省虚拟机的启动时间。另外,相对现有技术中的链接克隆技术,本发明实施例提供的方法不受虚拟机数量的限制,并且虚拟机读取到操作***的必要数据就可以启动,虚拟机启动的时间亦大大缩短。The embodiment of the present invention provides a method for acquiring data during a virtual machine startup process. During a virtual machine startup process, after the virtual disk drive of the virtualization platform receives the read data request sent by the virtual machine, the search and read data request is performed. The first virtual disk identifier corresponds to the first operating system identifier, and determines whether the buffer needs to be read in the buffer according to the first operating system identifier, the size value of the data block to be read, and the offset of the data to be read. The data block is taken. When the data block to be read is stored in the buffer area, the virtual disk drive returns the data block to be read to the virtual machine. The cache area is used to store the necessary data used by the operating system that the virtual machine needs to read to start the virtual machine. In this way, during the startup process of the virtual machine, if the necessary data of the operating system required for the virtual machine to be booted can be read in the cache area, the prior art needs to first put the image storage device in the virtual machine startup process. The data of the operating system is read into the first storage device, so that the solution provided by the embodiment of the present invention greatly saves the startup time of the virtual machine. In the embodiment of the present invention, the necessary data of the operating system is required to be read in the mirror storage device, so that the solution provided by the embodiment of the present invention can save the data. The startup time of the virtual machine. In addition, compared with the link cloning technology in the prior art, the method provided by the embodiment of the present invention is not limited by the number of virtual machines, and the necessary data of the virtual machine to read the operating system can be started, and the startup time of the virtual machine is also greatly shortened. .
本发明实施例还提供一种云计算***(如附图1所示),包括服务器11、第一存储设备13和第二存储设备15。服务器11与第二存储设备15相连;第一 存储设备13可以与服务器11相连,也可以是服务器11中的硬盘。第一存储设备13用于为创建的虚拟机提供存储空间,即为创建的虚拟机1011分配虚拟磁盘,因此所述第一存储设备13也可以称为虚拟机存储设备。第一存储设备13可以是服务器外挂的磁盘阵列。第二存储设备15用于存储虚拟机模板、虚拟机的虚拟磁盘等信息,第二存储设备15也可以称为镜像存储设备。一般情况下,第一存储设备13和第二存储设备15是物理上独立的两个存储设备。The embodiment of the invention further provides a cloud computing system (as shown in FIG. 1 ), comprising a server 11 , a first storage device 13 and a second storage device 15 . The server 11 is connected to the second storage device 15; The storage device 13 may be connected to the server 11 or may be a hard disk in the server 11. The first storage device 13 is configured to provide a storage space for the created virtual machine, that is, a virtual disk is allocated for the created virtual machine 1011, and thus the first storage device 13 may also be referred to as a virtual machine storage device. The first storage device 13 may be a disk array external to the server. The second storage device 15 is configured to store information such as a virtual machine template, a virtual disk of the virtual machine, and the like, and the second storage device 15 may also be referred to as a mirror storage device. In general, the first storage device 13 and the second storage device 15 are two storage devices that are physically independent.
所述服务器用于实现前述的在虚拟机启动中获取数据的方法,服务器的结构如附图5所示。服务器包含处理器51,处理器51用于创建虚拟机511并运行虚拟化平台513。虚拟化平台513中运行有虚拟磁盘驱动5131,虚拟磁盘驱动5131用于实现以下方案:The server is configured to implement the foregoing method for acquiring data in a virtual machine startup, and the structure of the server is as shown in FIG. 5. The server includes a processor 51 for creating a virtual machine 511 and running a virtualization platform 513. A virtual disk drive 5131 is running in the virtualization platform 513, and the virtual disk drive 5131 is used to implement the following solutions:
接收虚拟机511的读数据请求;所述读数据请求中携带有第一虚拟磁盘标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,其中,所述第一虚拟磁盘为第一存储设备中为所述虚拟机分配的虚拟磁盘;Receiving a read data request of the virtual machine 511; the read data request carries a first virtual disk identifier, a size value of the data block to be read, and an offset of the data block to be read, where The first virtual disk is a virtual disk allocated to the virtual machine in the first storage device;
根据虚拟磁盘标识与操作***标识之间的对应关系查找到所述第一虚拟磁盘标识对应的第一操作***标识,所述第一操作***标识是所述虚拟机需要安装的操作***的标识;And searching, according to the correspondence between the virtual disk identifier and the operating system identifier, the first operating system identifier corresponding to the first virtual disk identifier, where the first operating system identifier is an identifier of an operating system that the virtual machine needs to be installed;
根据所述读数据请求确定缓存区54中是否存储有所述需读取的数据块。Determining, according to the read data request, whether the data block to be read is stored in the buffer area 54.
所述缓存区54用于存储所述虚拟机需要读取的操作***用于启动所述虚拟机的必要数据;所述必要数据为所述虚拟机处于启动完成状态时已读取的所述操作***的数据。The buffer area 54 is configured to store necessary data used by the operating system that the virtual machine needs to read to start the virtual machine; and the necessary data is the operation that has been read when the virtual machine is in a startup completion state. System data.
所述虚拟磁盘驱动用于根据所述读数据请求确定缓存区中是否存储有需读取的数据块,具体为:所述虚拟磁盘驱动用于根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,确定缓 存区中是否存储有所述需读取的数据块。The virtual disk drive is configured to determine, according to the read data request, whether a data block to be read is stored in the cache area, where the virtual disk drive is configured to read according to the first operating system identifier. The size value of the fetched data block and the offset of the data block to be read are determined to be slow Whether the data block to be read is stored in the storage area.
所述缓存区54可以位于服务器中(如附图6所示的服务器),例如位于服务器的内存中,或者位于服务器的本机存储介质中。可选的,所述缓存区54也可以位于第一存储设备13中(如附图7所示的云计算***),例如可以位于第一存储设备13的控制器中,也可以由高性能的存储设备(例如SSD盘)来提供缓存区。The cache area 54 may be located in a server (such as the server shown in FIG. 6), such as in the memory of the server, or in a local storage medium of the server. Optionally, the buffer area 54 may also be located in the first storage device 13 (such as the cloud computing system shown in FIG. 7), for example, may be located in the controller of the first storage device 13, or may be high-performance. A storage device (such as an SSD) provides a buffer.
当所述缓存区54中存储有所述需读取的数据块时,虚拟磁盘驱动5131用于从所述缓存区54中读取所述需读取的数据块,并返回给所述虚拟机511;当所述缓存区54中没有存储有所述需读取的数据块时,虚拟磁盘驱动5131还用于根据所述读数据请求在第二存储设备中查找所述需读取的数据块,并将查找到的所述需读取的数据块返回给所述虚拟机511。When the data block to be read is stored in the buffer area 54, the virtual disk drive 5131 is configured to read the data block to be read from the buffer area 54 and return it to the virtual machine. The virtual disk drive 5131 is further configured to: in the second storage device, search for the data block to be read according to the read data request, when the data block to be read is not stored in the buffer area 54. And returning the found data block to be read back to the virtual machine 511.
所述虚拟磁盘驱动用于当所述缓存区中没有存储有所述需读取的数据块时,根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块,具体为:当所述缓存区中没有存储所述需读取的数据块时,所述虚拟磁盘驱动用于根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量在所述第二存储设备中查找所述需读取的数据块。The virtual disk drive is configured to: when the data block to be read is not stored in the buffer area, search for the data block to be read in the second storage device according to the read data request, Specifically, when the data block to be read is not stored in the buffer area, the virtual disk driver is configured to determine, according to the first operating system identifier, a size value and a size of the data block to be read. An offset of the data block to be read is searched for in the second storage device for the data block to be read.
如果在缓存区中存储有虚拟机启动时需读取的数据块(即虚拟机启动时需要读取的操作***的数据),在虚拟机的启动过程中虚拟磁盘驱动5131可以从缓存区中读取所述需读取的数据块,而不需要从第二存储设备中读取所述需读取的数据块到虚拟磁盘再从虚拟磁盘中读取所述需读取的数据,从而大大加快了虚拟机的启动速度。并且创建同类型的虚拟机的数量不受限制,这样在创建大量的虚拟机时,启动虚拟机的时间大大缩短。If the data block to be read when the virtual machine starts (that is, the data of the operating system that needs to be read when the virtual machine starts) is stored in the cache area, the virtual disk drive 5131 can be read from the cache during the startup process of the virtual machine. Taking the data block to be read without reading the data block to be read from the second storage device to the virtual disk and reading the data to be read from the virtual disk, thereby greatly speeding up The startup speed of the virtual machine. And the number of virtual machines of the same type is unlimited, so when you create a large number of virtual machines, the time to start the virtual machine is greatly reduced.
即使在缓存区中没有存储所述虚拟机启动时需读取的数据块,在虚拟机启动的过程中,也只需要从第二存储设备中读取操作***的必要数据,而不 需要读取操作***的全部数据,可以大大节省虚拟机的启动时间。Even if the data block to be read when the virtual machine is started is not stored in the cache area, during the startup of the virtual machine, only the necessary data of the operating system needs to be read from the second storage device, instead of Need to read all the data of the operating system, can greatly save the startup time of the virtual machine.
所述虚拟磁盘驱动5131还用于:若在所述第二存储设备中查找到的所述需读取的数据块为所述操作***用于启动所述虚拟机的必要数据,将所述查找到的数据块写入所述缓存区54。The virtual disk drive 5131 is further configured to: if the data block to be read found in the second storage device is necessary data used by the operating system to start the virtual machine, the searching The resulting data block is written to the buffer area 54.
所述操作***用于启动虚拟机的必要数据的判断方法在前文已做了详细的描述,在此不再另行说明。The method for determining the necessary data for starting the virtual machine by the operating system has been described in detail above and will not be further described herein.
所述虚拟磁盘驱动5131还用于:判断所述虚拟机511是否处于启动完成状态;所述启动完成状态包括:所述缓存区中写入的所述操作***的数据大于预定数量;所述虚拟机的CPU占用率小于预定阈值;或者所述虚拟磁盘驱动接收到所述虚拟机读写非操作***虚拟磁盘的操作请求数量超过预定阈值。The virtual disk drive 5131 is further configured to: determine whether the virtual machine 511 is in a startup completion state; the startup completion state includes: the data of the operating system written in the cache area is greater than a predetermined number; The CPU usage of the machine is less than a predetermined threshold; or the number of operation requests by the virtual disk drive to receive the virtual machine to read and write a non-operating system virtual disk exceeds a predetermined threshold.
所述服务器还与第一存储设备相连,所述虚拟磁盘驱动5131还用于:将所述需读取的数据块写入所述第一虚拟磁盘。The server is further connected to the first storage device, and the virtual disk drive 5131 is further configured to: write the data block to be read into the first virtual disk.
所述虚拟磁盘驱动5131还用于:将所述操作***的非必要数据写入所述第一虚拟磁盘。The virtual disk drive 5131 is further configured to: write non-essential data of the operating system to the first virtual disk.
所述虚拟磁盘驱动5131还用于:根据所述读数据请求确定所述缓存区54中没有存储所述需读取的数据块,且在所述第二存储设备中查找到的所述需读取的数据块的数据为所述操作***用于启动所述虚拟机的必要数据时,在对应所述操作***的缓冲链表的描述对象上记录所述查找到的数据块的大小值和数据块的偏移量,并把所述查找到的数据块保存在所述缓存区中的地址保存到对应所述操作***的所述缓冲链表的最后一个描述对象上。The virtual disk drive 5131 is further configured to: determine, according to the read data request, that the data block to be read is not stored in the buffer area 54, and the read data is found in the second storage device When the data of the fetched data block is used by the operating system to start the necessary data of the virtual machine, the size value and the data block of the searched data block are recorded on the description object corresponding to the buffer linked list of the operating system. An offset, and the address in which the found data block is saved in the buffer is saved to the last description object of the buffer linked list corresponding to the operating system.
使用缓冲链表来记录写入所述缓存区的数据块的信息的具体在实现方法在前文已进行了详细的描述。在些不再另行说明。The specific implementation method of using the buffer linked list to record the information of the data block written in the buffer area has been described in detail above. It will not be explained separately.
本领域普通技术人员可以意识到,本文所描述的实施例中的各示例性单 元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件形式来实现,取决于技术方案的特定应用和设计约束条件。专业技术人员可以针对特定的应用选择不同的方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。One of ordinary skill in the art will recognize the various exemplary singles in the embodiments described herein. Meta and algorithm steps can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can select different methods for implementing the described functions for a particular application, but such implementation should not be considered to be beyond the scope of the present invention.
如果以计算机软件的形式来实现所述功能并作为独立的产品销售或使用时,则在一定程度上可认为本发明的技术方案的全部或部分(例如对现有技术做出贡献的部分)是以计算机软件产品的形式体现的。该计算机软件产品通常存储在计算机可读取的存储介质中,包括若干指令用以使得计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各实施例方法的全部或部分步骤。而前述的存储介质包括U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of computer software and sold or used as a stand-alone product, it is considered to some extent that all or part of the technical solution of the present invention (for example, a part contributing to the prior art) is It is embodied in the form of computer software products. The computer software product is typically stored in a computer readable storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。 The above is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.

Claims (19)

  1. 一种虚拟机启动过程中的数据获取方法,应用于云计算***,所述云计算***包括服务器和第二存储设备,所述第二存储设备为镜像存储设备,所述服务器上运行虚拟化平台,其特征在于,所述方法包括以下步骤:A data acquisition method in a virtual machine startup process is applied to a cloud computing system, where the cloud computing system includes a server and a second storage device, the second storage device is a mirror storage device, and the virtualization platform is run on the server. , characterized in that the method comprises the following steps:
    所述虚拟化平台的虚拟磁盘驱动接收所述虚拟机发送的读数据请求;The virtual disk drive of the virtualization platform receives a read data request sent by the virtual machine;
    所述虚拟磁盘驱动根据所述读数据请求,确定缓存区中是否存储有需读取的数据块,所述缓存区用于存储所述虚拟机需要读取的操作***用于启动所述虚拟机的必要数据;The virtual disk drive determines, according to the read data request, whether a data block to be read is stored in the cache area, where the cache area is used to store an operating system that the virtual machine needs to read for starting the virtual machine. Necessary data;
    当所述缓存区中存储有所述需读取的数据块时,所述虚拟磁盘驱动从所述缓存区中读取所述需读取的数据块,返回所述虚拟机;When the data block to be read is stored in the buffer area, the virtual disk drive reads the data block to be read from the buffer area, and returns the virtual machine;
    当所述缓存区中没有存储所述需读取的数据块时,所述虚拟磁盘驱动根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块,并将查找到的所述需读取的数据块返回给所述虚拟机。When the data block to be read is not stored in the buffer area, the virtual disk drive searches for the data block to be read in the second storage device according to the read data request, and searches for The data block to be read to is returned to the virtual machine.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若在所述第二存储设备中查找到的所述需读取的数据块为所述操作***用于启动所述虚拟机的必要数据,所述虚拟磁盘驱动将所述查找到的数据块写入所述缓存区。And if the data block to be read found in the second storage device is necessary data used by the operating system to start the virtual machine, the virtual disk drive writes the searched data block Enter the buffer area.
  3. 根据权利要求1或2所述的方法,所述云计算***还包括第一存储设备,其特征在于,所述方法还包括:The method of claim 1 or 2, wherein the cloud computing system further comprises a first storage device, wherein the method further comprises:
    所述读数据请求中携带有第一虚拟磁盘标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,其中,所述第一虚拟磁盘标识为所述第一存储设备中为所述虚拟机分配的第一虚拟磁盘的标识;The read data request carries a first virtual disk identifier, a size value of the data block to be read, and an offset of the data block to be read, where the first virtual disk identifier is An identifier of the first virtual disk allocated to the virtual machine in the first storage device;
    所述虚拟磁盘驱动根据虚拟磁盘标识与操作***标识之间的对应关系查找到所述第一虚拟磁盘标识对应的第一操作***标识,所述第一操作*** 标识是所述虚拟机需要安装的操作***的标识;The virtual disk drive searches for the first operating system identifier corresponding to the first virtual disk identifier according to the correspondence between the virtual disk identifier and the operating system identifier, and the first operating system The identifier is an identifier of an operating system that the virtual machine needs to be installed;
    步骤所述虚拟磁盘驱动根据所述读数据请求确定缓存区中是否存储有需读取的数据块具体为:Step: The virtual disk drive determines, according to the read data request, whether a data block to be read is stored in the buffer area, specifically:
    所述虚拟磁盘驱动根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,确定所述缓存区中是否存储有所述需读取的数据块;Determining, according to the first operating system identifier, the size value of the data block to be read, and the offset of the data block to be read, whether the virtual disk drive stores the The data block to be read;
    步骤当所述缓存区中没有存储所述需读取的数据块时,所述虚拟磁盘驱动根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块具体为:Step: When the data block to be read is not stored in the buffer area, the virtual disk drive searches for the data block to be read in the second storage device according to the read data request, specifically:
    当所述缓存区中没有存储所述需读取的数据块时,所述虚拟磁盘驱动根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量在所述第二存储设备中查找所述需读取的数据块。When the data block to be read is not stored in the buffer area, the virtual disk drive is configured according to the first operating system identifier, the size value of the data block to be read, and the read-to-read data block. The offset of the data block looks up the data block to be read in the second storage device.
  4. 根据权利要求3所述的方法,其特征在于,所述第一操作***标识为所述虚拟机对应的虚拟机模板的操作***虚拟磁盘的标识。The method according to claim 3, wherein the first operating system identifier is an identifier of an operating system virtual disk of a virtual machine template corresponding to the virtual machine.
  5. 根据权利要求1-4任一所述的方法,其特征在于,所述操作***用于启动所述虚拟机的必要数据为所述虚拟机处于启动完成状态时已读取的所述操作***的数据,所述启动完成状态包括:所述缓存区中写入的所述操作***的数据的数量大于预定数量,所述虚拟机的CPU占用率小于预定阈值,或者所述虚拟磁盘驱动接收到所述虚拟机读写非操作***虚拟磁盘的操作请求数量超过预定阈值。The method according to any one of claims 1 to 4, wherein the necessary data used by the operating system to start the virtual machine is the operating system that has been read when the virtual machine is in a startup completion state. Data, the startup completion status includes: the number of data of the operating system written in the buffer area is greater than a predetermined number, the CPU usage of the virtual machine is less than a predetermined threshold, or the virtual disk drive receives the The number of operation requests for the virtual machine to read and write non-operating system virtual disks exceeds a predetermined threshold.
  6. 根据权利要求3-5任一所述的方法,其特征在于,所述方法还包括:所述虚拟磁盘驱动将所述需读取的数据块写入所述第一虚拟磁盘。The method according to any one of claims 3-5, wherein the method further comprises: the virtual disk drive writing the data block to be read to the first virtual disk.
  7. 根据权利要求6所述的方法,其特征在于,所述方法包括:The method of claim 6 wherein said method comprises:
    所述虚拟磁盘驱动将所述操作***的非必要数据写入所述第一虚拟 磁盘。The virtual disk drive writes non-essential data of the operating system to the first virtual Disk.
  8. 根据权利要求3-6任一所述的方法,其特征在于,所述缓存区位于所述服务器中或者位于所述第一存储设备中。The method according to any one of claims 3-6, wherein the buffer area is located in the server or in the first storage device.
  9. 根据权利要求1-7任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-7, wherein the method further comprises:
    所述虚拟磁盘驱动采用缓冲链表的方式来记录写入所述缓存区的数据块的操作***标识、数据块的大小值和数据块的偏移量。The virtual disk drive records the operating system identifier of the data block written in the buffer area, the size value of the data block, and the offset of the data block in a buffer chain table manner.
  10. 根据权利要求8所述的方法,其特征在于,所述虚拟磁盘驱动根据所述读数据请求确定所述缓存区中没有存储所述需读取的数据块,且在所述第二存储设备中查找到的所述需读取的数据块的数据为所述操作***用于启动所述虚拟机的必要数据时,所述方法还包括:The method according to claim 8, wherein the virtual disk drive determines, according to the read data request, that the data block to be read is not stored in the buffer area, and is in the second storage device. When the data of the data block to be read is the necessary data used by the operating system to start the virtual machine, the method further includes:
    在对应所述操作***的缓冲链表的描述对象上记录所述查找到的数据块的大小值和数据块的偏移量,并把所述查找到的数据块保存在所述缓存区中的地址保存到对应所述操作***的所述缓冲链表的最后一个描述对象上。Recording a size value of the found data block and an offset of the data block on a description object corresponding to the buffer linked list of the operating system, and storing the searched data block in an address in the buffer area Saved to the last description object of the buffer linked list corresponding to the operating system.
  11. 一种用于在虚拟机启动过程中获取数据的服务器,所述服务器与第二存储设备相连,所述第二存储设备为镜像存储设备,其特征在于:所述服务器包括处理器,所述处理器运行有虚拟化平台,所述虚拟化平台中运行有虚拟磁盘驱动,所述虚拟磁盘驱动用于:A server for acquiring data during a virtual machine startup process, the server is connected to a second storage device, and the second storage device is a mirror storage device, wherein the server includes a processor, and the processing The device runs a virtualization platform in which a virtual disk drive is running, the virtual disk drive being used to:
    接收所述虚拟机的读数据请求;Receiving a read data request of the virtual machine;
    根据所述读数据请求确定缓存区中是否存储有需读取的数据块,所述缓存区用于存储所述虚拟机需要读取的操作***用于启动所述虚拟机的必要数据;所述必要数据为所述虚拟机处于启动完成状态时已读取的所述操作***的数据;Determining, according to the read data request, whether a data block to be read is stored in the buffer area, where the buffer area is used to store necessary data of an operating system that the virtual machine needs to read for starting the virtual machine; The necessary data is data of the operating system that has been read when the virtual machine is in a startup completion state;
    当所述缓存区中存储有所述需读取的数据块时,从所述缓存区中读取所述需读取的数据块,并返回所述虚拟机; When the data block to be read is stored in the buffer area, the data block to be read is read from the buffer area, and returned to the virtual machine;
    当所述缓存区中没有存储有所述需读取的数据块时,根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块,并将查找到的所述需读取的数据块返回给所述虚拟机。When the data block to be read is not stored in the buffer area, searching for the data block to be read in the second storage device according to the read data request, and searching for the The data block to be read is returned to the virtual machine.
  12. 根据权利要求11所述的服务器,其特征在于,所述虚拟磁盘驱动还用于:The server according to claim 11, wherein said virtual disk drive is further configured to:
    若在所述第二存储设备中查找到的所述需读取的数据块为所述操作***用于启动所述虚拟机的必要数据,将所述查找到的数据块写入所述缓存区。If the data block to be read found in the second storage device is necessary data used by the operating system to start the virtual machine, the searched data block is written into the buffer area. .
  13. 根据权利要求11或12所述的服务器,所述云计算***还包括第一存储设备,其特征在于,所述读数据请求中携带有第一虚拟磁盘标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,其中,所述第一虚拟磁盘标识为所述第一存储设备中为所述虚拟机分配的第一虚拟磁盘的标识;The server according to claim 11 or 12, wherein the cloud computing system further includes a first storage device, wherein the read data request carries a first virtual disk identifier and the data block to be read. a size value and an offset of the data block to be read, wherein the first virtual disk identifier is an identifier of a first virtual disk allocated to the virtual machine in the first storage device;
    所述虚拟磁盘驱动还用于根据虚拟磁盘标识与操作***标识之间的对应关系查找到所述第一虚拟磁盘标识对应的第一操作***标识,所述第一操作***标识是所述虚拟机需要安装的操作***的标识;The virtual disk drive is further configured to search for a first operating system identifier corresponding to the first virtual disk identifier according to a correspondence between the virtual disk identifier and the operating system identifier, where the first operating system identifier is the virtual machine The ID of the operating system that needs to be installed;
    所述虚拟磁盘驱动用于根据所述读数据请求确定缓存区中是否存储有需读取的数据块,具体为:所述虚拟磁盘驱动用于根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量,确定缓存区中是否存储有所述需读取的数据块;The virtual disk drive is configured to determine, according to the read data request, whether a data block to be read is stored in the cache area, where the virtual disk drive is configured to read according to the first operating system identifier. Determining a size value of the data block and an offset of the data block to be read, determining whether the data block to be read is stored in the buffer area;
    所述虚拟磁盘驱动用于当所述缓存区中没有存储有所述需读取的数据块时,根据所述读数据请求在所述第二存储设备中查找所述需读取的数据块,具体为:当所述缓存区中没有存储所述需读取的数据块时,所述虚拟磁盘驱动用于根据所述第一操作***标识、所述需读取的数据块的大小值和所述需读取的数据块的偏移量在所述第二存储设备中查找所述需读取的数据块。 The virtual disk drive is configured to: when the data block to be read is not stored in the buffer area, search for the data block to be read in the second storage device according to the read data request, Specifically, when the data block to be read is not stored in the buffer area, the virtual disk driver is configured to determine, according to the first operating system identifier, a size value and a size of the data block to be read. An offset of the data block to be read is searched for in the second storage device for the data block to be read.
  14. 根据权利要求11-13任一所述的服务器,其特征在于,所述虚拟磁盘驱动还用于:The server according to any one of claims 11-13, wherein the virtual disk drive is further configured to:
    判断所述虚拟机是否处于启动完成状态;所述启动完成状态包括:所述缓存区中写入的所述操作***的数据大于预定数量,所述虚拟机的CPU占用率小于预定阈值,或者所述虚拟磁盘驱动接收到所述虚拟机读写非操作***虚拟磁盘的操作请求数量超过预定阈值。Determining whether the virtual machine is in a startup completion state; the startup completion state includes: the data of the operating system written in the buffer area is greater than a predetermined number, and the CPU usage of the virtual machine is less than a predetermined threshold, or The virtual disk drive receives the operation request of the virtual machine to read and write a non-operating system virtual disk by a predetermined threshold.
  15. 根据权利要求13-14任一所述的服务器,其特征在于,所述虚拟磁盘驱动还用于:将所述需读取的数据块写入所述第一虚拟磁盘。The server according to any one of claims 13-14, wherein the virtual disk drive is further configured to: write the data block to be read into the first virtual disk.
  16. 根据权利要求13-15任一所述的服务器,其特征在于,所述虚拟磁盘驱动还用于:The server according to any one of claims 13-15, wherein the virtual disk drive is further configured to:
    将所述操作***的非必要数据写入所述第一虚拟磁盘。Non-essential data of the operating system is written to the first virtual disk.
  17. 根据权利要求11-16任一所述的服务器,其特征在于,所述虚拟磁盘驱动还用于:The server according to any one of claims 11-16, wherein the virtual disk drive is further configured to:
    根据所述读数据请求确定所述服务器的缓存区中没有存储所述需读取的数据块,且在所述第二存储设备中查找到的所述需读取的数据块的数据为所述操作***用于启动所述虚拟机的必要数据时,在对应所述操作***的缓冲链表的描述对象上记录所述查找到的数据块的大小值和数据块的偏移量,并把所述查找到的数据块保存在所述缓存区中的地址保存到对应所述操作***的所述缓冲链表的最后一个描述对象上。Determining, according to the read data request, that the data block to be read is not stored in a buffer area of the server, and the data of the data block to be read found in the second storage device is the When the operating system is configured to start the necessary data of the virtual machine, the size value of the found data block and the offset of the data block are recorded on the description object corresponding to the buffer linked list of the operating system, and the The address of the found data block stored in the buffer area is saved to the last description object of the buffer linked list corresponding to the operating system.
  18. 根据权利要求11-17任一所述的服务器,其特征在于,所述缓存区位于所述服务器中或者位于所述第一存储设备中。The server according to any one of claims 11-17, wherein the buffer area is located in the server or in the first storage device.
  19. 一种云计算***,其特征在于,所述云计算***包括第一存储设备、第二存储设备和如权利要求11-17所述的服务器,所述服务器与所述第二存储设备相连,所述第二存储设备为镜像存储设备,所述第一存储设备可以在所述服务器中,也可以与所述服务器相连,所述第一存储设备为虚拟机存储设备。 A cloud computing system, comprising: a first storage device, a second storage device, and a server according to claims 11-17, the server being connected to the second storage device The second storage device is a mirrored storage device, and the first storage device may be connected to the server, and the first storage device is a virtual machine storage device.
PCT/CN2016/107112 2016-11-24 2016-11-24 Method for acquiring data during startup of virtual machine, and cloud computing system WO2018094649A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2016/107112 WO2018094649A1 (en) 2016-11-24 2016-11-24 Method for acquiring data during startup of virtual machine, and cloud computing system
CN201680003333.7A CN108475201B (en) 2016-11-24 2016-11-24 Data acquisition method in virtual machine starting process and cloud computing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/107112 WO2018094649A1 (en) 2016-11-24 2016-11-24 Method for acquiring data during startup of virtual machine, and cloud computing system

Publications (1)

Publication Number Publication Date
WO2018094649A1 true WO2018094649A1 (en) 2018-05-31

Family

ID=62194563

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/107112 WO2018094649A1 (en) 2016-11-24 2016-11-24 Method for acquiring data during startup of virtual machine, and cloud computing system

Country Status (2)

Country Link
CN (1) CN108475201B (en)
WO (1) WO2018094649A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181596A (en) * 2020-10-10 2021-01-05 济南浪潮数据技术有限公司 Virtual machine cloning method, device, equipment and storage medium
CN116560796A (en) * 2023-05-12 2023-08-08 深圳天融信创新科技有限公司 Data loading method, device, equipment and medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491757B (en) * 2018-10-11 2022-03-15 广东微云科技股份有限公司 Starting acceleration method of local computing mode virtual machine
CN110704157B (en) * 2019-09-12 2023-06-30 深圳市元征科技股份有限公司 Application starting method, related device and medium
CN110531730A (en) * 2019-10-16 2019-12-03 广东紫方环保技术有限公司 A kind of pollution sources online monitoring system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102307206A (en) * 2010-09-25 2012-01-04 广东电子工业研究院有限公司 Caching system and caching method for rapidly accessing virtual machine images based on cloud storage
CN102629941A (en) * 2012-03-20 2012-08-08 武汉邮电科学研究院 Caching method of a virtual machine mirror image in cloud computing system
CN103067425A (en) * 2011-10-20 2013-04-24 ***通信集团公司 Creation method of virtual machine, management system of virtual machine and related equipment thereof
CN105045663A (en) * 2015-08-24 2015-11-11 湖南昇云科技有限公司 Method and system for rapidly deploying virtual machine
CN105487898A (en) * 2015-11-27 2016-04-13 国云科技股份有限公司 Method for improving batch power-on/power off speed of virtual machines

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176845B (en) * 2011-12-22 2016-07-06 ***通信集团公司 A kind of virtual machine deployment method, system and device
US8904113B2 (en) * 2012-05-24 2014-12-02 International Business Machines Corporation Virtual machine exclusive caching
CN103870312B (en) * 2012-12-12 2018-01-23 华为技术有限公司 Establish the method and device that virtual machine shares memory buffers
US9436555B2 (en) * 2014-09-22 2016-09-06 Commvault Systems, Inc. Efficient live-mount of a backed up virtual machine in a storage management system
CN105607973B (en) * 2014-11-19 2020-03-17 ***通信集团公司 Method, device and system for processing equipment fault in virtual machine system
CN104580391A (en) * 2014-12-18 2015-04-29 国云科技股份有限公司 Server bandwidth improving method suitable for cloud computing
KR102192503B1 (en) * 2015-04-01 2020-12-17 한국전자통신연구원 Method and system for providing virtual desktop service using cache server
CN105718280A (en) * 2015-06-24 2016-06-29 乐视云计算有限公司 Method and management platform for accelerating IO of virtual machine
CN105279000B (en) * 2015-11-19 2019-06-21 北京北信源软件股份有限公司 A kind of software virtual machine installation method, installation controller and installation agent
CN105549905B (en) * 2015-12-09 2018-06-01 上海理工大学 A kind of method that multi-dummy machine accesses distributed objects storage system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102307206A (en) * 2010-09-25 2012-01-04 广东电子工业研究院有限公司 Caching system and caching method for rapidly accessing virtual machine images based on cloud storage
CN103067425A (en) * 2011-10-20 2013-04-24 ***通信集团公司 Creation method of virtual machine, management system of virtual machine and related equipment thereof
CN102629941A (en) * 2012-03-20 2012-08-08 武汉邮电科学研究院 Caching method of a virtual machine mirror image in cloud computing system
CN105045663A (en) * 2015-08-24 2015-11-11 湖南昇云科技有限公司 Method and system for rapidly deploying virtual machine
CN105487898A (en) * 2015-11-27 2016-04-13 国云科技股份有限公司 Method for improving batch power-on/power off speed of virtual machines

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181596A (en) * 2020-10-10 2021-01-05 济南浪潮数据技术有限公司 Virtual machine cloning method, device, equipment and storage medium
CN112181596B (en) * 2020-10-10 2023-05-12 济南浪潮数据技术有限公司 Virtual machine cloning method, device, equipment and storage medium
CN116560796A (en) * 2023-05-12 2023-08-08 深圳天融信创新科技有限公司 Data loading method, device, equipment and medium
CN116560796B (en) * 2023-05-12 2024-02-02 深圳天融信创新科技有限公司 Data loading method, device, equipment and medium

Also Published As

Publication number Publication date
CN108475201B (en) 2021-02-26
CN108475201A (en) 2018-08-31

Similar Documents

Publication Publication Date Title
US9413683B2 (en) Managing resources in a distributed system using dynamic clusters
US10198377B2 (en) Virtual machine state replication using DMA write records
WO2018094649A1 (en) Method for acquiring data during startup of virtual machine, and cloud computing system
US9448728B2 (en) Consistent unmapping of application data in presence of concurrent, unquiesced writers and readers
US8793427B2 (en) Remote memory for virtual machines
US10496613B2 (en) Method for processing input/output request, host, server, and virtual machine
CN110597451B (en) Method for realizing virtualized cache and physical machine
CN100451995C (en) System and method to preserve a cache of a virtual machine
TWI735542B (en) Data storage method and device of virtual machine
US8433888B2 (en) Network boot system
US20090132621A1 (en) Selecting storage location for file storage based on storage longevity and speed
US20180139100A1 (en) Storage-aware dynamic placement of virtual machines
JP6337902B2 (en) Storage system, node device, cache control method and program
WO2019061352A1 (en) Data loading method and device
KR20170042593A (en) Flushing in file system
CN110457261B (en) Data access method, device and server
JP2008090657A (en) Storage system and control method
US20170024322A1 (en) Event based pre-fetch caching storage controller
US10579419B2 (en) Data analysis in storage system
CN112486858A (en) Data prefetching method and device
US20180136958A1 (en) Storage-aware dynamic placement of virtual machines
US10013201B2 (en) Region-integrated data deduplication
US10007437B2 (en) Management apparatus, storage system, method, and computer readable medium
US11126371B2 (en) Caching file data within a clustered computing system
US10346193B1 (en) Efficient placement of virtual machines based on cache hit ratio

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16922210

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16922210

Country of ref document: EP

Kind code of ref document: A1