WO2017193764A1 - 镜像文件的处理方法、装置及存储介质 - Google Patents
镜像文件的处理方法、装置及存储介质 Download PDFInfo
- Publication number
- WO2017193764A1 WO2017193764A1 PCT/CN2017/080488 CN2017080488W WO2017193764A1 WO 2017193764 A1 WO2017193764 A1 WO 2017193764A1 CN 2017080488 W CN2017080488 W CN 2017080488W WO 2017193764 A1 WO2017193764 A1 WO 2017193764A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image file
- file
- image
- specified
- specified image
- Prior art date
Links
Images
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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
- G06F11/2053—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant
- G06F11/2056—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant by mirroring
- G06F11/2064—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant by mirroring while ensuring consistency
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
- G06F11/2053—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant
- G06F11/2094—Redundant storage or storage space
-
- 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/4557—Distribution of virtual machine instances; Migration and load balancing
Definitions
- the present invention relates to the field of file processing, and in particular, to a method, an apparatus, and a storage medium for processing an image file.
- the embodiment of the present invention is to provide a method, an apparatus, and a storage medium for mirroring a file, so as to at least solve the problem of waste of storage resources by repeatedly copying the same image file in the related art.
- a method for processing an image file including: determining whether a target image library has the same image label as a specified image file to be copied. The image file of the recognition; when the judgment result is YES, the operation of copying the specified image file from the source repository to the target repository is discarded.
- the method further includes: copying the specified image file into the target repository, and assigning the image identifier to the location in the target repository Specify the image file.
- the method further includes: when the specified image file changes, updating the image identifier of the specified image file when the specified image file changes.
- the changing of the specified image file comprises: changing a data content of the specified image file; and/or changing a node position of the specified image file in a hierarchical model or a mesh model.
- the method further includes at least one of: updating an image file corresponding to the image identifier before the specified image file update and a mirror image thereof; Updating the image ID of the parent node in the hierarchical model or the mesh model with the image file having the same image identifier as the specified image file; the image file having the same image identifier as the specified image file in the hierarchical model or network The mirror image of the child nodes in the model is updated.
- a method for processing an image file including: setting a mirror image of a specified image file; and updating a mirror image of the specified image file when the specified image file changes.
- the changing of the specified image file comprises: changing a data content of the specified image file; and/or changing a node position of the specified image file in a hierarchical model or a mesh model.
- the method further includes at least one of: updating an image file corresponding to the image identifier before the specified image file update and a mirror image thereof; a mirror with the same image ID as the specified image file
- the file is updated in the mirror image of the parent node in the hierarchical model or the mesh model; the mirror image of the child node in the hierarchical model or the mesh model is updated with the image file having the same image identifier as the specified image file.
- setting the image identifier of the specified image file includes: setting a mirror image corresponding to the specified image file when creating the specified image file; and/or, migrating from the source repository to the specified image file to When the target repository is used, the mirror image of the specified image file in the target repository is set to be the same as the mirror image of the specified image file in the source repository.
- an apparatus for processing an image file comprising: a determining module configured to determine whether an image file having the same image identifier as a specified image file to be copied is included in the target repository; The module is configured to, when the determination result is yes, abandon the operation of copying the specified image file from the source repository to the target repository.
- another apparatus for processing an image file comprising: a setting module configured to set a mirror image of a specified image file; and an update module configured to change when the specified image file changes Update the mirror image of the specified image file.
- the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a computer program configured to execute the processing method of the image file according to the embodiment of the present invention.
- the target storage library it is determined whether the target storage library includes an image file having the same image identifier as the specified image file to be copied, and when the determination result is yes, the copying of the specified image file from the source storage library is discarded.
- the operation in the target storage library solves the problem that the same image file is duplicated and the storage resource is wasted in the related art by determining whether the image file to be copied already exists in the target storage database before copying the image file. , in turn, achieve the effect of efficient management of image files.
- FIG. 1 is a first flowchart of a method for processing an image file according to an embodiment of the present invention
- FIG. 2 is a second flowchart of a method for processing an image file according to an embodiment of the present invention
- FIG. 3 is a block diagram 1 of a processing apparatus of an image file in an embodiment of the present invention.
- FIG. 4 is a block diagram 2 of a processing apparatus of an image file in an embodiment of the present invention.
- FIG. 5 is a schematic diagram of a file change of a storage migration according to an alternative embodiment of the present invention.
- FIG. 6 is a flowchart of a mirroring judgment of a storage migration according to an alternative embodiment of the present invention.
- FIG. 7 is a schematic diagram of a file reset lookup associated file according to an alternative embodiment of the present invention.
- FIG. 8 is a flow chart of a file reset lookup associated file in an alternative embodiment of the present invention.
- FIG. 9 is a flow diagram of a single file reset image identification of an alternate embodiment of the present invention.
- FIG. 1 is a flowchart 1 of a method for processing an image file according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
- Step S102 Determine whether the target repository includes an image file having the same image identifier as the specified image file to be copied.
- the copy is a file migration, such as copying and pasting.
- step S104 when the determination result is YES, the operation of copying the specified image file from the source repository to the target repository is discarded.
- the image file includes a mirror image (mirror_id) corresponding thereto, and the mirror_id can be used for the judgment when the migration is performed, if the target storage has the source storage. If the file with the same mirror_id is on the file, you can reuse the existing file without actually copying the file.
- mirror_id a mirror image corresponding thereto
- the target storage library includes an image file having the same image identifier as the specified image file to be copied, and when the determination result is yes, the copying of the specified image file from the source storage library to the target storage library is discarded.
- the operation of the image file to be copied is determined by the target storage database before the image file is copied, thereby solving the problem that the same image file is duplicated and the storage resource is wasted in the related art, thereby achieving efficient management of the image. The effect of the file.
- the method further includes: copying the specified image file Go to the target repository and assign the image ID to the specified image file in the target repository.
- the method further includes: updating the mirror image of the specified image file when the specified image file changes.
- the change of the specified image file may be, but is not limited to, the case where the data content of the specified image file is changed; the location of the node of the specified image file in the hierarchical model or the mesh model is changed.
- the image identifier of the specified image file after updating the image identifier of the specified image file that is changed, other image files related to the specified image file may also be updated, and the image identifier may be updated at the same time.
- the method includes: updating an image file corresponding to the image identifier before the specified image file update and a mirror image thereof; and the image file having the same image identifier as the specified image file in the hierarchical model or the parent node of the mesh model The image identifier is updated; the image file of the child node having the same image identifier as the specified image file is updated in the hierarchical model or the mirror image of the child node in the mesh model.
- the file when the data of the image file is changed, for example, the file is merged (other files merge data into the file) or the parent node becomes a leaf node (ie, If there is a virtual machine to write data, then the image file is no longer consistent with the data of other files, and the image relationship cannot be maintained.
- the reset operation includes resetting your own mirror_id and resetting other files that have the mirror_id. In addition to resetting the file, all child nodes of the file need to be reset.
- FIG. 2 is a second flowchart of a method for processing an image file according to an embodiment of the present invention. As shown in FIG. 2, the process includes the following steps:
- Step S202 setting a mirror image of the specified image file.
- step S204 when the specified image file changes, the image identifier of the specified image file is updated.
- the change of the image file includes: the data content of the image file changes, and the position of the node of the image file in the hierarchical model or the mesh model changes.
- the image identifier of the specified image file after updating the image identifier of the specified image file that is changed, other image files related to the specified image file may also be updated, and the image identifier may be updated at the same time.
- the method includes: updating an image file corresponding to the image identifier before the specified image file update and a mirror image thereof; and the image file having the same image identifier as the specified image file in the hierarchical model or the parent node of the mesh model The image identifier is updated; the image file of the child node having the same image identifier as the specified image file is updated in the hierarchical model or the mirror image of the child node in the mesh model.
- the data of the image file is changed, such as the file is merged (other files merge data into the file) or the parent node becomes a leaf node (the virtual machine will write data), then
- the image file is no longer consistent with the data of other files, and the mirror relationship cannot be maintained.
- the reset operation includes resetting your own mirror_id and resetting other files that have the mirror_id.
- all child nodes of the file need to be reset.
- setting the image identifier of the image file includes setting in the source repository and the target repository, respectively: setting a mirror image corresponding to the specified image file when creating the specified image file; When the specified image file is migrated from the source repository to the target repository, the mirror image of the specified image file in the target repository is set to be the same as the mirror image of the specified image file in the source repository.
- the mirror_id of the file When the file is created, there will be a default mirror_id. If the file is migrated once, a new copy is generated on the target repository, and the mirror_id of the source file can be assigned to the copied file. This way, with this image ID, the source file is associated with the new file on the target repository. Similarly, if the target file is migrated to another repository again, the mirror_id will continue to the third file. It can be achieved that files that are copied from the same source will have the same image ID.
- the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
- the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in a form of a software product stored in a storage medium (such as a magnetic disk or an optical disk).
- a number of instructions are included to cause a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
- a processing device for the image file is provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
- the term “module” may implement a combination of software and/or hardware of a predetermined function.
- the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
- FIG. 3 is a structural block diagram 1 of an apparatus for processing an image file according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes:
- the determining module 30 is configured to determine whether the target repository includes an image file having the same image identifier as the specified image file to be copied;
- the processing module 32 is configured to, when the determination result is yes, abandon the operation of copying the specified image file from the source repository to the target repository.
- FIG. 4 is a second structural block diagram of an apparatus for processing an image file according to an embodiment of the present invention. As shown in FIG. 4, the apparatus includes:
- the setting module 40 is configured to set a mirror image of the specified image file
- the update module 42 is configured to update the mirror image of the specified image file when the specified image file changes.
- the optional embodiment adds the management function of the file mirroring in the existing storage migration interface of the virtualization management system. Includes settings, modifications, and resets for file mirroring.
- the entire storage migration function can be improved to avoid the migration process being correct, but the virtual machine running data is inconsistent and difficult to check.
- S11 setting the mirror_id of the file: when the file is created, there will be a default mirror_id. If the file is migrated once, a new copy is generated on the target repository, and the management system assigns the mirror_id of the source file to The document. This way, with this image ID, the source file is associated with the new file on the target repository. Similarly, if the target file is migrated to another repository again, the mirror_id will continue to the third file. Therefore, as long as the files are copied from the same source, they will have the same image ID.
- S12 The image identifier of the reset file: when the data of the file is changed, for example, the file is merged (other files merge data into the file) or the parent node becomes a leaf node (the virtual machine will write data), That file is no longer consistent with the data of other files, and it is impossible to continue to maintain the mirror relationship.
- a reset operation on the mirror_id of such a file is required.
- Reset operation includes reset from The own mirror_id resets the other files that own the mirror_id. In addition to resetting the file, all child nodes of the file need to be reset.
- S13 The process of judging the mirroring identifier by the storage migration: the file has a mirror_id, and the mirrorid can be used for the judgment when the migration is performed. If the destination storage has the same mirror_id file as the source file, the actual file copy may not be performed. Work and reuse existing files.
- FIG. 5 is a schematic diagram of a file change of a storage migration according to an alternative embodiment of the present invention.
- a virtual hard disk image (VDI, Virtual Disk Images) may be a storage library, a disk, etc., and a combination of f and numbers is formed.
- FIG. 6 is a flowchart for determining the mirroring of the storage migration according to an alternative embodiment of the present invention. As shown in FIG. 6, the method includes:
- FIG. 7 is a schematic diagram of a file reset search associated file according to an alternative embodiment of the present invention.
- FIG. 8 is a flowchart of a file reset search associated file according to an alternative embodiment of the present invention. As shown in FIG. 7 and FIG.
- the file has child nodes, then all the child nodes of the file can no longer have a mirror relationship with other files. You need to find all of its child nodes and reset the image identifiers one by one.
- FIG. 9 is a flowchart of a single file reset image identifier according to an alternative embodiment of the present invention. As shown in FIG. 9, determining a branch Y (Yes), N (No), includes:
- a mirror image may be set for each of the source file and the copy file after the migration, and then the source file is migrated again next time, and the duplicate copy can be avoided by the identifier.
- the mirroring relationship between files is dynamically managed while the mirroring mechanism is introduced. The file changes can modify the image identifier in real time. It perfectly solves two key problems in the storage migration process.
- each of the above modules may be implemented by software or hardware.
- the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
- Embodiments of the present invention also provide a storage medium.
- the above storage medium may be configured to store program code for performing the following steps:
- the foregoing storage medium may include, but not limited to, a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, a magnetic disk, or a magnetic disk. And other media that can store program code.
- the processor performs, according to the stored program code in the storage medium, whether the target storage library includes an image file having the same image identifier as the specified image file to be copied;
- the processor performs an operation of copying the specified image file from the source repository to the target repository when the determination result is yes according to the stored program code in the storage medium.
- Each module proposed in the embodiment of the present invention may be implemented by a processor, and may also be implemented by a specific logic circuit.
- the processor may be a central processing unit (CPU), a microprocessor. (Microprocessor Uint, MPU) or Field Programmable Gate Array (FPGA).
- the processing method of the image file described above is implemented in the form of a software function module and sold or used as a stand-alone product, it may also be stored in a computer readable storage medium.
- a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
- the foregoing storage medium includes: a U disk, a mobile hard disk, and a read-only memory.
- ROM Read Only Memory
- embodiments of the invention are not limited to any specific combination of hardware and software.
- the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a computer program, and the computer program is used to execute the processing method of the image file according to the embodiment of the present invention.
- the embodiment of the present invention determines whether the target storage library includes an image file having the same image identifier as the specified image file to be copied; when the determination result is yes, the copying of the specified image file from the source storage library to the target is discarded.
- the operation in the repository In this way, the problem that the same image file is repeatedly copied and the storage resource is wasted in the related art is solved, thereby achieving the effect of efficiently managing the image file.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种镜像文件的处理方法、处理装置及存储介质,包括:判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件(S102),在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作(S104)。通过该镜像文件的处理方法、处理装置及存储介质,解决了相关技术中对相同的镜像文件进行重复拷贝而浪费存储资源的问题。
Description
相关申请的交叉引用
本申请基于申请号为201610303594.2、申请日为2016年05月09日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
本发明涉及文件处理领域,尤其涉及一种镜像文件的处理方法、装置及存储介质。
在虚拟化场景中,一般会创建多个存储库,所有的虚机磁盘文件都创建在这些存储库上。当存储库空间爆满,或者业务管理需要,必须将部分虚拟机迁移到其他的存储库。一般而言,可以直接拷贝虚拟机的磁盘文件至目标存储。但是这样一来如果两个虚机的磁盘公用一个父节点文件,如果都迁移到同一个存储库中,就会出现一个源文件产生多个目标副本的现象。
针对相关技术中存在的上述问题,目前尚未发现有效的解方案。
发明内容
有鉴于此,本发明实施例期望提供一种镜像文件的方法、装置及存储介质,以至少解决相关技术中对相同的镜像文件进行重复拷贝而浪费存储资源的问题。
根据本发明实施例的一个方面,提供了一种镜像文件的处理方法,包括:判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标
识的镜像文件;在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作。
在一实施例中,在判断结果为否时,所述方法还包括:将所述指定镜像文件拷贝至所述目标存储库中,并将所述镜像标识赋值给所述目标存储库中的所述指定镜像文件。
在一实施例中,所述方法还包括:在所述指定镜像文件发生变化时,在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
在一实施例中,所述指定镜像文件发生变化包括:所述指定镜像文件的数据内容发生变化;和/或,所述指定镜像文件在层次模型或网状模型中的节点位置发生变化。
在一实施例中,在更新所述指定镜像文件的镜像标识之后,所述方法还包括以下至少之一:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
根据本发明实施例的一个方面,提供了另一种镜像文件的处理方法,包括:设置指定镜像文件的镜像标识;在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
在一实施例中,所述指定镜像文件发生变化包括:所述指定镜像文件的数据内容发生变化;和/或,所述指定镜像文件在层次模型或网状模型中的节点位置发生变化。
在一实施例中,在更新所述镜像文件的镜像标识之后,所述方法还包括以下至少之一:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像
文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
在一实施例中,设置指定镜像文件的镜像标识包括:在创建指定镜像文件时,设置与所述指定镜像文件对应的镜像标识;和/或,在所述指定镜像文件从源存储库迁移到目标存储库时,将所述指定镜像文件在目标存储库中的镜像标识设置为与所述指定镜像文件在源存储库中的镜像标识相同。
根据本发明实施例的另一方面,提供了一种镜像文件的处理装置,包括:判断模块,配置为判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;处理模块,配置为在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作。
根据本发明实施例的另一方面,提供了另一种镜像文件的处理装置,包括:设置模块,配置为设置指定镜像文件的镜像标识;更新模块,配置为在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质存储有计算机程序,该计算机程序配置为执行本发明实施例的上述镜像文件的处理方法。
通过本发明上述实施例,采用判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件,在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作,通过在拷贝镜像文件前还判断目标存储库中是否已经存在待拷贝的镜像文件,解决了相关技术中对相同的镜像文件进行重复拷贝而浪费存储资源的问题,进而达到了高效管理镜像文件的效果。
图1是本发明实施例中镜像文件的处理方法的流程图一;
图2是本发明实施例中镜像文件的处理方法的流程图二;
图3是本发明实施例中镜像文件的处理装置的结构框图一;
图4是本发明实施例中镜像文件的处理装置的结构框图二;
图5是本发明可选实施例的存储迁移的文件变化示意图;
图6是本发明可选实施例的存储迁移的镜像判断流程图;
图7是本发明可选实施例的文件重置查找关联文件的示意图;
图8是本发明可选实施例的文件重置查找关联文件的流程图;
图9是本发明可选实施例的单个文件重置镜像标识的流程图。
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
在本实施例中提供了一种镜像文件的处理方法,图1是本发明实施例中镜像文件的处理方法的流程图一,如图1所示,该流程包括如下步骤:
步骤S102,判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;在一实施例中,拷贝即文件迁移,如:复制、粘贴。
步骤S104,在判断结果为是时,放弃将指定镜像文件从源存储库中拷贝至目标存储库中的操作。
在一实施例中,镜像文件包括与其对应的镜像标识(mirror_id),在迁移的时候就可以使用该mirror_id进行判断,如果目标存储上拥有跟源存储
上文件相同mirror_id的文件,那就可以不进行实际的文件拷贝工作,重用已存在的文件。
通过上述步骤,采用判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件,在判断结果为是时,放弃将指定镜像文件从源存储库中拷贝至目标存储库中的操作,通过在拷贝镜像文件前还判断目标存储库中是否已经存在待拷贝的镜像文件,解决了相关技术中对相同的镜像文件进行重复拷贝而浪费存储资源的问题,进而达到了高效管理镜像文件的效果。
在根据本实施例的可选实施方式中,在目标存储库中不包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件,即在判断结果为否时,还包括:将指定镜像文件拷贝至目标存储库中,并将镜像标识赋值给目标存储库中的指定镜像文件。
在根据本实施例的可选实施方式中,方法还包括:在指定镜像文件发生变化时,更新指定镜像文件的镜像标识。在一实施例中,指定镜像文件发生变化可以但不限于是以下情况:指定镜像文件的数据内容发生变化;指定镜像文件在层次模型或网状模型中的节点位置发生变化。
在一实施例中,在更新发生变化的指定镜像文件的镜像标识之后,还可以将与该指定镜像文件有关系的其他镜像文件也进行更新,并同时更新镜像标识。包括:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
根据上述可选实施方式,当镜像文件的数据发生改变,比如文件进行了合并(其他文件将数据合并至该文件)或者由父节点变成了叶子节点(即将
有虚机写入数据),那该镜像文件跟其他文件的数据就不再一致,无法继续保持镜像关系。可以对此类文件的mirror_id做重置操作。重置操作包括,重置自己的mirror_id,重置拥有该mirror_id的其他文件。另外除了对该文件进行重置之外,还需要对该文件的所有子节点进行重置。
在本实施例中还提供了另一种镜像文件的处理方法,图2是本发明实施例中镜像文件的处理方法的流程图二,如图2所示,该流程包括如下步骤:
步骤S202,设置指定镜像文件的镜像标识;
步骤S204,在指定镜像文件发生变化时,更新该指定镜像文件的镜像标识。
在一实施例中,镜像文件发生变化包括:镜像文件的数据内容发生变化、镜像文件在层次模型或网状模型中的节点位置发生变化。
在一实施例中,在更新发生变化的指定镜像文件的镜像标识之后,还可以将与该指定镜像文件有关系的其他镜像文件也进行更新,并同时更新镜像标识。包括:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
根据上述可选实施方式,当镜像文件的数据发生改变,比如文件进行了合并(其他文件将数据合并至该文件)或者由父节点变成了叶子节点(即将有虚机写入数据),那该镜像文件跟其他文件的数据就不再一致,无法继续保持镜像关系。可以对此类文件的mirror_id做重置操作。重置操作包括,重置自己的mirror_id,重置拥有该mirror_id的其他文件。另外除了对该文件进行重置之外,还需要对该文件的所有子节点进行重置。
在一实施例中,设置镜像文件的镜像标识包括在源存储库和目标存储库中进行设置,分别为:在创建指定镜像文件时,设置与所述指定镜像文件对应的镜像标识;在所述指定镜像文件从源存储库迁移到目标存储库时,将所述指定镜像文件在目标存储库中的镜像标识设置为与所述指定镜像文件在源存储库中的镜像标识相同。
设置文件的mirror_id:文件创建的时候会有一个默认的mirror_id,如果该文件做了一次存储迁移,即在目标存储库上产生了一个新的拷贝,可以将源文件的mirror_id赋值给该拷贝文件。这样利用这个镜像标识,源文件就跟目标存储库上的新文件建立了关联。同样,目标文件如果再次迁移至另一个存储库,那该mirror_id会延续到第三个文件上。可以实现只要是从同一个源复制过来的文件,都会拥有相同的镜像标识。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例的方法。
在本实施例中还提供了一种镜像文件的处理装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图3是本发明实施例中镜像文件的处理装置的结构框图一,如图3所示,该装置包括:
判断模块30,配置为判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;
处理模块32,配置为在判断结果为是时,放弃将指定镜像文件从源存储库中拷贝至目标存储库中的操作。
图4是本发明实施例中镜像文件的处理装置的结构框图二,如图4所示,该装置包括:
设置模块40,配置为设置指定镜像文件的镜像标识;
更新模块42,配置为在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
下面结合根据发明的可选实施例进行详细说明:
本可选实施例在虚拟化管理系统现有的存储迁移接口中,增加文件镜像的管理功能。包括文件镜像标识的设置,修改,和重置。可以完善整个存储迁移功能,避免迁移流程正确,但是虚机运行数据不一致这种难以排查的问题。
本实施例中的步骤包括:
S11:设置文件的mirror_id:文件创建的时候会有一个默认的mirror_id,如果该文件做了一次存储迁移,即在目标存储库上产生了一个新的拷贝,管理系统会将源文件的mirror_id赋值给该文件。这样利用这个镜像标识,源文件就跟目标存储库上的新文件建立了关联。同样,目标文件如果再次迁移至另一个存储库,那该mirror_id会延续到第三个文件上。因此只要是从同一个源复制过来的文件,都会拥有相同的镜像标识。
S12:重置文件的镜像标识:当文件的数据发生改变,比如文件进行了合并(其他文件将数据合并至该文件)或者由父节点变成了叶子节点(即将有虚机写入数据),那该文件跟其他文件的数据就不再一致,无法继续保持镜像关系。需要对此类文件的mirror_id做重置操作。重置操作包括,重置自
己的mirror_id,重置拥有该mirror_id的其他文件。另外除了对该文件进行重置之外,还需要对该文件的所有子节点进行重置。
S13:存储迁移对镜像标识的判断流程:文件拥有了mirror_id,在迁移的时候就可以使用该mirrorid进行判断,如果目的存储上拥有跟源文件相同mirror_id的文件,那就可以不进行实际的文件拷贝工作,重用已存在的文件。
需要说明的是,上述三个步骤并不存在特定的时序关系。
图5是本发明可选实施例的存储迁移的文件变化示意图,如图5所示,其中,虚拟硬盘镜像(VDI,Virtual Disk Images)可以是存储库、磁盘等,f与数字的结合形成与镜像文件对应的镜像标识;图6是本发明可选实施例的存储迁移的镜像判断流程图,如图6所示,包括:
S21:虚拟机存储迁移的时候,需要在复制磁盘文件之前查找对方存储库上有没有对应的镜像文件(或者影子文件);
S22:如果该存储库上有源文件的影子文件,则跳过文件拷贝步骤;
S23:如果目标存储库上没有找到影子文件,则需要走文件拷贝流程,并将源文件的mirror_id赋值给副本文件。
图7是本发明可选实施例的文件重置查找关联文件的示意图,图8是本发明可选实施例的文件重置查找关联文件的流程图,如图7及图8所示,包括:
S31:当文件进行了合并(其他文件将数据合并至该文件)或者由父节点变成了叶子节点(即将有虚机写入数据),那该文件跟其他文件的数据就不再一致,无法继续保持镜像关系。需要重置此类文件的镜像标识。
文件如果有子节点,那该文件所有的子节点也不能再与其他文件有镜像关系了,需要找到他所有的子节点,逐个对其重置镜像标识。
S32:逐个查找引用该文件的所有VDI,没有则结束流程。
S33:找到某一个VDI之后,从该VDI的叶子文件开始向上遍历,对每一个文件做重置镜像标识的操作。当遍历到原始的文件之后,则结束该VDI的重置操作,继续查找下一个VDI。直到所有VDI都遍历完,结束流程。
图9是本发明可选实施例的单个文件重置镜像标识的流程图,如图9所示,判断分支Y(是),N(否),包括:
S41:遍历所有的存储库,如果没有找到存储库则结束流程;
S42:找到某一个存储库之后,遍历该存储库上的所有文件,找不到则将原文件的mirror_id设置为自己的file_id,结束文件遍历,继续S41;
S43:找到跟目标文件拥有相同mirror_id的文件,设置该文件的镜像标识为新的id。继续S42;
S44:遍历完所有的存储库之后,还需要将原文件的mirror_id初始化为自己的文件标识file_id。
在本可选实施例中,可以在迁移之后对源文件和副本文件各设置一个镜像标识,那么下一次再次迁移源文件,通过这个标识,就能避免重复拷贝。引入镜像机制之后,还有一个缺陷:当源文件或者副本文件的数据发生改变,那两个文件就不能保持镜像关系了。本可选实施例在引入镜像机制的同时,还对文件之间的镜像关系进行动态管理,文件发生改变能实时修改镜像标识。完美解决了存储迁移过程中的两个关键问题。
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。
本发明的实施例还提供了一种存储介质。在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜
像标识的镜像文件;
S2,在判断结果为是时,放弃将指定镜像文件从源存储库中拷贝至目标存储库中的操作。
在本发明实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
在一实施例中,处理器根据存储介质中已存储的程序代码执行判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;
在一实施例中,处理器根据存储介质中已存储的程序代码执行在判断结果为是时,放弃将指定镜像文件从源存储库中拷贝至目标存储库中的操作。
本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。
本发明实施例中提出的各个模块均可以通过处理器来实现,当然也可通过具体的逻辑电路实现;在实际应用中,处理器可以为中央处理器(Central Processing Unit,CPU)、微处理器(Microprocessor Uint,MPU)或现场可编程门阵列(Field Programmable Gate Array,FPGA)等。
本发明实施例中,如果以软件功能模块的形式实现上述镜像文件的处理方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储
器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本发明实施例不限制于任何特定的硬件和软件结合。
相应地,本发明实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机程序,该计算机程序用于执行本发明实施例的上述镜像文件的处理方法。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
本发明实施例判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作。如此,解决了相关技术中对相同的镜像文件进行重复拷贝而浪费存储资源的问题,进而达到了高效管理镜像文件的效果。
Claims (13)
- 一种镜像文件的处理方法,包括:判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;在判断结果为是时,放弃将所述指定镜像文件从源存储库中拷贝至所述目标存储库中的操作。
- 根据权利要求1所述的方法,其中,在判断结果为否时,所述方法还包括:将所述指定镜像文件拷贝至所述目标存储库中,并将所述镜像标识赋值给所述目标存储库中的所述指定镜像文件。
- 根据权利要求1所述的方法,其中,所述方法还包括:在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
- 根据权利要求3所述的方法,其中,所述指定镜像文件发生变化包括:所述指定镜像文件的数据内容发生变化;和/或,所述指定镜像文件在层次模型或网状模型中的节点位置发生变化。
- 根据权利要求3所述的方法,其中,在更新所述指定镜像文件的镜像标识之后,所述方法还包括以下至少之一:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
- 一种镜像文件的处理方法,包括:设置指定镜像文件的镜像标识;在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
- 根据权利要求6所述的方法,其中,所述指定镜像文件发生变化包括:所述指定镜像文件的数据内容发生变化;和/或,所述指定镜像文件在层次模型或网状模型中的节点位置发生变化。
- 根据权利要求6所述的方法,其中,在更新所述镜像文件的镜像标识之后,所述方法还包括以下至少之一:将所述指定镜像文件更新前的镜像标识对应的镜像文件及其镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的父节点的镜像标识进行更新;将与所述指定镜像文件具有相同镜像标识的镜像文件在层次模型或网状模型中的子节点的镜像标识进行更新。
- 根据权利要求6所述的方法,其中,设置指定镜像文件的镜像标识包括:在创建指定镜像文件时,设置与所述指定镜像文件对应的镜像标识;和/或在所述指定镜像文件从源存储库迁移到目标存储库时,将所述指定镜像文件在目标存储库中的镜像标识设置为与所述指定镜像文件在源存储库中的镜像标识相同。
- 一种镜像文件的处理装置,包括:判断模块,配置为判断目标存储库中是否包括与待拷贝的指定镜像文件具有相同镜像标识的镜像文件;处理模块,配置为在判断结果为是时,放弃将所述指定镜像文件从源 存储库中拷贝至所述目标存储库中的操作。
- 一种镜像文件的处理装置,包括:设置模块,配置为设置指定镜像文件的镜像标识;更新模块,配置为在所述指定镜像文件发生变化时,更新所述指定镜像文件的镜像标识。
- 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令用于执行权利要求1至5任一项所述的镜像文件的处理方法。
- 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令用于执行权利要求6至9任一项所述的镜像文件的处理方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610303594.2 | 2016-05-09 | ||
CN201610303594.2A CN107357691B (zh) | 2016-05-09 | 2016-05-09 | 镜像文件的处理方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017193764A1 true WO2017193764A1 (zh) | 2017-11-16 |
Family
ID=60266326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/080488 WO2017193764A1 (zh) | 2016-05-09 | 2017-04-13 | 镜像文件的处理方法、装置及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107357691B (zh) |
WO (1) | WO2017193764A1 (zh) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110275717B (zh) * | 2019-05-17 | 2024-03-22 | 平安科技(深圳)有限公司 | 私有镜像克隆方法、装置、计算机设备及存储介质 |
CN110851144B (zh) * | 2019-09-06 | 2023-09-29 | 北京京东尚科信息技术有限公司 | 云主机部署方法及装置、计算机可存储介质 |
CN114996226B (zh) * | 2021-11-05 | 2023-03-31 | 荣耀终端有限公司 | 图标检测方法、电子设备、可读存储介质和程序产品 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103227818A (zh) * | 2013-03-27 | 2013-07-31 | 福建伊时代信息科技股份有限公司 | 终端、服务器、文件传输方法、文件存储管理系统和方法 |
CN103513999A (zh) * | 2012-06-25 | 2014-01-15 | 联想(北京)有限公司 | 一种更新系统固件的方法及电子设备 |
CN103595808A (zh) * | 2013-11-20 | 2014-02-19 | 珠海金山办公软件有限公司 | 一种文件更新信息推送方法及装置 |
CN105187252A (zh) * | 2015-09-28 | 2015-12-23 | 浪潮(北京)电子信息产业有限公司 | 一种批量部署定制化系统的方法及系统 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1836283B (zh) * | 2003-08-12 | 2011-04-13 | 日本先锋公司 | 记录装置及记录方法、重放装置及重放方法 |
CN102693302B (zh) * | 2012-05-21 | 2015-04-22 | 浙江省公众信息产业有限公司 | 快速文件比对方法、系统及客户端 |
CN102932415B (zh) * | 2012-09-26 | 2015-04-15 | 东软集团股份有限公司 | 一种镜像文件存储方法及装置 |
CN103942292A (zh) * | 2014-04-11 | 2014-07-23 | 华为技术有限公司 | 虚拟机镜像文件处理方法、装置及系统 |
-
2016
- 2016-05-09 CN CN201610303594.2A patent/CN107357691B/zh active Active
-
2017
- 2017-04-13 WO PCT/CN2017/080488 patent/WO2017193764A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103513999A (zh) * | 2012-06-25 | 2014-01-15 | 联想(北京)有限公司 | 一种更新系统固件的方法及电子设备 |
CN103227818A (zh) * | 2013-03-27 | 2013-07-31 | 福建伊时代信息科技股份有限公司 | 终端、服务器、文件传输方法、文件存储管理系统和方法 |
CN103595808A (zh) * | 2013-11-20 | 2014-02-19 | 珠海金山办公软件有限公司 | 一种文件更新信息推送方法及装置 |
CN105187252A (zh) * | 2015-09-28 | 2015-12-23 | 浪潮(北京)电子信息产业有限公司 | 一种批量部署定制化系统的方法及系统 |
Also Published As
Publication number | Publication date |
---|---|
CN107357691B (zh) | 2022-06-21 |
CN107357691A (zh) | 2017-11-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11119678B2 (en) | Transactional operations in multi-master distributed data management systems | |
US8874626B2 (en) | Tracking files and directories related to unsuccessful change operations | |
US20140280796A1 (en) | Systems and methods for providing a distributed service configuration framework | |
US9031906B2 (en) | Method of managing data in asymmetric cluster file system | |
JP6239004B2 (ja) | 最適化されたデータサブセット化のための方法、装置及びコンピュータ読み取り可能媒体 | |
WO2014146240A1 (zh) | 分布式存储系统的数据更新方法及服务器 | |
US11507474B2 (en) | System and method for a backup and recovery of application using containerized backups comprising application data and application dependency information | |
US11308043B2 (en) | Distributed database replication | |
US20200257514A1 (en) | Scalable artifact distribution | |
US9535925B2 (en) | File link migration | |
US11455216B2 (en) | Method and system for generating synthetic backups using pseudo-asset backups | |
US20180129686A1 (en) | Merging and unmerging objects using graphical representation | |
WO2017193764A1 (zh) | 镜像文件的处理方法、装置及存储介质 | |
JP2009259007A (ja) | 分散格納方法、分散格納システム及び分散格納装置 | |
US11468016B2 (en) | Method and system for parallelizing backup generation operations using pseudo-asset backups | |
JP2016510918A (ja) | ボリューム複製を目的としたワークロードの特定およびバッファのサイズ設定 | |
US11726743B2 (en) | Merging multiple sorted lists in a distributed computing system | |
WO2016177027A1 (zh) | 批量数据查询方法和装置 | |
CN111488242B (zh) | 将条带化备份加标签和路由到重复数据删除设备上的单个重复数据删除实例的方法和系统 | |
US11157459B2 (en) | Granular data self-healing | |
US10031668B2 (en) | Determining status of a host operation without accessing the host in a shared storage environment | |
US20150350315A1 (en) | Zero copy volume reconstruction | |
US10275468B2 (en) | Replication of data in a distributed file system using an arbiter | |
US20170357657A1 (en) | Systems and methods for implementing dynamic file systems | |
US11907162B2 (en) | Minimizing data volume growth under encryption changes |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17795382 Country of ref document: EP Kind code of ref document: A1 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17795382 Country of ref document: EP Kind code of ref document: A1 |