CN114003569A - Method and device for updating qcow2 mirror image file increment - Google Patents

Method and device for updating qcow2 mirror image file increment Download PDF

Info

Publication number
CN114003569A
CN114003569A CN202111241500.0A CN202111241500A CN114003569A CN 114003569 A CN114003569 A CN 114003569A CN 202111241500 A CN202111241500 A CN 202111241500A CN 114003569 A CN114003569 A CN 114003569A
Authority
CN
China
Prior art keywords
qcow2
voi
image file
client
data
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
Application number
CN202111241500.0A
Other languages
Chinese (zh)
Inventor
程皓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Os Easy Cloud Computing Co ltd
Original Assignee
Wuhan Os Easy Cloud Computing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Os Easy Cloud Computing Co ltd filed Critical Wuhan Os Easy Cloud Computing Co ltd
Priority to CN202111241500.0A priority Critical patent/CN114003569A/en
Publication of CN114003569A publication Critical patent/CN114003569A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1748De-duplication implemented within the file system, e.g. based on file segments
    • G06F16/1756De-duplication implemented within the file system, e.g. based on file segments based on delta files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1727Details of free space management performed by the file system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/188Virtual file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for updating the increment of a qcow2 mirror image file, which comprises the following steps: acquiring a qcow2 image file to be issued to a VOI client to update a qcow2 image file in the VOI client; analyzing metadata of a qcow2 mirror image file to be issued to obtain data content and data size of each distributed data cluster and sector offset in a virtual disk corresponding to the qcow2 mirror image file; the data content, the data size and the sector offset of each distributed data cluster are transmitted to a VOI client; and taking the data size, the sector offset and a file handle to be written with data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to the qcow2 mirror image file in the VOI client. In the whole incremental updating process of the qcow2 image file, the VOI client does not need to prepare extra large hard disk free space for storing temporary data, and the VOI client only needs to write once the qcow2 image file to be issued, so that the updating efficiency is effectively improved, and the updating time is shortened.

Description

Method and device for updating qcow2 mirror image file increment
Technical Field
The invention relates to the technical field of Virtual OS (operating system) management, in particular to a method and a device for updating an increment of a qcow2 image file.
Background
In a VOI scene, after a user issues a system image file in a qcow2 format to a VOI client through a VOI server for the first time to complete system deployment, when the user wants to update template system data, the VOI server usually adopts a qcow2 external snapshot mode to store user update data, each update data corresponds to 1 qcow2 image file, and thus the update data can be issued to all clients in an incremental mode through the VOI server. However, as the number of updates by the user increases, the qcow2 (a disk image format) file levels corresponding to the template system also increase, and if the VOI client stores all updates in the form of qcow2 external snapshots like the VOI server, according to the qcow2 algorithm principle, the more qcow2 image file levels corresponding to one system, the lower the efficiency of reading and writing a disk in the system, which may affect the user experience.
For the above situation, it is currently common practice to: when the VOI server sends the update file to the VOI client, the VOI client uses the qcow2 merging function to merge 2 or more qcow2 mirror image files into 1 file, so that the hierarchical relationship is reduced, and the reduction of the efficiency of reading and writing the disk in the system is avoided. However, this approach has the following drawbacks: 1. when the qcow2 merging function is used, files needing to be merged are stored locally, and the issued files can be deleted after the merging operation is executed, the merged files can be gradually increased in the merging execution process, the maximum increased capacity is basically equal to the size of the updated files, at the moment, the VOI client side is required to have a hard disk free space which is 2 times or more the size of the updated files, and if the free space of the hard disk is insufficient, the merging fails; 2. in the whole merging and updating process, the VOI client performs 1 read operation and 2 write operations on the same file, the first write operation is in the process of receiving the file sent by the VOI server, and the read operation and the second write operation are in the process of executing merging, so that more time is consumed, and the updating efficiency is influenced.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and a device for updating the qcow2 image file increment.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
in a first aspect, the invention provides a method for updating an increment of a qcow2 image file, which specifically comprises the following steps:
acquiring a qcow2 image file to be issued to a VOI client to update a qcow2 image file in the VOI client;
analyzing metadata of a qcow2 mirror image file to be issued to obtain data content and data size of each distributed data cluster and sector offset in a virtual disk corresponding to the qcow2 mirror image file;
the data content, the data size and the sector offset of each distributed data cluster are transmitted to a VOI client;
and taking the data size, the sector offset and a file handle to be written with data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to the qcow2 mirror image file in the VOI client.
On the basis of the technical scheme, the acquiring of the qcow2 image file to be sent to the VOI client to update the qcow2 image file in the VOI client specifically comprises the following steps:
comparing the qcow2 mirror image file in the VOI server with the qcow2 mirror image file in the VOI client;
and obtaining a qcow2 image file to be issued based on the comparison result, wherein the qcow2 image file to be issued is used for being issued to the VOI client so as to update the qcow2 image file in the VOI client.
On the basis of the technical scheme, the metadata of the qcow2 image file to be issued is analyzed to obtain the data content and the data size of each allocated data cluster and the sector offset in the virtual disk corresponding to the qcow2 image file, wherein the specific steps for the data size and the sector offset are as follows:
the VOI server side analyzes metadata of a qcow2 mirror image file to be issued, and traverses all entries of an L2 table of the metadata based on a traversal mode to obtain a set of all distributed data clusters;
and creating a delivered data information list, and storing the data size of each allocated data cluster in the set and the sector offset in the virtual disk corresponding to the qcow2 image file into the delivered data information list.
On the basis of the above technical solution, before issuing the data content, the data size, and the sector offset of each allocated data cluster to the VOI client, the method further includes:
the VOI server side sends the space size information of the qcow2 mirror image file to be issued and the name of the parent level mirror image file to the VOI client side;
and the VOI client receives the space size information and the parent mirror image file and judges whether the free space capacity of the disk is enough or not based on the received space size information.
On the basis of the above technical solution, when the free space capacity of the disk of the VOI client is sufficient:
the VOI client uses the received path of the parent mirror image file as a parameter, and opens a file interface by calling qcow2 to obtain a file handle of data to be written on the VOI client;
the VOI server takes the file path of the qcow2 image file to be issued as a parameter, and opens a file interface by calling qcow2 to obtain the file handle of the qcow2 image file to be issued.
On the basis of the technical scheme, when the disk free space capacity of the VOI client is insufficient: the update of the qcow2 image file on the VOI client is stopped.
On the basis of the technical scheme, the metadata of the qcow2 image file to be issued is analyzed to obtain the data content and the data size of each allocated data cluster and the virtual sector offset corresponding to the qcow2 image file, wherein the data content is obtained by the following specific steps:
the VOI server side traverses the issued data information list to obtain the data size and sector offset of each distributed data cluster;
and taking the obtained data size, the sector offset and the file handle of the image file of qcow2 to be issued as parameters, and calling a qcow2 read file interface to sequentially obtain the data content of each allocated data cluster.
On the basis of the above technical solution, the specific steps of using the data size, the sector offset, and a file handle to be written with data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to a qcow2 image file in the VOI client include:
and taking the data size and the sector offset of each allocated data cluster and a file handle to be written with data on the VOI client as parameters, calling a qcow2 write file interface, and writing the data content of each allocated data cluster into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client to complete the update of the qcow2 mirror image file in the VOI client.
On the basis of the above technical solution, the issuing the data content, the data size, and the sector offset of each allocated data cluster to the VOI client specifically includes:
and the VOI server side issues the data content, the data size and the sector offset of each distributed data cluster to the VOI client side in sequence.
In a second aspect, the present invention provides an apparatus for incrementally updating a qcow2 image file, including:
the VOI server is used for acquiring a qcow2 mirror image file to be issued to the VOI client to update the qcow2 mirror image file in the VOI client, analyzing metadata of the qcow2 mirror image file to be issued to obtain the data content and the data size of each allocated data cluster and the sector offset in the virtual disk corresponding to the qcow2 mirror image file, and then issuing the data content, the data size and the sector offset of each allocated data cluster to the VOI client;
and the VOI client is used for receiving the data content, the data size and the sector offset sent by the VOI server, taking the data size, the sector offset and a file handle to be written in data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to the qcow2 mirror image file in the VOI client.
Compared with the prior art, the invention has the advantages that: when the incremental update of the qcow2 image file is carried out on the VOI client by the VOI server, the metadata of the qcow2 image file to be issued is analyzed to obtain the data content, the data size and the sector offset of each allocated data cluster in the virtual disk corresponding to the qcow2 image file, then the data content, the data size and the sector offset of each allocated data cluster are issued to the VOI client, finally the data size, the sector offset and the file handle to be written in the data on the VOI client are taken as parameters, then the data content is written in the sector of the virtual disk corresponding to the qcow2 image file in the VOI client, the incremental update operation of the qcow2 image file can be completed, the VOI client does not need to prepare an extra large free hard disk space to store temporary data in the whole update process, and the VOI client only needs to write the qcow2 image file to be issued once, so that the update efficiency is effectively improved, while shortening the update time.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a method for updating an increment of a qcow2 image file according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an incremental update apparatus for qcow2 image files in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method for updating an increment of a qcow2 mirror image file, which comprises the steps of analyzing metadata of a qcow2 mirror image file to be issued when a VOI client is subjected to qcow2 mirror image file increment updating through a VOI server, and obtaining the data content and the data size of each allocated data cluster and the sector offset in a virtual disk corresponding to the qcow2 mirror image file; and then the data content, the data size and the sector offset of each allocated data cluster are issued to a VOI client, finally the data size, the sector offset and a file handle to be written in data on the VOI client are used as parameters, then the data content is written in a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client, so that the incremental updating operation of the qcow2 mirror image file can be completed, the VOI client does not need to prepare extra large free hard disk space to store temporary data in the whole updating process, and the VOI client only needs to write the qcow2 mirror image file to be issued once, so that the updating efficiency is effectively improved, and the updating time is shortened. The embodiment of the invention correspondingly provides a device for updating the qcow2 image file increment.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, an incremental update method for a qcow2 image file provided in an embodiment of the present invention specifically includes the following steps:
s1: acquiring a qcow2 image file to be issued to a VOI client to update a qcow2 image file in the VOI client; the to-be-issued qcow2 mirror image file is specifically acquired by the VOI server.
In the embodiment of the invention, the VOI server is used for providing the functions of centralized management and distributing the qcow2 format image files as required; the VOI client is installed on the VOI client and used for receiving the qcow2 format image file distributed by the VOI server and creating a virtual disk device.
For the data cluster of qcow2, the data cluster is a data storage unit in a qcow2 mirror image format and is used for storing metadata of qcow2 and virtual disk data corresponding to a mirror image file, the size of each cluster in the same qcow2 mirror image file is equal and is continuous in space in the mirror image file, generally, the size of each cluster is an integral multiple of 512 bytes, and the data cluster of qcow2 is divided into a qcow2 metadata cluster, an allocated data cluster and an unallocated data cluster; the qcow2 metadata cluster is a cluster for storing qcow2 mirror format metadata; the allocated data cluster is a cluster which is stored in a qcow2 mirror file and used for representing disk data; the unallocated data cluster is an unused data cluster with a reference count of 0.
In the embodiment of the present invention, a qcow2 image file to be sent to a VOI client for updating a qcow2 image file in the VOI client is obtained, and the specific steps include:
s101: comparing the qcow2 mirror image file in the VOI server with the qcow2 mirror image file in the VOI client;
s102: and obtaining a qcow2 image file to be issued based on the comparison result, wherein the qcow2 image file to be issued is used for being issued to the VOI client so as to update the qcow2 image file in the VOI client.
When a user executes the functional operation of issuing the system update to the VOI client through the VOI server according to needs, the VOI server finds all the qcow2 image files stored in the VOI server correspondingly according to the system to be issued, and then compares the qcow2 image files with the qcow2 image files in the VOI client to obtain the qcow2 image files to be issued to the VOI client for updating, namely the qcow2 image files to be issued.
S2: analyzing metadata of a qcow2 mirror image file to be issued to obtain data content and data size of each distributed data cluster and sector offset in a virtual disk corresponding to the qcow2 mirror image file;
s3: the data content, the data size and the sector offset of each distributed data cluster are transmitted to a VOI client;
s4: and taking the data size, the sector offset and a file handle to be written with data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to the qcow2 mirror image file in the VOI client.
In the embodiment of the present invention, metadata of a qcow2 image file to be distributed is analyzed to obtain data content and data size of each allocated data cluster and sector offset in a virtual disk corresponding to the qcow2 image file, wherein the specific steps obtained for the data size and the sector offset are as follows:
s111: the VOI server side analyzes metadata of a qcow2 mirror image file to be issued, and traverses all entries of an L2 (two-layer) table of the metadata based on a traversal mode to obtain a set of all distributed data clusters;
s112: and creating a delivered data information list, and storing the data size of each allocated data cluster in the set and the sector offset in the virtual disk corresponding to the qcow2 image file into the delivered data information list.
In the embodiment of the present invention, before issuing the data content, the data size, and the sector offset of each allocated data cluster to the VOI client, the method further includes:
s301: the VOI server side sends the space size information of the qcow2 mirror image file to be issued and the name of the parent level mirror image file to the VOI client side;
s302: and the VOI client receives the space size information and the parent mirror image file and judges whether the free space capacity of the disk is enough or not based on the received space size information.
When the free space capacity of the disk of the VOI client is enough: the VOI client uses the received path of the parent mirror image file as a parameter, and opens a file interface by calling qcow2 to obtain a file handle of data to be written on the VOI client; the VOI server takes the file path of the qcow2 image file to be issued as a parameter, and opens a file interface by calling qcow2 to obtain the file handle of the qcow2 image file to be issued.
It should be noted that the image file qcow2 to be issued is finally written into the VOI client, but when the file handle of the data to be written on the VOI client is obtained, the image file qcow2 to be issued is not yet issued to the VOI client, at this time, obtaining the file handle of the data to be written is equivalent to preparation work prepared for a later writing stage, and the file handle of a corresponding position where the data to be written is obtained in advance.
When the disk free space capacity of the VOI client is insufficient: the update of the qcow2 image file on the VOI client is stopped.
In the embodiment of the present invention, metadata of a qcow2 image file to be distributed is analyzed to obtain data content and data size of each allocated data cluster and sector offset in a virtual disk corresponding to the qcow2 image file, wherein for the data content, the specific steps obtained are as follows:
s221: the VOI server side traverses the issued data information list to obtain the data size and sector offset of each distributed data cluster;
s222: and taking the obtained data size, the sector offset and the file handle of the image file of qcow2 to be issued as parameters, and calling a qcow2 read file interface to sequentially obtain the data content of each allocated data cluster.
In the embodiment of the present invention, the data size, the sector offset, and a file handle to be written with data on the VOI client are used as parameters, and then the data content is written into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client, which specifically includes the following steps:
and taking the data size and the sector offset of each allocated data cluster and a file handle to be written with data on the VOI client as parameters, calling a qcow2 write file interface, and writing the data content of each allocated data cluster into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client to complete the update of the qcow2 mirror image file in the VOI client.
In the embodiment of the present invention, the data content, the data size, and the sector offset of each allocated data cluster are issued to the VOI client, specifically:
and the VOI server side issues the data content, the data size and the sector offset of each distributed data cluster to the VOI client side in sequence.
The specific process of the qcow2 mirror image file increment updating method comprises the following steps:
a: when a user executes the function operation of issuing system update to the VOI client through the VOI server according to the requirement;
b: the VOI server finds all the qcow2 mirror image files stored in the VOI server correspondingly according to a system to be issued;
c: comparing the qcow2 image file in the VOI server with the qcow2 image file in the VOI client, and obtaining a qcow2 image file to be issued based on a comparison result, wherein the qcow2 image file to be issued is used for issuing to the VOI client to update the qcow2 image file in the VOI client;
d: the VOI server side analyzes metadata of a qcow2 mirror image file to be issued, and traverses entries of all L2 tables of the metadata based on a traversal mode to obtain a set of all distributed data clusters, creates an issued data information list, and stores the data size of each distributed data cluster in the set and the sector offset in a virtual disk corresponding to the qcow2 mirror image file into the issued data information list;
e: the VOI server side sends the space size information of the qcow2 mirror image file to be issued and the name of the parent level mirror image file to the VOI client side;
f: the VOI client receives the space size information and the parent mirror image file, judges whether the free space capacity of a disk is enough or not based on the received space size information, and when the free space capacity is enough, the VOI client takes the path of the received parent mirror image file as a parameter and opens a file interface by calling qcow2 to obtain a file handle of data to be written on the VOI client;
g: the VOI server takes a file path of the qcow2 image file to be issued as a parameter, and opens a file interface by calling qcow2 to obtain a file handle of the qcow2 image file to be issued;
h: the VOI server traverses the issued data information list, acquires the data size and the sector offset of each allocated data cluster, takes the acquired data size, the sector offset and the file handle of the qcow2 mirror image file to be issued as parameters, sequentially acquires the data content of each allocated data cluster by calling a qcow2 file reading interface, and then sequentially issues the data content, the data size and the sector offset of each allocated data cluster to the VOI client;
i: taking the data size and sector offset of each allocated data cluster and a file handle to be written with data on the VOI client as parameters, calling a qcow2 write file interface, writing the data content of each allocated data cluster into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client, and completing updating of the qcow2 mirror image file in the VOI client;
j: and after the VOI server finishes transmitting all the allocated data cluster data in the qcow2 image file, finishing the incremental updating of the whole qcow2 image file.
When a user performs a function operation of issuing a qcow2 incremental file (i.e., a qcow2 image file for updating a qcow2 image file in a VOI client) to the VOI client through the VOI server, the qcow2 incremental file data is analyzed, all allocated data clusters in the qcow2 incremental file can be found through the data structure characteristics of the qcow2 format file, the VOI server can issue the data of the clusters to the VOI client in batches in a stream form, and the VOI client writes the data into the qcow2 file to be combined through a write interface of qcow2 while receiving the data, so that the operation of updating the qcow2 image file in increments is completed. In the whole data issuing and updating process, the spare space of a hard disk with the size 2 times that of the issued file is not required to be prepared for storing temporary data, only the residual space of the hard disk is required to be larger than the size of the issued file, and in the updating process, the VOI client only writes the qcow2 incremental file for 1 time, so that the efficiency is improved to a great extent, and the updating time is shortened.
The method for updating the qcow2 mirror image file increment in the embodiment of the invention comprises the steps of analyzing metadata of a qcow2 mirror image file to be issued when the qcow2 mirror image file increment updating is carried out on a VOI client through a VOI server, obtaining the data content and the data size of each allocated data cluster and the sector offset in a virtual disk corresponding to the qcow2 mirror image file, then sending the data content, the data size and the sector offset of each allocated data cluster to the VOI client, finally taking the data size, the sector offset and a file handle to be written with data on the VOI client as parameters, then writing the data content into a sector of the virtual disk corresponding to the qcow2 mirror image file in the VOI client, namely, completing the increment updating operation of the qcow2 mirror image file, wherein the VOI client does not need to prepare extra large hard disk free space to store temporary data in the whole updating process, and only needs to write the qcow2 mirror image file once, the updating efficiency is effectively improved, and the updating time is shortened.
Referring to fig. 2, an apparatus for incrementally updating a qcow2 image file according to an embodiment of the present invention includes a VOI server and a VOI client.
The VOI server is used for acquiring a qcow2 mirror image file to be issued to the VOI client to update the qcow2 mirror image file in the VOI client, analyzing metadata of the qcow2 mirror image file to be issued to obtain the data content and the data size of each allocated data cluster and the sector offset in the virtual disk corresponding to the qcow2 mirror image file, and then issuing the data content, the data size and the sector offset of each allocated data cluster to the VOI client; the VOI client is used for receiving data content, data size and sector offset issued by the VOI server, taking the data size, the sector offset and a file handle to be written in data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

Claims (10)

1. A method for updating the increment of a qcow2 image file is characterized by comprising the following steps:
acquiring a qcow2 image file to be issued to a VOI client to update a qcow2 image file in the VOI client;
analyzing metadata of a qcow2 mirror image file to be issued to obtain data content and data size of each distributed data cluster and sector offset in a virtual disk corresponding to the qcow2 mirror image file;
the data content, the data size and the sector offset of each distributed data cluster are transmitted to a VOI client;
and taking the data size, the sector offset and a file handle to be written in data on the VOI client as parameters, and then writing the data content into a virtual disk sector corresponding to a qcow2 mirror image file in the VOI client.
2. The method for incrementally updating the qcow2 image file according to claim 1, wherein the obtaining of the qcow2 image file to be sent to the VOI client for updating the qcow2 image file in the VOI client comprises:
comparing the qcow2 mirror image file in the VOI server with the qcow2 mirror image file in the VOI client;
and obtaining a qcow2 image file to be issued based on the comparison result, wherein the qcow2 image file to be issued is used for being issued to the VOI client so as to update the qcow2 image file in the VOI client.
3. The method for incrementally updating a qcow2 image file as claimed in claim 1, wherein the analyzing metadata of the qcow2 image file to be distributed obtains the data content and data size of each allocated data cluster and the sector offset in the virtual disk corresponding to the qcow2 image file, wherein for the data size and the sector offset, the obtaining comprises the following specific steps:
the VOI server side analyzes metadata of a qcow2 mirror image file to be issued, and traverses all entries of an L2 table of the metadata based on a traversal mode to obtain a set of all distributed data clusters;
and creating a delivered data information list, and storing the data size of each allocated data cluster in the set and the sector offset in the virtual disk corresponding to the qcow2 image file into the delivered data information list.
4. The qcow2 image file incremental updating method of claim 3, wherein before sending the data content, the data size and the sector offset of each allocated data cluster to the VOI client, the method further comprises:
the VOI server side sends the space size information of the qcow2 mirror image file to be issued and the name of the parent level mirror image file to the VOI client side;
and the VOI client receives the space size information and the parent mirror image file and judges whether the free space capacity of the disk is enough or not based on the received space size information.
5. The qcow2 image file incremental update method of claim 4, wherein when the free disk space capacity of the VOI client is sufficient:
the VOI client uses the received path of the parent mirror image file as a parameter, and opens a file interface by calling qcow2 to obtain a file handle of data to be written on the VOI client;
the VOI server takes the file path of the qcow2 image file to be issued as a parameter, and opens a file interface by calling qcow2 to obtain the file handle of the qcow2 image file to be issued.
6. The qcow2 image file incremental update method of claim 4, wherein when the free disk capacity of the VOI client is insufficient: the update of the qcow2 image file on the VOI client is stopped.
7. The method for incrementally updating a qcow2 image file as claimed in claim 5, wherein the analyzing metadata of the qcow2 image file to be distributed obtains the data content, the data size and the sector offset in the virtual disk corresponding to the qcow2 image file of each allocated data cluster, wherein for the data content, the obtaining comprises the following specific steps:
the VOI server side traverses the issued data information list to obtain the data size and sector offset of each distributed data cluster;
and taking the obtained data size, the sector offset and the file handle of the image file of qcow2 to be issued as parameters, and calling a qcow2 read file interface to sequentially obtain the data content of each allocated data cluster.
8. The method for incrementally updating a qcow2 image file as claimed in claim 5, wherein the steps of using the data size, the sector offset and the file handle to be written with data on the VOI client as parameters, and then writing the data content into the sector of the virtual disk corresponding to the qcow2 image file in the VOI client comprise:
and taking the data size and the sector offset of each allocated data cluster and a file handle to be written with data on the VOI client as parameters, calling a qcow2 write file interface, and writing the data content of each allocated data cluster into a sector of a virtual disk corresponding to a qcow2 mirror image file in the VOI client to complete the update of the qcow2 mirror image file in the VOI client.
9. The method for incrementally updating a qcow2 image file according to claim 1, wherein the issuing of the data content, the data size, and the sector offset of each allocated data cluster to the VOI client specifically comprises:
and the VOI server side issues the data content, the data size and the sector offset of each distributed data cluster to the VOI client side in sequence.
10. An apparatus for incrementally updating a qcow2 image file, comprising:
the VOI server is used for acquiring a qcow2 mirror image file to be issued to the VOI client to update the qcow2 mirror image file in the VOI client, analyzing metadata of the qcow2 mirror image file to be issued to obtain the data content and the data size of each allocated data cluster and the sector offset of a virtual disk corresponding to the qcow2 mirror image file, and then issuing the data content, the data size and the sector offset of each allocated data cluster to the VOI client;
and the VOI client is used for receiving the data content, the data size and the sector offset sent by the VOI server, taking the data size, the sector offset and a file handle to be written in data on the VOI client as parameters, and then writing the data content into a sector of a virtual disk corresponding to the qcow2 mirror image file in the VOI client.
CN202111241500.0A 2021-10-25 2021-10-25 Method and device for updating qcow2 mirror image file increment Pending CN114003569A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111241500.0A CN114003569A (en) 2021-10-25 2021-10-25 Method and device for updating qcow2 mirror image file increment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111241500.0A CN114003569A (en) 2021-10-25 2021-10-25 Method and device for updating qcow2 mirror image file increment

Publications (1)

Publication Number Publication Date
CN114003569A true CN114003569A (en) 2022-02-01

Family

ID=79923844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111241500.0A Pending CN114003569A (en) 2021-10-25 2021-10-25 Method and device for updating qcow2 mirror image file increment

Country Status (1)

Country Link
CN (1) CN114003569A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115509624A (en) * 2022-10-25 2022-12-23 中南大学 Mirror image fusion method and system for streaming loading
CN116257277A (en) * 2023-05-12 2023-06-13 天津卓朗昆仑云软件技术有限公司 Mirror image file updating method and device and VOI system
WO2024078262A1 (en) * 2022-10-10 2024-04-18 华为技术有限公司 Snapshotting method, electronic device, computer program product and readable storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024078262A1 (en) * 2022-10-10 2024-04-18 华为技术有限公司 Snapshotting method, electronic device, computer program product and readable storage medium
CN115509624A (en) * 2022-10-25 2022-12-23 中南大学 Mirror image fusion method and system for streaming loading
CN115509624B (en) * 2022-10-25 2023-04-28 中南大学 Stream loading-oriented mirror image fusion method and system
CN116257277A (en) * 2023-05-12 2023-06-13 天津卓朗昆仑云软件技术有限公司 Mirror image file updating method and device and VOI system
CN116257277B (en) * 2023-05-12 2023-08-01 天津卓朗昆仑云软件技术有限公司 Mirror image file updating method and device and VOI system

Similar Documents

Publication Publication Date Title
CN114003569A (en) Method and device for updating qcow2 mirror image file increment
JP6777673B2 (en) In-place snapshot
CN109558215B (en) Backup method, recovery method and device of virtual machine and backup server cluster
US10310949B1 (en) Disaster restore of big data application with near zero RTO
US11061884B2 (en) Method and system to accelerate transaction commit using non-volatile memory
US10152387B1 (en) Instant start of virtual machine from archive copy on backup media
CN102594849B (en) Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device
US20040103104A1 (en) Snapshot creating method and apparatus
US11436194B1 (en) Storage system for file system objects
US7506117B2 (en) Data recovery method for computer system
US11960442B2 (en) Storing a point in time coherently for a distributed storage system
CN109522043B (en) Method and device for managing configuration data and storage medium
CN111930716A (en) Database capacity expansion method, device and system
US11533391B2 (en) State replication, allocation and failover in stream processing
CN111143323A (en) MPP database management method, device and system
US9766984B2 (en) N to M host system copy
CN112579550B (en) Metadata information synchronization method and system of distributed file system
CN117992283A (en) Cloud host backup method and device, computer equipment and storage medium
US10235089B2 (en) Storage control device, method and storage system to backup data using allocation information
CN110781137A (en) Directory reading method and device for distributed system, server and storage medium
US20200226060A1 (en) In-place garbage collection of a sharded, replicated distributed state machine based on mergeable operations
CN114328007B (en) Container backup and restoration method, device and medium thereof
US20230195582A1 (en) Rolling back a database transaction
US10423494B2 (en) Trimming unused blocks from a versioned image backup of a source storage that is stored in a sparse storage
CN115277398A (en) Cluster network configuration method 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