A file synchronization method and system

By directly synchronizing data in a distributed storage system and using the mapping relationship between virtual machine monitors and virtual machines, the problem of long IO paths during data synchronization between virtual machines is solved, and resource conservation and performance improvement is achieved.

CN114896221BActive Publication Date: 2024-12-17BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210653096.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-09
Publication Date
2024-12-17
Estimated Expiration
2042-06-09

AI Technical Summary

Technical Problem

In the prior art, when data synchronization between virtual machines is synchronized, the IO path is long, resulting in large consumption of CPU and memory resources, affecting performance.

Method used

By directly synchronizing data in a distributed storage system, avoiding the participation of virtual machine processes, shortening IO paths, and using the mapping relationship between virtual machine monitors and virtual machines to synchronize data, reducing communication resource consumption.

Benefits of technology

It greatly reduces the consumption of virtual machine CPU and memory resources by file synchronization, improves file synchronization performance, simplifies IO paths, and improves data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896221B_ABST
    Figure CN114896221B_ABST
Patent Text Reader

Abstract

The present application provides a file synchronization method and system, in which the first virtual machine, upon receiving a file synchronization command, obtains the file volume and first storage location information of the file to be synchronized, and then sends the file volume and the first storage location information to the virtual machine monitor; the virtual machine monitor sends the file volume to the second virtual machine; the second virtual machine creates an empty file according to the file volume, and obtains the second storage location information corresponding to the empty file, and then sends the second storage location information to the virtual machine monitor; the virtual machine monitor calls the interface of the distributed storage system to synchronize data according to the first storage location information and the second storage location information. It can be seen that this method can achieve an effect of synchronizing data directly in a distributed storage system without using a virtual machine process, thereby greatly shortening the IO path, thereby reducing the consumption of virtual machine CPU and memory resources by file synchronization, and can improve the performance of file synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of cloud computing, and in particular to a file synchronization method and system. Background Art

[0002] At present, virtual machines generally use virtual block devices in distributed storage systems as virtual disks. Based on this setting, when synchronizing data between virtual machines, the distributed storage system usually needs to first transmit data to the virtual machine monitor through the network, then transfer the data to the virtual machine through a virtualized or semi-virtualized IO driver, and then transfer the data to the user program of another virtual machine through the network through the virtual machine user program, and then the user program of another virtual machine transfers the data to the virtual machine monitor through a virtualized or semi-virtualized IO driver, and finally the virtual machine monitor writes the data into the virtual disk of the distributed storage system, thereby completing the data synchronization process. It can be seen that there is a long IO path in this process, which will consume a lot of CPU resources and memory resources. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a file synchronization method and system, which can achieve the effect of synchronizing data directly in a distributed storage system without utilizing a virtual machine process, thereby significantly shortening the IO path, thereby reducing the consumption of virtual machine CPU and memory resources by file synchronization, and improving the performance of file synchronization.

[0004] A first aspect of an embodiment of the present application provides a file synchronization method, which is applied to a file synchronization system including a virtual machine monitor, a first virtual machine, a second virtual machine, and a distributed storage system, and the method includes:

[0005] When receiving the file synchronization command, the first virtual machine obtains the file volume and first storage location information of the file to be synchronized;

[0006] The first virtual machine sends the file volume and the first storage location information to the virtual machine monitor;

[0007] When receiving the file volume and the first storage location information, the virtual machine monitor sends the file volume to the second virtual machine;

[0008] The second virtual machine creates an empty file according to the file volume, and obtains second storage location information corresponding to the empty file;

[0009] The second virtual machine sends the second storage location information to the virtual machine monitor;

[0010] When receiving the second storage location information, the virtual machine monitor calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

[0011] In the above implementation process, the method first requires the first virtual machine to obtain the file volume and the first storage location information of the file to be synchronized when receiving the file synchronization command. It can be seen that on the one hand, the method sets the starting requirements for file synchronization, avoids file synchronization at an inappropriate time, and is conducive to the user's control of the file synchronization process; on the other hand, the method obtains the file volume and storage location information, which has a small amount of data and does not occupy too many communication resources, which is conducive to reducing the CPU consumption, memory consumption and network consumption in the file synchronization process. Secondly, the method requires the first virtual machine to send the file volume and the first storage location information to the virtual machine monitor, so that the virtual machine monitor can undertake the work of transferring information and coordinating the file synchronization process, and can also avoid the interaction between the first virtual machine and the second virtual machine, reducing the communication burden. Then, when the virtual machine monitor receives the file volume and the first storage location information, it sends the file volume to the second virtual machine. It can be seen that in this process, the virtual machine monitor autonomously stores the first storage location information and sends the file volume to the second virtual machine separately, thereby avoiding the transmission of redundant information and saving various communication resources. After that, the second virtual machine creates an empty file according to the file volume, and obtains the second storage location information corresponding to the empty file. It can be seen that in this process, the second virtual machine can create an empty file according to the file volume, and at the same time specify the second storage location, so that the second virtual machine can control the empty file to read the data stored in the second storage location, thereby providing an address basis for the subsequent content interaction in the distributed storage system. Thereafter, the second virtual machine sends the second storage location information to the virtual machine monitor so that the virtual machine monitor can know the first storage location and the second storage location, thereby facilitating the subsequent steps. Finally, when the virtual machine monitor receives the second storage location information, it calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information. It can be seen that the method can complete the synchronization of file data in the distributed storage system, so that the second virtual machine can directly call the data in the distributed storage system through the mapping relationship, thereby avoiding the interaction between the first virtual machine and the second virtual machine and the interaction between the first virtual machine and the second virtual machine and the virtual machine monitor, thereby greatly shortening the IO path and reducing the consumption of the virtual machine CPU and memory resources by file synchronization, while also improving the performance of file synchronization.

[0012] Furthermore, when the first virtual machine receives the file synchronization command, the step of obtaining the file volume and the first storage location information of the file to be synchronized includes:

[0013] When receiving the file synchronization command, the first virtual machine obtains the file volume of the file to be synchronized;

[0014] The first virtual machine obtains first storage location information according to a first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

[0015] In the above implementation process, the method requires the first virtual machine to obtain the file volume of the file to be synchronized when receiving the file synchronization command. The purpose is to ensure the effectiveness of the operation and avoid automatic file synchronization at inappropriate times. It is also beneficial for users to start and control the file synchronization process. Then, the first virtual machine specifically obtains the first storage location information based on the mapping relationship between the file to be synchronized and the first storage location information. It can be seen that the process describes that the acquisition process of the first storage location information is based on the first mapping relationship, which enables the method to avoid the use of virtual machine processes based on the disk mapping relationship, thereby facilitating the completion of file synchronization with higher performance.

[0016] Furthermore, the step of the second virtual machine creating an empty file according to the file volume and obtaining second storage location information corresponding to the empty file includes:

[0017] The second virtual machine creates an empty file according to the file volume;

[0018] The second virtual machine obtains the second storage location information according to the second mapping relationship; the second mapping relationship is a mapping relationship between the empty file and the second storage location information.

[0019] In the above implementation process, the second virtual machine can create an empty file according to the file volume, so as to ensure that the file to be synchronized can have the corresponding storage space, and avoid the lack of storage space affecting file synchronization; at the same time, file synchronization can only be achieved if the file has storage space, so the method of creating an empty file according to the file volume is the optimal file creation method in this method, which also provides sufficient preparation for subsequent steps. Then, the second virtual machine obtains the second storage location information according to the mapping relationship between the empty file and the second storage location information. It can be seen that the process describes that the acquisition process of the second storage location information is based on the second mapping relationship, which enables the method to avoid the use of virtual machine processes based on the disk mapping relationship, thereby facilitating the completion of file synchronization with higher performance.

[0020] Furthermore, before the step of obtaining the file volume and first storage location information of the file to be synchronized when the first virtual machine receives the file synchronization command, the method further includes:

[0021] The virtual machine monitor detects whether a file synchronization command input by a user is received;

[0022] When the virtual machine monitor detects the file synchronization command, it sends the file synchronization command to the first virtual machine.

[0023] In the above implementation process, the method can first detect whether the file synchronization command input by the user is received by the virtual machine monitor, so that the method can perform full disk monitoring based on the virtual machine monitor, thereby avoiding the first virtual machine from executing its operation first or adding a new operation to detect the file synchronization command, which will help reduce the work content of the first virtual machine and improve the full-time work ability of the first virtual machine. In addition, the virtual machine monitor will send the file synchronization command to the first virtual machine when the file synchronization command is detected. It can be seen that the method can start the file synchronization operation only when the virtual machine monitor detects the file synchronization command, thereby concentrating the entire process of the method on the virtual machine monitor, thereby greatly avoiding affecting the normal operation of the virtual machine.

[0024] Further, when the virtual machine monitor receives the file volume and the first storage location information, the step of sending the file volume to the second virtual machine includes:

[0025] When receiving the file volume and the first storage location information, the virtual machine monitor sends the file synchronization command and the file volume to the second virtual machine.

[0026] In the above implementation process, the method can send a file synchronization command to the second virtual machine while sending the file volume to the second virtual machine, so that the second virtual machine can use the file synchronization instruction as a start signal for the file synchronization work, thereby avoiding invalid startup and efficient operation of the file synchronization work.

[0027] Furthermore, the step of the second virtual machine creating an empty file according to the file volume and obtaining second storage location information corresponding to the empty file includes:

[0028] When receiving the file synchronization command, the second virtual machine creates an empty file according to the file volume, and obtains second storage location information corresponding to the empty file.

[0029] In the above implementation process, the method can require the second virtual machine to create an empty file according to the file volume when receiving the file synchronization command, and then obtain the second storage location information corresponding to the empty file. It can be seen that the method can specify the working start time of the second virtual machine, avoid the invalid work of the second virtual machine, and thus help improve the operational reliability of the file synchronization work.

[0030] A second aspect of an embodiment of the present application provides a file synchronization system, the file synchronization system comprising a virtual machine monitor, a first virtual machine, a second virtual machine and a distributed storage system, wherein:

[0031] The first virtual machine is used to obtain the file volume and first storage location information of the file to be synchronized when receiving the file synchronization command;

[0032] The first virtual machine is further used to send the file volume and the first storage location information to the virtual machine monitor;

[0033] the virtual machine monitor being configured to send the file volume to the second virtual machine upon receiving the file volume and the first storage location information;

[0034] The second virtual machine is used to create an empty file according to the file volume, and obtain second storage location information corresponding to the empty file;

[0035] The second virtual machine is further used to send the second storage location information to the virtual machine monitor;

[0036] The virtual machine monitor is also used to call the interface of the distributed storage system when receiving the second storage location information, and synchronize the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

[0037] In the above implementation process, the system first requires the first virtual machine to obtain the file volume and the first storage location information of the file to be synchronized when receiving the file synchronization command. It can be seen that on the one hand, the system sets the initial requirements for file synchronization, avoids file synchronization at an inappropriate time, and is conducive to the user's control of the file synchronization process; on the other hand, the system obtains the file volume and storage location information, which has a small amount of data and does not occupy too many communication resources, which is conducive to reducing the CPU consumption, memory consumption and network consumption in the file synchronization process. Secondly, the system requires the first virtual machine to send the file volume and the first storage location information to the virtual machine monitor, so that the virtual machine monitor can undertake the work of transferring information and coordinating the file synchronization process, and at the same time, it can also avoid the interaction between the first virtual machine and the second virtual machine, reducing the communication burden. Then, when the virtual machine monitor receives the file volume and the first storage location information, it sends the file volume to the second virtual machine. It can be seen that in this process, the virtual machine monitor autonomously stores the first storage location information and sends the file volume to the second virtual machine separately, thereby avoiding the transmission of redundant information and saving various communication resources. After that, the second virtual machine creates an empty file according to the file volume, and obtains the second storage location information corresponding to the empty file. It can be seen that in this process, the second virtual machine can create an empty file according to the file volume, and at the same time specify the second storage location, so that the second virtual machine can control the empty file to read the data stored in the second storage location, thereby providing an address basis for the subsequent content interaction in the distributed storage system. Thereafter, the second virtual machine sends the second storage location information to the virtual machine monitor so that the virtual machine monitor can know the first storage location and the second storage location, thereby facilitating the development of subsequent steps. Finally, when the virtual machine monitor receives the second storage location information, it calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information. It can be seen that the system can complete the synchronization of file data in the distributed storage system, so that the second virtual machine can directly call the data in the distributed storage system through the mapping relationship, thereby avoiding the interaction between the first virtual machine and the second virtual machine and the interaction between the first virtual machine and the second virtual machine and the virtual machine monitor, thereby greatly shortening the IO path and reducing the consumption of the virtual machine CPU and memory resources by file synchronization, while also improving the performance of file synchronization.

[0038] Furthermore, the first virtual machine is specifically configured to obtain the file volume of the file to be synchronized when receiving the file synchronization command;

[0039] The first virtual machine is further specifically used to obtain first storage location information according to a first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

[0040] In the above implementation process, the first virtual machine in the system will obtain the file volume of the file to be synchronized when receiving the file synchronization command, so as to ensure the effectiveness of the operation and avoid the automatic synchronization of the file at an inappropriate time. It is also beneficial for the user to start and control the file synchronization process. Then, the first virtual machine specifically obtains the first storage location information based on the mapping relationship between the file to be synchronized and the first storage location information. It can be seen that the process describes that the acquisition process of the first storage location information is based on the first mapping relationship, which enables the system to avoid the use of the virtual machine process based on the disk mapping relationship, thereby facilitating the completion of file synchronization with higher performance.

[0041] Furthermore, the second virtual machine is specifically used to create an empty file according to the file volume;

[0042] The second virtual machine is further specifically used to obtain second storage location information according to a second mapping relationship; the second mapping relationship is a mapping relationship between the empty file and the second storage location information.

[0043] In the above implementation process, the second virtual machine in the system can create an empty file according to the file volume, so as to ensure that the file to be synchronized can have the corresponding storage space, and avoid the lack of storage space affecting file synchronization; at the same time, file synchronization can only be achieved if the file has storage space, so the method of creating an empty file according to the file volume is the optimal file creation method, which also provides sufficient preparation for subsequent steps. Then, the second virtual machine obtains the second storage location information according to the mapping relationship between the empty file and the second storage location information. It can be seen that the process describes that the acquisition process of the second storage location information is based on the second mapping relationship, which enables the system to avoid the use of virtual machine processes based on the disk mapping relationship, thereby facilitating higher performance file synchronization.

[0044] Furthermore, the virtual machine monitor is also used to detect whether a file synchronization command input by a user is received;

[0045] The virtual machine monitor is further configured to send the file synchronization command to the first virtual machine when the file synchronization command is detected.

[0046] In the above implementation process, the system can first detect whether the file synchronization command input by the user is received by the virtual machine monitor, so that the system can perform full disk monitoring based on the virtual machine monitor, thereby avoiding the first virtual machine from executing its operation first or adding a new operation to detect the file synchronization command, which will help reduce the work content of the first virtual machine and improve the full-time work ability of the first virtual machine. In addition, the virtual machine monitor will send the file synchronization command to the first virtual machine when the file synchronization command is detected. It can be seen that the system can start the file synchronization operation only when the virtual machine monitor detects the file synchronization command, thereby concentrating the entire process of the system on the virtual machine monitor, thereby greatly avoiding affecting the normal operation of the virtual machine.

[0047] A third aspect of an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the file synchronization method described in any one of the first aspect of the embodiment of the present application.

[0048] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the file synchronization method described in any one of the first aspect of the embodiment of the present application is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A flowchart of a file synchronization method provided in an embodiment of the present application;

[0051] Figure 2 A flowchart of another file synchronization method provided in an embodiment of the present application;

[0052] Figure 3 An example schematic diagram of a file synchronization process provided in an embodiment of the present application;

[0053] Figure 4 A schematic diagram of the system structure of a file synchronization system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0055] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0056] Example 1

[0057] Please see Figure 1 , Figure 1 A flowchart of a file synchronization method is provided for this embodiment. The file synchronization method is applied to a file synchronization system including a virtual machine monitor, a first virtual machine, a second virtual machine and a distributed storage system, and the method includes:

[0058] S110. When receiving a file synchronization command, the first virtual machine obtains the file volume and first storage location information of the file to be synchronized.

[0059] In this embodiment, the first and second virtual machines are only used to distinguish different virtual machines.

[0060] In this embodiment, the file volume is used to indicate the size of the file.

[0061] In this embodiment, the first storage location information is the information of the first storage location.

[0062] In this embodiment, the first storage location is used to refer to the storage location of the file to be synchronized in the distributed storage system.

[0063] In this embodiment, the first storage location information includes a virtual disk WWN (Worldwide Unique Name) number of the first virtual machine.

[0064] S120: The first virtual machine sends the file volume and the first storage location information to the virtual machine monitor.

[0065] S210. When receiving the file volume and the first storage location information, the virtual machine monitor sends the file volume to the second virtual machine.

[0066] In this embodiment, the virtual machine monitor implements the forwarding function here.

[0067] S310: The second virtual machine creates an empty file according to the file volume, and obtains second storage location information corresponding to the empty file.

[0068] In this embodiment, the method creates an empty file in the second virtual machine with the same size as the file to be synchronized. The second storage location is the disk space reserved by the second virtual machine for the file to be synchronized.

[0069] In this embodiment, the second storage location information is the information of the second storage location.

[0070] In this embodiment, the second storage location is used to refer to the storage location of the empty file in the distributed storage system.

[0071] In this embodiment, the second storage location information includes a virtual disk WWN (Worldwide Unique Name) number of the second virtual machine.

[0072] S320: The second virtual machine sends the second storage location information to the virtual machine monitor.

[0073] In this embodiment, the virtual machine monitor implements the sending and receiving function here.

[0074] S220. When receiving the second storage location information, the virtual machine monitor calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

[0075] In this embodiment, the virtual machine monitor (VMM) obtains the virtual disk information (such as the virtual disk WWN number) of the two virtual machines and the specific storage location information of the files to be synchronized and the empty files, and then synchronizes the data using the virtual disk copy interface provided by the distributed storage system. After the data synchronization is completed, the VMM notifies the virtual machine that the data synchronization is completed. In this method, the entire data synchronization process is carried out inside the distributed storage system, without the participation of the virtual machine, and its IO path is short and the performance is high, which can save a lot of CPU resources and network resources of the computing cluster.

[0076] In this embodiment, in the case of virtual machine migration, the amount of data synchronization is usually very large, and full copy is required. This means that other synchronization methods cannot be used to reduce the amount of synchronized data, and the only way to speed up synchronization and reduce CPU and network resource overhead is to shorten the IO path. If the traditional synchronization method is used, the IO path is distributed storage system → virtual machine simulator → IO driver → virtual machine A file system → virtual machine A user process → virtual machine B user process → virtual machine B file system → IO driver → virtual machine simulator → distributed storage system. Using this method, data synchronization only needs to be from distributed storage → distributed storage system. The number of data transmissions is reduced from 9 times to 1 time, and the number of network transmissions is reduced from 3 times to 1 time. In addition, when transmitting through the virtual machine, the virtual machine kernel and driver are required to read and transmit data, which will cause the virtual machine CPU and memory usage to be too high, thereby affecting the normal business of the virtual machine. Using this method, although a large amount of data needs to be synchronized during the virtual machine migration process, most of the data transmission does not pass through the virtual machine. The virtual machine only needs to obtain the file information, so that the CPU resources and memory resources of the virtual machine are basically not consumed, so there is no need to limit the speed of the migration process, thereby greatly improving the speed of migration.

[0077] It can be seen that the file synchronization method described in this embodiment can be applied to hyper-convergence and desktop cloud products, and can also synchronize files between virtual machines with lower overhead and faster performance. The file synchronization method can be specifically used in scenarios such as software migration between virtual machines, batch installation of software, and migration of virtual machines, thereby achieving the effect of improving the performance of file synchronization between virtual machines.

[0078] Example 2

[0079] Please see Figure 2 , Figure 2 A flowchart of another file synchronization method is provided for this embodiment. The file synchronization method is applied to a file synchronization system including a virtual machine monitor, a first virtual machine, a second virtual machine and a distributed storage system, and the method includes:

[0080] S201: The virtual machine monitor detects whether a file synchronization command input by a user is received.

[0081] In this embodiment, the virtual machine monitor (VMM) first detects whether a file synchronization command input by the user is received.

[0082] S202: When the virtual machine monitor detects a file synchronization command, it sends the file synchronization command to the first virtual machine.

[0083] In this embodiment, this step is a step in which the VMM sends a file synchronization command to the first virtual machine.

[0084] S111. When receiving a file synchronization command, the first virtual machine obtains a file volume of a file to be synchronized.

[0085] In this embodiment, upon receiving the file synchronization command, the first virtual machine obtains the file volume (ie, file size) of the file to be synchronized.

[0086] S112. The first virtual machine obtains first storage location information according to a first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

[0087] In this embodiment, the first virtual machine needs to obtain the virtual disk WWN number corresponding to the first virtual machine and the specific storage location of the file to be synchronized (ie, the first storage location), wherein there is a first mapping relationship between the file to be synchronized and the first storage location.

[0088] S120: The first virtual machine sends the file volume and the first storage location information to the virtual machine monitor.

[0089] S210. When receiving the file volume and the first storage location information, the virtual machine monitor sends a file synchronization command and the file volume to the second virtual machine.

[0090] In this embodiment, the VMM sends the file synchronization command and the file volume to the second virtual machine.

[0091] S311. When receiving a file synchronization command, the second virtual machine creates an empty file according to the file volume.

[0092] In this embodiment, after receiving the file synchronization command, the second virtual machine first creates an empty file of the same size and reserves disk space.

[0093] S312. The second virtual machine obtains second storage location information according to the second mapping relationship; the second mapping relationship is a mapping relationship between an empty file and the second storage location information.

[0094] In this embodiment, the second virtual machine needs to obtain the virtual disk WWN number corresponding to the second virtual machine and the specific storage location of the empty file (ie, the second storage location), wherein there is a second mapping relationship between the empty file and the second storage location.

[0095] S320: The second virtual machine sends the second storage location information to the virtual machine monitor.

[0096] S220. When receiving the second storage location information, the virtual machine monitor calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

[0097] In this embodiment, the VMM calls the distributed storage system interface to synchronize data according to the information returned by the two virtual machines, and completes the underlying data synchronization through the distributed storage system.

[0098] In this embodiment, the VMM can obtain the virtual disk information of the two virtual machines (such as the virtual disk WWN number) and the mapping relationship between the files to be synchronized and the empty files and the physical addresses of the virtual disks, and then synchronize the data using the virtual disk copy interface provided by the storage system. After the data synchronization is completed, the VMM notifies the virtual machine that the data synchronization has been completed. It can be seen that the entire data synchronization process is carried out inside the distributed storage system and does not require the participation of the virtual machine. It has a short IO path and high performance, and can save a large amount of CPU resources and network resources of the computing cluster.

[0099] See also Figure 3 , Figure 3 An example schematic diagram of a file synchronization process is shown. In which, file A is the file to be synchronized, file B is an empty file, and the hard disk is a virtual hard disk in the distributed storage space. Figure 3 It can be seen that file A has two sub-files, A1 and A2, and both sub-files A1 and A2 have corresponding storage locations in the distributed storage space; correspondingly, file B has two sub-files B1 and B2, and both sub-files B1 and B2 have corresponding storage locations in the distributed storage space, but in fact B1 and B2 are both empty. When this method is used to synchronize data, the data in the A1 area of ​​the hard disk will be backed up to the B1 area so that the B1 area has the A1 data; similarly, the B2 area will also copy the A2 data so that the B2 area has the A2 data. Based on this, it is not difficult to see that data synchronization is performed between A1, A2, B1, and B2 in the distributed storage system, so it will not use more IO paths and has better synchronization performance.

[0100] It can be seen that the file synchronization method described in this embodiment can be applied to hyper-convergence and desktop cloud products, and can also synchronize files between virtual machines with lower overhead and faster performance. The file synchronization method can be specifically used in scenarios such as software migration between virtual machines, batch installation of software, and migration of virtual machines, thereby achieving the effect of improving the performance of file synchronization between virtual machines.

[0101] Example 3

[0102] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a file synchronization system provided by this embodiment. Figure 4 As shown, the file synchronization system includes a virtual machine monitor 400, a first virtual machine 500, a second virtual machine 600 and a distributed storage system 700, wherein:

[0103] The first virtual machine 500 is used to obtain the file volume and first storage location information of the file to be synchronized when receiving the file synchronization command;

[0104] The first virtual machine 500 is further used to send the file volume and the first storage location information to the virtual machine monitor 400;

[0105] The virtual machine monitor 400 is used to send the file volume to the second virtual machine 600 when receiving the file volume and the first storage location information;

[0106] The second virtual machine 600 is used to create an empty file according to the file volume and obtain second storage location information corresponding to the empty file;

[0107] The second virtual machine 600 is further used to send the second storage location information to the virtual machine monitor 400;

[0108] The virtual machine monitor 400 is also used to call the interface of the distributed storage system 700 when receiving the second storage location information, and synchronize the storage data in the distributed storage system 700 according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system 700 of the file to be synchronized.

[0109] In this embodiment, please refer to Figure 4 , Figure 4 The double-arrow solid line in the middle is the data path. Figure 4 The double-arrow dashed line in the middle is the message path. Figure 4 It can be seen that there is a physical data transmission process in the data channel, and there is only simple careful interaction in the message channel, and there is no need to transmit a large amount of data content.

[0110] As an optional implementation, the first virtual machine 500 is specifically configured to obtain the file volume of the file to be synchronized when receiving the file synchronization command;

[0111] The first virtual machine 500 is further specifically used to obtain the first storage location information according to the first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

[0112] As an optional implementation, the second virtual machine 600 is specifically configured to create an empty file according to the file volume;

[0113] The second virtual machine 600 is further specifically used to obtain the second storage location information according to the second mapping relationship; the second mapping relationship is a mapping relationship between an empty file and the second storage location information.

[0114] As an optional implementation, the virtual machine monitor 400 is further used to detect whether a file synchronization command input by a user is received;

[0115] The virtual machine monitor 400 is further configured to send a file synchronization command to the first virtual machine 500 when a file synchronization command is detected.

[0116] As an optional implementation manner, the virtual machine monitor 400 is specifically configured to send a file synchronization command and the file volume to the second virtual machine 600 upon receiving the file volume and the first storage location information.

[0117] As an optional implementation manner, the second virtual machine 600 is specifically configured to create an empty file according to the file volume when receiving the file synchronization command, and obtain second storage location information corresponding to the empty file.

[0118] In the embodiments of the present application, the explanation of the file synchronization system can refer to the description in Embodiment 1 or Embodiment 2, and will not be further elaborated in this embodiment.

[0119] It can be seen that the file synchronization system described in this embodiment can achieve the effect of synchronizing file data directly on the distributed storage system without using a virtual machine process by reserving file space and obtaining the mapping relationship between files and disks. This can effectively shorten the IO path, reduce the consumption of virtual machine CPU and memory resources by file synchronization, and also greatly improve the performance of file synchronization.

[0120] In several embodiments provided in the present application, it should be understood that the disclosed system and method can also be implemented in other ways. The system embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0121] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0122] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0123] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0124] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0125] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A file synchronization method, characterized in that: The method is applied to a file synchronization system including a virtual machine monitor, a first virtual machine, a second virtual machine and a distributed storage system, and the method includes: When receiving the file synchronization command, the first virtual machine obtains the file volume and first storage location information of the file to be synchronized; The first virtual machine sends the file volume and the first storage location information to the virtual machine monitor; The virtual machine monitor sends the file volume to the second virtual machine when receiving the file volume and the first storage location information; The second virtual machine creates an empty file according to the file volume, and obtains second storage location information corresponding to the empty file; The second virtual machine sends the second storage location information to the virtual machine monitor; When receiving the second storage location information, the virtual machine monitor calls the interface of the distributed storage system and synchronizes the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

2. The file synchronization method according to claim 1, characterized in that: When the first virtual machine receives the file synchronization command, the step of obtaining the file volume and first storage location information of the file to be synchronized includes: When receiving the file synchronization command, the first virtual machine obtains the file volume of the file to be synchronized; The first virtual machine obtains first storage location information according to a first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

3. The file synchronization method according to claim 1, characterized in that: The step of the second virtual machine creating an empty file according to the file volume and obtaining second storage location information corresponding to the empty file includes: The second virtual machine creates an empty file according to the file volume; The second virtual machine obtains the second storage location information according to the second mapping relationship; the second mapping relationship is a mapping relationship between the empty file and the second storage location information.

4. The file synchronization method according to claim 1, characterized in that: Before the step of obtaining the file volume and first storage location information of the file to be synchronized when the first virtual machine receives the file synchronization command, the method further includes: The virtual machine monitor detects whether a file synchronization command input by a user is received; When the virtual machine monitor detects the file synchronization command, it sends the file synchronization command to the first virtual machine.

5. The file synchronization method according to claim 1, characterized in that: When the virtual machine monitor receives the file volume and the first storage location information, the step of sending the file volume to the second virtual machine includes: When receiving the file volume and the first storage location information, the virtual machine monitor sends the file synchronization command and the file volume to the second virtual machine.

6. The file synchronization method according to claim 1, characterized in that: The step of the second virtual machine creating an empty file according to the file volume and obtaining second storage location information corresponding to the empty file includes: When receiving the file synchronization command, the second virtual machine creates an empty file according to the file volume, and obtains second storage location information corresponding to the empty file.

7. A file synchronization system, characterized in that: The file synchronization system includes a virtual machine monitor, a first virtual machine, a second virtual machine and a distributed storage system, wherein: The first virtual machine is used to obtain the file volume and first storage location information of the file to be synchronized when receiving the file synchronization command; The first virtual machine is further used to send the file volume and the first storage location information to the virtual machine monitor; the virtual machine monitor being configured to send the file volume to the second virtual machine upon receiving the file volume and the first storage location information; The second virtual machine is used to create an empty file according to the file volume, and obtain second storage location information corresponding to the empty file; The second virtual machine is further used to send the second storage location information to the virtual machine monitor; The virtual machine monitor is also used to call the interface of the distributed storage system when receiving the second storage location information, and synchronize the storage data in the distributed storage system according to the first storage location information and the second storage location information; the storage data is the data stored in the distributed storage system for the file to be synchronized.

8. The file synchronization system according to claim 7, characterized in that: The first virtual machine is specifically configured to obtain the file volume of the file to be synchronized upon receiving the file synchronization command; The first virtual machine is further specifically used to obtain first storage location information according to a first mapping relationship; the first mapping relationship is a mapping relationship between the file to be synchronized and the first storage location information.

9. The file synchronization system according to claim 7, characterized in that: The second virtual machine is specifically used to create an empty file according to the file volume; The second virtual machine is further specifically used to obtain second storage location information according to a second mapping relationship; the second mapping relationship is a mapping relationship between the empty file and the second storage location information.

10. The file synchronization system according to claim 7, characterized in that: The virtual machine monitor is further used to detect whether a file synchronization command input by a user is received; The virtual machine monitor is further configured to send the file synchronization command to the first virtual machine when the file synchronization command is detected.