A kind of recycle bin mechanism and system thereof that is applicable to cloud computingTechnical field
The present invention relates to the recycle bin technical field, particularly a kind of recycle bin mechanism and system thereof that is applicable to cloud computing.
Background technology
Under cloud computing environment, resource is constantly carrying out distributing the cyclic process of using, reclaiming, reallocate and use, and in cloud computing, needs the mechanism of recycle bin temporarily to manage reclaiming resource; But, simultaneously from the angle of the utilization of resources and the angle of data security, current recycle bin mechanism can not meet requirement.Current recycle bin mechanism is all that operating system directly provides, and directly the data on subregion is operated.Can be checked object, logic is deleted, physics is deleted and restoring operation.The recycle bin mechanism of Windows and (SuSE) Linux OS is such:
1, set up a collapse directories in each subregion, preserve the object in recycle bin in catalogue;
2, set up a list for preserving the current object of recycle bin;
When 3, logic is deleted an object, first attempt this object is moved in collapse directories, if success, the information of in list, adding this object;
4, the information of object comprises title, size, original path of object etc.;
When 5, physics is deleted an object, directly in hidden folder, object is thoroughly deleted, discharged storage space;
While 6, reducing an object, the information according to name lookup to this object, according to the original path in information, first attempt this object is moved under original path, if success, the information of deleting this object in list;
While 7, checking the recycle bin object, the information in direct read list.
Can there be following problem in described mechanism:
1, the object on single operation can only be managed, the object under multinode under cloud computing environment can not be managed;
2, for associated files can only be isolated manage, can not unify to carry out management and control; Such as, under cloud computing environment, only to delete the instance document of a virtual machine and can not thoroughly delete data, the configuration file be associated in addition, snapshot document also will be deleted in the lump, and guarantee space useless is thoroughly discharged and data security;
3, under the same file folder, can not before and after logic two files of the same name, if first logic is deleted a file a under normal folder, then a newly-built file is also a, this time is all still no problem, if but more newly-built file a being carried out to the logic deletion, at this time will be prohibited, this is because the restriction of the file system of single-click operation system causes.
For the unified retrieval management of object under multinode in cloud computing, improve to delete integrality and security, need a kind of cloud computing environment that be applicable to, under the management multinode, object logics is deleted, physics is deleted and a whole set for the treatment of mechanism of reduction.
Summary of the invention
One of problem that the present invention solves is to provide a kind of recycle bin mechanism that is applicable to cloud computing, solve object-based logic deletion, physics deletion and reduction in cloud computing environment, under multinode, object is unified retrieval management, with repeating deletion under path with problems such as title objects.
Two of the problem that the present invention solves is to provide a kind of recycle bin system that is applicable to cloud computing, solve object-based logic deletion, physics deletion and reduction in cloud computing environment, under multinode, object is unified retrieval management, with repeating deletion under path with problems such as title objects.
The technical scheme that the present invention one of solves the problems of the technologies described above is:
Comprise the steps:
Step 1: define the scope of recyclable object, comprise file, data item that object comprises, then at recycle object, in original state, add the state of " logic deletion ";
Step 2: set up a database table of preserving recycle object;
Step 3: when logic is deleted, revising Obj State is " logic deletion ", inserts the information of this object in database table;
Step 4: when physics is deleted, find the information of this object according to object name from database; Then the path on node according to the nodal information in this information and object, find this object and associations thereof;
Step 5: thoroughly delete in conjunction with the recycle object scope file, the data item that object is associated, if success, the record of this object of deletion in database table;
Step 6: while reducing an object, find the information of this object according to object name from database; Then the path on node according to the nodal information in this information and object, find this object and associations thereof;
Step 7: the state according to object on node changes " normally " state into, if success, the record of this object of deletion in database table.
Described object is entity object in cloud computing, and wherein classification comprises: virtual machine, virtual machine snapshot, logical volume, logical volume backup, mirror image, image file.
It is to delete object resource to discharge that described logic is deleted, and object record still remains in recycle bin, supports to revert to original route.
Described physics delete be object and object are associated file from system, thoroughly remove, the record in the data collection storehouse is also deleted in the lump.
Described reduction, to liking " normally " state that object is set in situ, recovers normally to use, by the record deletion in the data collection storehouse.
Two the technical scheme that the present invention solves the problems of the technologies described above is:
Comprise recycle object definition module, logic deletion object module, search object module, physics deletion object module and reduction object module;
Described recycle object definition module, define callable object, comprises file, data item, the Obj State of recycle object association; Define and judge whether an object is callable object by recycle object;
Described logic is deleted object module, object logics in cloud computing environment is deleted, first judge that whether the recycle bin space size is enough, if enough Obj States become " logic deletion ", by the object information data inserting storehouse that logic is deleted, the information of object comprises nodal information, the path of object on node, the time that logic is deleted under object name, object; Deleted object discharges shared resource;
The described object module of searching is searched object from database table, and object information is provided; The information of object comprises nodal information, the path of object on node, the time that logic is deleted under object name, object;
Described physics is deleted object module, and object is thoroughly deleted from recycle bin; First according to object name, from database table, find the information of this object; Then the path on node according to the nodal information in information and object, and, according to the scope of recycle object, thoroughly delete file, data item that object is associated; If success, the record of this object of deletion in database table;
Described reduction object module reverts to object original route from recycle bin, first according to object name, from database table, finds the information of this object; Judge that according to object information whether the origin node resource is enough, if enough the state of this object on node is made into to normal condition; If there is reduction object and original object, bear the same name, automatically rename reduction object.If last all success, the record of this object of deletion in database table.
The present invention is by being applicable to the object-based unified retrieval management of cloud computing, can be from by an object and associated file retrieval management thereof, and do not need manually to delete one by one content association, can guarantee that resource is thoroughly discharged and the safety of data.While managing the object of a plurality of nodes that distribute, the present invention is providing great convenience property also simultaneously.The present invention can carry out retrieval management to the object of a plurality of nodes under cloud computing environment, comprise check, logic deletion, physics deletion, reduction, overtime deletion.Object reduction of the present invention is supported to revert to original route by deleting the object that enters recycle bin, has reduced the loss that mistake is deleted, and has improved the safety of system data.Object physics of the present invention is deleted and is supported batch operation, and the user can manage a plurality of objects simultaneously, improves convenience.The present invention adopts database table ID to carry out unique identification to object, allows to bear the same name for the object on a node, and allows object is carried out to rename, can improve the identification of recycle object.
The accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention is further described:
Fig. 1 is the inventive method process flow diagram;
Fig. 2 and Fig. 3 are the invention process logical diagram.
Embodiment
Recycle bin system of the present invention comprises recycle object definition module, logic deletion object module, searches object module, physics deletion object module and reduction object module;
Described recycle object definition module, define callable object, comprises file, data item, the Obj State of recycle object association; Define and judge whether an object is callable object by recycle object;
Described logic is deleted object module, and the object logics in cloud computing environment is deleted, and after the logic deletion, this object discharges shared resource, and object enters recycle bin;
The described object module of searching is searched object from database table, and object information is provided; The information of object comprises nodal information, the path of object on node, the time that logic is deleted under object name, object;
Described physics is deleted object module, and object is thoroughly deleted from recycle bin; According to the object information found, physics is deleted object and associated file, data item thereof, finally this object record in the recycle object database is deleted;
Described reduction object module reverts to object original route from recycle bin, according to the object information found, Obj State is set to " normally ", finally this object record in the recycle object database is deleted.
Recycle bin of the present invention mechanism flow process, implement, as shown in accompanying drawing 1-3, first to define callable object, comprise file that object comprises, data item etc., be added into the state of " logic deletion " in the recycle object state.Delete object but for example need to add virtual machine or logical volume for logic, just in database table, add the recycle bin tag field.Code is as follows:
# is that storage volume table and virtual machine table add the trashed field
ALTER?TABLE`gc_volume`ADD`trashed`int(11)DEFAULT?0?COMMENT′
The recycle bin state ';
ALTER?TABLE`gc_vm_instance`ADD`trashed`int(11)DEFAULT?0?COMME
NT ' recycle bin state ';
Define a certain size recycle bin space.
Then set up to preserve the database table of recycle object, the information of object comprises path on node of nodal information under object name, object, object, the time that logic is deleted etc.
When logic is deleted, as shown in Figure 2, judge that whether the recycle bin space size is enough, if enough Obj States become " logic deletion ", the object information data inserting storehouse that logic is deleted, the information of object comprises path on node of nodal information under object name, object, object, the time that logic is deleted etc.Deleted object discharges shared resource.
When physics is deleted, as shown in Figure 2, first according to object name, from database table, find the information of this object; Then the path on node according to the nodal information in information and object, and, according to the scope of recycle object, thoroughly delete file, data item that object is associated; If success, the record of this object of deletion in database table;
When the reduction object, as shown in Figure 3, first according to object name, from database table, find the information of this object; Judge that according to object information whether the origin node resource is enough, if enough the state of this object on node is made into to normal condition; If there is reduction object and original object, bear the same name, automatically rename reduction object.If last all success, the record of this object of deletion in database table.