WO2012058917A1 - 虚拟机存储空间管理方法、系统及物理主机 - Google Patents

虚拟机存储空间管理方法、系统及物理主机 Download PDF

Info

Publication number
WO2012058917A1
WO2012058917A1 PCT/CN2011/074025 CN2011074025W WO2012058917A1 WO 2012058917 A1 WO2012058917 A1 WO 2012058917A1 CN 2011074025 W CN2011074025 W CN 2011074025W WO 2012058917 A1 WO2012058917 A1 WO 2012058917A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage
virtual
block
virtual storage
balloon
Prior art date
Application number
PCT/CN2011/074025
Other languages
English (en)
French (fr)
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 KR1020127012967A priority Critical patent/KR101403416B1/ko
Priority to EP11779077A priority patent/EP2479677A4/en
Priority to JP2012542354A priority patent/JP5510556B2/ja
Priority to US13/339,209 priority patent/US8850156B2/en
Publication of WO2012058917A1 publication Critical patent/WO2012058917A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Definitions

  • the present invention relates to the field of computer virtualization technologies, and in particular, to a virtual machine storage space management method, system, and physical host.
  • Computer virtualization technology is a decoupling method that separates the underlying hardware devices of the computer from the upper operating system and applications. It introduces the virtual machine monitor (VMM) layer to directly manage the underlying hardware resources, and creates and The hardware-independent virtual machine (VM) is used by the upper-layer operating system and applications.
  • VMM virtual machine monitor
  • VM hardware-independent virtual machine
  • the corresponding virtual machine architecture is shown in Figure 1.
  • VDI Virtual Disk Image
  • Operations such as snapshots, backups, clones, and distributions.
  • a virtual disk is a virtual storage device that a virtual machine monitor provides to a virtual machine.
  • the corresponding physical storage space can be either a local storage system of a host or a network storage system of a data center.
  • NAS network attached storage
  • SAN Storage Area Network
  • Storage Cloud Storage Cloud
  • the corresponding form in the host machine can be a file or a block device (such as a disk partition, a logical volume, etc.).
  • the pre-allocation is to allocate a storage space of a specified size for each virtual machine at a time.
  • the pre-allocated space is wasted.
  • the virtual storage space of the dynamic allocation mode can reduce the waste of storage resources to a certain extent.
  • the virtual storage space occupies a small amount of actual storage space. As the user uses it, more and more virtual machine storage space will be created. The file, and the storage space it occupies will become larger.
  • the existing dynamically allocated storage space management method can be allocated on demand, when the virtual machine performs file deletion operations internally, if the host cannot perceive the operation, the free space that the virtual machines have released can not be released.
  • a virtual machine with a 20GB virtual storage device basically runs out of storage space as a temporary file during the busiest task. When the task is idle, these temporary files are deleted, and 15GB appears in the system. Free space, but the storage resources of this 15GB host are not released.
  • the virtual computer software VM ware Workstation provides a VM wareshrinking Virtual Disk function, which can perform free data blocks in a VMDK (VM Ware Virtual Machine Disk Format) dynamic virtual disk (hereinafter referred to as a data block cartridge). Release, the main steps are as follows:
  • the virtual machine internally clears the free block in the virtual disk to 0 by the VM Tools tool;
  • the supporting tool on the host scans the file or block device corresponding to the virtual disk, recognizes the "0" block, and uses the dynamic image format feature to shrink the image to complete the release of the free data block.
  • VM Tools clears the free block in the virtual disk to “0”, and needs to perform write operation on all the free blocks; when the host recognizes the "0" block
  • the read operation needs to be performed on all data blocks, that is, the existing method has a relatively large operation overhead, and more disk read and write operations waste a large amount of disk bandwidth and take a long time; moreover, the host method recognizes by the existing method.
  • the 0" block indirectly determines the space occupancy of each data block in the virtual disk, so the virtual machine disk global free block information cannot be obtained in real time; in addition, the existing method is limited in application, and is only applicable to the dynamically allocated image format. Free block release is not possible with pre-allocated image formats.
  • the embodiment of the invention provides a virtual machine storage space management method and a physical host, so as to effectively perform storage space management and improve utilization of the storage system.
  • a virtual machine storage space management method is applied to a physical host, where the physical host includes: a hardware layer, a virtual machine monitoring unit layer running on the hardware layer, and a virtual machine running on the virtual machine monitoring unit layer.
  • the virtual machine is deployed with a storage balloon proxy module, and the virtual machine monitoring unit layer is configured with a storage balloon daemon module, and the method includes:
  • the storage balloon proxy module acquires the occupied size according to the size of the virtual storage space occupied by the predefined file. Part of the virtual storage block, the virtual storage free block information corresponding to the virtual storage block is transferred to the storage balloon daemon module;
  • the storage balloon daemon module partially or completely releases the physical storage space corresponding to the virtual storage free block information, and marks the virtual storage block corresponding to the released physical storage space as unavailable.
  • a virtual machine storage space management system includes a storage balloon proxy module deployed in a virtual machine and a storage balloon daemon module deployed in a virtual machine monitoring unit layer;
  • the storage balloon proxy module is configured to obtain a part of the virtual storage block occupied according to the size of the virtual storage space occupied by the predefined file, and transmit the virtual storage free block information corresponding to the virtual storage block to the storage balloon daemon module;
  • the storage balloon daemon module is configured to partially or completely release the physical storage space corresponding to the virtual storage free block information, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • a physical host includes: a hardware layer, a virtual machine monitoring unit layer running on the hardware layer, and at least one virtual machine running on the virtual machine monitoring unit layer, wherein the virtual machine is deployed with a storage balloon agent Module, the virtual machine monitoring unit layer is deployed with a storage balloon daemon module:
  • the storage balloon proxy module is configured to obtain a part of the virtual storage block occupied according to the size of the virtual storage space occupied by the predefined file, and transmit the virtual storage free block information corresponding to the partial virtual storage block to the storage balloon daemon module;
  • the storage balloon daemon module is configured to partially or completely release the physical storage space corresponding to the virtual storage free block information, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • a storage balloon proxy module is deployed in a virtual machine, and a storage balloon daemon module is deployed at a virtual machine monitoring unit layer, and the storage balloon proxy module acquires virtual storage free block information according to a pre-defined file occupying virtual storage space, and The virtual storage free block information is delivered to the storage balloon daemon module, and the physical storage space corresponding to the virtual storage free block information is released by the storage balloon daemon module.
  • the virtual storage free block information can be obtained in real time, and the real-time performance is good; on the other hand, a large number of storage system read and write operations are avoided, and the system overhead is small; and the method obtains the virtual storage free block information through the file system interface. , no need to know the file
  • the implementation details of the system are versatile and can be applied to dynamically allocated image formats and pre-allocated image formats.
  • FIG. 1 is a schematic diagram of a virtual machine architecture
  • FIG. 2 is a schematic flowchart of a method for managing a storage space of a virtual machine according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a specific step of storing step 100 of the method shown in FIG. 2;
  • FIG. 2b is a schematic flow chart of the specific steps of step 200 of the method shown in FIG. 2;
  • FIG. 3 is a logical structural diagram of a virtual machine storage space management system according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a logical structure of a physical host according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a virtual machine storage space management method according to an application scenario of the present invention
  • FIG. 5b is a schematic flowchart of a virtual machine storage space management method according to an application scenario of the present invention.
  • An embodiment of the present invention provides a virtual machine storage space management method, which is applied to a physical host, where the physical host includes: a hardware layer, a virtual machine monitoring unit layer VMM running on the hardware layer, and running in a virtual machine monitoring unit layer VMM.
  • the storage balloon agent (SBA, Storage Balloon Agent) module is deployed in the virtual machine
  • the storage balloon daemon (SBD) module is deployed in the virtual machine monitoring unit layer VMM;
  • the SBA in the virtual machine obtains the virtual storage free block information in a direct manner, and transmits the obtained virtual storage free block information to the SBD in the virtual machine monitoring unit layer VMM and the SBA.
  • the SBD is marked and released in the virtual machine storage format.
  • Embodiments of the present invention also provide a corresponding virtual machine storage space management system and a physical host. The details are described below separately.
  • a virtual machine storage space management method provided by an embodiment of the present invention may be applied to a physical host, where the physical host includes: a hardware layer, a virtual machine monitoring unit layer running on the hardware layer, running A virtual machine above the virtual machine monitoring unit layer, wherein the virtual machine is deployed with a storage balloon proxy module, and the virtual machine monitoring unit layer is configured with a storage balloon daemon module, and the method may include the following steps:
  • the storage balloon proxy module acquires a part of the virtual storage block occupied according to the size of the virtual storage space occupied by the predefined file, and transmits the virtual storage free block information corresponding to the virtual storage block to the storage balloon daemon module.
  • the SB ⁇ deployed in the virtual machine can directly obtain the virtual storage free block information according to the pre-defined file occupying the virtual storage space, and does not need to perform the "0" write operation for each free block;
  • the storage balloon proxy module SB A can transfer the virtual storage free block information corresponding to the virtual storage block to the storage balloon daemon module SBD deployed in the virtual machine monitor layer by means of shared memory, so that there is no need for each idle The block performs a read operation.
  • the predefined file may be any type of file defined in advance, and its role is to occupy a certain virtual storage free space. For example, for a virtual machine Windows operating system (Windows) C drive, you can create a new file as a predefined file.
  • Windows Windows operating system
  • the storage balloon daemon module partially or completely releases the physical storage space corresponding to the virtual storage free block information, and marks the virtual storage block corresponding to the released physical storage space as unavailable.
  • the SBD performs an operation of releasing the free block.
  • the SBD may release part or all of the physical storage space corresponding to the idle virtual storage block, and mark the virtual storage block corresponding to the released physical storage space as unavailable. .
  • the predefined file occupies the virtual disk space, and the physical storage space that is released and marked is specifically the physical disk space.
  • step 100 may specifically include the following steps: 110.
  • the SBA deployed in the virtual machine compares the size of the virtual storage space occupied by the predefined file with the obtained limit range.
  • the limit range may be a fixed value set in advance, or may be obtained by a prescribed algorithm according to other parameters obtained.
  • the step 110 may specifically include:
  • the SBA calls the file system to obtain the size of the virtual storage free space and the size of the virtual storage space of the predefined file, and obtains the lower limit ratio and the upper limit ratio of the virtual storage free space from the storage balloon daemon module.
  • the virtual machine obtains the virtual storage free space information through the file system interface.
  • the step is repeated according to a certain period.
  • the interval between two consecutive executions may be 1 to 5 seconds.
  • the lower and upper scale ratios that allow the predefined files to occupy the virtual storage free space are preset in the Storage Balloon Daemon module.
  • the upper limit ratio is preferably 80 to 90%, and the lower limit ratio is preferably 60 to 70%.
  • the SBA uses the product of the lower limit ratio and the upper limit ratio respectively as the size of the virtual storage free space as the lower limit value and the upper limit value of the preset limit value range.
  • the lower limit ratio is L1 %
  • the upper limit ratio is L2%.
  • the lower limit of the limit range is X*L1 % and the upper limit is X*L2%.
  • the virtual machine compares the size of the virtual storage space occupied by the predefined file with the lower limit value and the upper limit value of the limit range respectively.
  • the predefined file occupies the size of the virtual storage space as S, then judge S and
  • the SBA invokes the file system to expand the predefined file, and allocates a virtual storage block for the expanded predefined file.
  • the predefined file is smaller than the lower limit, indicating that the free space of the virtual storage is too large, and it is necessary to release a part of the free space.
  • the step 120 may specifically include:
  • the SBA calls the file system pre-allocation interface, and the intermediate value of the incoming limit range is used as the size of the expanded predefined file, and the intermediate value is equal to half of the sum of the lower limit value and the upper limit value.
  • the lower limit is X*L1%, and the upper limit is X*L2%, the median is X* ( Ll% +L2% ) 12.
  • the SBA virtual machine file system allocates a virtual storage block for the expanded predefined file. For example, for a predefined file of size X* ( Ll% + L2% ) /2, the allocated virtual storage block can be [bl , b2, ... bn].
  • the SBA calls the file system lock (lock) interface, and locks the virtual storage block allocated for the expanded predefined file, so as not to be modified by the storage device defragmentation tool.
  • lock file system lock
  • the SBA calls the file system to obtain a virtual storage block occupied by an enlarged portion of the predefined file.
  • the virtual machine calls the file system "Price Quota Off -> Data Block" map (bmap) interface, which is occupied.
  • Virtual memory block [bs , ... bn].
  • the SB A transmits the first virtual storage free block information indicating the virtual storage block to the storage balloon daemon module by using the shared memory.
  • the first virtual storage free block information is passed to the storage balloon daemon module, and its corresponding physical storage space is used as a candidate for recycling release.
  • the manner in which the first virtual storage free block information is transmitted is performed in a shared memory mode, which is reliable.
  • step 200 may specifically include the following steps:
  • the SBD deployed in the virtual machine monitoring unit layer VMM determines whether a virtual storage block corresponding to the first virtual storage free block information is available, and if available, marks the virtual storage block as idle.
  • the SBD obtains the first virtual storage free block information through the shared memory mode, and determines whether the corresponding virtual storage block is available. If available, the virtual storage block is marked as idle; if not, the processing is not processed. After processing, the SBD responds to the SBA.
  • the SBD releases part or all of the physical storage space corresponding to the idle virtual storage block, and marks the virtual storage block corresponding to the released physical storage space as unavailable.
  • the SBD performs an operation of releasing the free block.
  • the SBD may release part or all of the physical storage space corresponding to the idle virtual storage block, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • a single policy can be executed, that is, for the virtual storage block marked as idle, the physical storage space corresponding to the virtual storage block is completely released, and the released physical storage space is released. The corresponding virtual storage block is marked as unavailable.
  • a preferred policy may also be implemented, that is, when the operating frequency of the virtual machine internally allocating and/or releasing the storage space is equal to or greater than a threshold (the threshold here may be preset, When it is dynamically calculated, the SBD reduces the proportion of free blocks released; when the virtual machine internally allocates and/or releases the storage space less, the SBD increases the proportion of free blocks that are freed.
  • the SBD determines whether the operating frequency of the virtual machine internal allocation or release storage space is equal to or greater than a preset threshold, and if not, releases the physical storage space corresponding to the virtual storage block marked as idle according to a preset ratio, for example, 80% of the ratio is released; if yes, the preset ratio is reduced according to the preset rate, and the physical storage space corresponding to the virtual memory block marked as free is released according to the reduced ratio, for example, the preset is reduced by 1% per second.
  • This ratio is 80%, and is released in a reduced ratio such as 75% or 70%. Reduce the original release ratio of free blocks This is because these free blocks are likely to be reused in the short term, which reduces the overhead caused by frequent release and redistribution.
  • the proportion of releasing the free block should be appropriately increased. If the storage space corresponding to the free block is a file, the function of releasing the free data block depends on the internal interface of the exported host file system (free_blocks (start_block, count)); if the storage space corresponding to the virtual storage block is a block device, the free block is released. Notifies the underlying block storage system to release.
  • the method provided by the embodiment of the present invention may further include: after the SBA compares the size of the virtual storage space occupied by the predefined file with the obtained limit value range, the method may further include:
  • the calling file system obtains the virtual storage block occupied by the to-be-reduced portion of the predefined file.
  • the predefined file is larger than the upper limit, indicating that the free space of the virtual storage is too small. It is necessary to return the free space occupied by a part of the predefined files to the virtual machine file system. In order to return some of the free space, it is necessary to shrink the predefined file and reduce the free space occupied by it, thereby releasing the free space occupied by the reduced portion.
  • SB A obtains a target value as the size of the pre-shrinking predefined file, and the portion larger than the target value is the portion to be reduced, which will be truncated and removed.
  • the shrinkage of the predefined file is the target size of the limit range.
  • the predefined The portion to be contracted of the file is the [X* ( Ll% + L2% ) /2 , S] interval. For this interval, the virtual machine calls the "File System -> Data Block" mapping (bmap) interface to obtain the corresponding virtual storage block. .
  • the SBA transmits the second virtual storage idle block information indicating the virtual storage block occupied by the to-be-reduced portion to the SBD, and notifies the SBD that the virtual storage block occupied by the to-be-reduced portion is prohibited from being in an idle state.
  • the manner of transmitting the second virtual storage free block information is performed in a shared memory manner, and the method is reliable.
  • the SBD After receiving the second virtual storage free block information delivered by the SBA, the SBD performs the following steps: 230.
  • the SBD determines whether the virtual storage block corresponding to the second virtual storage free block information is idle, and if it is idle, This virtual block is marked as available.
  • the SBD obtains the second virtual storage free block information by using the shared memory mode, and determines whether the virtual storage block corresponding to the second virtual storage free block information is idle, and if it is idle, the flag is available; if the second virtual storage is free block information If the corresponding virtual storage block is unavailable, no processing is performed. It should be noted that the allocation of data blocks in the virtual machine is only a virtual layer, and the real block allocation of physical storage space is performed when a write operation occurs. After processing, the SBD responds to the SBA.
  • the SBA calls the file system to shrink the predefined file.
  • the SBA calls the file system truncation interface, passing in the intermediate value of the preset limit range as the size of the pre-shrinked predefined file, and the intermediate value is equal to half the sum of the lower limit and the upper limit;
  • the virtual storage block occupied by the truncated part of the predefined file, that is, the virtual storage block corresponding to the second virtual storage free block information, is returned to the virtual machine file system.
  • the preferred solution of the above method deals with the fact that the virtual storage space occupied by the predefined file is less than the lower limit value of the limit range and the upper limit value of the limit range.
  • the size of the predefined file is between the lower limit and the upper limit of the limit range, it indicates that the free space of the virtual storage is suitable and will not be processed.
  • the virtual machine storage space management method provided by the embodiment of the present invention is cyclically executed according to a certain period.
  • the SBA deployed in the virtual machine compares the size of the virtual storage space occupied by the predefined file with the obtained limit value range, and performs different operations for the comparison result respectively, after the execution is completed, regardless of the predefined file. Whether the size and the range of the obtained limit change, return to the next cycle.
  • the virtual machine obtains the virtual storage idle data block information in real time through the SBA, and actively informs the host machine of the virtual machine storage space usage, and the idle to be released.
  • the block information is transmitted to the SBD deployed on the virtual machine monitor layer (that is, the host machine), and the host machine releases and redistributes the virtual storage free block through the SBD. It can be seen that the host machine can obtain the virtual machine storage space usage in real time, and the real-time performance. it is good;
  • the virtual machine storage space management method avoids a large number of storage system read and write operations, thereby reducing system overhead; and obtaining a virtual storage free block through the file system interface, without knowing the implementation details of the file system. Good versatility;
  • the virtual machine storage space management method by identifying the virtual machine storage space usage situation in real time (that is, identifying the valid data block and the idle data block in the virtual machine storage system), the corresponding virtual storage free block may be released.
  • Physical storage space which can effectively manage storage space and improve the utilization of the underlying storage system.
  • identifying valid blocks of data you can effectively increase the efficiency of I/O-intensive operations such as storage online migration, virtual machine cloning, and image backup. It can be seen that the virtual machine storage space management solution provided by the embodiment of the present invention can be used for storage system automatic fine tube deployment space management.
  • an embodiment of the present invention provides a virtual machine storage space management system, which includes a storage balloon agent (SBA) module deployed in a virtual machine and a storage balloon deployed in a virtual machine monitoring unit layer.
  • SBA storage balloon agent
  • SBD Storage Balloon Daemon
  • the system runs on a physical host.
  • the physical host includes:
  • Hardware layer is the entire hardware platform running in a virtualized environment and can include processors (such as
  • CPU central processing unit
  • memory Memory memory Memory
  • storage system such as disk Disk, Hard Disk
  • network card input/output device (I/O).
  • the virtual machine monitor (VMM) layer which acts as a management layer to manage and allocate hardware resources; presents a virtual hardware platform for virtual machines; and schedules and isolates virtual machines.
  • VMM implementations require a privileged virtual machine to combine and form a host (HOST).
  • the virtual hardware platform provides various hardware resources for the virtual machines on it, such as VCPU, virtual memory, virtual disk VDisk, virtual network card, and so on.
  • the virtual disk corresponds to a file in the host machine, or a logical block device. Since the contiguous blocks of the virtual disk can be discretely stored in the host machine, the virtual machine disk image is generally described by an image format for the organization and management, wherein the metadata area is used to store the virtual disk data block and the data in the host machine. The mapping relationship between blocks.
  • Virtual Machine The virtual machine runs in the virtual platform it is prepared for. Most of the time the execution of the virtual machine is not affected by the host.
  • the SBA is deployed in the virtual machine, and the SBD is deployed in the virtual machine monitor layer.
  • the storage balloon proxy module 401 is configured to obtain a part of the virtual storage block occupied according to the size of the virtual storage space occupied by the predefined file, and transmit the virtual storage free block information corresponding to the virtual storage block to the storage balloon daemon module.
  • the storage balloon daemon module 402 is configured to partially or completely release the physical storage space corresponding to the virtual storage free block information, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • the storage balloon proxy module 401 may specifically include:
  • a comparison unit configured to compare the size of the virtual storage space occupied by the predefined file with the obtained limit range
  • An expansion unit configured to: if the virtual storage space occupied by the predefined file is less than a lower limit value of the limit range, call the file system to expand the predefined file, and allocate a data block for the expanded predefined file; and acquire a unit for calling the file The system obtains the virtual storage block occupied by the enlarged portion of the predefined file;
  • a delivery module configured to pass the first virtual storage free block information indicating the virtual storage block to the storage balloon daemon module.
  • the storage balloon daemon module 402 can specifically include:
  • a determining unit configured to determine whether a virtual storage block corresponding to the first virtual storage free block information is available, and if available, mark the virtual storage block as idle;
  • the release and labeling unit is configured to release the physical storage space corresponding to the virtual storage block that is partially or completely marked as free according to the policy, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • the virtual machine obtains the virtual storage idle data block information in real time through the SBA, and actively informs the host machine of the virtual machine storage space usage, and the idle to be released.
  • the block information is transmitted to the SBD deployed on the virtual machine monitor layer (that is, the host machine), and the host machine releases and redistributes the virtual storage free block through the SBD. It can be seen that the host machine can obtain the virtual machine storage space usage in real time, and the real-time performance. it is good;
  • the virtual machine storage space management system provided by the embodiment of the present invention avoids a large number of storage system read and write operations, thereby reducing system overhead; and obtaining a virtual storage free block through the file system interface, without knowing the implementation details of the file system. Good versatility; Moreover, the virtual machine storage space management system provided by the embodiment of the present invention can be applied to both the dynamically allocated image format and the pre-allocated image format.
  • the virtual machine storage space management system provided by the embodiment of the present invention, by identifying the virtual machine storage space usage situation in real time (that is, identifying the valid data block and the idle data block in the virtual machine storage system), the corresponding virtual storage free block may be released.
  • Physical storage space which can effectively manage storage space and improve the utilization of the underlying storage system.
  • identifying valid blocks of data you can effectively increase the efficiency of I/O-intensive operations such as storage online migration, virtual machine cloning, and image backup. It can be seen that the virtual machine storage space management solution provided by the embodiment of the present invention can be used for storage system automatic fine tube deployment space management.
  • an embodiment of the present invention further provides a physical host, including a hardware layer, a virtual machine monitoring unit layer VMM running on a hardware layer, and at least one virtual machine running on a virtual machine monitoring unit layer VMM.
  • the virtual machine is deployed with a storage balloon proxy, and the virtual machine monitoring unit layer is deployed with a storage balloon daemon:
  • the storage balloon proxy module is configured to obtain a part of the virtual storage block occupied according to the size of the virtual storage space occupied by the predefined file, and transmit the virtual storage free block information corresponding to the partial virtual storage block to the storage balloon daemon module.
  • the storage balloon daemon module is configured to partially or completely release the physical storage space corresponding to the virtual storage free block information, and mark the virtual storage block corresponding to the released physical storage space as unavailable.
  • the storage balloon proxy module is specifically configured to compare the size of the virtual storage space occupied by the predefined file with the obtained limit range, if the virtual storage space occupied by the predefined file is smaller than the limit range.
  • the lower limit value the file system is called to expand the predefined file, the virtual storage block is allocated for the expanded predefined file, and the file system is called to obtain the virtual storage block occupied by the enlarged portion of the predefined file, which will represent the virtual storage block.
  • a virtual storage free block information is passed to the storage balloon daemon module;
  • the storage balloon daemon module is specifically configured to determine whether a virtual storage block corresponding to the first virtual storage free block information is available, and if available, mark the virtual storage block as idle, and mark part or all of the virtual storage as idle virtual storage according to the policy.
  • the physical storage space corresponding to the block is released, and the virtual storage block corresponding to the released physical storage space is marked as unavailable.
  • the storage balloon proxy module is further configured to: if the virtual storage space occupied by the predefined file is greater than an upper limit value of the limit range, invoke the file system to obtain the virtual storage occupied by the to-be-reduced portion of the predefined file.
  • Block the second virtual storage free block information indicating the virtual storage block is passed to the storage balloon daemon module; and the file system is called to shrink the predefined file.
  • the storage balloon daemon module is further configured to: determine whether the virtual storage block corresponding to the second virtual storage free block information is idle, and if idle, mark the virtual storage block as available.
  • the virtual machine obtains the virtual storage idle data block information in real time through the SBA, and actively informs the host machine of the virtual machine storage space usage, and transmits the free block information to be released to the virtual machine.
  • the SBD deployed on the virtual machine monitor layer that is, the host
  • the host uses the SBD to release and redistribute the virtual storage free blocks. It can be seen that the host can obtain the virtual machine storage space usage in real time, and the real-time performance is good;
  • the physical host provided by the embodiment of the present invention avoids a large number of storage system read and write operations, thereby reducing system overhead; and obtaining a virtual storage free block through the file system interface, without knowing the implementation details of the file system, and having good versatility;
  • the physical host provided by the embodiment of the present invention can be applied to both the dynamically allocated image format and the pre-allocated image format.
  • the physical storage space corresponding to the virtual storage free block can be released by real-time identifying the storage space usage of the virtual machine, that is, identifying the valid data block and the free data block in the virtual machine storage system. Therefore, the storage space management can be effectively performed, and the utilization of the underlying storage system can be improved. In addition, by identifying valid blocks of data, you can effectively increase the efficiency of I/O-intensive operations such as line migration, virtual machine cloning, and image backup. It can be seen that the virtual machine storage space management solution provided by the embodiment of the present invention can be used for storage system automatic fine tube deployment space management.
  • the virtual machine storage space management method described in the foregoing embodiment is described in detail in a specific application scenario.
  • the steps performed by SB A and SBD are described separately.
  • the description is made by taking the underlying storage system as a disk.
  • the physical storage space is a physical disk space
  • the virtual storage space is a virtual disk space.
  • the predefined file (F, for example, the C drive for Windows can be C: ⁇ balloon.sys) does not exist, create a predefined file. 202. Obtain a file size S of the predefined file F.
  • the first virtual disk free block information corresponding to the virtual disk block group is transferred to the SBD by means of shared memory, and the virtual disk block group is used as a candidate for recovery release. As shown in FIG. 4, the first virtual disk free block information, such as [2, 3, 14, 15, 16, 17, 18, 19, 20, ..., 24]. At the same time, an extended message is sent to the SBD to notify the SBD to perform corresponding operations.
  • the system will use X*(Ll%+L2%)/2 as the size of the F after shrinking, so for the [X*(Ll%+L2%)/2, S] interval, the file system "file offset” is called.
  • the second virtual disk free block information corresponding to the virtual disk block group is transmitted to the SBD through the shared memory. Also pass a shrink message to the SBD for notification
  • the SBD performs the corresponding operations and ensures that the virtual disk block group is not marked as idle by the SBD.
  • step 208 After waiting for an appropriate time, go to step 202.
  • predefined file F is limited by the file system, it may be necessary to create multiple predefined files F.
  • the SBA provides a user interface, and configuring the SBA to allow the predefined file to occupy the lower limit and upper limit ratio of the virtual disk free space.
  • the upper and lower ratios can be flexibly set. For example, when storing online migration, an appropriate increase ratio can further reduce the virtual space free space copy.
  • the lower limit ratio can be set to about 60%
  • the upper limit ratio can be set between 80% and 90%.
  • the SBD obtains the first virtual disk free block information corresponding to the virtual disk block to be released by using the shared memory mode, and performs marking processing on the corresponding virtual disk block, which specifically includes the following steps:
  • the SBD reduces the proportion of free data blocks released, because these free data blocks are likely to be used again in a short period of time. This reduces the overhead caused by frequent release and redistribution; when the virtual machine allocates and frees disk space internally, the SBD increases the proportion of free blocks that are freed.
  • the function of releasing the free block depends on the internal interface of the exported host file system (free_blocks(st art_block, count)); when the data block is in the block interface mode, the underlying block storage system is notified to release.
  • the method obtains the second virtual disk free block information corresponding to the virtual disk block that needs to be reclaimed, and performs marking processing on the corresponding virtual disk block, and specifically includes the following steps:
  • the virtual machine obtains the virtual storage idle data block information in real time through the SBA, and actively informs the host machine of the virtual machine storage space usage, and the idle to be released.
  • the block information is transmitted to the SBD deployed on the virtual machine monitor layer (that is, the host machine), and the host machine releases and redistributes the virtual storage free block through the SBD. It can be seen that the host machine can obtain the virtual machine storage space usage in real time, and the real-time performance. it is good;
  • the virtual machine storage space management solution provided by the embodiment of the present invention avoids a large number of storage system read and write operations, thereby reducing system overhead; and obtaining a virtual storage free block through the file system interface, without knowing the implementation details of the file system. Good versatility;
  • the virtual machine storage space management scheme provided by the embodiment of the present invention can be applied to both the dynamically allocated image format and the pre-allocated image format.
  • the virtual machine storage space management solution provided by the embodiment of the present invention, by identifying the virtual machine storage space usage situation in real time (that is, identifying the valid data block and the idle data block in the virtual machine storage system), the corresponding virtual storage free block may be released.
  • Physical storage space which can effectively manage storage space and improve the utilization of the underlying storage system.
  • identifying valid blocks of data you can effectively increase the efficiency of I/O-intensive operations such as online migration, virtual machine cloning, and image backup. It can be seen that the virtual machine storage space management solution provided by the embodiment of the present invention can be used for storage system automatic fine tube deployment space management.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Read-Only Memory (ROM), random access memory (RAM), disk or 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)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

虚拟机存储空间管理方法、 系统及物理主机
本申请要求于 2010 年 11 月 03 日提交中国专利局、 申请号为 201010530638.8、 发明名称为 "虚拟机存储空间管理方法、 系统及物理主机" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机虚拟化技术领域,具体涉及一种虚拟机存储空间管理方 法、 系统及物理主机。
背景技术
计算机虚拟化技术是一种将计算机底层硬件设备与上层操作系统、应用程 序分离的去耦合方法, 其引入虚拟机监控器( VMM , Virtual Machine Monitor ) 层来直接管理底层硬件资源, 并创建与底层硬件无关的虚拟机(VM, Virtual Machine )供上层操作系统和应用程序使用, 相应的虚拟机架构如图 1所示。 虚拟化技术作为当前流行的云计算(Cloud Computing )平台的底层重要支撑 技术之一, 可以大大提高物理设备的资源使用效率。 与传统的物理机相比, 虚 拟机具有更好的隔离性和封装性,其可以将整个虚拟机的信息保存到虚拟磁盘 映像(VDI, Virtual Disk Image ) 中, 从而可以方便地对虚拟机进行快照、 备 份、 克隆和分发等操作。
虚拟磁盘 ( Virtual Disk )是虚拟机监控器提供给虚拟机使用的虚拟存储设 备, 其对应的物理存储空间既可以是宿主机(Host )的本地存储系统, 也可以 是数据中心的网络存储系统,如网络附加存储( NAS , Network Attached Storage ) 文件服务器、 存储区域网 (SAN, Storage Area Network ), 存储集群或者云存 储(Storage Cloud )等。 其对应在宿主机里面的存在形式可以是文件, 也可以 是块设备(如磁盘分区、 逻辑卷等)。
虚拟机存储空间分配一般有两种方法: 预先分配和动态分配。其中预先分 配是为每个虚拟机一次性分配好指定大小的存储空间, 当虚拟机数据较少时, 预先分配空间浪费较大。而动态分配方式的虚拟存储空间可以一定程度减少存 储资源的浪费, 刚开始的时候, 虚拟存储空间占用很少的实际存储空间, 随着 用户的使用,虚拟机存储空间上会创建越来越多的文件, 而其占有的存储空间 也会变得原来越大。 虽然现有动态分配的存储空间管理方法可以按需进行分配,但当虚拟机内 部执行文件删除操作时,如果宿主机无法感知到此操作, 就不能释放这些虚拟 机已释放的空闲空间。 比如, 一个拥有 20GB虚拟存储设备的虚拟机, 在任务 最繁忙的时候基本上用完了所有的存储空间作为临时文件,而当任务空闲下来 以后, 这些临时文件都被删除, 系统中又出现了 15GB 的空闲空间, 但是这 15GB占用的宿主机的存储资源并没有被释放。
现有技术中, 虚拟计算机软件 VM ware Workstation 提供 VM ware Shrinking Virtual Disk功能, 其可以对 VMDK ( VM Ware Virtual Machine Disk Format )动态虚拟磁盘中的空闲数据块(以下将数据块筒称为块)进行释放, 主要步骤如下:
虚拟机内部执行磁盘碎片整理(可选 );
虚拟机内部通过 VM Tools工具将虚拟磁盘中的空闲块清" 0";
宿主机上配套工具扫描虚拟磁盘对应的文件或者块设备, 识别出 "0"块, 利用动态映像格式特性进行映像收缩, 完成空闲数据块的释放。
发明人在实现本发明的过程中, 发现: 上述方法中, VM Tools将虚拟磁 盘中的空闲块清" 0"的过程,需要对所有空闲块执行写操作;宿主机上识别 "0" 块时, 需要对所有数据块执行读操作, 即现有方法具有比较大的操作开销, 较 多的磁盘读写操作浪费大量的磁盘带宽且耗时较长; 而且,现有方法中宿主机 通过识别 "0" 块间接判断虚拟磁盘中每一数据块的空间占用情况, 故无法实 时获取虚拟机磁盘全局空闲数据块信息; 此外, 该现有方法应用受限, 只适用 于动态分配的映像格式, 对于预先分配的镜像格式则无法进行空闲块释放。
发明内容
本发明实施例提供一种虚拟机存储空间管理方法及物理主机,以有效地进 行存储空间管理, 提高存储系统的利用率。
一种虚拟机存储空间管理方法, 应用于物理主机, 该物理主机包括: 硬件 层,运行在该硬件层之上的虚拟机监控单元层,运行在该虚拟机监控单元层之 上的虚拟机, 其中, 该虚拟机部署有存储气球代理模块, 该虚拟机监控单元层 部署有存储气球守护进程模块, 该方法包括:
该存储气球代理模块根据预定义文件占用虚拟存储空间的大小获取所占 用的部分虚拟存储块,将该虚拟存储块对应的虚拟存储空闲块信息传递给存储 气球守护进程模块;
该存储气球守护进程模块将虚拟存储空闲块信息对应的物理存储空间进 行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记为不可 用。
一种虚拟机存储空间管理系统,包括部署于虚拟机中的存储气球代理模块 和部署于虚拟机监控单元层中的存储气球守护进程模块;
该存储气球代理模块,用于根据预定义文件占用虚拟存储空间的大小获取 所占用的部分虚拟存储块,将该虚拟存储块对应的虚拟存储空闲块信息传递给 存储气球守护进程模块;
该存储气球守护进程模块,用于将虚拟存储空闲块信息对应的物理存储空 间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记为 不可用。
一种物理主机, 包括:硬件层,运行在该硬件层之上的虚拟机监控单元层, 运行在该虚拟机监控单元层之上的至少一个虚拟机, 其中, 该虚拟机部署有存 储气球代理模块, 该虚拟机监控单元层部署有存储气球守护进程模块:
该存储气球代理模块,用于根据预定义文件占用虚拟存储空间的大小获取 所占用的部分虚拟存储块,将该部分虚拟存储块对应的虚拟存储空闲块信息传 递给存储气球守护进程模块;
该存储气球守护进程模块,用于将该虚拟存储空闲块信息对应的物理存储 空间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记 为不可用。
本发明实施例采用在虚拟机部署存储气球代理模块,在虚拟机监控单元层 部署存储气球守护进程模块,由存储气球代理模块根据预定义文件占用虚拟存 储空间情况获取虚拟存储空闲块信息,并将该虚拟存储空闲块信息传递给存储 气球守护进程模块,由存储气球守护进程模块将该虚拟存储空闲块信息对应的 物理存储空间释放的技术方案。采用该技术方案, 一方面可以实时获取虚拟存 储空闲块信息, 实时性好; 另一方面避免了大量存储系统读写操作, 系统开销 小; 并且该方法通过文件系统接口来获取虚拟存储空闲块信息, 无需了解文件 系统的实现细节,通用性好,对于动态分配的映像格式和预先分配的镜像格式 都能适用。
附图说明
图 1是虚拟机架构示意图;
图 2是本发明实施例一种虚拟机存储空间管理方法的流程示意图; 图 2a是存储图 2所示方法的步骤 100的具体步骤流程示意图;
图 2b是图 2所示方法的步骤 200的具体步骤流程示意图;
图 3是本发明实施例一种虚拟机存储空间管理系统的逻辑结构图; 图 4是本发明实施例一种物理主机的逻辑结构示意图;
图 5a是本发明应用场景例一种虚拟机存储空间管理方法的流程示意图; 图 5b是本发明应用场景例一种虚拟机存储空间管理方法的流程示意图。
具体实施方式
本发明实施例提供一种虚拟机存储空间管理方法,应用于物理主机, 该物 理主机包括: 硬件层, 运行在硬件层之上的虚拟机监控单元层 VMM, 运行在 虚拟机监控单元层 VMM之上的虚拟机, 其中,虚拟机中部署有存储气球代理 ( SBA, Storage Balloon Agent )模块, 虚拟机监控单元层 VMM中部署有存储 气球守护进程 ( SBD, Storage Balloon Daemon )模块; 该方法通过部署在虚拟 机中的 SBA用直接的方法获得虚拟存储空闲块信息,将获取的虚拟存储空闲块 信息传递给虚拟机监控单元层 VMM里面与 SBA配合的 SBD, SBD在虚拟机存 储格式里标记并释放虚拟存储空闲块信息对应的物理存储空间。本发明实施例 还提供相应的虚拟机存储空间管理系统和物理主机。 以下分别进行详细说明。
如图 2所示, 本发明实施例提供的虚拟机存储空间管理方法, 该方法可以 应用于物理主机, 该物理主机包括: 硬件层, 运行在该硬件层之上的虚拟机监 控单元层, 运行在该虚拟机监控单元层之上的虚拟机, 其中, 该虚拟机部署有 存储气球代理模块, 该虚拟机监控单元层部署有存储气球守护进程模块, 该方 法可以包括如下步骤:
100、 存储气球代理模块根据预定义文件占用虚拟存储空间的大小获取所 占用的部分虚拟存储块,将该虚拟存储块对应的虚拟存储空闲块信息传递给存 储气球守护进程模块。 本步骤中,部署于虚拟机中的 SB Α根据预定义文件占用虚拟存储空间情况 可以直接获取虚拟存储空闲块信息, 无需对每一空闲块执行清 "0" 的写操作; 并且, 在一种实现方式下, 存储气球代理模块 SB A可以通过共享内存的方 式将虚拟存储块对应的虚拟存储空闲块信息传递给部署于虚拟机监控器层的 存储气球守护进程模块 SBD, 从而无需对每一空闲块执行读操作。
其中, 该预定义文件可以是预先定义的任意类型的文件, 其作用是占据一 定的虚拟存储空闲空间。 例如, 对于虚拟机视窗操作系统(Windows ) 的 C盘 可以创建新的文件作为预定义文件。
200、 存储气球守护进程模块将该虚拟存储空闲块信息对应的物理存储空 间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记为 不可用。
本步骤中, SBD执行释放空闲块的操作。 在一种实现方式下, 根据预设的 策略, SBD可以将部分或者全部标记为空闲的虚拟存储块对应的物理存储空间 释放, 并将已释放的物理存储空间对应的虚拟存储块标记为不可用。
应当理解的是, 当物理主机的存储系统为磁盘时,预定义文件占用的是虚 拟磁盘空间, 释放和标记的物理存储空间具体为物理磁盘空间。
请参阅图 2a, 在一个优选方案中, 步骤 100可以具体包括以下步骤: 110、 部署于虚拟机中的 SBA将预定义文件占用虚拟存储空间的大小与获 得的限值范围进行比较。
需要说明的是,针对将预定义文件占用虚拟存储空间的大小与限值范围进 行比较所获得的不同结果,将执行不同的操作。该限值范围可以是预先设置的 固定值,也可以根据获取的其它参数通过规定的算法来获得。在一种实现方式 下, 该步骤 110具体可以包括:
111、 SBA调用文件系统获取虚拟存储空闲空间的大小和预定义文件占 用虚拟存储空间的大小, 从存储气球守护进程模块获得允许预定义文件占 用虚拟存储空闲空间的下限比例和上限比例。
其中, 虚拟机通过文件系统接口获取虚拟存储空闲空间信息, 该步骤 按一定周期重复执行, 例如, 相邻两次执行的时间间隔可选 1一 5秒。 允许预定义文件占用虚拟存储空闲空间的下限比例和上限比例在存储 气球守护进程模块中预先设置。 其中上限比例优选为 80~90% , 下限比例优 选为 60~70%。
112、 SBA将下限比例和上限比例分别与虚拟存储空闲空间的大小的乘 积作为预先设置的限值范围的下限值和上限值。
假定虚拟存储空闲空间的大小为 X,下限比例为 L1 % ,上限比例为 L2% , 则限值范围的下限值为 X*L1 % , 上限值为 X*L2%。
113、虚拟机将预定义文件占用虚拟存储空间的大小分别与限值范围的 下限值和上限值进行比较。
假定预定义文件占用虚拟存储空间的大小为 S , 则分别判断 S与
X*L1%、 X*L2%的大小。
120、 若预定义文件占用的虚拟存储空间的大小小于限值范围的下限值, SBA调用文件系统扩大预定义文件, 为扩大后的预定义文件分配虚拟存储块。
需要说明的是, 预定义文件小于下限值, 说明虚拟存储的空闲空间过大, 此时有必要将一部分空闲空间释放。 为了释放部分空闲空间, 首先需要扩大预 定义文件, 增加其占用的空闲空间, 从而将其扩大部分占用的空闲空间释放。 在一种实现方式下, 该步骤 120具体可以包括:
121、 SBA调用文件系统预分配接口, 传入限值范围的中间值作为扩大 后预定义文件的大小, 中间值等于下限值和上限值的和的一半。
下限值为 X*L1% , 上限值为 X*L2%时, 中间值为 X* ( Ll% +L2% ) 12。
122、 SBA虚拟机文件系统为扩大后的预定义文件分配虚拟存储块。 例如, 对于大小为 X* ( Ll% +L2% ) /2的预定义文件, 分配虚拟存储 块可以为 [bl , b2, ...bn]。
123、 SBA调用文件系统锁 (lock )接口, 锁定为扩大后的预定义文件 分配的虚拟存储块, 以不被存储设备碎片整理工具修改。
130、 SBA调用文件系统获得预定义文件的扩大部分所占用的虚拟存储块。 对于预定义文件的扩大部分, 即 [S , X* ( Ll% +L2% ) /2]区间, 虚拟机调 用文件系统 "问价偏移- >数据块" 映射(bmap )接口, 获得占用的虚拟存储 块 [bs , ...bn]。 140、 SB A将表示该虚拟存储块的第一虚拟存储空闲块信息通过共享内存 的方式传递给存储气球守护进程模块。
第一虚拟存储空闲块信息被传递给存储气球守护进程模块,其对应的物理 存储空间作为回收释放的候选。第一虚拟存储空闲块信息的传递方式以共享内 存方式进行, 该方式筒单可靠。
请参阅图 2b, 在一种实现方式下, 步骤 200具体可以包括以下步骤:
210、部署于虚拟机监控单元层 VMM中的 SBD判断第一虚拟存储空闲块信 息对应的虚拟存储块是否可用, 若可用, 则将该虚拟存储块标记为空闲。
SBD通过共享内存方式, 获取第一虚拟存储空闲块信息, 判断其对应的虚 拟存储块是否可用, 若可用, 则将该虚拟存储块标记为空闲; 若不可用, 则不 作处理。 处理完毕后, SBD应答 SBA。
220、 SBD将部分或者全部标记为空闲的虚拟存储块对应的物理存储空间 释放, 并将已释放的物理存储空间对应的虚拟存储块标记为不可用。
本步骤中, SBD执行释放空闲块的操作。 根据预设的策略, SBD可以将部 分或者全部标记为空闲的虚拟存储块对应的物理存储空间释放,并将已释放的 物理存储空间对应的虚拟存储块标记为不可用。
在实际执行中, 筒单起见, 可以执行一种筒单的策略, 即: 对于标记为空 闲的虚拟存储块,将该虚拟存储块对应的物理存储空间全部释放, 并将已释放 的物理存储空间对应的虚拟存储块标记为不可用。
出于提高虚拟存储管理水平的目的, 也可以执行一种优选的策略, 即: 当 虚拟机内部分配和 /或释放存储空间的操作频率等于或者大于阈值(这里的阈 值可以是预先设置的, 也可以是动态计算得到的) 时, SBD减少释放空闲块 的比例; 当虚拟机内部分配和 /或释放存储空间的操作较少时, SBD增加释放 空闲块的比例。 具体为: SBD判断虚拟机内部分配或释放存储空间的操作频 率是否等于或大于预先设置的阀值, 若否,按照预先设置的比例释放标记为空 闲的虚拟存储块对应的物理存储空间, 例如按 80%的比例释放; 若是, 则按照 预先设置的速率降低预先设置的比例,按照降低后的比例释放标记为空闲的虚 拟存储块对应的物理存储空间, 例如按每秒 1%的速度降低预先设这的比例 80%, 并按降低后的比例例如 75%或者 70%等释放。 降低空闲块释放比例的原 因在于, 这些空闲块在短期内很可能被再次使用, 这样可以减少因频繁释放和 再分配带来的开销。 当然, 虚拟机内部分配和释放存储空间的操作较少时, 应 适当增加释放空闲块的比例。若空闲块对应的存储空间为文件, 则释放空闲数 据块功能依赖于导出宿主机文件系统内部接口 ( free_blocks (start_block, count) ); 若虚拟存储块对应的存储空间为块设备, 则释放空闲块时通知底层数 据块存储系统释放。
请参阅图 2a, 本发明实施例提供的方法, 在步骤 110、 SBA将预定义文件 占用虚拟存储空间的大小与获得的限值范围进行比较之后, 还可以包括:
150、 若预定义文件占用的虚拟存储空间大于限值范围的上限值, 调用文 件系统获得预定义文件的待缩减部分所占用的虚拟存储块。
预定义文件大于上限值,说明虚拟存储的空闲空间过小, 此时有必要将一 部分预定义文件占用的空闲空间返还给虚拟机文件系统。为了返还部分空闲空 间, 就需要收缩预定义文件, 减少其占用的空闲空间, 从而将其缩减部分占用 的空闲空间释放。
SB A获取一个目标值作为收缩后预定义文件的大小,大于该目标值的部分 是待缩减部分, 将被截断去掉。 一种实现方式中, 预定义文件的收缩以限值范 围的中间值作为目标大小, 在预定义文件的原大小为 S , 中间值为 X* ( Ll% +L2% ) /2时, 预定义文件的待收缩部分为 [X* ( Ll% +L2% ) /2 , S]区间, 对 于该区间, 虚拟机调用 "文件系统- >数据块" 映射(bmap )接口, 获得对应 的虚拟存储块。
160、 SBA将表示该待缩减部分所占用的虚拟存储块的第二虚拟存储空闲 块信息传递给 SBD,通知 SBD禁止标记该待缩减部分所占用的虚拟存储块为空 闲状态。
支若该待缩减部分所占用的虚拟存储块被标记为空闲状态,将被 SBD进行 释放, 无法返还给虚拟机文件系统, 因而, 有必要及时通知 SBD确保该缩减部 分所占用的虚拟存储块不被标记为空闲。在一种实现方式下, 第二虚拟存储空 闲块信息的传递方式以共享内存方式进行, 该方式筒单可靠。
SBD收到 SBA传递的第二虚拟存储空闲块信息后,将执行步骤: 230、 SBD 判断第二虚拟存储空闲块信息对应的虚拟存储块是否为空闲, 若为空闲, 则将 该虚拟存储块标记为可用。
SBD通过共享内存方式, 获取第二虚拟存储空闲块信息, 判断该第二虚拟 存储空闲块信息对应的虚拟存储块是否为空闲, 若为空闲则标记为可用; 若该 第二虚拟存储空闲块信息对应的虚拟存储块为不可用,则不作处理。需要注意, 虚拟机中分配数据块仅为虚拟层面,真正的物理存储空间的数据块分配是在写 操作发生时进行的。 处理完毕后, SBD应答 SBA。
170、 SBA调用文件系统收缩所述预定义文件。
SBA调用文件系统截断 (truncate )接口, 传入预先设置的限值范围的中 间值作为收缩后预定义文件的大小, 中间值等于下限值和上限值的和的一半; 将标记为可用的、该预定义文件的待缩减部分即截断部分所占用的虚拟存 储块(即第二虚拟存储空闲块信息对应的虚拟存储块)返还给虚拟机文件系统。
上述的方法的优选方案分别对预定义文件占用的虚拟存储空间小于限值 范围的下限值和大于限值范围的上限值时进行了处理。
需要注意的是,在预定义文件的大小介于限值范围的下限值和上限值之间 时, 说明虚拟存储的空闲空间大小合适, 将不予处理。
本发明实施例提供的虚拟机存储空间管理方法, 是按一定周期循环执行 的。 在步骤 110、 部署于虚拟机中的 SBA将预定义文件占用虚拟存储空间的大 小与获得的限值范围进行比较之后,针对比较的结果分别执行不同的操作, 在 执行完毕后, 无论预定义文件的大小和获得的限值范围是否发生变化,返回重 新进行下一个循环周期。
综上所述, 本发明实施例提供的虚拟机存储空间管理方法中: 虚拟机中通 过 SBA实时获取虚拟存储空闲数据块信息,主动向宿主机告知虚拟机存储空间 使用情况, 将待释放的空闲块信息传递给部署于虚拟机监控器层(即宿主机) 的 SBD, 宿主机通过 SBD进行虚拟存储空闲块的释放和再分配, 可见, 宿主机 可以实时获取虚拟机存储空间使用情况, 实时性好;
以及, 本发明实施例提供的虚拟机存储空间管理方法,避免了大量存储系 统读写操作, 从而系统开销小; 并且, 通过文件系统接口来获取虚拟存储空闲 块, 无需了解文件系统的实现细节, 通用性好;
而且, 本发明实施例提供的虚拟机存储空间管理方法,对于动态分配的映 像格式和预先分配的镜像格式都能适用。
本发明实施例提供的虚拟机存储空间管理方法中,通过实时识别虚拟机存 储空间使用情况(即识别虚拟机存储系统中的有效数据块和空闲数据块), 可 以释放该虚拟存储空闲块对应的物理存储空间,从而可以从而有效地进行存储 空间管理,, 提高底层存储系统的利用率。 此外, 通过识别有效数据块, 还可 以有效提升存储在线迁移、 虚拟机克隆、 映像备份这类 I/O密集型操作的效率。 可见,本发明实施例提供的虚拟机存储空间管理方案可用于存储系统自动精筒 部署空间管理。
如图 3所示, 本发明实施例提供一种虚拟机存储空间管理系统, 包括部署 于虚拟机中的存储气球代理( SBA, Storage Balloon Agent )模块和部署于虚拟 机监控单元层中的存储气球守护进程 ( SBD , Storage Balloon Daemon )模块。 该系统运行于物理主机中。
下面,首先对运行虚拟机存储空间管理系统的物理主机的逻辑架构进行说 明, 如图 4所示, 该物理主机包括:
硬件层: 硬件层是虚拟化环境运行的整个硬件平台, 可以包括处理器(如
CPU ), 内存 Memory, 存储系统(如磁盘 Disk, 硬盘 Hard Disk )、 网卡和输入 输出设备(I/O )等。
宿主机: 即虚拟机监控器(VMM )层, 它作为一个管理层, 完成硬件资 源的管理、 分配; 为虚拟机呈现一个虚拟硬件平台; 虚拟机的调度和隔离。 有 些 VMM的实现里面需要一个特权虚拟机配合, 两者结合组成宿主机 ( HOST )。 虚拟硬件平台对其上的虚拟机提供各种硬件资源, 如 VCPU、 虚拟内存、 虚拟 磁盘 VDisk、 虚拟网卡等。 其中虚拟磁盘对应宿主机里面的一个文件, 或者一 个逻辑块设备。 由于虚拟磁盘的连续块在宿主机中可以是离散存放的, 为了便 于组织和管理,虚拟机磁盘映像一般通过映像格式来描述, 其中的元数据区用 于存放虚拟磁盘数据块与宿主机中数据块之间的映射关系。
虚拟机: 虚拟机运行宿主机为其准备的虚拟平台中。 大多数时间虚拟机的 执行不受宿主机的影响。
下面, 对存储气球代理模块(SBA )和存储气球守护进程(SBD )模块进 行说明。 其中, SBA部署于虚拟机中, SBD部署于虚拟机监控器层。 存储气球代理模块 401 , 用于根据预定义文件占用虚拟存储空间的大小获 取所占用的部分虚拟存储块,将该虚拟存储块对应的虚拟存储空闲块信息传递 给存储气球守护进程模块。
存储气球守护进程模块 402, 用于将虚拟存储空闲块信息对应的物理存储 空间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记 为不可用。
在一种实现方式下, 存储气球代理模块 401可以具体包括:
比较单元,用于将预定义文件占用虚拟存储空间的大小与获得的限值范围 进行比较;
扩大单元, 用于若预定义文件占用的虚拟存储空间小于限值范围的下限 值, 则调用文件系统扩大预定义文件, 为扩大后的预定义文件分配数据块; 获取单元,用于调用文件系统获取预定义文件的扩大部分所占用的虚拟存 储块;
传递模块,用于将表示该虚拟存储块的第一虚拟存储空闲块信息传递给存 储气球守护进程模块。
在一种实现方式下, 存储气球守护进程模块 402可以具体包括:
判断单元, 用于判断第一虚拟存储空闲块信息对应的虚拟存储块是否可 用, 若可用, 则将该虚拟存储块标记为空闲;
释放及标记单元,用于根据策略将部分或者全部标记为空闲的虚拟存储块 对应的物理存储空间释放,并将已释放的物理存储空间对应的虚拟存储块标记 为不可用。
综上所述, 本发明实施例提供的虚拟机存储空间管理系统中: 虚拟机中通 过 SBA实时获取虚拟存储空闲数据块信息,主动向宿主机告知虚拟机存储空间 使用情况, 将待释放的空闲块信息传递给部署于虚拟机监控器层(即宿主机) 的 SBD, 宿主机通过 SBD进行虚拟存储空闲块的释放和再分配, 可见, 宿主机 可以实时获取虚拟机存储空间使用情况, 实时性好;
以及, 本发明实施例提供的虚拟机存储空间管理系统,避免了大量存储系 统读写操作, 从而系统开销小; 并且, 通过文件系统接口来获取虚拟存储空闲 块, 无需了解文件系统的实现细节, 通用性好; 而且, 本发明实施例提供的虚拟机存储空间管理系统,对于动态分配的映 像格式和预先分配的镜像格式都能适用。
本发明实施例提供的虚拟机存储空间管理系统中,通过实时识别虚拟机存 储空间使用情况(即识别虚拟机存储系统中的有效数据块和空闲数据块), 可 以释放该虚拟存储空闲块对应的物理存储空间,从而可以从而有效地进行存储 空间管理,, 提高底层存储系统的利用率。 此外, 通过识别有效数据块, 还可 以有效提升存储在线迁移、 虚拟机克隆、 映像备份这类 I/O密集型操作的效率。 可见,本发明实施例提供的虚拟机存储空间管理方案可用于存储系统自动精筒 部署空间管理。
如图 4所示, 本发明实施例还提供一种物理主机, 包括硬件层, 运行在硬 件层之上的虚拟机监控单元层 VMM, 运行在虚拟机监控单元层 VMM之上的 至少一个虚拟机, 其中, 该虚拟机部署有存储气球代理, 该虚拟机监控单元层 部署有存储气球守护进程:
存储气球代理模块,用于根据预定义文件占用虚拟存储空间的大小获取所 占用的部分虚拟存储块,将该部分虚拟存储块对应的虚拟存储空闲块信息传递 给存储气球守护进程模块。
存储气球守护进程模块,用于将该虚拟存储空闲块信息对应的物理存储空 间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记为 不可用。
在一种实现方式下,该存储气球代理模块具体用于将该预定义文件占用虚 拟存储空间的大小与获得的限值范围进行比较,若该预定义文件占用的虚拟存 储空间小于限值范围的下限值, 则调用文件系统扩大预定义文件, 为扩大后的 预定义文件分配虚拟存储块,调用文件系统获得预定义文件的扩大部分所占用 的虚拟存储块,将表示该虚拟存储块的第一虚拟存储空闲块信息传递给存储气 球守护进程模块;
该存储气球守护进程模块具体用于判断第一虚拟存储空闲块信息对应的 虚拟存储块是否可用, 若可用, 则将该虚拟存储块标记为空闲, 根据策略将部 分或者全部标记为空闲的虚拟存储块对应的物理存储空间释放,并将已释放的 物理存储空间对应的虚拟存储块标记为不可用。 在一种实现方式下, 该存储气球代理模块进一步用于: 若预定义文件占用 的虚拟存储空间大于限值范围的上限值,调用文件系统获得预定义文件的待缩 减部分所占用的虚拟存储块,将表示虚拟存储块的第二虚拟存储空闲块信息传 递给存储气球守护进程模块; 以及, 调用文件系统收缩预定义文件。
该存储气球守护进程模块进一步用于:判断该第二虚拟存储空闲块信息对 应的虚拟存储块是否为空闲, 若为空闲, 则将该虚拟存储块标记为可用。
综上所述, 本发明实施例提供的物理主机中: 虚拟机中通过 SBA实时获取 虚拟存储空闲数据块信息, 主动向宿主机告知虚拟机存储空间使用情况,将待 释放的空闲块信息传递给部署于虚拟机监控器层(即宿主机)的 SBD, 宿主机 通过 SBD进行虚拟存储空闲块的释放和再分配, 可见, 宿主机可以实时获取虚 拟机存储空间使用情况, 实时性好;
以及, 本发明实施例提供的物理主机, 避免了大量存储系统读写操作, 从 而系统开销小; 并且, 通过文件系统接口来获取虚拟存储空闲块, 无需了解文 件系统的实现细节, 通用性好;
而且, 本发明实施例提供的物理主机, 对于动态分配的映像格式和预先分 配的镜像格式都能适用。
本发明实施例提供的物理主机中,通过实时识别虚拟机存储空间使用情况 (即识别虚拟机存储系统中的有效数据块和空闲数据块), 可以释放该虚拟存 储空闲块对应的物理存储空间,从而可以从而有效地进行存储空间管理,提高 底层存储系统的利用率。 此外, 通过识别有效数据块, 还可以有效提升存储在 线迁移、 虚拟机克隆、 映像备份这类 I/O密集型操作的效率。 可见, 本发明实 施例提供的虚拟机存储空间管理方案可用于存储系统自动精筒部署空间管理。
为便于理解,下面以一具体的应用场景对上述实施例中描述的虚拟机存储 空间管理方法进行详细描述。 为清楚起见, 将 SB A和 SBD各自执行的步骤分开 描述。 在本实施例中, 以底层存储系统为磁盘为例进行说明, 相应的, 物理存 储空间为物理磁盘空间, 虚拟存储空间为虚拟磁盘空间。
如图 5a所示, 下面首先描述 SBA执行的步骤, 包括:
201、 如果预定义文件(F, 比如对于 Windows的 C盘可以为 C:\balloon.sys ) 不存在, 则创建预定义文件。 202、 获取预定义文件 F的文件大小 S。
203、 通过文件系统接口获得虚拟磁盘的空闲空间信息, 包括空闲空间的 大小 X。
204、 从 SBD获取允许 F占用虚拟磁盘空闲空间的下限(Ll% )和上限比例 ( L2% ) 的配置, 如图 4所示。
205、 将预定义文件的大小 S与预先设置的限值范围进行比较, 如果 S<X*L1% , 说明预定义文件 F占用空闲空间过小, 则扩大预定义文件。
2011、 调用文件系统预分配(fallocate )接口, 传入 X*(Ll%+L2%)/2 作为预定义文件 F的大小, 文件系统为该文件分配数据块 [bl,b2, ...bn]。
2022、 调用文件系统锁 (lock)接口, 确保预定义文件 F对应虚拟磁盘 的数据块不会被磁盘碎片整理类工具修改。
2023、 对于预定义文件的扩大部分, 即 [S, X*(Ll%+L2%)/2]区间, 调用文件系统"文件偏移- >数据块 "映射( bmap )接口, 获得对应的虚拟 磁盘块组。
2024、 ^fc该虚拟磁盘块组对应的第一虚拟磁盘空闲块信息通过共享 内存的方式传递给 SBD , 该虚拟磁盘块组将作为回收释放的候选。 如图 4所示,第一虚拟磁盘空闲块信息,例如 [2,3,14,15,16,17,18,19,20, ...,24]。 同时将一个扩大消息传递给 SBD, 用于通知 SBD进行相应的操作。
206、 如果 S>X*L2% , 说明预定义文件 F占用空闲空间过大, 则收缩预定 义文件。
2061、 系统将以 X*(Ll%+L2%)/2作为收缩后 F的大小, 因而对于 [X*(Ll%+L2%)/2, S]区间, 调用文件系统 "文件偏移- >数据块"映射接 口 (bmap ), 获得对应的虚拟磁盘块组。
2062、 将该虚拟磁盘块组对应的第二虚拟磁盘空闲块信息通过共享 内存的方式传递给 SBD。 同时将一个收缩消息传递给 SBD, 用于通知
SBD进行相应的操作,以及确保该虚拟磁盘块组没有被 SBD标记为空闲 状态。
2063、 调用文件系统的截断(truncate )接口, 传入 X*(Ll%+L2%)/2 作为收缩后 F的大小, 把该虚拟磁盘块组返还给虚拟机文件系统。 207、 如果 X*L1%<=S<=X*L2% , 说明预定义文件 F占用空闲空间大小适 应, 无需执行扩大或收缩操作。
208、 等待适当时间后, 转到步骤 202。
需要注意的是, 当预定义文件 F的大小受限于文件系统时, 可能需要创建 多个预定义文件F。
如图 5b所示, 下面描述 SBD执行的步骤, 包括:
301、 提供用户接口, 配置 SBA允许预定义文件占用虚拟磁盘空闲空间的 下限、 上限比例。 该上、 下限比例可以灵活设置, 比如在存储在线迁移时, 适 当提高比例可以达到进一步减少虚拟磁盘空闲空间拷贝的目的。一般可以将下 限比例设置在 60%左右, 上限比例设置在 80%~90%之间。
302、 处理所收到的 SBA发出的扩大消息。 该步骤中, SBD通过共享内存 方式获取需要释放的虚拟磁盘块对应的第一虚拟磁盘空闲块信息,对相应的虚 拟磁盘块进行标记处理, 具体包括以下步骤:
3031、判断该第一虚拟磁盘空闲块信息对应的虚拟磁盘块是否可用, 若可用, 则标记为空闲; 若不可用, 不做处理。
3032、 在判断和标记完毕后, 应答 SBA。
3033、 根据策略, 释放部分或者全部空闲块对应的磁盘空间, 标记 相应块为不可用。
一种筒单的策略: 对于所有标记为空闲的块, 全部释放并且标记为 不可用。
一种更优的策略: 当虚拟机内部分配和释放磁盘空间的操作频率等 于或者大于某个阈值时, SBD减少释放空闲数据块的比例, 因为这些空 闲数据块在短期内很可能被再次用到, 这样可以减少因为频繁释放和再 分配带来的开销;当虚拟机内部分配和释放磁盘空间的操作较少时, SBD 增加释放空闲数据块的比例。
需要注意的是, 数据块为文件方式时, 释放空闲块功能依赖于导出 宿主机文件系统内部接口 ( free_blocks(st art_block, count) ); 数据块为块 接口方式时, 通知底层块存储系统释放。
303、 处理所收到的 SB A发出的收缩消息。 该步骤中, SBD通过共享内存 方式获取需要收回的虚拟磁盘块对应的第二虚拟磁盘空闲块信息,对相应的虚 拟磁盘块进行标记处理, 具体包括以下步骤:
3031、 判断虚拟磁盘格式中相应虚拟磁盘块是否为空闲, 若是, 则 标记为可用。
3032、 判断虚拟磁盘格式中相应虚拟磁盘块是否为不可用, 若是则 不作处理。 需要注意, 真正的数据块分配在写操作发生时进行。
3033、 应答 SBA。
综上所述, 本发明实施例提供的虚拟机存储空间管理方案中: 虚拟机中通 过 SBA实时获取虚拟存储空闲数据块信息,主动向宿主机告知虚拟机存储空间 使用情况, 将待释放的空闲块信息传递给部署于虚拟机监控器层(即宿主机) 的 SBD, 宿主机通过 SBD进行虚拟存储空闲块的释放和再分配, 可见, 宿主机 可以实时获取虚拟机存储空间使用情况, 实时性好;
以及, 本发明实施例提供的虚拟机存储空间管理方案,避免了大量存储系 统读写操作, 从而系统开销小; 并且, 通过文件系统接口来获取虚拟存储空闲 块, 无需了解文件系统的实现细节, 通用性好;
而且, 本发明实施例提供的虚拟机存储空间管理方案,对于动态分配的映 像格式和预先分配的镜像格式都能适用。
本发明实施例提供的虚拟机存储空间管理方案中,通过实时识别虚拟机存 储空间使用情况(即识别虚拟机存储系统中的有效数据块和空闲数据块), 可 以释放该虚拟存储空闲块对应的物理存储空间,从而可以从而有效地进行存储 空间管理, 提高底层存储系统的利用率。 此外, 通过识别有效数据块, 还可以 有效提升存储在线迁移、 虚拟机克隆、 映像备份这类 I/O密集型操作的效率。 可见,本发明实施例提供的虚拟机存储空间管理方案可用于存储系统自动精筒 部署空间管理。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读 存储介质中, 存储介质可以包括: 只读存储器(ROM, Read-Only Memory )、 随机存取存者器(RAM, random access memory )、 磁盘或光盘等。
以上对本发明实施例所提供的虚拟机存储空间管理方法、系统以及计算机 了阐述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同 时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体实施方式及应用 范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求
1、 一种虚拟机存储空间管理方法, 其特征在于, 应用于物理主机, 所述 物理主机包括: 硬件层, 运行在所述硬件层之上的虚拟机监控单元层, 运行在 所述虚拟机监控单元层之上的虚拟机, 其中, 所述虚拟机部署有存储气球代理 模块, 所述虚拟机监控单元层部署有存储气球守护进程模块, 该方法包括: 所述存储气球代理模块根据预定义文件占用虚拟存储空间的大小获取所 占用的部分虚拟存储块,将所述虚拟存储块对应的虚拟存储空闲块信息传递给 所述存储气球守护进程模块;
所述存储气球守护进程模块将所述虚拟存储空闲块信息对应的物理存储 空间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块标记 为不可用。
2、 根据权利要求 1所述的方法, 其特征在于, 所述存储气球代理模块根据 预定义文件占用虚拟存储空间的大小获取所占用的部分虚拟存储块,将所述虚 拟存储块对应的虚拟存储空闲块信息传递给所述存储气球守护进程模块包括: 所述存储气球代理模块将所述预定义文件占用虚拟存储空间的大小与获 得的限值范围进行比较;
若所述预定义文件占用的虚拟存储空间小于所述限值范围的下限值,则调 用文件系统扩大所述预定义文件, 为扩大后的预定义文件分配虚拟存储块; 调用文件系统获得所述预定义文件的扩大部分所占用的虚拟存储块; 将表示所述虚拟存储块的第一虚拟存储空闲块信息传递给所述存储气球 守护进程模块。
3、 根据权利要求 2所述的方法, 其特征在于, 所述存储气球守护进程模块 将所述虚拟存储空闲块信息对应的物理存储空间进行部分或全部释放,并将已 释放的物理存储空间对应的虚拟存储块标记为不可用包括:
所述存储气球守护进程模块判断所述第一虚拟存储空闲块信息对应的虚 拟存储块是否可用, 若可用, 则将所述虚拟存储块标记为空闲;
根据策略将部分或者全部标记为空闲的虚拟存储块对应的物理存储空间 释放, 并将已释放的物理存储空间对应的虚拟存储块标记为不可用。
4、 根据权利要求 2所述的方法, 其特征在于, 所述存储气球代理模块将所 述预定义文件占用虚拟存储空间的大小与获得的限值范围进行比较之后还包 括:
若所述预定义文件占用的虚拟存储空间大于所述限值范围的上限值,调用 文件系统获得所述预定义文件的待缩减部分所占用的虚拟存储块;
将表示所述虚拟存储块的第二虚拟存储空闲块信息传递给所述存储气球 守护进程模块。
5、 根据权利要求 4所述的方法, 其特征在于, 所述将表示所述虚拟存储块 的第二虚拟存储空闲块信息传递给所述存储气球守护进程模块之后还包括: 所述存储气球守护进程模块判断所述第二虚拟存储空闲块信息对应的虚 拟存储块是否为空闲, 若为空闲, 则将该虚拟存储块标记为可用; 所述存储气 球代理模块调用文件系统收缩所述预定义文件。
6、 根据权利要求 2至 5中任一项所述的方法, 其特征在于, 所述存储气球 代理模块将所述预定义文件占用虚拟存储空间的大小与获得的限值范围进行 比较包括:
所述存储气球代理模块调用文件系统获取所述虚拟存储空闲空间的大小 和所述预定义文件占用虚拟存储空间的大小,从所述存储气球守护进程模块获 得允许所述预定义文件占用所述虚拟存储空闲空间的下限比例和上限比例; 将所述下限比例和上限比例分别与所述虚拟存储空闲空间的大小的乘积 作为所述限值范围的下限值和上限值;
将所述预定义文件占用虚拟存储空间的大小分别与所述限值范围的下限 值和上限值进行比较。
7、 根据权利要求 2或 3所述的方法, 其特征在于, 所述调用文件系统扩大 所述预定义文件包括:
所述存储气球代理模块调用文件系统预分配接口,传入所述限值范围的中 间值作为扩大后预定义文件的大小,所述中间值等于所述限值范围的下限值和 上限值的和的一半。
8、 根据权利要求 5所述的方法, 其特征在于, 所述调用文件系统收缩所述 预定义文件包括:
所述存储气球代理模块调用文件系统截断接口,传入所述限值范围的中间 值作为收缩后预定义文件的大小,所述中间值等于所述限值范围的下限值和上 限值的和的一半;
将标记为可用的、所述预定义文件的截断部分对应的虚拟存储块返还给文 件系统。
9、 根据权利要求 2或 3所述的方法, 其特征在于, 所述为扩大后的预定义 文件分配虚拟存储块之后还包括:
所述存储气球代理模块调用文件系统锁接口,锁定为扩大后的预定义文件 分配的虚拟存储块。
10、 根据权利要求 3所述的方法, 其特征在于, 所述根据策略将部分或者 全部标记为空闲的虚拟存储块对应的物理存储空间释放包括:判断虚拟机内部 分配或释放存储空间的操作频率是否大于预先设置的阀值, 若否,按照预先设 置的比例释放所述标记为空闲的虚拟存储块对应的物理存储空间; 若是, 则按 照预先设置的速率降低该预先设置的比例,按照降低后的比例释放所述标记为 空闲的虚拟存储块对应的物理存储空间。
11、 根据权利要求 1至 5任一项所述的方法, 其特征在于, 所述将所述虚拟 存储块对应的虚拟存储空闲块信息传递给所述存储气球守护进程模块, 包括: 所述存储气球代理模块将所述虚拟存储块对应的虚拟存储空闲块信息通 过共享内存通道传递给所述存储气球守护进程模块。
12、 一种虚拟机存储空间管理系统, 其特征在于, 包括部署于虚拟机中的 存储气球代理模块和部署于虚拟机监控单元层中的存储气球守护进程模块; 所述存储气球代理模块,用于根据预定义文件占用虚拟存储空间的大小获 取所占用的部分虚拟存储块,将所述虚拟存储块对应的虚拟存储空闲块信息传 递给所述存储气球守护进程模块;
所述存储气球守护进程模块,用于将所述虚拟存储空闲块信息对应的物理 存储空间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块 标记为不可用。
13、 一种物理主机, 其特征在于, 所述物理主机包括: 硬件层, 运行在所 述硬件层之上的虚拟机监控单元层,运行在所述虚拟机监控单元层之上的至少 一个虚拟机, 其中, 所述虚拟机部署有存储气球代理模块, 所述虚拟机监控单 元层部署有存储气球守护进程模块:
所述存储气球代理模块,用于根据预定义文件占用虚拟存储空间的大小获 取所占用的部分虚拟存储块,将所述部分虚拟存储块对应的虚拟存储空闲块信 息传递给所述存储气球守护进程模块;
所述存储气球守护进程模块,用于将所述虚拟存储空闲块信息对应的物理 存储空间进行部分或全部释放,并将已释放的物理存储空间对应的虚拟存储块 标记为不可用。
14、 根据权利要求 13所述的物理主机, 其特征在于, 所述存储气球代理模 块具体用于将所述预定义文件占用虚拟存储空间的大小与获得的限值范围进 行比较, 若所述预定义文件占用的虚拟存储空间小于所述限值范围的下限值, 则调用文件系统扩大所述预定义文件, 为扩大后的预定义文件分配虚拟存储 块,调用文件系统获得所述预定义文件的扩大部分所占用的虚拟存储块,将表 示所述虚拟存储块的第一虚拟存储空闲块信息传递给所述存储气球守护进程 模块;
所述存储气球守护进程模块具体用于判断所述第一虚拟存储空闲块信息 对应的虚拟存储块是否可用, 若可用, 则将所述虚拟存储块标记为空闲, 根据 策略将部分或者全部标记为空闲的虚拟存储块对应的物理存储空间释放,并将 已释放的物理存储空间对应的虚拟存储块标记为不可用。
15、 根据权利要求 14所述的物理主机, 其特征在于, 所述存储气球代理模 块进一步用于:若所述预定义文件占用的虚拟存储空间大于所述限值范围的上 限值, 调用文件系统获得所述预定义文件的待缩减部分所占用的虚拟存储块, 将表示所述虚拟存储块的第二虚拟存储空闲块信息传递给所述存储气球守护 进程模块, 以及调用文件系统收缩所述预定义文件;
所述存储气球守护进程模块进一步用于:判断所述第二虚拟存储空闲块信 息对应的虚拟存储块是否为空闲, 若为空闲, 则将该虚拟存储块标记为可用。
PCT/CN2011/074025 2010-11-03 2011-05-13 虚拟机存储空间管理方法、系统及物理主机 WO2012058917A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
KR1020127012967A KR101403416B1 (ko) 2010-11-03 2011-05-13 가상 머신 저장 공간 관리를 위한 방법 및 시스템, 및 물리적 호스트
EP11779077A EP2479677A4 (en) 2010-11-03 2011-05-13 METHOD, SYSTEM AND PHYSICAL HOST FOR MEMORY CONTROL MANAGEMENT OF A VIRTUAL MACHINE (VM)
JP2012542354A JP5510556B2 (ja) 2010-11-03 2011-05-13 仮想マシンのストレージスペースおよび物理ホストを管理するための方法およびシステム
US13/339,209 US8850156B2 (en) 2010-11-03 2011-12-28 Method and system for managing virtual machine storage space and physical host

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010530638.8 2010-11-03
CN 201010530638 CN101986285B (zh) 2010-11-03 2010-11-03 虚拟机存储空间管理方法、系统及物理主机

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/339,209 Continuation US8850156B2 (en) 2010-11-03 2011-12-28 Method and system for managing virtual machine storage space and physical host

Publications (1)

Publication Number Publication Date
WO2012058917A1 true WO2012058917A1 (zh) 2012-05-10

Family

ID=43710634

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/074025 WO2012058917A1 (zh) 2010-11-03 2011-05-13 虚拟机存储空间管理方法、系统及物理主机

Country Status (5)

Country Link
EP (1) EP2479677A4 (zh)
JP (1) JP5510556B2 (zh)
KR (1) KR101403416B1 (zh)
CN (1) CN101986285B (zh)
WO (1) WO2012058917A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110389905A (zh) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 资源释放方法、资源分配方法、设备和计算机程序产品

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8850156B2 (en) 2010-11-03 2014-09-30 Huawei Technologies Co., Ltd. Method and system for managing virtual machine storage space and physical host
CN101986285B (zh) * 2010-11-03 2012-09-19 华为技术有限公司 虚拟机存储空间管理方法、系统及物理主机
CN102012834B (zh) * 2010-12-20 2013-02-27 复旦大学 基于用户空闲进程的提高虚拟机性能与可伸缩性的方法
US8873398B2 (en) * 2011-05-23 2014-10-28 Telefonaktiebolaget L M Ericsson (Publ) Implementing EPC in a cloud computer with openflow data plane
CN102222014B (zh) * 2011-06-16 2013-05-22 华中科技大学 基于内存热插拔的虚拟机动态内存管理方法
CN102404253B (zh) * 2011-06-28 2014-08-06 西安交通大学 支持linux 的硬件抽象层的虚拟网卡设计方法
CN103226518B (zh) * 2012-01-31 2016-06-22 国际商业机器公司 一种在存储管理系统中进行卷扩展的方法和装置
CN102779074B (zh) * 2012-06-18 2015-04-08 中国人民解放军国防科学技术大学 基于内存空洞机制的虚拟机内存资源分配方法
US9069669B2 (en) 2012-10-11 2015-06-30 Industrial Technology Research Institute Method and computer system for memory management on virtual machine
CN102968380B (zh) * 2012-11-02 2016-12-07 深圳市同洲电子股份有限公司 内存文件系统中内存分区的管理方法和装置
US9053002B2 (en) * 2013-11-12 2015-06-09 International Business Machines Corporation Thick and thin data volume management
CN103713941B (zh) * 2013-12-20 2018-05-04 汉柏科技有限公司 基于qcow2格式的虚拟机镜像克隆方法及系统
CN103744622B (zh) * 2014-01-10 2017-10-13 浪潮电子信息产业股份有限公司 一种实现存储系统自动精简配置异步全额分配的方法
CN104156173A (zh) * 2014-07-29 2014-11-19 浪潮(北京)电子信息产业有限公司 一种实现磁盘碎片整理的方法及装置
US20160299712A1 (en) * 2015-04-07 2016-10-13 Microsoft Technology Licensing, Llc Virtual Machines Backed by Host Virtual Memory
CN105138284B (zh) * 2015-08-11 2018-10-23 上海交通大学 虚拟机磁盘镜像同步操作优化的系统及方法
CN105550111A (zh) * 2015-12-16 2016-05-04 浪潮(北京)电子信息产业有限公司 虚拟环境下操作系统io性能基准的测试调优方法及系统
CN107783722B (zh) * 2016-08-25 2020-08-21 星辰天合(北京)数据科技有限公司 数据传输方法和数据转发装置
CN106502762A (zh) * 2016-10-20 2017-03-15 浪潮电子信息产业股份有限公司 一种基于虚拟化技术的内存自动优化方法
CN109697016B (zh) * 2017-10-20 2022-02-15 伊姆西Ip控股有限责任公司 用于改进容器的存储性能的方法和装置
CN107800806B (zh) * 2017-11-15 2019-08-06 中国联合网络通信集团有限公司 云环境下存储资源回收方法、共享存储系统和云服务系统
CN109324893B (zh) * 2018-08-07 2021-08-31 华为技术有限公司 分配内存的方法和装置
CN109857343B (zh) * 2019-01-30 2023-02-07 新华三云计算技术有限公司 磁盘空间释放方法及装置
CN112148228A (zh) * 2020-09-29 2020-12-29 上海摩勤智能技术有限公司 存储空间的释放方法、终端及存储介质
CN112286630A (zh) * 2020-10-22 2021-01-29 烽火通信科技股份有限公司 一种虚拟机内存热迁移的优化方法与装置
CN116074003B (zh) * 2023-03-06 2023-06-20 中安云科科技发展(山东)有限公司 一种密码机动态多线程负载均衡方法、系统及密码机

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7433951B1 (en) * 2000-09-22 2008-10-07 Vmware, Inc. System and method for controlling resource revocation in a multi-guest computer system
US20090070776A1 (en) * 2007-09-07 2009-03-12 Oracle International Corporation System and method to improve memory usage in virtual machines running as hypervisor guests
CN101751335A (zh) * 2008-11-28 2010-06-23 国际商业机器公司 调度虚拟机的垃圾收集的方法、装置和集群系统
CN101986285A (zh) * 2010-11-03 2011-03-16 华为技术有限公司 虚拟机存储空间管理方法、系统及物理主机

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000155713A (ja) * 1998-11-24 2000-06-06 Sony Corp キャッシュサイズ制御装置
JP2005011208A (ja) * 2003-06-20 2005-01-13 Hitachi Ltd ボリュームサイズ変更装置および変更方法
JP2006293543A (ja) * 2005-04-07 2006-10-26 Nec Corp ストレージシステム及び物理記憶領域の動的回収方法
JP4765967B2 (ja) * 2007-03-20 2011-09-07 日本電気株式会社 情報処理装置及び情報処理方法並びにプログラム
US8195866B2 (en) 2007-04-26 2012-06-05 Vmware, Inc. Adjusting available persistent storage during execution in a virtual computer system
JP5146174B2 (ja) * 2008-07-28 2013-02-20 富士通株式会社 仮想マシンモニタ装置およびプログラム,ならびに仮想マシン間メモリ共有管理方法
CN101477495B (zh) * 2008-10-28 2011-03-16 北京航空航天大学 分布式内存虚拟化技术的实现方法
CN101587524B (zh) * 2009-06-23 2015-02-11 宏碁电脑(上海)有限公司 一种基于虚拟系统的数据存储设备加密方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7433951B1 (en) * 2000-09-22 2008-10-07 Vmware, Inc. System and method for controlling resource revocation in a multi-guest computer system
US20090070776A1 (en) * 2007-09-07 2009-03-12 Oracle International Corporation System and method to improve memory usage in virtual machines running as hypervisor guests
CN101751335A (zh) * 2008-11-28 2010-06-23 国际商业机器公司 调度虚拟机的垃圾收集的方法、装置和集群系统
CN101986285A (zh) * 2010-11-03 2011-03-16 华为技术有限公司 虚拟机存储空间管理方法、系统及物理主机

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110389905A (zh) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 资源释放方法、资源分配方法、设备和计算机程序产品
CN110389905B (zh) * 2018-04-20 2023-12-19 伊姆西Ip控股有限责任公司 资源释放方法、资源分配方法、设备和计算机程序产品

Also Published As

Publication number Publication date
JP5510556B2 (ja) 2014-06-04
CN101986285B (zh) 2012-09-19
EP2479677A4 (en) 2012-08-08
EP2479677A1 (en) 2012-07-25
CN101986285A (zh) 2011-03-16
JP2013513174A (ja) 2013-04-18
KR20120086322A (ko) 2012-08-02
KR101403416B1 (ko) 2014-06-03

Similar Documents

Publication Publication Date Title
WO2012058917A1 (zh) 虚拟机存储空间管理方法、系统及物理主机
US8850156B2 (en) Method and system for managing virtual machine storage space and physical host
US9672075B2 (en) Method, apparatus, and system for implementing hot migration of virtual machine
WO2015196931A1 (zh) 基于磁盘io的虚拟资源分配方法及装置
WO2017008675A1 (zh) 一种用于虚拟化环境下传输数据的方法与设备
US10241550B2 (en) Affinity aware parallel zeroing of memory in non-uniform memory access (NUMA) servers
WO2018149263A1 (zh) 一种网络业务实例化的方法及装置
CN110941481A (zh) 资源调度方法、装置及系统
US11947985B2 (en) Data processing method and apparatus, and server for ensuring consistency of data processing processes of a plurality of containers
WO2014169649A1 (zh) 一种数据处理方法、装置及计算机系统
WO2019148854A1 (zh) 虚拟化网元设备的部署方法以及装置
CN102236603A (zh) 虚拟化环境中垃圾回收的方法和系统
WO2021057489A1 (zh) 虚拟机内存管理的方法及设备
WO2013181939A1 (zh) 通信设备硬件资源的虚拟化管理方法及相关装置
US8141084B2 (en) Managing preemption in a parallel computing system
CN110704161B (zh) 虚拟机创建方法、装置及计算机设备
WO2021018267A1 (zh) 虚拟机热迁移方法和通信设备
US20220083281A1 (en) Reading and writing of distributed block storage system
WO2023246843A1 (zh) 数据处理方法、装置及系统
CN110750336A (zh) 一种OpenStack虚拟机内存热扩容方法
CN110019475B (zh) 数据持久化处理方法、装置及系统
US20130246729A1 (en) Method for Managing a Memory of a Computer System, Memory Management Unit and Computer System
WO2022237624A1 (zh) 内存分配方法、装置和系统
CN113127210B (zh) 一种分布式系统的存储管理方法、装置及存储介质
CN113806019A (zh) 一种OpenStack云平台中绑定及解绑PMEM设备的方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2011779077

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 1050/KOLNP/2012

Country of ref document: IN

ENP Entry into the national phase

Ref document number: 20127012967

Country of ref document: KR

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2012542354

Country of ref document: JP

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

Ref document number: 11779077

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE