WO2019149184A1 - Virtual machine disk space reclamation method and system - Google Patents

Virtual machine disk space reclamation method and system Download PDF

Info

Publication number
WO2019149184A1
WO2019149184A1 PCT/CN2019/073612 CN2019073612W WO2019149184A1 WO 2019149184 A1 WO2019149184 A1 WO 2019149184A1 CN 2019073612 W CN2019073612 W CN 2019073612W WO 2019149184 A1 WO2019149184 A1 WO 2019149184A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
disk
file
virtual
space
Prior art date
Application number
PCT/CN2019/073612
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 华为技术有限公司
Publication of WO2019149184A1 publication Critical patent/WO2019149184A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0632Configuration or reconfiguration of storage systems by initialisation or re-initialisation of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0665Virtualisation aspects at area level, e.g. provisioning of virtual or logical volumes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Definitions

  • the present application relates to network technologies, and in particular, to a virtual machine disk space recovery method and system.
  • the virtual disk file created on the host storage device is mounted to the virtual machine through the virtual disk controller as a virtual disk of the virtual machine, such as the C disk inside the Windows virtual machine.
  • the virtual disk controller may be a virtio-scsi, a virtio-blk, an integrated drive electronics (IDE), etc., wherein a virtual disk controller of the virtio-blk type is widely used due to its better performance.
  • a virtual disk file is usually created by thin allocation, that is, when the virtual disk file is initially created, less space is allocated on the host storage device for the virtual disk file.
  • the file system on the host storage device automatically allocates space for the virtual disk file as needed.
  • the data deletion request of the virtual disk corresponding to the virtual disk file in the virtual machine cannot be perceived by the file system on the host storage device through the virtual disk controller, and the file system on the host storage device cannot automatically recycle the deleted data. The space, therefore, cannot truly achieve flexible storage over-allocation.
  • the virtual disk controller can recognize the write zero request, and when the virtual disk controller receives the write zero request, the write zero request is converted into a file system identifiable on the host storage device.
  • Space reclamation requests to achieve virtual machine disk space reclamation needs to carry the information of the space range of the virtual disk to be reclaimed, and the information of the space range of the virtual disk to be reclaimed needs to be manually configured by the user and is difficult for the user to obtain, so the existing virtual machine disk space recovery method exists. A problem that is difficult to achieve.
  • the present invention provides a virtual machine disk space recovery method and system, which are used to solve the problem that the existing virtual machine disk space recovery method is difficult to implement.
  • the first aspect of the present application provides a method for recovering a disk space of a virtual machine, which is applied to a virtual machine, and the method for recovering the disk space of the virtual machine includes:
  • the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request;
  • the virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file; the write zero request is used to indicate that the virtual machine file system is based on The write zero request performs virtual machine disk space reclamation.
  • the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control.
  • the disk space is reclaimed, and the realizable disk space recovery method of the virtual machine is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
  • the virtual machine operating system determines, after receiving the virtual machine disk space reclamation request, the deleted file in the virtual machine file system, including:
  • the virtual machine operating system determines, according to the type of the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system when receiving the virtual machine disk space reclamation request;
  • the virtual machine operating system determines, in the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file by using the deleted file scanning device corresponding to the virtual machine file system.
  • the deleted file includes at least one subfile; when the virtual machine operating system receives the virtual machine disk space reclamation request, determining, in the virtual machine file system, After deleting the file, the method further includes:
  • the virtual machine operating system acquires range information of space occupied by each of the subfiles in the virtual disk;
  • the virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file, including:
  • the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and eliminates the subdisk in the virtual disk.
  • the write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  • the method further includes:
  • the virtual machine file system sends the write zero request to a virtual disk controller
  • the virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
  • the file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated.
  • the virtual disk controller When receiving the zero write request, the virtual disk controller converts the write zero request into a disk space reclamation request, and determines the space access in the virtual disk file to be reclaimed according to the spatial extent of the virtual disk carried in the write zero request, thereby virtualizing The disk space in the disk file is recycled, which realizes automatic recovery of the virtual machine disk space.
  • the virtual machine operating system receives a virtual machine disk space reclamation request, including:
  • the virtual machine operating system receives the virtual machine disk space reclamation request sent by the virtualization management host agent;
  • the method further includes: before the virtual machine operating system receives the virtual machine disk space reclamation request, and determines the space occupied by the deleted file and the deleted file in the virtual machine file system, the method further includes:
  • the virtualization management host agent receives the virtual machine disk space reclamation request sent by the virtualization management component.
  • a second aspect of the present application provides a virtual machine disk space reclamation system for performing the method of any of the above aspects or any of the possible implementations of the first aspect.
  • the system comprises means for performing the method of any of the above-described first aspects or any of the possible implementations of the first aspect.
  • the virtual machine disk space recovery system includes: a virtual machine operating system and a virtual machine file system;
  • the virtual machine operating system is configured to: when the virtual machine disk space reclamation request is received, determine the deleted file in the virtual machine file system;
  • the virtual machine operating system is further configured to send a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file;
  • the virtual machine file system is configured to perform virtual machine disk space reclamation according to the write zero request.
  • the virtual machine operating system is specifically configured to: when receiving a virtual machine disk space reclamation request, determine the virtual machine file system according to a type of the virtual machine file system Corresponding deleted file scanning device;
  • the virtual machine operating system is further configured to: in the virtual machine file system, determine, by using the deleted file scanning device corresponding to the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file.
  • the deleted file includes at least one subfile
  • the virtual machine operating system is further configured to obtain, to obtain, range information of space occupied by each of the subfiles in the virtual disk.
  • the virtual machine operating system is specifically configured to: identify, for any of the subfiles, a space occupied by the subfile in the virtual disk, send a write zero request to the virtual machine file system, and eliminate the sub The identifier of the space occupied by the file in the virtual disk;
  • the write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  • the virtual machine disk space reclamation system further includes: a virtual disk controller, a virtual machine, and a file system of a storage device of the host where the virtual machine is located;
  • the virtual machine file system is specifically configured to send the write zero request to the virtual disk controller
  • the virtual disk controller is configured to determine, according to the spatial range information occupied by the deleted file in the write zero request, the spatial range information to be recovered in the virtual disk file;
  • the virtual disk controller is further configured to send a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
  • the file system of the storage device of the host where the virtual machine is located is used to mark the space indicated by the space range information to be recovered as unallocated.
  • system further includes: a virtualization management host agent;
  • the virtual machine operating system is further configured to receive the virtual machine disk space reclamation request sent by the virtualization management host agent;
  • the virtualization management host agent is configured to receive the virtual machine disk space reclamation request sent by the virtualization management component.
  • a third aspect of the present application provides a virtual machine disk space reclamation device, including a processor, a memory, a communication interface, and a bus, where the processor, the memory, and the communication interface are connected and completed through the bus Inter-communication, the memory is for storing computer execution instructions, and when the device is running, the processor executes a computer execution instruction in the memory to perform the first aspect or the first with a hardware resource in the device An operational step in any possible implementation on the one hand.
  • a fourth aspect of the present application provides a computer readable medium having stored therein instructions that, when executed on a computer, cause the computer to perform the first aspect or any possible implementation of the first aspect The instructions in the method.
  • FIG. 1 is a schematic structural diagram of a virtualization platform to which an embodiment of the present application is applied;
  • FIG. 2 is a schematic structural diagram of a host to which an embodiment of the present application is applied;
  • FIG. 3 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 1 of the present application;
  • FIG. 4 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 2 of the present application;
  • FIG. 5 is a schematic diagram of a signaling flow of a method for recovering a disk space of a virtual machine according to Embodiment 3 of the present application;
  • FIG. 6 is a schematic structural diagram of a virtual machine disk space recovery device according to Embodiment 1 of the present application.
  • FIG. 1 is a schematic structural diagram of a virtualization platform to which an embodiment of the present application is applied.
  • the virtualization platform 100 provided in this embodiment may include at least a virtualization management component 101, at least one virtualization management host agent 102, and at least one virtual machine 103.
  • the virtualization management component 101 is configured to manage the deployment of the virtual machine 103 on at least one host.
  • Each of the hosts managed by the virtualization management component 101 is provided with a virtualization management host agent 102, and the virtualization management host agent 102 is used.
  • the virtual machine 103 deployed on the host where the virtualization management host agent 102 is located is managed.
  • At least one virtual machine 103 can be deployed on each host.
  • the virtual machine 103 deployed on the same host shares the storage space of the host.
  • the following embodiments of the present application take the example of deploying only one virtual machine 103 in a host, and the virtual disk space recovery of the virtual machine 103 is exemplarily described.
  • FIG. 2 is a schematic structural diagram of a host to which an embodiment of the present application is applied.
  • the host 200 provided in this embodiment may include at least a virtualization management host agent 201, a storage device 202, a virtual disk controller 203, and at least one virtual machine 203.
  • the virtualization management host agent 201, the virtual disk controller 203, and the at least one virtual machine 203 are exemplarily functional modules running on the operating system of the host 200.
  • At least one virtual disk file can be created on the storage device 202.
  • the file system on the storage device 202 manages each virtual disk file, and manages the space occupation of the virtual disk file on the storage device 202.
  • Each virtual disk file is mounted to the virtual machine 204 by the virtual disk controller 203 as a virtual disk of the virtual storage space of the virtual machine 204.
  • a virtual disk file corresponds to a virtual disk of the virtual machine 204.
  • Each virtual disk can be exemplarily used with different types of file systems, such as a FAT type file system, an NTFS type file system, and different versions of the EXT type file system.
  • the user When the user writes a file in the virtual machine 203, the user sends a write request to the virtual machine operating system, and the virtual machine file system running in the virtual machine operating system sends the write request to the virtual disk file through the virtual disk controller 203, virtualizing The file system where the disk file is located adds disk space to the virtual disk file according to the write request, and performs a write request.
  • the file in the write request is stored in the increased disk space in the storage space occupied by the storage device, thereby completing the write request.
  • the virtual machine file system changes the corresponding disk space management data of the file to be deleted in the file system, and the file system on the storage device of the host does not sense the deletion operation of the virtual machine.
  • the disk space occupied by the virtual disk file according to the delete operation cannot be managed accordingly. Therefore, as the virtual machine runs for a long time, the virtual disk file corresponding to the virtual disk of the virtual machine occupies more and more storage space on the storage device, and finally reaches the storage line of the storage device.
  • Disk space recycling has problems that are difficult to implement.
  • the embodiment of the present application provides a method for recovering a virtual machine disk space.
  • the virtual machine operating system determines the deleted file according to the disk space reclamation request, and carries the space range information occupied by the deleted file in the write zero request, thereby realizing the disk space recovery.
  • the achievability of the virtual machine disk space reclamation method is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
  • FIG. 3 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 1 of the present application.
  • the virtual machine operating system when receiving the disk space reclamation request, the virtual machine operating system first determines the deleted file in the virtual machine file system, and then converts the disk space reclamation request into a write zero request and sends it to the virtual disk controller, and The write zero request carries the space range information occupied by the deleted file, thereby automatically obtaining the spatial range information in the virtual disk, and improving the realizability of the virtual machine disk space recovery method.
  • the method is applicable to the virtual machine shown in FIGS. 1 and 2, and the execution subject may be an operating system in the virtual machine.
  • the virtual machine disk space recovery method includes:
  • the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request.
  • the virtual machine disk space reclaiming request may be sent to the virtual machine operating system directly by the virtual machine, or may be delivered to the virtual machine operating system of the virtual machine through the virtualization management component, or may be virtualized management.
  • the component relaxes to the virtual machine operating system according to a preset period.
  • the virtual machine disk space reclamation request is used to indicate the space occupied by the deleted files in the virtual machine's disk space, that is, the space occupied by the deleted files in the virtual disk is reclaimed in the space occupied by the virtual disk file, reducing the virtual The size of the disk file.
  • the storage block occupied by the space to be reclaimed in the virtual disk file may be marked as unallocated, thereby releasing the storage space of the storage device.
  • the virtual machine operating system receives the virtual machine disk space reclamation request, all the virtual disks are scanned in the virtual machine file system running on the virtual machine operating system, according to whether the files in the virtual disk are carried. Deleting an ID determines the deleted file. Illustrative, in turn, determines the disk space that the deleted file occupies in the virtual disk. Exemplarily, when there are multiple virtual machine file systems running in the virtual machine operating system, scanning is performed in the virtual disks corresponding to all the virtual machine file systems.
  • the manner in which the virtual machine operating system determines the deleted file in the virtual machine file system may be:
  • the virtual machine operating system determines, according to the type of the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system when receiving the virtual machine disk space reclamation request.
  • the virtual machine operating system determines the type of each virtual machine file system included in the virtual machine operating system, and then determines the corresponding deleted file scan according to the type of the virtual machine file system.
  • Device Illustrative, such as the NTFS file system, the deleted file scanning device can be a device that invokes the sdelete interface of the Windows operating system.
  • the device is used to scan all the files in the corresponding virtual machine file system to determine the deleted file.
  • S302 The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file.
  • the write zero request is used to instruct the virtual machine file system to perform virtual machine disk space reclamation according to the write zero request.
  • the virtual machine disk space reclamation request can be converted into a write zero request, and the space range information occupied by the deleted file in the virtual disk is carried in the write zero request. in.
  • the virtual machine file system can recover the disk space according to the write zero request.
  • the method for recovering a virtual machine disk space includes: when the virtual machine operating system receives the virtual machine disk space reclamation request, the deleted file is determined in the virtual machine file system, and the virtual machine operating system sends the virtual machine operating system to the virtual machine file system.
  • Write a zero request the write zero request carries the spatial range information occupied by the deleted file.
  • the virtual machine disk space reclamation request is received, the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control.
  • the disk space is reclaimed, and the realizable disk space recovery method of the virtual machine is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
  • the embodiment of the present application further provides a method for recovering a virtual machine disk space.
  • 4 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 2 of the present application.
  • the virtual machine file system divides the disk space occupied by the deleted file into multiple subspaces, and separately recovers the disk space.
  • the deleted file includes at least one subfile
  • the virtual machine disk space reclamation method includes:
  • the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request.
  • the virtual machine operating system acquires space occupied by each subfile in the virtual disk.
  • the virtual machine operating system separately obtains the range information of the space occupied by each subfile in the virtual disk.
  • the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and eliminates the identifier of the space occupied by the subfile in the virtual disk.
  • the write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  • the virtual machine operating system identifies the space occupied by the first sub-file in the virtual disk. For example, the identifier to be reclaimed is added to the virtual storage block corresponding to the first subfile.
  • the virtual machine operating system sends a write zero request to the virtual machine file system, and the write zero request carries the spatial range information of the first subfile. After the virtual machine file system receives the write zero request, the virtual machine file system completes the space range recovery of the first subtext according to the write zero request.
  • the virtual machine file system After the virtual machine file system completes writing zero to the space occupied by the first subfile in the virtual disk, the virtual machine file system sends a response message to the virtual machine operating system, and the virtual machine operating system receives the response message. After the identifier of the space occupied by the subfile in the virtual disk is canceled, the space occupied by the first subfile is recovered.
  • the virtual machine operating system can simultaneously send a write zero request corresponding to multiple subfiles to the virtual machine file system, thereby simultaneously realizing the space occupied by the multiple subfiles.
  • the virtual machine operating system determines that the identifier of the space occupied by the first subfile still exists before sending the write zero request.
  • the user can avoid using other write file requests in the virtual machine file system to use the space at the same time, causing the file to fail.
  • multiple processes can simultaneously perform space reclamation, which can greatly reduce the time required for disk space recovery and improve the space recovery speed.
  • the virtual machine disk space reclaiming method provided by the embodiment includes: when the virtual machine operating system receives the virtual machine disk space reclamation request, the deleted file is determined in the virtual machine file system, and the virtual machine operating system obtains each of the deleted files.
  • the range information of the space occupied by the subfile in the virtual disk For any subfile, the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and writes a zero request.
  • the range information of the space occupied by the subfile in the virtual disk is carried out, and the identifier of the space occupied by the subfile in the virtual disk is eliminated.
  • the virtual machine operating system when the virtual machine operating system receives the space reclamation progress query request, the virtual machine operating system sends a space reclamation progress query response to the virtual machine management host agent, where the space The recycling progress query response carries the disk recycling progress information.
  • the disk recycling progress information is used to indicate how many subfiles in the space occupied by the deleted file have been reclaimed.
  • FIG. 5 is a schematic diagram of a signaling flow of a method for recovering a disk space of a virtual machine according to Embodiment 3 of the present application.
  • a process of the virtual machine file system recovering the disk space according to the write zero request is exemplified.
  • the virtual machine disk space recovery method includes:
  • the virtual machine operating system receives a virtual machine disk space reclamation request.
  • the virtual machine operating system receives the virtual machine disk space reclamation request sent by the virtualization management host agent.
  • the virtual machine operating system determines the deleted file in the virtual machine file system.
  • the virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file.
  • S501 to S503 in this embodiment are the same as the steps in the embodiment shown in FIG. 3, and details are not described herein again.
  • the virtual machine file system sends a write zero request to the virtual disk controller.
  • the virtual machine file system sends the received write zero request to the virtual disk controller.
  • the virtual disk controller determines, according to the spatial extent information occupied by the deleted file in the write zero request, the spatial extent information to be recovered in the virtual disk file.
  • the virtual disk controller mounts the virtual disk file in the virtual machine, so the virtual disk controller stores the mapping relationship between the virtual disk and the virtual disk file, and after receiving the zero write request, the virtual disk controller is based on By writing the space range information of the deleted file in the zero request, the space range information to be reclaimed in the virtual disk file can be determined.
  • the virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed.
  • the virtual disk controller after determining the spatial extent information to be reclaimed in the virtual disk file, the virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located.
  • S507 The file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated.
  • the file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated, thereby realizing virtual machine disk space reclamation.
  • the virtual machine disk space recovery method provided by the embodiment further includes:
  • the virtualization management component receives the virtual machine disk space reclamation request.
  • the virtualization management component sends a virtual machine disk space reclamation request to the virtualization management host agent.
  • a virtualization management component and a virtualization management host agent disposed in each host are usually disposed on the virtualization platform.
  • the user can send a virtual machine disk space reclamation request to the virtual machine operating system through the virtualization management component.
  • the virtual machine disk space reclamation request received by the virtualization management component can also set a virtual machine disk space reclamation request for the virtualization platform with a fixed period.
  • the virtual machine when multiple hosts are included in the virtualization platform, the virtual machine can be modified according to the actual usage of each host to modify the deployed host. Therefore, the virtualization management component receives the virtual machine. After the virtual machine disk space reclaiming request, the virtualization management component needs to query the host where the virtual machine is located. After determining the host where the virtual machine is located, the virtualization management component sends a virtual machine disk space reclamation request to the host where the virtual machine is located.
  • the virtual disk controller converts the write zero request into a disk space reclamation request when receiving the zero write request, and determines the space range of the virtual disk carried in the write zero request.
  • the space access in the reclaimed virtual disk file is used to recycle the disk space in the virtual disk file, which realizes automatic recovery of the virtual machine disk space.
  • a further embodiment of the present application further provides a virtual machine disk space recovery system.
  • the virtual machine disk space recovery system may be the host in FIG. 2 .
  • the virtual machine disk space recovery system includes: Machine operating system and virtual machine file system;
  • the virtual machine operating system is configured to determine the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request;
  • the virtual machine operating system is further configured to send a write zero request to the virtual machine file system, where the write zero request carries the space range information occupied by the deleted file;
  • the virtual machine file system is used to perform virtual machine disk space reclamation based on a write zero request.
  • the virtual machine disk space recovery system provided by the embodiment of the present application, wherein the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request; the virtual machine operating system to the virtual machine file system The write zero request is sent, and the write zero request carries the space range information occupied by the deleted file; the virtual machine file system performs the virtual machine disk space recovery according to the write zero request.
  • the virtual machine disk space reclamation request is received, the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control.
  • the disk space is reclaimed by the user, and the achievability of the modified virtual machine disk space recovery system is higher in this embodiment by avoiding the user obtaining and manually configuring the disk space range information to be recovered.
  • the virtual machine operating system is specifically configured to: when receiving the virtual machine disk space reclamation request, determine the deleted file scanning device corresponding to the virtual machine file system according to the type of the virtual machine file system;
  • the virtual machine operating system is further configured to determine, in the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system and the spatial extent occupied by the deleted file.
  • the deleted file includes at least one subfile; and the virtual machine operating system is further configured to obtain range information of space occupied by each subfile in the virtual disk;
  • the virtual machine operating system is specifically configured to identify, for any subfile, the space occupied by the subfile in the virtual disk, send a write zero request to the virtual machine file system, and eliminate the identifier of the space occupied by the subfile in the virtual disk. .
  • the write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  • the virtual machine disk space reclamation system further includes: a virtual disk controller, a virtual machine, and a file system of a storage device of the host where the virtual machine is located;
  • the virtual machine file system is specifically configured to send a write zero request to the virtual disk controller
  • the virtual disk controller is configured to determine, according to the space range information occupied by the deleted file in the write zero request, the space range information to be recovered in the virtual disk file;
  • the virtual disk controller is further configured to send a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
  • the file system of the storage device of the host where the virtual machine is located is used to mark the space indicated by the space range information to be reclaimed as unallocated.
  • the virtual disk controller when receiving the zero write request, converts the write zero request into a disk space reclamation request, and determines the space range of the virtual disk carried in the write zero request.
  • the space access in the reclaimed virtual disk file is used to recycle the disk space in the virtual disk file, which realizes automatic recovery of the virtual machine disk space.
  • the virtual machine disk space recycling system further includes: a virtualization management host agent;
  • the virtual machine operating system is further configured to receive a virtual machine disk space reclamation request sent by the virtualization management host agent;
  • the virtualization management host agent is configured to receive a virtual machine disk space reclamation request sent by the virtualization management component.
  • FIG. 6 is a schematic structural diagram of a virtual machine disk space recovery device according to Embodiment 1 of the present application.
  • the virtual machine disk space reclamation device includes a processor 601, a memory 602, a communication interface 603, and a bus 604;
  • the processor 601, the memory 602 and the communication interface 603 are connected and communicate with each other through a bus 604 for storing computer execution instructions.
  • the processor 601 executes a computer execution instruction in the memory 602 to utilize
  • the hardware resources in the device perform the steps in the packet sending method corresponding to FIG. 3 to FIG. 5.
  • Still another aspect of the embodiments of the present application provides a computer readable medium having instructions stored therein that, when run on a computer, cause the computer to execute instructions of the firewall configuration method corresponding to FIGS. 3 through 5.
  • each module of the system is only a division of logical functions, and the actual implementation may have another division manner, for example, multiple units or components may be combined. Or it can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • each device embodiment may refer to related methods in the related method embodiments. Partial understanding.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as an optical disk), or a semiconductor medium (such as a solid-state drive (SSD)), etc., which may store non-transient code of the program code.
  • Non-transitory machine readable medium such as a floppy disk, a hard disk, a magnetic tape
  • an optical medium such as an optical disk
  • a semiconductor medium such as a solid-state drive (SSD)

Abstract

Embodiments of the invention provide a virtual machine disk space reclamation method and system. The method comprises: upon receiving a virtual machine disk space reclamation request, a virtual machine operating system determining a deleted file in a virtual machine file system and sending a zero-filling request to the virtual machine file system, the zero-filling request carrying information of the space occupied by the deleted file. When the virtual machine disk space reclamation request is received, the deleted file is determined by scanning files in a virtual disk, and information of the space occupied by the deleted file can be automatically carried in the zero-filling request, facilitating disk space reclamation control of a virtual disk controller. In addition, there is no need for users to acquire and manually configure information of a disk space size to be reclaimed, improving realizability of the virtual machine disk space reclamation method.

Description

虚拟机磁盘空间回收方法和系统Virtual machine disk space recycling method and system 技术领域Technical field
本申请涉及网络技术,尤其涉及一种虚拟机磁盘空间回收方法和系统。The present application relates to network technologies, and in particular, to a virtual machine disk space recovery method and system.
背景技术Background technique
在虚拟化平台中,主机存储设备上创建的虚拟磁盘文件通过虚拟磁盘控制器挂载到虚拟机中,作为虚拟机的一块虚拟磁盘,如Windows虚拟机内部的C盘。其中虚拟磁盘控制器可以是virtio-scsi、virtio-blk、电子集成驱动器(integrated drive electronics,IDE)等等,其中,virtio-blk类型的虚拟磁盘控制器因性能较好而广泛使用。In the virtualization platform, the virtual disk file created on the host storage device is mounted to the virtual machine through the virtual disk controller as a virtual disk of the virtual machine, such as the C disk inside the Windows virtual machine. The virtual disk controller may be a virtio-scsi, a virtio-blk, an integrated drive electronics (IDE), etc., wherein a virtual disk controller of the virtio-blk type is widely used due to its better performance.
为实现存储空间的超额分配,通常采用瘦分配的方式创建虚拟磁盘文件,也即在初始创建虚拟磁盘文件时,为虚拟磁盘文件在主机存储设备上分配较少的空间。随着虚拟机内部对该虚拟磁盘文件对应的虚拟磁盘的数据写入,主机存储设备上的文件系统自动按需为虚拟磁盘文件分配空间。但是,虚拟机内部对该虚拟磁盘文件对应的虚拟磁盘的数据删除请求,并不能通过虚拟磁盘控制器被主机存储设备上的文件系统感知,主机存储设备上的文件系统无法自动回收已删除数据占用的空间,因此,无法真正实现灵活的存储超额分配。To achieve over-allocation of storage space, a virtual disk file is usually created by thin allocation, that is, when the virtual disk file is initially created, less space is allocated on the host storage device for the virtual disk file. As the virtual machine internally writes data to the virtual disk corresponding to the virtual disk file, the file system on the host storage device automatically allocates space for the virtual disk file as needed. However, the data deletion request of the virtual disk corresponding to the virtual disk file in the virtual machine cannot be perceived by the file system on the host storage device through the virtual disk controller, and the file system on the host storage device cannot automatically recycle the deleted data. The space, therefore, cannot truly achieve flexible storage over-allocation.
现有虚拟机磁盘空间回收方法中,利用虚拟磁盘控制器可识别出写零请求,在虚拟磁盘控制器接收到写零请求时,将写零请求转化为主机存储设备上的文件系统可识别的空间回收请求,从而实现虚拟机磁盘空间的回收。但是,写零请求中需携带待回收的虚拟磁盘的空间范围的信息,而待回收的虚拟磁盘的空间范围的信息需用户手动配置且用户难以获取,因此现有虚拟机磁盘空间的回收方法存在难以实现的问题。In the existing virtual machine disk space reclamation method, the virtual disk controller can recognize the write zero request, and when the virtual disk controller receives the write zero request, the write zero request is converted into a file system identifiable on the host storage device. Space reclamation requests to achieve virtual machine disk space reclamation. However, the zero-write request needs to carry the information of the space range of the virtual disk to be reclaimed, and the information of the space range of the virtual disk to be reclaimed needs to be manually configured by the user and is difficult for the user to obtain, so the existing virtual machine disk space recovery method exists. A problem that is difficult to achieve.
发明内容Summary of the invention
本申请提供一种虚拟机磁盘空间回收方法和系统,用于解决现有虚拟机磁盘空间的回收方法存在难以实现的问题。The present invention provides a virtual machine disk space recovery method and system, which are used to solve the problem that the existing virtual machine disk space recovery method is difficult to implement.
本申请第一方面提供一种虚拟机磁盘空间回收方法,应用于虚拟机中,虚拟机磁盘空间回收方法包括:The first aspect of the present application provides a method for recovering a disk space of a virtual machine, which is applied to a virtual machine, and the method for recovering the disk space of the virtual machine includes:
虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件;The virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request;
所述虚拟机操作系统向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息;所述写零请求用于指示所述虚拟机文件系统根据所述写零请求进行虚拟机磁盘空间回收。The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file; the write zero request is used to indicate that the virtual machine file system is based on The write zero request performs virtual machine disk space reclamation.
通过在接收到虚拟机磁盘空间回收请求时,对虚拟磁盘中的文件进行扫描确定了已删除文件,从而可自动将已删除文件占用的空间范围信息携带在写零请求中,方便了虚拟磁盘控制器实现磁盘空间回收,通过避免用户获取并手动配置待回收的磁盘空间范围信息,提高了虚拟机磁盘空间回收方法的可实现性。When the virtual machine disk space reclamation request is received, the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control. The disk space is reclaimed, and the realizable disk space recovery method of the virtual machine is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
在第一方面的一种可能的实现方式中,所述虚拟机操作系统在接收到虚拟机磁盘 空间回收请求时,在虚拟机文件系统中确定已删除文件,包括:In a possible implementation manner of the first aspect, the virtual machine operating system determines, after receiving the virtual machine disk space reclamation request, the deleted file in the virtual machine file system, including:
所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,根据虚拟机文件系统的类型确定所述虚拟机文件系统对应的已删除文件扫描装置;The virtual machine operating system determines, according to the type of the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system when receiving the virtual machine disk space reclamation request;
所述虚拟机操作系统在所述虚拟机文件系统中,采用所述虚拟机文件系统对应的已删除文件扫描装置确定已删除文件以及所述已删除文件占用的空间范围。The virtual machine operating system determines, in the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file by using the deleted file scanning device corresponding to the virtual machine file system.
在第一方面的一种可能的实现方式中,所述已删除文件包括至少一个子文件;所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定对已删除文件之后,所述方法还包括:In a possible implementation manner of the first aspect, the deleted file includes at least one subfile; when the virtual machine operating system receives the virtual machine disk space reclamation request, determining, in the virtual machine file system, After deleting the file, the method further includes:
所述虚拟机操作系统获取各所述子文件在虚拟磁盘中占用的空间的范围信息;The virtual machine operating system acquires range information of space occupied by each of the subfiles in the virtual disk;
所述虚拟机操作系统向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息,包括:The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file, including:
对于任一所述子文件,所述虚拟机操作系统对所述子文件在虚拟磁盘中占用的空间进行标识,向所述虚拟机文件系统发送写零请求,消除对所述子文件在虚拟磁盘中占用的空间的标识;For any of the subfiles, the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and eliminates the subdisk in the virtual disk. The identifier of the space occupied in;
其中,所述写零请求中携带有所述子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
通过将已删除文件占用的空间划分为多个子文件占用的空间,采用多个进程同时进行空间回收,可大幅度减少磁盘空间回收所需的时间,提高空间回收速度。By dividing the space occupied by deleted files into the space occupied by multiple subfiles, multiple processes can simultaneously perform space reclamation, which can greatly reduce the time required for disk space recovery and improve the space recovery speed.
在第一方面的一种可能的实现方式中,所述方法还包括:In a possible implementation manner of the first aspect, the method further includes:
所述虚拟机文件系统向虚拟磁盘控制器发送所述写零请求;The virtual machine file system sends the write zero request to a virtual disk controller;
所述虚拟磁盘控制器根据所述写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息;Determining, by the virtual disk controller, space range information to be recovered in the virtual disk file according to the space range information occupied by the deleted file in the write zero request;
所述虚拟磁盘控制器向所述虚拟机所在主机的存储设备的文件系统发送空间回收请求,所述空间回收请求中携带有所述待回收的空间范围信息;The virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
所述虚拟机所在主机的存储设备的文件系统将所述待回收的空间范围信息指示的空间标记为未分配。The file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated.
虚拟磁盘控制器在接收到写零请求时,将写零请求转化为磁盘空间回收请求,根据写零请求中携带的虚拟磁盘的空间范围确定待回收的虚拟磁盘文件中的空间访问,从而将虚拟磁盘文件中的磁盘空间进行回收,实现了虚拟机磁盘空间的自动回收。When receiving the zero write request, the virtual disk controller converts the write zero request into a disk space reclamation request, and determines the space access in the virtual disk file to be reclaimed according to the spatial extent of the virtual disk carried in the write zero request, thereby virtualizing The disk space in the disk file is recycled, which realizes automatic recovery of the virtual machine disk space.
在第一方面的一种可能的实现方式中,所述虚拟机操作系统接收虚拟机磁盘空间回收请求,包括:In a possible implementation manner of the first aspect, the virtual machine operating system receives a virtual machine disk space reclamation request, including:
所述虚拟机操作系统接收虚拟化管理主机代理发送的所述虚拟机磁盘空间回收请求;The virtual machine operating system receives the virtual machine disk space reclamation request sent by the virtualization management host agent;
所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定对已删除文件以及所述已删除文件占用的空间之前,所述方法还包括:The method further includes: before the virtual machine operating system receives the virtual machine disk space reclamation request, and determines the space occupied by the deleted file and the deleted file in the virtual machine file system, the method further includes:
所述虚拟化管理主机代理接收虚拟化管理组件发送的所述虚拟机磁盘空间回收请求。The virtualization management host agent receives the virtual machine disk space reclamation request sent by the virtualization management component.
本申请的第二方面提供一种虚拟机磁盘空间回收系统,该系统用于执行上述第一方面或第一方面的任意可能的实现中的方法。具体的,该系统包括用于执行上述第一方面或第一方面的任意可能的实现中的方法的模块。A second aspect of the present application provides a virtual machine disk space reclamation system for performing the method of any of the above aspects or any of the possible implementations of the first aspect. In particular, the system comprises means for performing the method of any of the above-described first aspects or any of the possible implementations of the first aspect.
在第二方面的一种可能的实现方式中,虚拟机磁盘空间回收系统包括:虚拟机操作系统和虚拟机文件系统;其中,In a possible implementation manner of the second aspect, the virtual machine disk space recovery system includes: a virtual machine operating system and a virtual machine file system;
所述虚拟机操作系统用于,在接收到虚拟机磁盘空间回收请求时,在所述虚拟机文件系统中确定已删除文件;The virtual machine operating system is configured to: when the virtual machine disk space reclamation request is received, determine the deleted file in the virtual machine file system;
所述虚拟机操作系统还用于,向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息;The virtual machine operating system is further configured to send a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file;
所述虚拟机文件系统用于,根据所述写零请求进行虚拟机磁盘空间回收。The virtual machine file system is configured to perform virtual machine disk space reclamation according to the write zero request.
在第二方面的一种可能的实现方式中,所述虚拟机操作系统具体用于,在接收到虚拟机磁盘空间回收请求时,根据所述虚拟机文件系统的类型确定所述虚拟机文件系统对应的已删除文件扫描装置;In a possible implementation manner of the second aspect, the virtual machine operating system is specifically configured to: when receiving a virtual machine disk space reclamation request, determine the virtual machine file system according to a type of the virtual machine file system Corresponding deleted file scanning device;
所述虚拟机操作系统还用于,在所述虚拟机文件系统中,采用所述虚拟机文件系统对应的已删除文件扫描装置确定已删除文件以及所述已删除文件占用的空间范围。The virtual machine operating system is further configured to: in the virtual machine file system, determine, by using the deleted file scanning device corresponding to the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file.
在第二方面的一种可能的实现方式中,所述已删除文件包括至少一个子文件;所述虚拟机操作系统还用于,获取各所述子文件在虚拟磁盘中占用的空间的范围信息;In a possible implementation manner of the second aspect, the deleted file includes at least one subfile, and the virtual machine operating system is further configured to obtain, to obtain, range information of space occupied by each of the subfiles in the virtual disk. ;
所述虚拟机操作系统具体用于,对于任一所述子文件,对所述子文件在虚拟磁盘中占用的空间进行标识,向所述虚拟机文件系统发送写零请求,消除对所述子文件在虚拟磁盘中占用的空间的标识;The virtual machine operating system is specifically configured to: identify, for any of the subfiles, a space occupied by the subfile in the virtual disk, send a write zero request to the virtual machine file system, and eliminate the sub The identifier of the space occupied by the file in the virtual disk;
其中,所述写零请求中携带有所述子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
在第二方面的一种可能的实现方式中,虚拟机磁盘空间回收系统还包括:虚拟磁盘控制器、虚拟机和所述虚拟机所在主机的存储设备的文件系统;其中,In a possible implementation manner of the second aspect, the virtual machine disk space reclamation system further includes: a virtual disk controller, a virtual machine, and a file system of a storage device of the host where the virtual machine is located;
所述虚拟机文件系统具体用于,向所述虚拟磁盘控制器发送所述写零请求;The virtual machine file system is specifically configured to send the write zero request to the virtual disk controller;
所述虚拟磁盘控制器用于,根据所述写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息;The virtual disk controller is configured to determine, according to the spatial range information occupied by the deleted file in the write zero request, the spatial range information to be recovered in the virtual disk file;
所述虚拟磁盘控制器还用于,向所述虚拟机所在主机的存储设备的文件系统发送空间回收请求,所述空间回收请求中携带有所述待回收的空间范围信息;The virtual disk controller is further configured to send a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
所述虚拟机所在主机的存储设备的文件系统用于,将所述待回收的空间范围信息指示的空间标记为未分配。The file system of the storage device of the host where the virtual machine is located is used to mark the space indicated by the space range information to be recovered as unallocated.
在第二方面的一种可能的实现方式中,所述系统还包括:虚拟化管理主机代理;In a possible implementation manner of the second aspect, the system further includes: a virtualization management host agent;
所述虚拟机操作系统还用于,接收所述虚拟化管理主机代理发送的所述虚拟机磁盘空间回收请求;The virtual machine operating system is further configured to receive the virtual machine disk space reclamation request sent by the virtualization management host agent;
所述虚拟化管理主机代理用于,接收虚拟化管理组件发送的所述虚拟机磁盘空间回收请求。The virtualization management host agent is configured to receive the virtual machine disk space reclamation request sent by the virtualization management component.
本申请的第三方面提供了一种虚拟机磁盘空间回收设备,包括处理器、存储器、通信接口以及总线,所述处理器、所述存储器和所述通信接口之间通过所述总线连接并完成相互间的通信,所述存储器中用于存储计算机执行指令,所述设备运行时,所述处理器执行所述存储器中的计算机执行指令以利用所述设备中的硬件资源执行第一方面或第一方面的任意可能的实现中的操作步骤。A third aspect of the present application provides a virtual machine disk space reclamation device, including a processor, a memory, a communication interface, and a bus, where the processor, the memory, and the communication interface are connected and completed through the bus Inter-communication, the memory is for storing computer execution instructions, and when the device is running, the processor executes a computer execution instruction in the memory to perform the first aspect or the first with a hardware resource in the device An operational step in any possible implementation on the one hand.
本申请的第四方面提供了一种计算机可读介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行第一方面或第一方面的任意可能的 实现中的方法的指令。A fourth aspect of the present application provides a computer readable medium having stored therein instructions that, when executed on a computer, cause the computer to perform the first aspect or any possible implementation of the first aspect The instructions in the method.
本申请的在上述各方面提供的实现的基础上,还可以进行进一步组合以提供更多实现。Further combinations may be made to provide further implementations based on the implementations provided by the various aspects described above.
附图说明DRAWINGS
图1为本申请实施例适用的虚拟化平台的结构示意图;1 is a schematic structural diagram of a virtualization platform to which an embodiment of the present application is applied;
图2为本申请实施例适用的主机的结构示意图;2 is a schematic structural diagram of a host to which an embodiment of the present application is applied;
图3为本申请实施例一提供的虚拟机磁盘空间回收方法的流程示意图;3 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 1 of the present application;
图4为本申请实施例二提供的虚拟机磁盘空间回收方法的流程示意图;4 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 2 of the present application;
图5为本申请实施例三提供的虚拟机磁盘空间回收方法的信令流程示意图;5 is a schematic diagram of a signaling flow of a method for recovering a disk space of a virtual machine according to Embodiment 3 of the present application;
图6为本申请实施例一提供的虚拟机磁盘空间回收设备的结构示意图。FIG. 6 is a schematic structural diagram of a virtual machine disk space recovery device according to Embodiment 1 of the present application.
具体实施方式Detailed ways
下面结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application are described below with reference to the accompanying drawings in the embodiments of the present application.
图1为本申请实施例适用的虚拟化平台的结构示意图。如图1所示,本实施例提供的虚拟化平台100至少可以包括虚拟机化管理组件101、至少一个虚拟化管理主机代理102和至少一个虚拟机103。虚拟机化管理组件101用于管理至少一个主机上的虚拟机103的部署,虚拟机化管理组件101管理的每一个主机上设置有一个虚拟化管理主机代理102,虚拟化管理主机代理102用于管理部署在虚拟化管理主机代理102所在的主机上的虚拟机103。每个主机上可部署有至少一个虚拟机103。部署在同一个主机上的虚拟机103分享该主机的存储空间。本申请以下各实施例以一个主机中只部署一个虚拟机103为例,对虚拟机103的虚拟磁盘空间的回收进行示例性的说明。FIG. 1 is a schematic structural diagram of a virtualization platform to which an embodiment of the present application is applied. As shown in FIG. 1, the virtualization platform 100 provided in this embodiment may include at least a virtualization management component 101, at least one virtualization management host agent 102, and at least one virtual machine 103. The virtualization management component 101 is configured to manage the deployment of the virtual machine 103 on at least one host. Each of the hosts managed by the virtualization management component 101 is provided with a virtualization management host agent 102, and the virtualization management host agent 102 is used. The virtual machine 103 deployed on the host where the virtualization management host agent 102 is located is managed. At least one virtual machine 103 can be deployed on each host. The virtual machine 103 deployed on the same host shares the storage space of the host. The following embodiments of the present application take the example of deploying only one virtual machine 103 in a host, and the virtual disk space recovery of the virtual machine 103 is exemplarily described.
图2为本申请实施例适用的主机的结构示意图。如图2所示,本实施例提供的主机200至少可以包括虚拟化管理主机代理201、存储设备202、虚拟磁盘控制器203和至少一个虚拟机203。其中,虚拟化管理主机代理201、虚拟磁盘控制器203和至少一个虚拟机203示例性的为运行在主机200的操作系统上的功能模块。存储设备202上可创建至少一个虚拟磁盘文件,存储设备202上的文件系统对各虚拟磁盘文件进行管理,管理虚拟磁盘文件在存储设备202上的空间占用情况。各虚拟磁盘文件通过虚拟磁盘控制器203挂载到虚拟机204中,作为虚拟机204的虚拟存储空间的一块虚拟磁盘。一个虚拟磁盘文件对应虚拟机204的一块虚拟磁盘,各虚拟磁盘示例性的可以采用不同类型的文件系统,例如FAT类型文件系统、NTFS类型文件系统以及不同版本的EXT类型文件系统。FIG. 2 is a schematic structural diagram of a host to which an embodiment of the present application is applied. As shown in FIG. 2, the host 200 provided in this embodiment may include at least a virtualization management host agent 201, a storage device 202, a virtual disk controller 203, and at least one virtual machine 203. The virtualization management host agent 201, the virtual disk controller 203, and the at least one virtual machine 203 are exemplarily functional modules running on the operating system of the host 200. At least one virtual disk file can be created on the storage device 202. The file system on the storage device 202 manages each virtual disk file, and manages the space occupation of the virtual disk file on the storage device 202. Each virtual disk file is mounted to the virtual machine 204 by the virtual disk controller 203 as a virtual disk of the virtual storage space of the virtual machine 204. A virtual disk file corresponds to a virtual disk of the virtual machine 204. Each virtual disk can be exemplarily used with different types of file systems, such as a FAT type file system, an NTFS type file system, and different versions of the EXT type file system.
当用户在虚拟机203中写一个文件时,用户向虚拟机操作系统发送写请求,虚拟机操作系统中运行的虚拟机文件系统将该写请求通过虚拟磁盘控制器203发送至虚拟磁盘文件,虚拟磁盘文件所在的文件系统根据写请求为虚拟磁盘文件增加磁盘空间,并执行写请求,写请求中的文件存储在增加的磁盘空间在存储设备所占用的存储空间中,从而完成了写请求。When the user writes a file in the virtual machine 203, the user sends a write request to the virtual machine operating system, and the virtual machine file system running in the virtual machine operating system sends the write request to the virtual disk file through the virtual disk controller 203, virtualizing The file system where the disk file is located adds disk space to the virtual disk file according to the write request, and performs a write request. The file in the write request is stored in the increased disk space in the storage space occupied by the storage device, thereby completing the write request.
但是,当用户删除虚拟磁盘中的文件时,虚拟机文件系统更改待删除的文件在文件系统中对应的磁盘空间管理数据,而主机的存储设备上的文件系统并不能感知虚拟机的删除操作,无法对根据删除操作对虚拟磁盘文件占用的磁盘空间进行相应的管理。因此,随着虚拟机的长时间运行,虚拟机的虚拟磁盘所对应的虚拟磁盘文件在存储设 备上占用的存储空间会越来越大,最终达到存储设备的存储上线。现有的虚拟机磁盘空间回收方法中,用户向虚拟机操作系统发送写零请求,需在写零请求中手动配置待回收的磁盘空间范围信息,方能使得虚拟磁盘控制器根据写零请求实现磁盘空间回收,存在难以实现的问题。However, when a user deletes a file in a virtual disk, the virtual machine file system changes the corresponding disk space management data of the file to be deleted in the file system, and the file system on the storage device of the host does not sense the deletion operation of the virtual machine. The disk space occupied by the virtual disk file according to the delete operation cannot be managed accordingly. Therefore, as the virtual machine runs for a long time, the virtual disk file corresponding to the virtual disk of the virtual machine occupies more and more storage space on the storage device, and finally reaches the storage line of the storage device. In the existing method for recovering the disk space of the virtual machine, the user sends a write zero request to the virtual machine operating system, and the disk space range information to be reclaimed needs to be manually configured in the write zero request, so that the virtual disk controller can implement the zero request according to the write request. Disk space recycling has problems that are difficult to implement.
为了解决上述问题,本申请实施例提供一种虚拟机磁盘空间回收方法。本实施例中,虚拟机操作系统在接收到磁盘空间回收请求时,根据磁盘空间回收请求确定已删除文件,在写零请求中携带已删除文件占用的空间范围信息,即可实现磁盘空间回收,通过避免用户获取并手动配置待回收的磁盘空间范围信息,提高了虚拟机磁盘空间回收方法的可实现性。In order to solve the above problem, the embodiment of the present application provides a method for recovering a virtual machine disk space. In this embodiment, when receiving the disk space reclamation request, the virtual machine operating system determines the deleted file according to the disk space reclamation request, and carries the space range information occupied by the deleted file in the write zero request, thereby realizing the disk space recovery. The achievability of the virtual machine disk space reclamation method is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
下面结合具体实施例对本申请实施例提供的虚拟机磁盘空间回收方法进行详细说明。The virtual machine disk space recovery method provided by the embodiment of the present application is described in detail below with reference to specific embodiments.
本申请实施例一方面提供一种虚拟机磁盘空间回收方法。图3为本申请实施例一提供的虚拟机磁盘空间回收方法的流程示意图。本实施例中虚拟机操作系统在接收到磁盘空间回收请求时,首先在在虚拟机文件系统中确定已删除文件,然后将磁盘空间回收请求转化为写零请求发送至虚拟磁盘控制器,并在写零请求中携带已删除文件占用的空间范围信息,从而实现了自动获取虚拟磁盘中空间范围信息,提高了虚拟机磁盘空间回收方法的可实现性。本方法适用于如图1和2所示的虚拟机,执行主体示例性的可以为虚拟机中的操作系统。如图3所示,虚拟机磁盘空间回收方法包括:An embodiment of the present application provides a method for recovering a virtual machine disk space. FIG. 3 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 1 of the present application. In this embodiment, when receiving the disk space reclamation request, the virtual machine operating system first determines the deleted file in the virtual machine file system, and then converts the disk space reclamation request into a write zero request and sends it to the virtual disk controller, and The write zero request carries the space range information occupied by the deleted file, thereby automatically obtaining the spatial range information in the virtual disk, and improving the realizability of the virtual machine disk space recovery method. The method is applicable to the virtual machine shown in FIGS. 1 and 2, and the execution subject may be an operating system in the virtual machine. As shown in Figure 3, the virtual machine disk space recovery method includes:
S301、虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件。S301. The virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request.
示例性的,虚拟机磁盘空间回收请求可以为用户直接通过虚拟机向虚拟机操作系统发送,也可以为用户通过虚拟化管理组件下发至虚拟机的虚拟机操作系统,还可以为虚拟化管理组件按照预设周期向虚拟机操作系统放松。虚拟机磁盘空间回收请求用于指示将虚拟机的磁盘空间中的已删除文件所占用的空间回收,也即将虚拟磁盘中已删除文件所占用的空间在虚拟磁盘文件中占用的空间回收,减少虚拟磁盘文件的大小。示例性的,在减少虚拟磁盘文件占用的空间范围时,具体可将虚拟磁盘文件中待回收的空间在存储设备中占用的存储块标记为未分配,从而释放存储设备的存储空间。For example, the virtual machine disk space reclaiming request may be sent to the virtual machine operating system directly by the virtual machine, or may be delivered to the virtual machine operating system of the virtual machine through the virtualization management component, or may be virtualized management. The component relaxes to the virtual machine operating system according to a preset period. The virtual machine disk space reclamation request is used to indicate the space occupied by the deleted files in the virtual machine's disk space, that is, the space occupied by the deleted files in the virtual disk is reclaimed in the space occupied by the virtual disk file, reducing the virtual The size of the disk file. Illustratively, when the space occupied by the virtual disk file is reduced, the storage block occupied by the space to be reclaimed in the virtual disk file may be marked as unallocated, thereby releasing the storage space of the storage device.
示例性的,虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机操作系统上运行的虚拟机文件系统中对所有虚拟磁盘进行扫描,根据虚拟磁盘中的文件是否有携带有已删除标识可确定出已删除文件。示例性的,进而可确定出已删除文件在虚拟磁盘中占用的磁盘空间。示例性的,当虚拟机操作系统中运行有多个虚拟机文件系统时,在所有虚拟机文件系统对应的虚拟磁盘中进行扫描。Exemplarily, when the virtual machine operating system receives the virtual machine disk space reclamation request, all the virtual disks are scanned in the virtual machine file system running on the virtual machine operating system, according to whether the files in the virtual disk are carried. Deleting an ID determines the deleted file. Illustrative, in turn, determines the disk space that the deleted file occupies in the virtual disk. Exemplarily, when there are multiple virtual machine file systems running in the virtual machine operating system, scanning is performed in the virtual disks corresponding to all the virtual machine file systems.
可选的,虚拟机操作系统在虚拟机文件系统中确定已删除文件的方式具体可以为:Optionally, the manner in which the virtual machine operating system determines the deleted file in the virtual machine file system may be:
S3011、虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,根据虚拟机文件系统的类型确定虚拟机文件系统对应的已删除文件扫描装置。S3011: The virtual machine operating system determines, according to the type of the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system when receiving the virtual machine disk space reclamation request.
示例性的,虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,确定虚拟机操作系统中包含的各虚拟机文件系统的类型,再根据虚拟机文件系统的类型确定对应的已删除文件扫描装置。示例性的,如NTFS文件系统,已删除文件扫描装置可以为调用Windows操作系统的sdelete接口的装置。Exemplarily, when receiving the virtual machine disk space reclamation request, the virtual machine operating system determines the type of each virtual machine file system included in the virtual machine operating system, and then determines the corresponding deleted file scan according to the type of the virtual machine file system. Device. Illustrative, such as the NTFS file system, the deleted file scanning device can be a device that invokes the sdelete interface of the Windows operating system.
S3012、在虚拟机文件系统中,采用虚拟机文件系统对应的已删除文件扫描装置确定已删除文件。S3012: In the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system is used to determine the deleted file.
示例性的,在确定了已删除文件扫描装置后,则采用该装置在对应的虚拟机文件系统中,对所有文件进行扫描,确定已删除文件。Exemplarily, after the deleted file scanning device is determined, the device is used to scan all the files in the corresponding virtual machine file system to determine the deleted file.
S302、虚拟机操作系统向虚拟机文件系统发送写零请求,写零请求中携带有已删除文件占用的空间范围信息。S302: The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file.
其中,写零请求用于指示虚拟机文件系统根据写零请求进行虚拟机磁盘空间回收。The write zero request is used to instruct the virtual machine file system to perform virtual machine disk space reclamation according to the write zero request.
示例性的,虚拟机操作系统在确定了已删除文件后,即可将虚拟机磁盘空间回收请求转化为写零请求,并将已删除文件在虚拟磁盘中占用的空间范围信息携带在写零请求中。虚拟机文件系统即可根据写零请求实现对磁盘空间的回收。Exemplarily, after the virtual machine operating system determines the deleted file, the virtual machine disk space reclamation request can be converted into a write zero request, and the space range information occupied by the deleted file in the virtual disk is carried in the write zero request. in. The virtual machine file system can recover the disk space according to the write zero request.
本申请实施例提供的虚拟机磁盘空间回收方法,包括虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件,虚拟机操作系统向虚拟机文件系统发送写零请求,写零请求中携带有已删除文件占用的空间范围信息。通过在接收到虚拟机磁盘空间回收请求时,对虚拟磁盘中的文件进行扫描确定了已删除文件,从而可自动将已删除文件占用的空间范围信息携带在写零请求中,方便了虚拟磁盘控制器实现磁盘空间回收,通过避免用户获取并手动配置待回收的磁盘空间范围信息,提高了虚拟机磁盘空间回收方法的可实现性。The method for recovering a virtual machine disk space provided by the embodiment of the present application includes: when the virtual machine operating system receives the virtual machine disk space reclamation request, the deleted file is determined in the virtual machine file system, and the virtual machine operating system sends the virtual machine operating system to the virtual machine file system. Write a zero request, the write zero request carries the spatial range information occupied by the deleted file. When the virtual machine disk space reclamation request is received, the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control. The disk space is reclaimed, and the realizable disk space recovery method of the virtual machine is improved by preventing the user from obtaining and manually configuring the disk space range information to be reclaimed.
示例性的,在图3所示实施例的基础上,本申请实施例还提供一种虚拟机磁盘空间回收方法。图4为本申请实施例二提供的虚拟机磁盘空间回收方法的流程示意图。本实施例中虚拟机文件系统将已删除文件占用的磁盘空间划分为多个子空间,分别进行回收。如图4所示,已删除文件包括至少一个子文件,虚拟机磁盘空间回收方法包括:Exemplarily, on the basis of the embodiment shown in FIG. 3, the embodiment of the present application further provides a method for recovering a virtual machine disk space. 4 is a schematic flowchart of a method for recovering a disk space of a virtual machine according to Embodiment 2 of the present application. In this embodiment, the virtual machine file system divides the disk space occupied by the deleted file into multiple subspaces, and separately recovers the disk space. As shown in FIG. 4, the deleted file includes at least one subfile, and the virtual machine disk space reclamation method includes:
S401、虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件。S401. The virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request.
S402、虚拟机操作系统获取各子文件在虚拟磁盘中占用的空间。S402. The virtual machine operating system acquires space occupied by each subfile in the virtual disk.
示例性的,虚拟机操作系统分别获取各子文件在虚拟磁盘中占用的空间的范围信息。Exemplarily, the virtual machine operating system separately obtains the range information of the space occupied by each subfile in the virtual disk.
S403、对于任一子文件,虚拟机操作系统对子文件在虚拟磁盘中占用的空间进行标识,向虚拟机文件系统发送写零请求,消除对子文件在虚拟磁盘中占用的空间的标识。S403. For any subfile, the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and eliminates the identifier of the space occupied by the subfile in the virtual disk.
其中,写零请求中携带有子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
示例性的,以第一子文件为例,虚拟机操作系统在获取了第一子文件在虚拟磁盘中占用的空间的范围信息后,将第一子文件在虚拟磁盘中占用的空间进行标识,例如,在第一子文件对应的虚拟存储块上添加待回收标识。虚拟机操作系统向虚拟机文件系统发送写零请求,写零请求中携带有第一子文件的空间范围信息。当虚拟机文件系统接收都写零请求后,虚拟机文件系统根据写零请求完成第一子文的空间范围的回收。示例性的,当虚拟机文件系统完成了对第一子文件在虚拟磁盘中占用的空间的写零后,虚拟机文件系统向虚拟机操作系统发送响应消息,虚拟机操作系统在接收到响应消息后取消对子文件在虚拟磁盘中占用的空间的标识,从而完成了对第一子文件占用的空 间的回收。示例性的,虚拟机操作系统可同时向虚拟机文件系统发送多个子文件对应的写零请求,从而同时实现多个子文件占用的空间的回收。示例性的,虚拟机操作系统在发送写零请求前,确定第一子文件占用的空间的标识还存在。通过在虚拟磁盘的空间上添加标识,可避免用户在虚拟机文件系统中的其他写文件请求同时使用该空间,造成写文件失败。通过将已删除文件占用的空间划分为多个子文件占用的空间,采用多个进程同时进行空间回收,可大幅度减少磁盘空间回收所需的时间,提高空间回收速度。Exemplarily, taking the first sub-file as an example, after obtaining the range information of the space occupied by the first sub-file in the virtual disk, the virtual machine operating system identifies the space occupied by the first sub-file in the virtual disk. For example, the identifier to be reclaimed is added to the virtual storage block corresponding to the first subfile. The virtual machine operating system sends a write zero request to the virtual machine file system, and the write zero request carries the spatial range information of the first subfile. After the virtual machine file system receives the write zero request, the virtual machine file system completes the space range recovery of the first subtext according to the write zero request. Exemplarily, after the virtual machine file system completes writing zero to the space occupied by the first subfile in the virtual disk, the virtual machine file system sends a response message to the virtual machine operating system, and the virtual machine operating system receives the response message. After the identifier of the space occupied by the subfile in the virtual disk is canceled, the space occupied by the first subfile is recovered. Exemplarily, the virtual machine operating system can simultaneously send a write zero request corresponding to multiple subfiles to the virtual machine file system, thereby simultaneously realizing the space occupied by the multiple subfiles. Exemplarily, the virtual machine operating system determines that the identifier of the space occupied by the first subfile still exists before sending the write zero request. By adding an identifier to the space of the virtual disk, the user can avoid using other write file requests in the virtual machine file system to use the space at the same time, causing the file to fail. By dividing the space occupied by deleted files into the space occupied by multiple subfiles, multiple processes can simultaneously perform space reclamation, which can greatly reduce the time required for disk space recovery and improve the space recovery speed.
本实施例提供的虚拟机磁盘空间回收方法,包括虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件,虚拟机操作系统获取已删除文件包括的各子文件在虚拟磁盘中占用的空间的范围信息,对于任一子文件,虚拟机操作系统对子文件在虚拟磁盘中占用的空间进行标识,向虚拟机文件系统发送写零请求,写零请求中携带有子文件在虚拟磁盘中占用的空间的范围信息,消除对子文件在虚拟磁盘中占用的空间的标识。通过将已删除文件占用的空间划分为多个子文件占用的空间,采用多个进程同时进行空间回收,可大幅度减少磁盘空间回收所需的时间,提高空间回收速度。The virtual machine disk space reclaiming method provided by the embodiment includes: when the virtual machine operating system receives the virtual machine disk space reclamation request, the deleted file is determined in the virtual machine file system, and the virtual machine operating system obtains each of the deleted files. The range information of the space occupied by the subfile in the virtual disk. For any subfile, the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and writes a zero request. The range information of the space occupied by the subfile in the virtual disk is carried out, and the identifier of the space occupied by the subfile in the virtual disk is eliminated. By dividing the space occupied by deleted files into the space occupied by multiple subfiles, multiple processes can simultaneously perform space reclamation, which can greatly reduce the time required for disk space recovery and improve the space recovery speed.
示例性的,在上述实施例的基础上,虚拟机操作系统在接收到空间回收进度查询请求时,所述虚拟机操作系统向所述虚拟机管理主机代理发送空间回收进度查询响应,所述空间回收进度查询响应中携带有磁盘回收进度信息。示例性的,磁盘回收进度信息用于指示已删除文件占用的空间中有多少子文件占用的空间已经被回收。Exemplarily, on the basis of the foregoing embodiment, when the virtual machine operating system receives the space reclamation progress query request, the virtual machine operating system sends a space reclamation progress query response to the virtual machine management host agent, where the space The recycling progress query response carries the disk recycling progress information. Exemplarily, the disk recycling progress information is used to indicate how many subfiles in the space occupied by the deleted file have been reclaimed.
示例性的,在上述任一实施例的基础上,本申请实施例还提供一种虚拟机磁盘空间回收方法。图5为本申请实施例三提供的虚拟机磁盘空间回收方法的信令流程示意图。本实施例中对虚拟机文件系统根据写零请求回收磁盘空间的过程进行示例性说明。如图5所示,虚拟机磁盘空间回收方法包括:Exemplarily, on the basis of any of the foregoing embodiments, the embodiment of the present application further provides a method for recovering a virtual machine disk space. FIG. 5 is a schematic diagram of a signaling flow of a method for recovering a disk space of a virtual machine according to Embodiment 3 of the present application. In the embodiment, a process of the virtual machine file system recovering the disk space according to the write zero request is exemplified. As shown in Figure 5, the virtual machine disk space recovery method includes:
S501、虚拟机操作系统接收虚拟机磁盘空间回收请求。S501. The virtual machine operating system receives a virtual machine disk space reclamation request.
可选的,虚拟机操作系统接收虚拟化管理主机代理发送的虚拟机磁盘空间回收请求。Optionally, the virtual machine operating system receives the virtual machine disk space reclamation request sent by the virtualization management host agent.
S502、虚拟机操作系统在虚拟机文件系统中确定已删除文件。S502. The virtual machine operating system determines the deleted file in the virtual machine file system.
S503、虚拟机操作系统向虚拟机文件系统发送写零请求,写零请求中携带有已删除文件占用的空间范围信息。S503. The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file.
示例性的,本实施例中的S501至S503与图3所示实施例中的步骤相同,本申请不再赘述。Illustratively, S501 to S503 in this embodiment are the same as the steps in the embodiment shown in FIG. 3, and details are not described herein again.
S504、虚拟机文件系统向虚拟磁盘控制器发送写零请求。S504. The virtual machine file system sends a write zero request to the virtual disk controller.
示例性的,虚拟机文件系统将接收到的写零请求发送至虚拟磁盘控制器。Illustratively, the virtual machine file system sends the received write zero request to the virtual disk controller.
S505、虚拟磁盘控制器根据写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息。S505. The virtual disk controller determines, according to the spatial extent information occupied by the deleted file in the write zero request, the spatial extent information to be recovered in the virtual disk file.
示例性的,虚拟磁盘控制器将虚拟磁盘文件挂载在虚拟机中,因此虚拟磁盘控制器中存储有虚拟磁盘和虚拟磁盘文件的映射关系,虚拟磁盘控制器在接收到写零请求后,根据写零请求中的已删除文件占用的空间范围信息,即可确定出虚拟磁盘文件中待回收的空间范围信息。Exemplarily, the virtual disk controller mounts the virtual disk file in the virtual machine, so the virtual disk controller stores the mapping relationship between the virtual disk and the virtual disk file, and after receiving the zero write request, the virtual disk controller is based on By writing the space range information of the deleted file in the zero request, the space range information to be reclaimed in the virtual disk file can be determined.
S506、虚拟磁盘控制器向虚拟机所在主机的存储设备的文件系统发送空间回收请求,空间回收请求中携带有待回收的空间范围信息。S506: The virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed.
示例性的,虚拟磁盘控制器在确定出虚拟磁盘文件中待回收的空间范围信息后,向虚拟机所在主机的存储设备的文件系统发送空间回收请求。Exemplarily, after determining the spatial extent information to be reclaimed in the virtual disk file, the virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located.
S507、虚拟机所在主机的存储设备的文件系统将待回收的空间范围信息指示的空间标记为未分配。S507: The file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated.
示例性的,虚拟机所在主机的存储设备的文件系统将待回收的空间范围信息指示的空间标记为未分配,从而实现虚拟机磁盘空间回收。Exemplarily, the file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated, thereby realizing virtual machine disk space reclamation.
可选的,如图5所示,在虚拟机操作系统接收虚拟化管理主机代理发送的虚拟机磁盘空间回收请求之前,本实施例提供的虚拟机磁盘空间回收方法还包括:Optionally, as shown in FIG. 5, before the virtual machine operating system receives the virtual machine disk space recovery request sent by the virtualization management host agent, the virtual machine disk space recovery method provided by the embodiment further includes:
S001、虚拟化管理组件接收虚拟机磁盘空间回收请求。S001. The virtualization management component receives the virtual machine disk space reclamation request.
S002、虚拟化管理组件向虚拟化管理主机代理发送虚拟机磁盘空间回收请求。S002. The virtualization management component sends a virtual machine disk space reclamation request to the virtualization management host agent.
示例性的,在虚拟化平台中,为方便对多个主机中部署的多个虚拟机进行管理,虚拟化平台上通常设置有虚拟化管理组件和设置在各主机中的虚拟化管理主机代理,用户可通过虚拟化管理组件向虚拟机操作系统发送虚拟机磁盘空间回收请求。虚拟化管理组件接收的虚拟机磁盘空间回收请求还可以为虚拟化平台设置的具有固定周期的虚拟机磁盘空间回收请求。Exemplarily, in the virtualization platform, in order to facilitate management of multiple virtual machines deployed in multiple hosts, a virtualization management component and a virtualization management host agent disposed in each host are usually disposed on the virtualization platform. The user can send a virtual machine disk space reclamation request to the virtual machine operating system through the virtualization management component. The virtual machine disk space reclamation request received by the virtualization management component can also set a virtual machine disk space reclamation request for the virtualization platform with a fixed period.
可选的,当虚拟化平台中包括多个主机时,考虑到虚拟机可在根据各主机的实际使用情况而进行热迁移,修改所部署的主机,因此,虚拟化管理组件在接收到虚拟机的虚拟机磁盘空间回收请求之后,虚拟化管理组件需查询虚拟机所在的主机,在确定了虚拟机所在的主机之后,虚拟化管理组件向虚拟机所在的主机发送虚拟机磁盘空间回收请求。Optionally, when multiple hosts are included in the virtualization platform, the virtual machine can be modified according to the actual usage of each host to modify the deployed host. Therefore, the virtualization management component receives the virtual machine. After the virtual machine disk space reclaiming request, the virtualization management component needs to query the host where the virtual machine is located. After determining the host where the virtual machine is located, the virtualization management component sends a virtual machine disk space reclamation request to the host where the virtual machine is located.
本实施例提供的虚拟机磁盘空间回收方法中,虚拟磁盘控制器在接收到写零请求时,将写零请求转化为磁盘空间回收请求,根据写零请求中携带的虚拟磁盘的空间范围确定待回收的虚拟磁盘文件中的空间访问,从而将虚拟磁盘文件中的磁盘空间进行回收,实现了虚拟机磁盘空间的自动回收。In the virtual machine disk space recovery method provided by the embodiment, the virtual disk controller converts the write zero request into a disk space reclamation request when receiving the zero write request, and determines the space range of the virtual disk carried in the write zero request. The space access in the reclaimed virtual disk file is used to recycle the disk space in the virtual disk file, which realizes automatic recovery of the virtual machine disk space.
本申请实施例再一方面还提供一种虚拟机磁盘空间回收系统,虚拟机磁盘空间回收系统示例性的可以为图2中的主机,如图2所示,虚拟机磁盘空间回收系统包括:虚拟机操作系统和虚拟机文件系统;其中,A further embodiment of the present application further provides a virtual machine disk space recovery system. The virtual machine disk space recovery system may be the host in FIG. 2 . As shown in FIG. 2 , the virtual machine disk space recovery system includes: Machine operating system and virtual machine file system;
虚拟机操作系统用于,在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件;The virtual machine operating system is configured to determine the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request;
虚拟机操作系统还用于,向虚拟机文件系统发送写零请求,写零请求中携带有已删除文件占用的空间范围信息;The virtual machine operating system is further configured to send a write zero request to the virtual machine file system, where the write zero request carries the space range information occupied by the deleted file;
虚拟机文件系统用于,根据写零请求进行虚拟机磁盘空间回收。The virtual machine file system is used to perform virtual machine disk space reclamation based on a write zero request.
本申请实施例提供的虚拟机磁盘空间回收系统,其中,虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件;虚拟机操作系统向虚拟机文件系统发送写零请求,写零请求中携带有已删除文件占用的空间范围信息;虚拟机文件系统根据写零请求进行虚拟机磁盘空间回收。通过在接收到虚拟机磁盘空间回收请求时,对虚拟磁盘中的文件进行扫描确定了已删除文件,从而可自动将已删 除文件占用的空间范围信息携带在写零请求中,方便了虚拟磁盘控制器实现磁盘空间回收,通过避免用户获取并手动配置待回收的磁盘空间范围信息,本实施例体用改的虚拟机磁盘空间回收系统的可实现性较高。The virtual machine disk space recovery system provided by the embodiment of the present application, wherein the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request; the virtual machine operating system to the virtual machine file system The write zero request is sent, and the write zero request carries the space range information occupied by the deleted file; the virtual machine file system performs the virtual machine disk space recovery according to the write zero request. When the virtual machine disk space reclamation request is received, the file in the virtual disk is scanned to determine the deleted file, so that the space range information occupied by the deleted file is automatically carried in the write zero request, which facilitates the virtual disk control. The disk space is reclaimed by the user, and the achievability of the modified virtual machine disk space recovery system is higher in this embodiment by avoiding the user obtaining and manually configuring the disk space range information to be recovered.
可选的,虚拟机操作系统具体用于,在接收到虚拟机磁盘空间回收请求时,根据虚拟机文件系统的类型确定虚拟机文件系统对应的已删除文件扫描装置;Optionally, the virtual machine operating system is specifically configured to: when receiving the virtual machine disk space reclamation request, determine the deleted file scanning device corresponding to the virtual machine file system according to the type of the virtual machine file system;
虚拟机操作系统还用于,在虚拟机文件系统中,采用虚拟机文件系统对应的已删除文件扫描装置确定已删除文件以及已删除文件占用的空间范围。The virtual machine operating system is further configured to determine, in the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system and the spatial extent occupied by the deleted file.
可选的,已删除文件包括至少一个子文件;虚拟机操作系统还用于,获取各子文件在虚拟磁盘中占用的空间的范围信息;Optionally, the deleted file includes at least one subfile; and the virtual machine operating system is further configured to obtain range information of space occupied by each subfile in the virtual disk;
虚拟机操作系统具体用于,对于任一子文件,对子文件在虚拟磁盘中占用的空间进行标识,向虚拟机文件系统发送写零请求,消除对子文件在虚拟磁盘中占用的空间的标识。The virtual machine operating system is specifically configured to identify, for any subfile, the space occupied by the subfile in the virtual disk, send a write zero request to the virtual machine file system, and eliminate the identifier of the space occupied by the subfile in the virtual disk. .
其中,写零请求中携带有子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
可选的,虚拟机磁盘空间回收系统还包括:虚拟磁盘控制器、虚拟机和所述虚拟机所在主机的存储设备的文件系统;其中,Optionally, the virtual machine disk space reclamation system further includes: a virtual disk controller, a virtual machine, and a file system of a storage device of the host where the virtual machine is located;
虚拟机文件系统具体用于,向虚拟磁盘控制器发送写零请求;The virtual machine file system is specifically configured to send a write zero request to the virtual disk controller;
虚拟磁盘控制器用于,根据写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息;The virtual disk controller is configured to determine, according to the space range information occupied by the deleted file in the write zero request, the space range information to be recovered in the virtual disk file;
虚拟磁盘控制器还用于,向虚拟机所在主机的存储设备的文件系统发送空间回收请求,空间回收请求中携带有待回收的空间范围信息;The virtual disk controller is further configured to send a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
虚拟机所在主机的存储设备的文件系统用于,将待回收的空间范围信息指示的空间标记为未分配。The file system of the storage device of the host where the virtual machine is located is used to mark the space indicated by the space range information to be reclaimed as unallocated.
本实施例提供的虚拟机磁盘空间回收系统中,虚拟磁盘控制器在接收到写零请求时,将写零请求转化为磁盘空间回收请求,根据写零请求中携带的虚拟磁盘的空间范围确定待回收的虚拟磁盘文件中的空间访问,从而将虚拟磁盘文件中的磁盘空间进行回收,实现了虚拟机磁盘空间的自动回收。In the virtual machine disk space recovery system provided by the embodiment, when receiving the zero write request, the virtual disk controller converts the write zero request into a disk space reclamation request, and determines the space range of the virtual disk carried in the write zero request. The space access in the reclaimed virtual disk file is used to recycle the disk space in the virtual disk file, which realizes automatic recovery of the virtual machine disk space.
可选的,虚拟机磁盘空间回收系统还包括:虚拟化管理主机代理;Optionally, the virtual machine disk space recycling system further includes: a virtualization management host agent;
虚拟机操作系统还用于,接收虚拟化管理主机代理发送的虚拟机磁盘空间回收请求;The virtual machine operating system is further configured to receive a virtual machine disk space reclamation request sent by the virtualization management host agent;
虚拟化管理主机代理用于,接收虚拟化管理组件发送的虚拟机磁盘空间回收请求。The virtualization management host agent is configured to receive a virtual machine disk space reclamation request sent by the virtualization management component.
本申请实施例再一方面还提供一种虚拟机磁盘空间回收设备。图6为本申请实施例一提供的虚拟机磁盘空间回收设备的结构示意图。如图6所示,虚拟机磁盘空间回收设备包括处理器601、存储器602、通信接口603以及总线604;其中,A further aspect of the embodiment of the present application further provides a virtual machine disk space recycling device. FIG. 6 is a schematic structural diagram of a virtual machine disk space recovery device according to Embodiment 1 of the present application. As shown in FIG. 6, the virtual machine disk space reclamation device includes a processor 601, a memory 602, a communication interface 603, and a bus 604;
处理器601、存储器602和通信接口603之间通过总线604连接并完成相互间的通信,存储器602中用于存储计算机执行指令,设备运行时,处理器601执行存储器602中的计算机执行指令以利用设备中的硬件资源执行图3至图5对应的报文发送方法中的步骤。The processor 601, the memory 602 and the communication interface 603 are connected and communicate with each other through a bus 604 for storing computer execution instructions. When the device is running, the processor 601 executes a computer execution instruction in the memory 602 to utilize The hardware resources in the device perform the steps in the packet sending method corresponding to FIG. 3 to FIG. 5.
本申请实施例再一方面还提供一种计算机可读介质,计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行图3至图5对应的防火墙配置方法 的指令。Still another aspect of the embodiments of the present application provides a computer readable medium having instructions stored therein that, when run on a computer, cause the computer to execute instructions of the firewall configuration method corresponding to FIGS. 3 through 5.
另外,需要说明的是,应理解以上虚拟机磁盘空间回收系统、系统的各个模块的划分仅仅是一种逻辑功能的划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In addition, it should be noted that the above virtual machine disk space recovery system, the division of each module of the system is only a division of logical functions, and the actual implementation may have another division manner, for example, multiple units or components may be combined. Or it can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本申请中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
本申请各方法实施例之间相关部分可以相互参考;各装置实施例所提供的装置用于执行对应的方法实施例所提供的方法,故各装置实施例可以参考相关的方法实施例中的相关部分进行理解。The relevant parts of the method embodiments of the present application may be referred to each other; the apparatus provided in each device embodiment is used to execute the method provided by the corresponding method embodiment, so each device embodiment may refer to related methods in the related method embodiments. Partial understanding.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关硬件来完成,所述的程序可以存储于一个设备的可读存储介质中,该程序在执行时,包括上述全部或部分步骤,所述的存储介质,如:FLASH、EEPROM等。A person skilled in the art can understand that all or part of the steps of implementing the above embodiments can be completed by a program to instruct related hardware, and the program can be stored in a readable storage medium of a device, when the program is executed. Including all or part of the above steps, the storage medium, such as: FLASH, EEPROM, and the like.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。One of ordinary skill in the art will appreciate that the method steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如软盘、硬盘、磁带)、光介质(例如光盘)、或者半导体介质(例如固态硬盘(solid-state drive,SSD))等各种可以存储程序代码的非短暂性的(non-transitory)机器可读介质。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with embodiments of the present application are generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic) or wireless (eg, infrared, wireless, microwave, etc.). The computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media. The usable medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as an optical disk), or a semiconductor medium (such as a solid-state drive (SSD)), etc., which may store non-transient code of the program code. Non-transitory machine readable medium.
需要说明的是,本申请所提供的实施例仅仅是示意性的。所属领域的技术人员可 以清楚地了解到,为了描述的方便和简洁,在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。在本申请实施例以及附图中揭示的特征可以独立存在也可以组合存在。在本申请实施例中以硬件形式描述的特征可以通过软件来执行,反之亦然。在此不做限定。It should be noted that the embodiments provided in the present application are merely illustrative. It will be apparent to those skilled in the art that, for the convenience and brevity of the description, in the above embodiments, the description of each embodiment has its own emphasis, and the parts which are not described in detail in a certain embodiment can be referred to other implementations. A description of the example. Features disclosed in the embodiments of the present application and the drawings may exist independently or in combination. Features described in hardware in the embodiments of the present application may be implemented by software, and vice versa. There is no limit here.

Claims (11)

  1. 一种虚拟机磁盘空间回收方法,其特征在于,应用于虚拟机中,所述方法包括:A method for recovering a disk space of a virtual machine is characterized in that it is applied to a virtual machine, and the method includes:
    虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件;The virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request;
    所述虚拟机操作系统向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息;所述写零请求用于指示所述虚拟机文件系统根据所述写零请求进行虚拟机磁盘空间回收。The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file; the write zero request is used to indicate that the virtual machine file system is based on The write zero request performs virtual machine disk space reclamation.
  2. 根据权利要求1所述的方法,其特征在于,所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定已删除文件,包括:The method according to claim 1, wherein the virtual machine operating system determines the deleted file in the virtual machine file system when receiving the virtual machine disk space reclamation request, including:
    所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,根据虚拟机文件系统的类型确定所述虚拟机文件系统对应的已删除文件扫描装置;The virtual machine operating system determines, according to the type of the virtual machine file system, the deleted file scanning device corresponding to the virtual machine file system when receiving the virtual machine disk space reclamation request;
    所述虚拟机操作系统在所述虚拟机文件系统中,采用所述虚拟机文件系统对应的已删除文件扫描装置确定已删除文件以及所述已删除文件占用的空间范围。The virtual machine operating system determines, in the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file by using the deleted file scanning device corresponding to the virtual machine file system.
  3. 根据权利要求1或2所述的方法,其特征在于,所述已删除文件包括至少一个子文件;所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定对已删除文件之后,所述方法还包括:The method according to claim 1 or 2, wherein the deleted file includes at least one subfile; the virtual machine operating system determines in the virtual machine file system when receiving the virtual machine disk space reclamation request After the deleted file, the method further includes:
    所述虚拟机操作系统获取各所述子文件在虚拟磁盘中占用的空间的范围信息;The virtual machine operating system acquires range information of space occupied by each of the subfiles in the virtual disk;
    所述虚拟机操作系统向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息,包括:The virtual machine operating system sends a write zero request to the virtual machine file system, where the write zero request carries the spatial range information occupied by the deleted file, including:
    对于任一所述子文件,所述虚拟机操作系统对所述子文件在虚拟磁盘中占用的空间进行标识,向所述虚拟机文件系统发送写零请求,消除对所述子文件在虚拟磁盘中占用的空间的标识;For any of the subfiles, the virtual machine operating system identifies the space occupied by the subfile in the virtual disk, sends a write zero request to the virtual machine file system, and eliminates the subdisk in the virtual disk. The identifier of the space occupied in;
    其中,所述写零请求中携带有所述子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, further comprising:
    所述虚拟机文件系统向虚拟磁盘控制器发送所述写零请求;The virtual machine file system sends the write zero request to a virtual disk controller;
    所述虚拟磁盘控制器根据所述写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息;Determining, by the virtual disk controller, space range information to be recovered in the virtual disk file according to the space range information occupied by the deleted file in the write zero request;
    所述虚拟磁盘控制器向所述虚拟机所在主机的存储设备的文件系统发送空间回收请求,所述空间回收请求中携带有所述待回收的空间范围信息;The virtual disk controller sends a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
    所述虚拟机所在主机的存储设备的文件系统将所述待回收的空间范围信息指示的空间标记为未分配。The file system of the storage device of the host where the virtual machine is located marks the space indicated by the space range information to be reclaimed as unallocated.
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述虚拟机操作系统接收虚拟机磁盘空间回收请求,包括:The method according to any one of claims 1 to 4, wherein the virtual machine operating system receives a virtual machine disk space reclamation request, including:
    所述虚拟机操作系统接收虚拟化管理主机代理发送的所述虚拟机磁盘空间回收请求;The virtual machine operating system receives the virtual machine disk space reclamation request sent by the virtualization management host agent;
    所述虚拟机操作系统在接收到虚拟机磁盘空间回收请求时,在虚拟机文件系统中确定对已删除文件以及所述已删除文件占用的空间之前,所述方法还包括:The method further includes: before the virtual machine operating system receives the virtual machine disk space reclamation request, and determines the space occupied by the deleted file and the deleted file in the virtual machine file system, the method further includes:
    所述虚拟化管理主机代理接收虚拟化管理组件发送的所述虚拟机磁盘空间回收请求。The virtualization management host agent receives the virtual machine disk space reclamation request sent by the virtualization management component.
  6. 一种虚拟机磁盘空间回收系统,其特征在于,所述系统包括:虚拟机操作系统和虚拟机文件系统;其中,A virtual machine disk space recovery system, the system comprising: a virtual machine operating system and a virtual machine file system; wherein
    所述虚拟机操作系统用于,在接收到虚拟机磁盘空间回收请求时,在所述虚拟机文件系统中确定已删除文件;The virtual machine operating system is configured to: when the virtual machine disk space reclamation request is received, determine the deleted file in the virtual machine file system;
    所述虚拟机操作系统还用于,向所述虚拟机文件系统发送写零请求,所述写零请求中携带有已删除文件占用的空间范围信息;The virtual machine operating system is further configured to send a write zero request to the virtual machine file system, where the write zero request carries spatial range information occupied by the deleted file;
    所述虚拟机文件系统用于,根据所述写零请求进行虚拟机磁盘空间回收。The virtual machine file system is configured to perform virtual machine disk space reclamation according to the write zero request.
  7. 根据权利要求6所述的系统,其特征在于,所述虚拟机操作系统具体用于,在接收到虚拟机磁盘空间回收请求时,根据所述虚拟机文件系统的类型确定所述虚拟机文件系统对应的已删除文件扫描装置;The system according to claim 6, wherein the virtual machine operating system is specifically configured to: when receiving a virtual machine disk space reclamation request, determine the virtual machine file system according to a type of the virtual machine file system Corresponding deleted file scanning device;
    所述虚拟机操作系统还用于,在所述虚拟机文件系统中,采用所述虚拟机文件系统对应的已删除文件扫描装置确定已删除文件以及所述已删除文件占用的空间范围。The virtual machine operating system is further configured to: in the virtual machine file system, determine, by using the deleted file scanning device corresponding to the virtual machine file system, the deleted file and the spatial extent occupied by the deleted file.
  8. 根据权利要求6或7所述的系统,其特征在于,所述已删除文件包括至少一个子文件;所述虚拟机操作系统还用于,获取各所述子文件在虚拟磁盘中占用的空间的范围信息;The system according to claim 6 or 7, wherein the deleted file includes at least one subfile; the virtual machine operating system is further configured to acquire a space occupied by each of the subfiles in the virtual disk. Range information
    所述虚拟机操作系统具体用于,对于任一所述子文件,对所述子文件在虚拟磁盘中占用的空间进行标识,向所述虚拟机文件系统发送写零请求,消除对所述子文件在虚拟磁盘中占用的空间的标识;The virtual machine operating system is specifically configured to: identify, for any of the subfiles, a space occupied by the subfile in the virtual disk, send a write zero request to the virtual machine file system, and eliminate the sub The identifier of the space occupied by the file in the virtual disk;
    其中,所述写零请求中携带有所述子文件在虚拟磁盘中占用的空间的范围信息。The write zero request carries the range information of the space occupied by the subfile in the virtual disk.
  9. 根据权利要求6至8中任一项所述的系统,其特征在于,所述系统还包括:虚拟磁盘控制器、虚拟机和所述虚拟机所在主机的存储设备的文件系统;其中,The system according to any one of claims 6 to 8, wherein the system further comprises: a virtual disk controller, a virtual machine, and a file system of a storage device of the host where the virtual machine is located;
    所述虚拟机文件系统具体用于,向所述虚拟磁盘控制器发送所述写零请求;The virtual machine file system is specifically configured to send the write zero request to the virtual disk controller;
    所述虚拟磁盘控制器用于,根据所述写零请求中的已删除文件占用的空间范围信息确定虚拟磁盘文件中待回收的空间范围信息;The virtual disk controller is configured to determine, according to the spatial range information occupied by the deleted file in the write zero request, the spatial range information to be recovered in the virtual disk file;
    所述虚拟磁盘控制器还用于,向所述虚拟机所在主机的存储设备的文件系统发送空间回收请求,所述空间回收请求中携带有所述待回收的空间范围信息;The virtual disk controller is further configured to send a space reclamation request to the file system of the storage device of the host where the virtual machine is located, where the space reclamation request carries the space range information to be reclaimed;
    所述虚拟机所在主机的存储设备的文件系统用于,将所述待回收的空间范围信息指示的空间标记为未分配。The file system of the storage device of the host where the virtual machine is located is used to mark the space indicated by the space range information to be recovered as unallocated.
  10. 根据权利要求6至9中任一项所述的系统,其特征在于,所述系统还包括:虚拟化管理主机代理;The system according to any one of claims 6 to 9, wherein the system further comprises: a virtualization management host agent;
    所述虚拟机操作系统还用于,接收所述虚拟化管理主机代理发送的所述虚拟机磁盘空间回收请求;The virtual machine operating system is further configured to receive the virtual machine disk space reclamation request sent by the virtualization management host agent;
    所述虚拟化管理主机代理用于,接收虚拟化管理组件发送的所述虚拟机磁盘空间回收请求。The virtualization management host agent is configured to receive the virtual machine disk space reclamation request sent by the virtualization management component.
  11. 一种虚拟机磁盘空间回收设备,其特征在于,包括处理器、存储器、通信接口以及总线,所述处理器、所述存储器和所述通信接口之间通过所述总线连接并完成相互间的通信,所述存储器中用于存储计算机执行指令,所述设备运行时,所述处理器执行所述存储器中的计算机执行指令以利用所述设备中的硬件资源执行权利要求1至5中任一所述方法的操作步骤。A virtual machine disk space reclamation device, comprising: a processor, a memory, a communication interface, and a bus, wherein the processor, the memory, and the communication interface are connected by the bus and complete communication with each other The memory is for storing computer execution instructions, and when the device is running, the processor executes a computer execution instruction in the memory to perform any one of claims 1 to 5 with hardware resources in the device. The operational steps of the method.
PCT/CN2019/073612 2018-01-31 2019-01-29 Virtual machine disk space reclamation method and system WO2019149184A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810096939.0 2018-01-31
CN201810096939.0A CN108363552B (en) 2018-01-31 2018-01-31 Method and system for recycling disk space of virtual machine

Publications (1)

Publication Number Publication Date
WO2019149184A1 true WO2019149184A1 (en) 2019-08-08

Family

ID=63007660

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/073612 WO2019149184A1 (en) 2018-01-31 2019-01-29 Virtual machine disk space reclamation method and system

Country Status (2)

Country Link
CN (1) CN108363552B (en)
WO (1) WO2019149184A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254430A (en) * 2021-05-20 2021-08-13 紫光云技术有限公司 Method for automatically cleaning public cloud environment garbage data

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108363552B (en) * 2018-01-31 2020-06-02 华为技术有限公司 Method and system for recycling disk space of virtual machine
CN111007985B (en) * 2019-10-31 2021-10-22 苏州浪潮智能科技有限公司 Compatible processing method, system and equipment for space recovery of storage system
CN112148228A (en) * 2020-09-29 2020-12-29 上海摩勤智能技术有限公司 Storage space release method, terminal and storage medium
CN113961147A (en) * 2021-10-26 2022-01-21 江苏安超云软件有限公司 Method and application for recycling space from deleted blocks on cloud platform

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103383648A (en) * 2012-12-21 2013-11-06 北京安天电子设备有限公司 Method and system for compressible virtual machine magnetic disk size recycling
CN104572656A (en) * 2013-10-12 2015-04-29 华为技术有限公司 Method and device for recycling space of disk mirror image
US9311375B1 (en) * 2012-02-07 2016-04-12 Dell Software Inc. Systems and methods for compacting a virtual machine file
CN105786655A (en) * 2016-03-08 2016-07-20 成都云祺科技有限公司 Repeated data deleting method for virtual machine backup data
CN108363552A (en) * 2018-01-31 2018-08-03 华为技术有限公司 Magnetic disk of virtual machine space reclamation method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8024378B2 (en) * 2006-12-20 2011-09-20 Oracle International Corporation System and method to reduce the promotion rate in a generational garbage collector in a virtual machine environment
US8874859B2 (en) * 2010-12-22 2014-10-28 Vmware, Inc. Guest file system introspection and defragmentable virtual disk format for space efficiency
CN103092678B (en) * 2013-01-22 2016-01-13 华中科技大学 A kind of many incremental virtual machine internal storage management system and method
CN104572242A (en) * 2013-10-24 2015-04-29 华为技术有限公司 Method and device for expanding disk space of virtual machine and virtual machine system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9311375B1 (en) * 2012-02-07 2016-04-12 Dell Software Inc. Systems and methods for compacting a virtual machine file
CN103383648A (en) * 2012-12-21 2013-11-06 北京安天电子设备有限公司 Method and system for compressible virtual machine magnetic disk size recycling
CN104572656A (en) * 2013-10-12 2015-04-29 华为技术有限公司 Method and device for recycling space of disk mirror image
CN105786655A (en) * 2016-03-08 2016-07-20 成都云祺科技有限公司 Repeated data deleting method for virtual machine backup data
CN108363552A (en) * 2018-01-31 2018-08-03 华为技术有限公司 Magnetic disk of virtual machine space reclamation method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254430A (en) * 2021-05-20 2021-08-13 紫光云技术有限公司 Method for automatically cleaning public cloud environment garbage data

Also Published As

Publication number Publication date
CN108363552B (en) 2020-06-02
CN108363552A (en) 2018-08-03

Similar Documents

Publication Publication Date Title
WO2019149184A1 (en) Virtual machine disk space reclamation method and system
US10838665B2 (en) Method, device, and system for buffering data for read/write commands in NVME over fabric architecture
EP3686739B1 (en) Method and system for enabling agentless backup and restore operations on a container orchestration platform
EP3457288B1 (en) Computer system and storage access device
JP5955870B2 (en) Method, computer readable storage medium and system for optimal compression of a virtual disk
US9588787B2 (en) Runtime virtual process creation for load sharing
JP6475256B2 (en) Computer, control device and data processing method
EP3206124A1 (en) Method, apparatus and system for accessing storage device
US20140108720A1 (en) High resolution tape directory (hrtd) stored at end of data in an index partition
US8966130B2 (en) Tag allocation for queued commands across multiple devices
WO2016078422A1 (en) Virtual machine configuration information storage method and apparatus
US9582214B2 (en) Data access method and data access apparatus for managing initialization of storage areas
US9658786B2 (en) Setting optimal space allocation policy for creating dependent snapshots to enhance application write performance and reduce resource usage
CN105739930A (en) Storage framework as well as initialization method, data storage method and data storage and management apparatus therefor
US8954702B2 (en) Extended address volume (EAV) allocation verification
JPWO2017145272A1 (en) Data migration method and computer system
CN107291507B (en) Upgrading method for virtual hard disk of virtual machine and electronic equipment
US20150074368A1 (en) Thin provisioning storage devices in connection with secure delete operations
US20110161428A1 (en) Two-way data and resources sharing method
US8543779B2 (en) Management system and management method for managing computer system
WO2018045926A1 (en) Method and device for use in accessing container
JP2012079245A (en) Volume assignment method of virtual machine and computer system using method thereof
US20160320977A1 (en) Storage control device, method and storage system
WO2022242665A1 (en) Data storage method and related device
KR102276912B1 (en) Storage system and operating method thereof

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: 19748076

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: 19748076

Country of ref document: EP

Kind code of ref document: A1