CN109857343A - Disk space method for releasing and device - Google Patents
Disk space method for releasing and device Download PDFInfo
- Publication number
- CN109857343A CN109857343A CN201910093758.7A CN201910093758A CN109857343A CN 109857343 A CN109857343 A CN 109857343A CN 201910093758 A CN201910093758 A CN 201910093758A CN 109857343 A CN109857343 A CN 109857343A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- disk
- target
- disk space
- command
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Landscapes
- Stored Programmes (AREA)
Abstract
This disclosure relates to virtual machine technique field, a kind of disk space method for releasing and device are provided, which comprises the release command of reception of magnetic disc space;Disk space release command is parsed, command id is generated and generates the multiple target virtual machines and target disk subregion corresponding with each target virtual machine of disk space to be released;Command id and the corresponding target disk subregion of each target virtual machine are packaged into multiple disk space release messages according to preset format;Multiple disk space release messages are sent to corresponding target virtual machine, so that corresponding target virtual machine calls default disk space collating order to discharge the disk space of corresponding target virtual machine based on corresponding disk space release message.The disclosure can discharge extra memory space in the target disk subregion of multiple target virtual machines by executing order on host simultaneously, greatly improve the efficiency of extra disk space in the target disk subregion of release target virtual machine.
Description
Technical field
This disclosure relates to virtual machine technique field, in particular to a kind of disk space method for releasing and device.
Background technique
It can run multiple virtual machines on one host simultaneously, it is mutually indepedent and each virtual between multiple virtual machines
Also mutually indepedent between machine and host, while the utilization rate for improving host, the disk partition of virtual machine can also be accounted for
With the memory space of a large amount of host, even if deleting the file in the disk partition of many virtual machines, virtual machine is in host
The memory space occupied on machine is not reduced, this is because there is no really when deleting the file in the disk partition of virtual machine
The content for removing respective file only simply does a label, thus improves the speed for deleting file.In order to veritably discharge void
The extra disk space that deleted document occupies in the disk partition of quasi- machine, the prior art need to enter virtual machine internal system and hold
Row disk collating order achievees the purpose that discharge extra disk space in the disk partition of virtual machine, but works as virtual machine number
When more, this mode is inefficient and easy error.
Summary of the invention
The disclosure is designed to provide a kind of disk space method for releasing and device, by executing unification on host
A disk space release command target disk subregion of disk space to be released can be sent to corresponding destination virtual
Machine, extra memory space in the target disk subregion to achieve the purpose that while discharge multiple target virtual machines, greatlys improve
The efficiency of extra disk space in the target disk subregion of release target virtual machine.
To achieve the goals above, the disclosure the technical solution adopted is as follows:
In a first aspect, being applied to host, running on host has present disclose provides a kind of disk space method for releasing
Multiple virtual machines, which comprises reception of magnetic disc space release command;Disk space release command is parsed, order mark is generated
Know and generate the multiple target virtual machines and target disk corresponding with each target virtual machine point of disk space to be released
Area;Command id and the corresponding target disk subregion of each target virtual machine are packaged into multiple disk spaces according to preset format
Release message;Multiple disk space release messages are sent to corresponding target virtual machine, so that corresponding target virtual machine base
Call default disk space collating order to the disk space of corresponding target virtual machine in corresponding disk space release message
It is discharged.
Second aspect, it is virtual on host applied to running on present disclose provides a kind of disk space method for releasing
Machine, which comprises receive the disk space release message that host is sent, wherein disk space release message is host
Made of machine encapsulates command id and target disk subregion according to preset format, command id, target disk subregion and target
Virtual machine is generated after host parses disk space release command;Default disk space is called based on disk space release message
Collating order discharges the disk space of target virtual machine.
The third aspect, the disclosure additionally provide a kind of disk space release device, are applied to host, run on host
There is at least one virtual machine, described device includes Order receiver module, parsing module, package module and sending module.Order connects
It receives module and is used for the release command of reception of magnetic disc space;Parsing module for parsing disk space release command, generate command id,
And generate the multiple target virtual machines and target disk subregion corresponding with each target virtual machine of disk space to be released;Envelope
Die-filling piece multiple for being packaged into command id and the corresponding target disk subregion of each target virtual machine according to preset format
Disk space release message;Sending module is used to multiple disk space release messages being sent to corresponding target virtual machine, with
So that corresponding target virtual machine is based on corresponding disk space release message calls default disk space collating order to corresponding
The disk space of virtual machine is discharged.
Fourth aspect, it is virtual on host applied to running on present disclose provides a kind of disk space release device
Machine, described device include: message reception module and release module.The disk that message reception module is used to receive host transmission is empty
Between release message, wherein disk space release message is host according to preset format by command id and target disk subregion
Made of encapsulation, command id, target disk subregion and target virtual machine are lifes after host parsing disk space release command
At;Release module is used to call default disk space collating order to the disk of target virtual machine based on disk space release message
Space is discharged.
5th aspect, the disclosure provide a kind of host, and the host includes: processor;Memory, for storing one
A or multiple programs, when one or more of programs are executed by the processor, so that the processor realizes above-mentioned answer
Disk space method for releasing for host or the disk space release side applied to the virtual machine run on host
Method.
6th aspect, the disclosure provide a kind of computer readable storage medium, are stored thereon with computer program, the calculating
Machine program realizes the above-mentioned disk space method for releasing applied to host or applied to running on place when being executed by processor
The disk space method for releasing of virtual machine on host.
Compared with the prior art, the disclosure provides a kind of disk space method for releasing and device, firstly, user is on host
Send the disk space release command for discharging the disk space of virtual machine, disk space release command of the host to receiving
Parsed, generate command id and generate disk space to be released multiple target virtual machines and with each destination virtual
The corresponding target disk subregion of machine, next, host is corresponding by command id and each target virtual machine according to preset format
Target disk subregion be packaged into multiple disk space release messages, finally, host sends out multiple disk space release messages
It send to corresponding target virtual machine, so that corresponding target virtual machine is based on corresponding disk space release message and calls default magnetic
Disk space collating order discharges the disk space of the corresponding target disk subregion of corresponding target virtual machine.With it is existing
There is technology to compare, the disclosure can be by disk to be released by executing a unified disk space release command on host
The target disk subregion in space is sent to corresponding target virtual machine, to reach while discharge the target magnetic of multiple target virtual machines
The purpose of extra memory space in the corresponding disk of disk subregion greatly improves in the corresponding disk for discharging target virtual machine
The efficiency of extra disk space.
To enable the above objects, features, and advantages of the disclosure to be clearer and more comprehensible, special embodiment below, and appended by cooperation
Attached drawing is described in detail below.
Detailed description of the invention
In order to illustrate more clearly of the technical solution of the disclosure, letter will be made to attached drawing needed in the embodiment below
It singly introduces, it should be understood that the following drawings illustrates only some embodiments of the disclosure, therefore is not construed as to range
It limits, it for those of ordinary skill in the art, without creative efforts, can also be according to these attached drawings
Obtain other relevant attached drawings.
Fig. 1 shows the block diagram of the host of disclosure offer.
Fig. 2 shows the disk space method for releasing flow charts applied to host that the disclosure provides.
Fig. 3 be Fig. 2 shows step S102 sub-step flow chart.
Fig. 4 shows the disk space method for releasing flow chart applied to virtual machine of disclosure offer.
Fig. 5 shows the block diagram of the disk space release device applied to host of disclosure offer.
Fig. 6 shows the block diagram of the disk space release device applied to virtual machine of disclosure offer.
Icon: 100- host;101- memory;102- communication interface;103- processor;104- bus;200- application
In the disk space release device of host;201- Order receiver module;202- parsing module;203- package module;204- hair
Send module;400- is applied to the disk space release device of virtual machine;401- message reception module;402- release module.
Specific embodiment
Below in conjunction with attached drawing in the disclosure, the technical solution in the disclosure is clearly and completely described, it is clear that
Described embodiment is only disclosure a part of the embodiment, instead of all the embodiments.Usually retouched in attached drawing here
The component for the disclosure stated and shown can be arranged and be designed with a variety of different configurations.Therefore, below to mentioning in the accompanying drawings
The detailed description of the embodiment of the disclosure of confession is not intended to limit claimed the scope of the present disclosure, but is merely representative of this
Disclosed selected embodiment.Based on embodiment of the disclosure, those skilled in the art are in the premise for not making creative work
Under every other embodiment obtained, belong to the disclosure protection range.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi
It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile in the disclosure
In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Fig. 1 is please referred to, Fig. 1 shows the block diagram of the host 100 of disclosure offer.Host 100 can be,
But it is not limited to, host, property server.The operating system of host 100 may be, but not limited to, Windows system, Linux
System etc..The host 100 includes memory 101, communication interface 102, processor 103 and bus 104, the memory
101, communication interface 102 and processor 103 are connected by bus 104, and processor 103 is used to executing to be stored in memory 101
Executable module, such as above-mentioned computer program.
Wherein, memory 101 may include high-speed random access memory (RAM:Random Access Memory),
It may further include non-labile memory (non-volatile memory), for example, at least a magnetic disk storage.By extremely
A few communication interface 102 (can be wired or wireless) realizes the communication link between host 100 and External memory equipment
It connects.
Bus 104 can be isa bus, pci bus or eisa bus etc..It is only indicated with a four-headed arrow in Fig. 1, but
It is not offered as only a bus or a type of bus.
Wherein, memory 101 is for storing program, such as the disk space release dress shown in fig. 5 applied to host
Set 200.Disk space release device 200 applied to host includes that at least one can be with software or firmware (firmware)
Form is stored in the memory 101 or is solidificated in the operating system (operating system, OS) of the host 100
In software function module.The processor 103 executes described program after receiving and executing instruction to realize that the disclosure is above-mentioned
The disk space method for releasing applied to host 100 that embodiment discloses.
It should be noted that since virtual machine is the software module operated on host 100, it is applied to
The disk space release device 400 of virtual machine is also stored in the memory 101 of host 100, and by the processing of host 100
Device 103 executes.
First embodiment
Referring to figure 2., Fig. 2 shows the disk space method for releasing processes applied to host 100 that the disclosure provides
Figure.It the described method comprises the following steps:
Step S101, the release command of reception of magnetic disc space.
In the disclosure, for host 100, virtual machine is the application program run on host 100, one
Multiple virtual machines can be run on a host 100, a disk of virtual machine is that store on 100 disk of host one is pre-
If the file of format, a virtual machine can have multiple disks, and each disk corresponds to a preset format on 100 disk of host
File, each disk can mark off one or more disk partition, for example, there are two virtual for operation on host 100
Machine: vm1 and vm2, wherein vm1 has 3 disks, respectively 1# disk, 2# disk and 3# disk, and vm2 has 2 disks, respectively
4# disk and 5# disk, each disk divide a disk partition, then vm1 has 3 disk partition, respectively 1# disk partition,
2# disk partition and 3# disk partition, vm2 have 2 disk partition, respectively 4# disk partition and 5# disk partition.User can be with
Use the format of different disk space release commands to the subregion pair of the designated disk of specified virtual machine according to specific requirements
The disk space answered is discharged, for example, user can be for all disk partition pair on all virtual machines on host 100
The disk space answered is discharged, can also be for all disks point for one or more virtual machine that host 100 is specified
The corresponding disk space in area is discharged, can also be for the specified of one or more virtual machine that host 100 is specified
The corresponding disk space of disk partition is discharged.
It should be noted that only making one when due to deleting file on a virtual machine to file to be deleted and deleting
File success is deleted except mark is returned to user, there is no the disk spaces of the host 100 occupied to file to be deleted to carry out
Really release, the disk space release command of the disclosure are occupied for the disk for having done those of deleted marker virtual machine
Disk space really discharged, with reduce virtual machine disk occupy host 100 disk space.
Step S102 parses disk space release command, generates command id and generates the more of disk space to be released
A target virtual machine and target disk subregion corresponding with each target virtual machine.
In the disclosure, in order to simplify user's operation, disk space release command can not include needing release disk point
All virtual machines in area and corresponding disk partition, user can discharge demand difference according to different disk spaces, use
The format of different disk space release commands, host 100 are generated by the disk space release command of parsing different-format
The multiple target virtual machines and target disk corresponding with each target virtual machine of corresponding command id, disk space to be released
Then subregion sends command id and corresponding target disk subregion to target virtual machine, to reach target virtual machine release pair
The purpose for the disk space on target disk subregion answered.
Specifically, disk space release command is parsed, command id is generated and generates the more of disk space to be released
A target virtual machine and target disk subregion corresponding with each target virtual machine can include at least following three kinds of situations: (1)
When the not disk partition of the mark including virtual machine and virtual machine corresponding with the mark of virtual machine in disk space release command
When, the mark of each virtual machine and the disk partition of virtual machine corresponding with the mark of each virtual machine are obtained first, then will
The corresponding virtual machine of the mark of each virtual machine is determined as target virtual machine and disk partition corresponding with each target virtual machine
It is determined as target disk subregion corresponding with each target virtual machine;(2) when including virtual machine in disk space release command
When identifying but not including the disk partition of virtual machine corresponding with the mark of virtual machine, obtain first corresponding with the mark of virtual machine
Virtual machine disk partition, the corresponding virtual machine of the mark of virtual machine is then determined as target virtual machine and and virtual machine
Corresponding disk partition is determined as target disk subregion corresponding with target virtual machine;(3) it is wrapped when in disk space release command
Include virtual machine mark and virtual machine corresponding with the mark of virtual machine disk partition when, by the corresponding void of the mark of virtual machine
The disk partition that quasi- machine is determined as target virtual machine and virtual machine corresponding with the mark of virtual machine is determined as and target virtual machine
Corresponding target disk subregion.
In the disclosure, disk space release command can only include command id, can also not only include command id, but also
It is identified including virtual machine, and can simultaneously include command id, virtual machine mark and corresponding target disk subregion.
In the disclosure, command id is the unique designation of order, can be a string that program developer defines specific words
Symbol string, for example, command id is defined as host-fstrim.Since the order that operating system or disk tools provide is not clever enough
Living, not enough automation, different demands, which needs to be implemented different steps, can be only achieved corresponding effect, for unification user difference
Actual demand scene, simplify the operation of user, the disclosure carries out again the order that operating system or disk tools provide
Secondary encapsulation externally provides unified command id, is parsed according to the command format with the command id that user inputs,
The effect of different actual demand scenes is realized using an order.For example, fstrim is disk tools offer for arranging magnetic
The order of disk space executes fstrim order and needs to specify one or more disk partition name in disk space to be arranged
Claim, if necessary to discharge redundant space all in a disk, needs successively to execute one to disk partition all in disk
Secondary fstrim order is in the disclosure encapsulated fstrim order again, externally provides unified command id host-
Fstrim, and the corresponding relationship between command id host-fstrim and fstrim is stored in advance in virtual machine, when user needs
When discharging the redundant space in all disks, it is only necessary to input host-fstrim in command format, not need to input all magnetic
All disk partition titles in disk, after the corresponding order of host-fstrim parses the command format that user inputs, root
It is automatic to execute the order acquisition institute for obtaining all disks according to the disk partition title in the pre-stored no designated disk of discovery
There is disk partition, command id host-fstrim is then sent to virtual machine, virtual machine is according to pre-stored command id
Corresponding relationship between host-fstrim and fstrim determines that order corresponding with host-fstrim is fstrime, virtual machine
Fstrim order is executed to each disk partition, achievees the effect that the disk space for discharging all disks.
It should be noted that in the disclosure, command id is also possible to command name, command name be operating system or
The name for the order that person's disk tools provide, the command name correspond to the disk space collating order actually executed on virtual machine,
At this point, the command keyword and command name corresponding relationship of disk space release command is stored in advance in host 100, according to input
Disk space release command character string, the command keyword in the character string is extracted, then, according to pre-stored disk
The command keyword and command name corresponding relationship of space release command, determine order corresponding with the disk space release command
Then command name is sent to virtual machine by title, so that virtual machine executes order corresponding with corresponding command name, to release
Put the disk space of target disk subregion.
Referring to figure 3., step S102 further includes following sub-step:
Sub-step S1021, when in disk space release command not including virtual machine mark and with the mark pair of virtual machine
When the disk partition for the virtual machine answered, the mark of pre-stored each virtual machine and corresponding with the mark of each virtual machine is obtained
Virtual machine disk partition.
In the disclosure, the mark of virtual machine is the unique designation for characterizing virtual machine, and the mark of virtual machine can be expression
The unique name or unique number of virtual machine, when user needs to discharge each virtual machine and each virtual machine on host 100
Each disk when, it does not include the mark of virtual machine that the format of disk release command of user's input, which can only include command id,
Knowledge and the disk partition of virtual machine corresponding with the mark of virtual machine, at this point, host 100 can obtain each virtual machine first
Mark, then obtain each disk partition of the corresponding virtual machine of mark of each virtual machine.For example, being run on host 100
There are two virtual machines: vm1 and vm2, wherein vm1 has 3 disks, the corresponding disk partition of each disk, respectively 1# disk
Subregion, 2# disk partition and 3# disk partition, vm2 have 2 disks, the corresponding disk partition of each disk, respectively 4# magnetic
Disk subregion and 5# disk partition, the command format of user's input are as follows: the mark of the not specified virtual machine of host-fstrim, i.e. user
And the disk partition of virtual machine corresponding with the mark of virtual machine, host 100 can obtain the mark of virtual machine: vm1 first
And vm2, then the corresponding 1# disk partition of vm1,2# disk partition and 3# disk partition are obtained respectively, next, obtaining vm2 respectively
Corresponding 4# disk partition and 5# disk partition.
Sub-step S1022, by the corresponding virtual machine of the mark of each virtual machine be determined as target virtual machine and will with it is each
The corresponding disk partition of target virtual machine is determined as target disk subregion corresponding with each target virtual machine.
It in the disclosure, in the command format of user's input does not include the mark of virtual machine and corresponding with the mark of virtual machine
Virtual machine disk partition, the command format mean disk space to be released be host 100 on each virtual machine
Each disk partition, i.e. target virtual machine is each virtual machine on host 100, each on each virtual machine
A disk partition is the corresponding target disk subregion of the target virtual machine.For example, the command format of user's input are as follows: host-
The disk partition of the mark of the not specified virtual machine of fstrim, i.e. user and virtual machine corresponding with the mark of virtual machine, virtual machine
There are two vm1 and vm2, vm1 2 disks, and corresponding disk partition is respectively 1# disk partition/dev/hda1 and 2# disk point
Area/dev/hda2;Vm2 has 2 disks, corresponding disk partition be respectively 3# disk partition/dev/hda34# disk partition/
Dev/hda4, then there are two target virtual machines: vm1 and vm2, target disk subregion corresponding with target virtual machine vm1 are as follows:/
Dev/hda1 ,/dev/hda2, target disk subregion corresponding with target virtual machine vm2 are as follows:/dev/hda3 ,/dev/hda4, table
Sign need to discharge vm1 virtual machine /dev/hda1 and the/corresponding disk of the disk partition of dev/hda2 on disk space, need
Discharge vm2 virtual machine /dev/hda3 disk corresponding with the/disk partition of dev/hda4 on disk space.
Sub-step S1023 when the mark for including virtual machine but does not include mark with virtual machine in disk space release command
When knowing the disk partition of corresponding virtual machine, the disk point of virtual machine corresponding with the mark of pre-stored virtual machine is obtained
Area.
In the disclosure, when user needs to discharge each disk partition of designated virtual machine, the disk space of input discharges
The life format of order need include virtual machine mark, do not include the corresponding disk partition of mark of the virtual machine, at this point, host
Machine 100 obtains each disk partition of the corresponding virtual machine of mark of the virtual machine automatically.
Sub-step S1024, is determined as target virtual machine for the corresponding virtual machine of the mark of virtual machine and will be with virtual machine pair
The disk partition answered is determined as target disk subregion corresponding with target virtual machine.
In the disclosure, as soon as when the disk partition of target virtual machine be when, target disk subregion only one, work as mesh
Mark virtual machine disk partition be it is multiple when, target disk subregion just have it is multiple, for example, virtual machine vm1 has 2 disks, each
Disk corresponds to a disk partition, respectively corresponds as 1# disk partition and 2# disk partition, and corresponding disk partition is entitled/
Dev/hda1 and/dev/hda2, the command format of user's input are as follows: the order lattice of host-fstrim-m vm1, i.e. user input
Include the mark vm1 of virtual machine in formula, but do not include the disk partition of virtual machine vm1, then target disk subregion there are 2 :/dev/
hda1、/dev/hda2。
Sub-step S1025, when including the mark of virtual machine in disk space release command and corresponding with the mark of virtual machine
Virtual machine disk partition when, the corresponding virtual machine of the mark of virtual machine is determined as target virtual machine and will be with virtual machine
The disk partition of the corresponding virtual machine of mark be determined as target disk subregion corresponding with target virtual machine.
In the disclosure, may include in the command format of disk space release command multiple virtual machines mark and with it is every
One disk partition of the corresponding virtual machine of mark of a virtual machine, for example, there are two vm1 and vm2, vm1 2 magnetic for virtual machine
Disk, the corresponding subregion of each disk, respectively 1# disk and 2# disk, corresponding disk partition are /dev/hda1 and/dev/
hda2;Vm2 has 2 disks, respectively 3# disk and 4# disk, and corresponding disk partition is /dev/hda3 and/dev/hda4,
The command format of user's input are as follows: host-fstrim-m vm1vm2/dev/hda2/dev/hda3, i.e. user are specified virtually
Machine vm1, and the corresponding disk space of disk partition/dev/hda2 of release virtual machine vm1 is specified, while specifying virtual machine
Vm2, and specify the disk space of the corresponding disk partition/dev/hda3 of release virtual machine vm2, then target virtual machine has two
It is a: the target disk subregion of vm1 and vm2, target virtual machine vm1 is /dev/hda2, target virtual machine vm2 target disk point
Area is /dev/hda3.
Step S103 encapsulates command id and the corresponding target disk subregion of each target virtual machine according to preset format
At multiple disk space release messages.
In the disclosure, as a kind of implementation, preset format can be JSON Format Object, when target disk subregion
When being multiple, the disk space release message being packaged into also is multiple, for example, according to JSON Format Object by command id and mesh
The disk space release message that mark disk partition is packaged into are as follows: " execute ": " fstrim ", " arguments ": "
Message ": "/dev/hda2 " } }, wherein fstrim is command id, and/dev/hda2 is target disk subregion.
Multiple disk space release messages are sent to target virtual machine, so that corresponding target virtual machine by step S104
Call default disk space collating order empty to the disk of corresponding target virtual machine based on corresponding disk space release message
Between discharged.
In the disclosure, in order to realize that multiple disk space release messages are sent to target virtual machine, place by host 100
It is interacted between host 100 and target virtual machine by qemu-ga (Qemu Guest Agent), qemu-ga is a fortune
In the common applications of virtual machine internal, (executable file title is defaulted as qemu-ga to row, and service name is defaulted as qemu-
Guest-agent), the purpose is to the message between host 100 and target virtual machine is realized in the case where not depending on network
Interaction.
As a kind of implementation, disk space release message is sent to virtual machine can be by host 100
The virshqemu-agent-command order that qemu-ga is provided is executed to complete, for example, executing order:
virshqemu-agent-command vm1--cmd
'{"execute":"fstrim","arguments":{"message":"/dev/hda2"}}'。
Command id fstrim and target disk subregion/dev/hda2 are sent to virtual machine vm1, virtual machine vm1 is called
Default disk space collating order fstrim discharges the corresponding disk space of disk partition/dev/hda2.
In the disclosure, the qemu-ga run on host 100 is responsible for command id and target disk subregion according to pre-
If format is sent to target virtual machine after being packaged into disk space release message, the qemu-ga of the operation on target virtual machine is negative
Duty receives and decapsulates the disk space release message, command id and target disk subregion is obtained, finally according to command id
With target disk subregion call default disk space collating order to the disk space of the target disk subregion of target virtual machine into
Row release, therefore, the disclosure further includes step S201 and step S202.
Referring to figure 4., the disk space based on qemu-ga applied to virtual machine that Fig. 4 shows disclosure offer is released
Put method flow diagram.
Step S201 receives the disk space release message that host is sent, wherein disk space release message is host
Made of machine encapsulates command id and target disk subregion according to preset format, command id, target disk subregion and target
Virtual machine is generated after host parses disk space release command.
Step S202 calls default disk space collating order to the magnetic of target virtual machine based on disk space release message
Disk space is discharged.
In the disclosure, call the implementation of default disk space collating order can be with based on disk space release message
It is:
Firstly, decapsulating to disk space release message, command id and target disk subregion are obtained;
Secondly, the corresponding order of command id is executed based on target disk subregion, to call default disk space to arrange life
Order discharges the disk space of the target disk subregion of target virtual machine.
It in the disclosure, can after the qemu-ga of the operation on target virtual machine obtains command id and target disk subregion
Carried out to the disk space of target disk subregion by calling preset disk space collating order corresponding with command id
Release.
It should be noted that a disk of virtual machine can also correspond to multiple disk partition, it can be by a magnetic
Disk subregion discharges the extra memory space of the corresponding disk of the disk partition using disk space collating order, so that virtually
The extra memory space that machine occupies on host 100 is released.
In the disclosure, by the unified operation on host 100, by the command id of disk space release command and to
The corresponding disk partition of the target virtual machine in release disk space is sent to target void by the qemu-ga that host 100 is run
Quasi- machine executes correspondence according to command id and the corresponding disk partition of target virtual machine by the qemu-ga of target virtual machine operation
Disk space collating order, realize while discharging extra memory space in the disk partition of multiple virtual machines, with the prior art
It compares, has the advantages that
First, due to being operated without entering virtual machine, it is virtual that release can be realized in execution order on host 100
The disk space of machine improves the efficiency of extra disk space in the disk partition of release virtual machine, final to realize corresponding host
The efficient release of redundant space on machine 100.
Second, release of the batch to the disk space of all virtual machines on host 100 can be realized using an order
With the release of the disk space of all disks of designated virtual machine, the operation of user is enormously simplified.
Third is supported the different demands for being realized user using different command formats, improves the spirit of disk space release
Activity.
Second embodiment
Referring to figure 5., Fig. 5 shows the side of the disk space release device 200 applied to host of disclosure offer
Frame schematic diagram, the disk space release device 200 applied to host include Order receiver module 201, parsing module 202, envelope
Die-filling piece 203 and sending module 204.
Order receiver module 201 is used for the release command of reception of magnetic disc space.
In the disclosure, Order receiver module 201 is for executing step S101.
Parsing module 202, for parsing disk space release command, generating command id and generating disk to be released
Multiple target virtual machines in space and target disk subregion corresponding with each target virtual machine.
In the disclosure, parsing module 202 is for executing step S102 and its sub-step S1021-S1025.
Package module 203, for according to preset format by command id and the corresponding target disk of each target virtual machine
Subregion is packaged into multiple disk space release messages.
In the disclosure, package module 203 is for executing step S103.
Sending module 204, for multiple disk space release messages to be sent to corresponding target virtual machine, so that corresponding
Target virtual machine be based on corresponding disk space release message and call default disk space collating order empty to corresponding target
The disk space of quasi- machine is discharged.
In the disclosure, sending module 204 is for executing step S104.
Fig. 6 is please referred to, Fig. 6 shows the side of the disk space release device 400 applied to virtual machine of disclosure offer
Frame schematic diagram, the disk space release device 400 applied to virtual machine include message reception module 401 and release module 402.
Message reception module 401, for receiving the disk space release message of host transmission, wherein disk space is released
Putting message is command id, target made of order is indicated meeting and the encapsulation of target disk subregion according to preset format by host
Disk partition and target virtual machine are generated after host parses disk space release command.
In the disclosure, message reception module 401 is for executing step S201.
Release module 402, for calling default disk space collating order to target void based on disk space release message
The disk space of quasi- machine is discharged.
As an implementation, release module 402 is specifically also used to:
Disk space release message is decapsulated, command id and target disk subregion are obtained;
The corresponding order of command id is executed based on target disk subregion, to call default disk space collating order to mesh
The disk space for marking the target disk subregion of virtual machine is discharged.
In the disclosure, release module 402 is for executing step S202.
In conclusion a kind of disk space method for releasing and device that the disclosure provides, the method packet applied to host
It includes: the release command of reception of magnetic disc space;Disk space release command is parsed, command id is generated and generates disk to be released
Multiple target virtual machines in space and target disk subregion corresponding with each target virtual machine;Order is marked according to preset format
Know and the corresponding target disk subregion of each target virtual machine is packaged into multiple disk space release messages;By multiple disk spaces
Release message is sent to corresponding target virtual machine, so that corresponding target virtual machine is based on corresponding disk space release message
Default disk space collating order is called to discharge the disk space of corresponding target virtual machine.Compared with prior art,
The disclosure can be by the target of disk space to be released by executing a unified disk space release command on host
Disk partition is sent to corresponding target virtual machine, more in the target disk subregion to reach while discharge multiple target virtual machines
The purpose of remaining memory space greatly improves the effect of extra disk space in the target disk subregion of release target virtual machine
Rate.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass through
Other modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and block diagram in attached drawing
Show the device of multiple embodiments according to the disclosure, the architectural framework in the cards of method and computer program product,
Function and operation.In this regard, each box in flowchart or block diagram can represent the one of a module, section or code
Part, a part of the module, section or code, which includes that one or more is for implementing the specified logical function, to be held
Row instruction.It should also be noted that function marked in the box can also be to be different from some implementations as replacement
The sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimes
It can execute in the opposite order, this depends on the function involved.It is also noted that every in block diagram and or flow chart
The combination of box in a box and block diagram and or flow chart can use the dedicated base for executing defined function or movement
It realizes, or can realize using a combination of dedicated hardware and computer instructions in the system of hardware.
In addition, each functional module in each embodiment of the disclosure can integrate one independent portion of formation together
Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module
It is stored in a computer readable storage medium.Based on this understanding, the technical solution of the disclosure is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a
People's computer, server or network equipment etc.) execute each embodiment the method for the disclosure all or part of the steps.
And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.It needs
Illustrate, herein, relational terms such as first and second and the like be used merely to by an entity or operation with
Another entity or operation distinguish, and without necessarily requiring or implying between these entities or operation, there are any this realities
The relationship or sequence on border.Moreover, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludability
Contain, so that the process, method, article or equipment for including a series of elements not only includes those elements, but also including
Other elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device.
In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the element
Process, method, article or equipment in there is also other identical elements.
The foregoing is merely preferred embodiment of the present disclosure, are not limited to the disclosure, for the skill of this field
For art personnel, the disclosure can have various modifications and variations.It is all within the spirit and principle of the disclosure, it is made any to repair
Change, equivalent replacement, improvement etc., should be included within the protection scope of the disclosure.It should also be noted that similar label and letter exist
Similar terms are indicated in following attached drawing, therefore, once being defined in a certain Xiang Yi attached drawing, are then not required in subsequent attached drawing
It is further defined and explained.
Claims (10)
1. a kind of disk space method for releasing, which is characterized in that be applied to host, operation has multiple virtual on the host
Machine, which comprises
The release command of reception of magnetic disc space;
The disk space release command is parsed, command id is generated and generates multiple targets void of disk space to be released
Quasi- machine and target disk subregion corresponding with each target virtual machine;
The corresponding target disk subregion of the command id and each target virtual machine is encapsulated according to preset format
At multiple disk space release messages;
The multiple disk space release message is sent to corresponding target virtual machine, so that the corresponding target virtual machine
Call default disk space collating order to the magnetic of the corresponding target virtual machine based on corresponding disk space release message
Disk space is discharged.
2. disk space method for releasing as described in claim 1, which is characterized in that the host is stored in advance each virtual
The disk partition of the mark of machine and the virtual machine corresponding with the mark of each virtual machine;
The parsing disk space release command generate disk space to be released multiple target virtual machines and with each institute
The step of stating target virtual machine corresponding target disk subregion further include:
When the not mark including virtual machine and corresponding with the mark of the virtual machine described in the disk space release command
When the disk partition of virtual machine, the mark of pre-stored each virtual machine and the mark with each virtual machine are obtained
The disk partition of the corresponding virtual machine;
The corresponding virtual machine of mark of each virtual machine is determined as the target virtual machine and will be with each target
The corresponding disk partition of virtual machine is determined as target disk subregion corresponding with each target virtual machine.
3. disk space method for releasing as described in claim 1, which is characterized in that the host is stored in advance described each
The disk partition of the corresponding virtual machine of mark of virtual machine;
The parsing disk space release command generate disk space to be released multiple target virtual machines and with each institute
The step of stating target virtual machine corresponding target disk subregion further include:
It when the mark for including virtual machine but does not include corresponding with the mark of the virtual machine in the disk space release command
When the disk partition of the virtual machine, the disk of the virtual machine corresponding with the mark of the pre-stored virtual machine is obtained
Subregion;
The corresponding virtual machine of the mark of the virtual machine is determined as the target virtual machine and will be corresponding with the virtual machine
Disk partition is determined as target disk subregion corresponding with the target virtual machine.
4. disk space method for releasing as described in claim 1, which is characterized in that the parsing disk space release life
Enable the multiple target virtual machines for generating disk space to be released and target disk subregion corresponding with each target virtual machine
The step of further include:
When the mark and the void corresponding with the mark of the virtual machine in the disk space release command including virtual machine
When the disk partition of quasi- machine, the corresponding virtual machine of the mark of the virtual machine is determined as target virtual machine and will be with the void
The disk partition of the corresponding virtual machine of mark of quasi- machine is determined as target disk subregion corresponding with the target virtual machine.
5. a kind of disk space method for releasing, which is characterized in that applied to the virtual machine run on host, the method packet
It includes:
Receive the disk space release message that the host is sent, wherein the disk space release message is the host
According to preset format by made of command id and the encapsulation of target disk subregion, the command id, the target disk divide machine
Area and target virtual machine are generated after the host parses the disk space release command;
Call default disk space collating order empty to the disk of the target virtual machine based on the disk space release message
Between discharged.
6. disk space method for releasing as claimed in claim 5, which is characterized in that described to be disappeared based on disk space release
The step of breath calls default disk space collating order to discharge the disk space of the target virtual machine, comprising:
The disk space release message is decapsulated, the command id and the target disk subregion are obtained;
The corresponding order of the command id is executed based on the target disk subregion, to call default disk space collating order
The disk space of the target disk subregion of the target virtual machine is discharged.
7. a kind of disk space release device, which is characterized in that be applied to host, operation has at least one on the host
Virtual machine, described device include:
Order receiver module is used for the release command of reception of magnetic disc space;
Parsing module, for parsing the disk space release command, generating command id and generating disk space to be released
Multiple target virtual machines and target disk subregion corresponding with each target virtual machine;
Package module, for according to preset format by the command id and the corresponding target of each target virtual machine
Disk partition is packaged into multiple disk space release messages;
Sending module, for the multiple disk space release message to be sent to corresponding target virtual machine, so that described right
The target virtual machine answered is based on corresponding disk space release message and calls default disk space collating order to described corresponding
The disk space of target virtual machine is discharged.
8. a kind of disk space release device, which is characterized in that applied to the virtual machine run on host, described device packet
It includes:
Message reception module, the disk space release message sent for receiving the host, wherein the disk space is released
Putting message is the order mark made of the host encapsulates command id and target disk subregion according to preset format
Know, the target disk subregion and target virtual machine are generated after the host parses the disk space release command;
Release module, for calling default disk space collating order empty to the target based on the disk space release message
The disk space of quasi- machine is discharged.
9. a kind of host, which is characterized in that the host includes:
Processor;
Memory, for storing one or more programs, when one or more of programs are executed by the processor, so that
The processor realizes the method as described in any one of claim 1-4 or claim 5-6.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt
The method as described in any one of claim 1-4 or claim 5-6 is realized when processor executes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910093758.7A CN109857343B (en) | 2019-01-30 | 2019-01-30 | Disk space releasing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910093758.7A CN109857343B (en) | 2019-01-30 | 2019-01-30 | Disk space releasing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109857343A true CN109857343A (en) | 2019-06-07 |
CN109857343B CN109857343B (en) | 2023-02-07 |
Family
ID=66896930
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910093758.7A Active CN109857343B (en) | 2019-01-30 | 2019-01-30 | Disk space releasing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109857343B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024174878A1 (en) * | 2023-02-24 | 2024-08-29 | 中兴通讯股份有限公司 | Thin provisioning method and system for memory disk, and device and computer-readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727456A (en) * | 2008-10-24 | 2010-06-09 | 国际商业机器公司 | Disk physical block allocation method for host machine system with virtual machine and equipment |
CN101986285A (en) * | 2010-11-03 | 2011-03-16 | 华为技术有限公司 | Virtual machine storage space management method, system and physical host |
CN104050045A (en) * | 2014-06-27 | 2014-09-17 | 华为技术有限公司 | Method and device for distributing virtual resources based on disk IO |
CN104572242A (en) * | 2013-10-24 | 2015-04-29 | 华为技术有限公司 | Method and device for expanding disk space of virtual machine and virtual machine system |
CN105573819A (en) * | 2015-12-11 | 2016-05-11 | 国云科技股份有限公司 | Method for obtaining disk capacity information of virtual machine directly through host machine |
US20180165037A1 (en) * | 2015-04-23 | 2018-06-14 | Hewlett Packard Enterprise Development Lp | Storage Reclamation in a Thin Provisioned Storage Device |
-
2019
- 2019-01-30 CN CN201910093758.7A patent/CN109857343B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727456A (en) * | 2008-10-24 | 2010-06-09 | 国际商业机器公司 | Disk physical block allocation method for host machine system with virtual machine and equipment |
CN101986285A (en) * | 2010-11-03 | 2011-03-16 | 华为技术有限公司 | Virtual machine storage space management method, system and physical host |
CN104572242A (en) * | 2013-10-24 | 2015-04-29 | 华为技术有限公司 | Method and device for expanding disk space of virtual machine and virtual machine system |
CN104050045A (en) * | 2014-06-27 | 2014-09-17 | 华为技术有限公司 | Method and device for distributing virtual resources based on disk IO |
US20180165037A1 (en) * | 2015-04-23 | 2018-06-14 | Hewlett Packard Enterprise Development Lp | Storage Reclamation in a Thin Provisioned Storage Device |
CN105573819A (en) * | 2015-12-11 | 2016-05-11 | 国云科技股份有限公司 | Method for obtaining disk capacity information of virtual machine directly through host machine |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024174878A1 (en) * | 2023-02-24 | 2024-08-29 | 中兴通讯股份有限公司 | Thin provisioning method and system for memory disk, and device and computer-readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109857343B (en) | 2023-02-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3373518B1 (en) | Service configuration method and device for network service | |
WO2016117697A1 (en) | Method, device, and program for management and orchestration of network functions virtualization | |
CN109962847B (en) | Method and device for encapsulating service function chain message and computer readable storage medium | |
CN104038401A (en) | Interoperability for distributed overlay virtual environments | |
CN108141416A (en) | A kind of message processing method, computing device and message process device | |
CN104718723A (en) | A framework for networking and security services in virtual networks | |
JP5993817B2 (en) | Routing system and method in carrier network | |
CN112398687A (en) | Configuration method of cloud computing network, cloud computing network system and storage medium | |
US11398981B2 (en) | Path creation method and device for network on chip and electronic apparatus | |
CN109189758B (en) | Operation and maintenance flow design method, device and equipment, operation method, device and host | |
CN110380992A (en) | Message processing method, device and network flow acquire equipment | |
CN105323229A (en) | CPE-based data transmission method, network element, platform and system | |
CN108804100B (en) | Method and device for creating interface element, storage medium and mobile terminal | |
CN102665284B (en) | Uplink service transmission scheduling method and terminal | |
CN104683428A (en) | Network service processing method and device | |
CN115174474B (en) | SRv 6-based SFC implementation method and device in private cloud | |
CN108540408B (en) | Openstack-based distributed virtual switch management method and system | |
CN112769738B (en) | DetNet data packet processing method and device | |
CN105610730A (en) | Method and system for message interaction between CPU and network equipment | |
CN109857343A (en) | Disk space method for releasing and device | |
CN109672575A (en) | Data processing method and electronic equipment | |
CN109313568A (en) | Method and apparatus for the mobile virtual network function example between network service instance | |
US20140112142A1 (en) | Method of forwarding packet and apparatus thereof | |
CN100499509C (en) | A data configuration method, system and operating and maintenance center | |
CN108574637B (en) | Address self-learning method and device and switch |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |