CN109062672A - A kind of method, apparatus and storage medium handling disk tree node - Google Patents
A kind of method, apparatus and storage medium handling disk tree node Download PDFInfo
- Publication number
- CN109062672A CN109062672A CN201810953305.2A CN201810953305A CN109062672A CN 109062672 A CN109062672 A CN 109062672A CN 201810953305 A CN201810953305 A CN 201810953305A CN 109062672 A CN109062672 A CN 109062672A
- Authority
- CN
- China
- Prior art keywords
- node
- son
- father
- processing module
- node number
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
Abstract
The invention discloses a kind of method, apparatus and storage medium for handling disk tree node, can delete disk tree and specify node.The described method includes: obtaining the son node number of the node after judging the node not and being live-vertex;The node is handled according to the son node number and preset strategy.Using the embodiment of the present invention, compared to the node in conventional deletion disabled middle position, according to the needs of users, the node for needing the middle position deleted can be deleted.
Description
Technical field
The present invention relates to computer technology, espespecially a kind of method, apparatus and storage medium for handling disk tree node.
Background technique
In the server virtualization platform of mainstream, (with single disk virtual machine instance), base after virtual machine creating snapshot
In virtual machine source disk, creation is linked to the new disk node of the disk, and virtual machine restores snapshot by repeatedly creation snapshot
Afterwards, the disk node of virtual machine will become tree, each disk node can occupy memory space, as shown in Figure 1, should
Each node of tree at most only one father node, because to guarantee the integrality of magnetic disk of virtual machine data,
Before deleting S node, needs for the data in S node to be merged into his father or child node deletes again later and resets the father and son pass of node
System;
It is the node in deletion disabled middle position under normal circumstances, sometimes according to user's needs, needs to delete interposition
The node set does not delete the method for node in an intermediate position in existing public technology.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides a kind of method, apparatus and storage for handling disk tree node
Medium can delete disk tree and specify node.
In order to reach the object of the invention, the present invention provides a kind of methods for handling disk tree node, which comprises
After judging the node not and being live-vertex, the son node number of the node is obtained;
The node is handled according to the son node number and preset strategy.
It is further, described according to the son node number and preset strategy handles the node, comprising:
When the son node number is zero, the node is deleted.
It is further, described according to the son node number and preset strategy handles the node, comprising:
When the son node number is more than or equal to a period of time, according to whether there are described in father node and son node number processing
Node.
Further, described according to whether there are father node and the son node numbers to handle the node, comprising:
In the presence of the father node, the data in the node are merged into the father node, delete the node;
When the father node is not present, and when the child node number is that for the moment, the data in the node are merged into
The child node deletes the node;
When the father node is not present, and when the child node number is greater than for the moment, terminates and delete the node.
Further, before the data merge, further includes: judge whether storage fragmentation is greater than the data and occupies
Space, if it is greater than then carrying out data merging.
In order to reach the object of the invention, the present invention also provides a kind of device for handling disk tree node, described device packets
It includes and obtains module and processing module, in which:
The acquisition module, is used for: after judging the node not and being live-vertex, obtaining the child node of the node
Number;
The processing module, is used for: handling the node according to the son node number and preset strategy.
Further, the processing module handles the node according to the son node number and preset strategy, comprising:
When the son node number is zero, the processing module deletes the node.
Further, the processing module handles the node according to the son node number and preset strategy, comprising:
When the son node number is more than or equal to for the moment, the processing module is according to whether there are father nodes and the sub- section
Points handle the node.
Further, the processing module is according to whether there are father nodes and the son node number to handle the node, packet
It includes:
In the presence of the father node, the data in the node are merged into the father node by the processing module, are deleted
Except the node;
When the father node is not present, and when the child node number is for the moment, the processing module will be in the node
Data be merged into the child node, delete the node;
When the father node is not present, and when the child node number is greater than for the moment, the processing module, which terminates, deletes institute
State node.
In order to reach the object of the invention, the present invention also provides a kind of computer readable storage mediums, are stored thereon with meter
Calculation machine program, when which is executed by processor the step of the realization above method.
Compared with prior art, the present invention includes after judging the node not and being live-vertex, obtaining the node
Son node number;The node is handled according to the son node number and preset strategy.Compared to conventional deletion disabled middle position
Node can delete the node for needing the middle position deleted according to user's needs.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right
Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this
The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is that the disk node of existing virtual machine will become tree figure;
Fig. 2 is the flow chart of the method for the processing disk tree node of the embodiment of the present invention one;
Fig. 3 is another flow chart of the method for the processing disk tree node of the embodiment of the present invention two;
Fig. 4 is the structural schematic diagram of the device of the processing disk tree node of the embodiment of the present invention three.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions
It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable
Sequence executes shown or described step.
Embodiment one
A kind of method for handling disk tree node is present embodiments provided, as shown in Fig. 2, this method includes S21-S22:
S21, after judging egress not and being live-vertex, the son node number of node is obtained;
S22, node is handled according to son node number and preset strategy.
In the embodiment of the present invention, by that can delete and need to delete according to son node number and preset strategy processing node
Middle position node.
In one alternate embodiment, as long as it is zero directly to delete that preset strategy, which includes: child node,;There are father node and child node
When be just merged into father node after delete;It is deleted after there is no father node and child node to be merged into child node for 1, the termination of other situations is deleted
It removes.
In one alternate embodiment, according to son node number and preset strategy processing node, comprising:
When child node number is zero, deletion of node.
In one alternate embodiment, according to son node number and preset strategy processing node, comprising:
Child node number is more than or equal to a period of time, according to whether there are father nodes and son node number to handle node.
In one alternate embodiment, according to whether there are father nodes and son node number to handle node, comprising:
In the presence of father node, the data in node are merged into father node, deletion of node;
When father node is not present, and child node number is for the moment, the data in node to be merged into child node, delete section
Point;
When father node is not present, and child node number is greater than for the moment, terminates deletion of node.At this point, prompt can be issued,
This node is deleted, child node need to be deleted.When needing to delete S node has child node, due to reading its son node number according to needing S node
Data, so data thereon cannot be deleted.
In one alternate embodiment, before data merge, further includes: judge whether storage fragmentation accounts for greater than data
Space, if it is greater than then carrying out data merging.
In the embodiment of the present invention, after judging the node not and being live-vertex, the son node number of the node is obtained;Root
The node is handled according to the son node number and preset strategy, compared to the node in conventional deletion disabled middle position, according to
User needs, and can delete the node for needing the middle position deleted.
Embodiment two
Above-described embodiment method is specifically described in the present embodiment, as shown in Figure 3, comprising the following steps:
1. receiving the instruction for deleting the node, determination certain that be deleted disk node S;
2. judging whether S is live-vertex;
If S is live-vertex, 10 are thened follow the steps;
If S is inactive node, 3 are thened follow the steps;
Can judge whether it is to enliven section according to whether the node read-write, than if any virtual machine just in the disk node
Upper read-write data, then it is live-vertex;
3. judging S with the presence or absence of child node, if it is present executing 4;Otherwise, then 10 are executed;
4. judging that S thens follow the steps 5 if there is father node S0 with the presence or absence of father node;Otherwise, 6 are thened follow the steps;
The present embodiment is it is first determined whether there is child node without with the presence or absence of father node, being because first judging the side of child node
Method execution efficiency is higher;Child node is first judged whether there is, when judging no, does not just have to consider the problems of that data merge, directly
It connects and deletes the node, therefore first judge child node, execution route is relatively much shorter, more efficient;
It, can be to judge whether it has child node, root it is first determined whether there is father node in other alternative embodiments
It is judged that as a result perform corresponding processing, as long as that is, child node is zero directly to delete;Father is just merged into when having father node and child node
It is deleted after node;It is deleted after there is no father node and child node to be merged into child node for 1, other situations, which terminate, deletes.
5. merging the data of S node to father node;
Whether 5.1 verification storage fragmentations are sufficient, if abundance thens follow the steps 5.2, otherwise, execute step 11;
It before deleting S node, needs the data by S node to be merged into S0, needs additionally to occupy S node space, complete
Data just delete S node after merging;
Storage fragmentation where verifying S node, if remaining space is less than S size of node and memory space inadequate,
As a result it is denoted as false, otherwise is denoted as true;S is merged to the process of S0 specifically: first by the data accumulation of S to S0, this space-time
Between occupy size be S+ (S+S0), after the completion of S is added to S0, then delete S.Described add up is interpreted as replicating, therefore cumulative
Afterwards, before deletion, memory space needs the additional size for occupying S, it is therefore desirable to verify whether memory space is enough to store S+ (S+
S0 size);
If whether verify storage fragmentation sufficient, if result is false, i.e. memory space inadequate, step is executed
11, if result is true, i.e. memory space is sufficient, thens follow the steps 5.2;
The data of node S are merged into node S0 by 5.2, then execute step 8;
The father node reference of all child nodes is directed toward node S0, then executed by all child nodes of 5.3 traverse node S
Step 13;All child nodes of traverse node S reassign set membership;If s father node S0 and child node S1 traverses S
The child node of node, it was found that the father node of S1 node is then directed toward the father node of S node by S1 node again, i.e. S1's is new
Father node is that S0, S0 and S1 are in connection.
Step 4 is also carried out after judging to have child node in step 3 and judges whether it has father node, be for the ease of deleting
After S node, establishes new father node S0 and connect with S1.
6. judging the child node number of S node, if only one child node S1, thens follow the steps 7, otherwise, then execute
Step 11;
It before executing step 11, can also be prompted, prompt to want to delete this node, should first delete its child node.
7. by the data downstairs merger of S node to child node S1, so, whether verification storage fragmentation is sufficient, if
As a result it is false, i.e. memory space inadequate, executes step 10, if result is true, i.e. memory space is sufficient, then executes step
Rapid 10;
8. the data of node S are merged into node S1, step 9 is then executed;
9. the father node reference of node S1 is emptied, step 10 is then executed;
10. executing deletion of node S;
11. terminating deletion of node S, need to repeat step 1-10, traversal deletes each child node, can delete S node.
Embodiment three
A kind of device for handling disk tree node is present embodiments provided, description is also applied for this in above method embodiment
In embodiment, shown in Fig. 4, which includes obtaining module 41 and processing module 42, in which:
Module 41 is obtained, is used for: after judging egress not and being live-vertex, obtaining the son node number of node;
Processing module 42, is used for: according to son node number and preset strategy processing node.
In one alternate embodiment, processing module 42 is according to son node number and preset strategy processing node, comprising:
When child node number is zero, 42 deletion of node of processing module.
In one alternate embodiment, processing module 42 is according to son node number and preset strategy processing node, comprising:
Child node number is more than or equal to for the moment, and processing module 42 is according to whether there are father nodes and son node number processing section
Point.
In one alternate embodiment, processing module 42 is according to whether there are father nodes and son node number to handle node, packet
It includes:
In the presence of father node, the data in node are merged into father node, deletion of node by processing module 42;
When father node is not present, and child node number is that for the moment, the data in node are merged into son by processing module 42
Node, deletion of node;
When father node is not present, and child node number is greater than for the moment, and processing module 42 terminates deletion of node.
In one alternate embodiment, before data merge, further includes: judge whether storage fragmentation accounts for greater than data
Space, if it is greater than then carrying out data merging.
The embodiment of the present invention also provides a kind of computer storage medium, and the computer storage medium is stored with computer journey
Sequence;After the computer program is performed, the method that the processing disk tree node of previous embodiment offer is provided, for example,
Execute method as shown in Figure 1.
Although disclosed herein embodiment it is as above, the content only for ease of understanding the present invention and use
Embodiment is not intended to limit the invention.Technical staff in any fields of the present invention is taken off not departing from the present invention
Under the premise of the spirit and scope of dew, any modification and variation, but the present invention can be carried out in the form and details of implementation
Scope of patent protection, still should be subject to the scope of the claims as defined in the appended claims.
Claims (10)
1. a kind of method for handling disk tree node, which is characterized in that the described method includes:
After judging the node not and being live-vertex, the son node number of the node is obtained;
The node is handled according to the son node number and preset strategy.
2. the method according to claim 1, wherein described handled according to the son node number with preset strategy
The node, comprising:
When the son node number is zero, the node is deleted.
3. the method according to claim 1, wherein described handled according to the son node number with preset strategy
The node, comprising:
When the son node number is more than or equal to a period of time, according to whether there are father nodes and the son node number to handle the section
Point.
4. according to the method described in claim 3, it is characterized in that, described according to whether there are father nodes and the son node number
Handle the node, comprising:
In the presence of the father node, the data in the node are merged into the father node, delete the node;
When the father node is not present, and when the child node number is for the moment, the data in the node to be merged into described
Child node deletes the node;
When the father node is not present, and when the child node number is greater than for the moment, terminates and delete the node.
5. according to the method described in claim 4, it is characterized in that, before data merging, further includes: judgement storage is remaining
Whether space is greater than described data the space occupied, if it is greater than then carrying out data merging.
6. a kind of device for handling disk tree node, which is characterized in that described device includes obtaining module and processing module,
In:
The acquisition module, is used for: after judging the node not and being live-vertex, obtaining the son node number of the node;
The processing module, is used for: handling the node according to the son node number and preset strategy.
7. device according to claim 6, which is characterized in that the processing module is according to the son node number and preset
Strategy handles the node, comprising:
When the son node number is zero, the processing module deletes the node.
8. device according to claim 6, which is characterized in that the processing module is according to the son node number and preset
Strategy handles the node, comprising:
When the son node number is more than or equal to for the moment, the processing module is according to whether there are father nodes and the son node number
Handle the node.
9. device according to claim 8, which is characterized in that the processing module is according to whether there are father nodes and described
The son node number processing node, comprising:
In the presence of the father node, the data in the node are merged into the father node by the processing module, delete institute
State node;
When the father node is not present, and when the child node number is that for the moment, the processing module is by the number in the node
According to the child node is merged into, the node is deleted;
When the father node is not present, and when the child node number is greater than for the moment, the processing module, which terminates, deletes the section
Point.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
The step of any one of claim 1-5 the method is realized when execution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810953305.2A CN109062672A (en) | 2018-08-21 | 2018-08-21 | A kind of method, apparatus and storage medium handling disk tree node |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810953305.2A CN109062672A (en) | 2018-08-21 | 2018-08-21 | A kind of method, apparatus and storage medium handling disk tree node |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109062672A true CN109062672A (en) | 2018-12-21 |
Family
ID=64686541
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810953305.2A Pending CN109062672A (en) | 2018-08-21 | 2018-08-21 | A kind of method, apparatus and storage medium handling disk tree node |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109062672A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106897119A (en) * | 2017-02-28 | 2017-06-27 | 郑州云海信息技术有限公司 | Disk tree optimization method and system in a kind of virtual platform |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120303670A1 (en) * | 2011-05-26 | 2012-11-29 | Gillen Robert E | Cloud computing method for dynamically scaling a process across physical machine boundaries |
CN104375877A (en) * | 2014-10-15 | 2015-02-25 | 国云科技股份有限公司 | Virtual machine online snapshot generating and deleting method |
CN106569872A (en) * | 2016-09-28 | 2017-04-19 | 浪潮电子信息产业股份有限公司 | Method for shortening virtual machine snapshot chain |
CN107491529A (en) * | 2017-08-18 | 2017-12-19 | 华为技术有限公司 | A kind of snapshot delet method and node |
CN107943557A (en) * | 2017-11-18 | 2018-04-20 | 浙江网新恒天软件有限公司 | A kind of magnetic disk of virtual machine incremental snapshot method based on cloud platform |
-
2018
- 2018-08-21 CN CN201810953305.2A patent/CN109062672A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120303670A1 (en) * | 2011-05-26 | 2012-11-29 | Gillen Robert E | Cloud computing method for dynamically scaling a process across physical machine boundaries |
CN104375877A (en) * | 2014-10-15 | 2015-02-25 | 国云科技股份有限公司 | Virtual machine online snapshot generating and deleting method |
CN106569872A (en) * | 2016-09-28 | 2017-04-19 | 浪潮电子信息产业股份有限公司 | Method for shortening virtual machine snapshot chain |
CN107491529A (en) * | 2017-08-18 | 2017-12-19 | 华为技术有限公司 | A kind of snapshot delet method and node |
CN107943557A (en) * | 2017-11-18 | 2018-04-20 | 浙江网新恒天软件有限公司 | A kind of magnetic disk of virtual machine incremental snapshot method based on cloud platform |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106897119A (en) * | 2017-02-28 | 2017-06-27 | 郑州云海信息技术有限公司 | Disk tree optimization method and system in a kind of virtual platform |
CN106897119B (en) * | 2017-02-28 | 2021-04-23 | 郑州云海信息技术有限公司 | Disk tree optimization method and system in virtualization platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108759851B (en) | More vehicle paths planning methods, system, equipment and storage medium based on time window | |
US8869111B2 (en) | Method and system for generating test cases for a software application | |
CN106383852A (en) | Docker container-based log acquisition method and apparatus | |
CN109951547A (en) | Transactions requests method for parallel processing, device, equipment and medium | |
CN102694801B (en) | Method for detecting virus, device and firewall box | |
CN109325016A (en) | Data migration method, device, medium and electronic equipment | |
KR20150091521A (en) | Method and device for mining data regular expression | |
CN105281949B (en) | Mix the partition method and isolating device of host in memory module | |
CN105573836B (en) | Data processing method and device | |
CN107819863A (en) | A kind of Explore of Unified Management Ideas and device of cloud platform user | |
CN103716237A (en) | Path-finding method and device utilizing binary heap sorting | |
CN109062672A (en) | A kind of method, apparatus and storage medium handling disk tree node | |
CN109951553A (en) | Data processing method, system, electronic equipment and computer readable storage medium | |
CN106033422A (en) | A database operation control method, device and system | |
CN104462322B (en) | Character string comparison method and device | |
CN106919374A (en) | A kind of scenario generation method and device | |
CN105843809A (en) | Data processing method and device | |
CN103369722B (en) | Mobile terminal control method and mobile terminal control apparatus | |
CN106295260B (en) | A kind of hidden method and system of application program nucleus module | |
CN109218345A (en) | Obtain method, storage medium, electronic equipment and the system of target resource | |
CN103399714A (en) | Maintenance system for storage device configuration information and application method of maintenance system | |
CN110704468A (en) | Data updating method and device and controller | |
CN107919991A (en) | A kind of virtual data center creates and quota collocation method and device | |
CN110704372B (en) | Data recovery method and device | |
CN107341058A (en) | A kind of its recovery method as resource and device |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181221 |
|
RJ01 | Rejection of invention patent application after publication |