Xen full-virtualization agentless real-time backup method, system and storage medium
By installing a backup driver in the Xen full virtualization environment, asynchronous I/O requests are intercepted and parsed to generate a global identifier vector table, enabling real-time monitoring and protection of virtual machine data. This solves the problem of data loss risk in existing technologies and improves backup efficiency and business continuity.
Patent Information
- Application Number
- CN202411216916.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-09-02
AI Technical Summary
In a Xen fully virtualized environment, existing technologies have not yet achieved true agentless, real-time, and continuous data protection. Scheduled snapshot backup methods carry the risk of data loss and cannot meet the requirements for efficient and low-interference real-time backup.
By installing a backup driver in the host operating system, asynchronous I/O requests are intercepted, a global identifier vector table is generated, disk write location information is parsed, a backup structure is created, and it is sent asynchronously to the backup service program, thereby achieving real-time monitoring and data protection of virtual machine disk files.
It achieves continuous protection of virtual machine data, shortens business interruption time, improves recovery speed, reduces resource consumption, simplifies management, and enhances business stability and operational resilience.
Smart Images

Figure CN119003248B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of data disaster recovery backup, and relates to a Xen full virtualization agentless real-time backup method, system and storage medium. BACKGROUND
[0002] Xen is an open-source virtualization technology that supports both semi-virtualization and full-virtualization. Full-virtualization mode relies on hardware with virtualization extensions such as Intel VT or AMD-V, allowing Xen to emulate a physical hardware environment at the virtualization layer. This feature allows Xen to run unmodified operating systems, including various versions of Windows and other standard operating systems, providing excellent flexibility and wide compatibility.
[0003] Compared with semi-virtualization, the main advantage of full-virtualization is its high compatibility with different operating systems and easy management and maintenance. Although this may mean some performance sacrifice in certain cases, overall, Xen's full-virtualization technology provides an ideal solution for environments that require flexible deployment and running of standard operating systems.
[0004] Agentless real-time backup technology for virtual machines is an efficient data backup solution. By real-time backup, any changes in the data of the virtual machine can be continuously captured and recorded, ensuring that the backup data is always up-to-date, greatly reducing the risk of data loss. At the same time, the agentless backup method avoids the need to install backup agent software inside the virtual machine, simplifying the backup process and reducing dependence on virtual machine configuration.
[0005] Capturing data changes in a virtual machine in a virtualization environment requires parsing the way the system performs I / O. In a Xen fully virtualized environment, disk I / O requests generated by a virtual machine are handled by the virtual machine manager Xen hypervisor, and finally passed to the host dom0 to actually write to the disk. The I / O request is first initiated by the guest operating system running in the virtual machine domU, which is unaware that it is running in a virtual environment, so it will handle the I / O request as if it were on a physical machine. When the domU device layer passes the I / O request down, the Xen hypervisor intercepts these I / O requests from the virtual machine, and the Xen hypervisor handles these requests through a virtual disk controller (such as an IDE or SCSI controller). At this time, tapdisk runs as a backend service in the user space of dom0, responsible for managing and accessing virtual disk image files. When tapdisk receives a disk read / write request from the virtual machine, it converts the request into a corresponding physical storage operation, such as reading or modifying data in the disk image file. When the tapdisk conversion operation is complete, the I / O request is submitted to the host dom0 kernel for actual write to physical hardware operation.
[0006] Currently, in the Xen virtualization technology, real-time continuous data protection without agent has not been realized. Most existing Xen virtual machine backup methods rely on using public interfaces to take timed snapshot backups of virtual machines. This way is to take a snapshot of the disk state of the virtual machine at the beginning of the backup to capture an accurate copy of the data, and take another snapshot after a fixed interval. The shorter the snapshot interval, the less data that can be lost. Prior art such as CN108182128A Xen-based agentless virtualization backup recovery method (application date December 29, 2017) and CN106598787A Xen-based agentless backup recovery method and system (application date December 31, 2016) both use a timed backup method based on virtual machine snapshots to protect Xen virtual machine data. However, this timed backup method, while providing some degree of data protection, can still result in significant data loss during the backup interval in the event of a system failure. So far, data backup technology in the Xen virtualization environment has not involved real-time backup research.
[0007] Now, there is an urgent need for real-time backup technology in Xen, but due to the unique I / O method of virtual machines under the Xen fully virtualized architecture, existing real-time protection technology cannot be fully applied to this environment. Therefore, how to continuously protect the data of virtual machines in the Xen fully virtualized environment and implement an efficient and low-interference real-time backup method has become a technical problem that needs to be solved urgently. SUMMARY
[0008] The present application provides a Xen full virtualization agentless real-time backup method, system and storage medium to solve the technical problems in the background art. The technical solution is as follows:
[0009] In the first aspect, the present application provides a Xen full virtualization agentless real-time backup method, which is executed by a backup driver in a production end host operating system. The method comprises the following steps:
[0010] In the initialization, a global identification vector table is obtained by the PIDs of all tapdisk processes in the host and the corresponding disk file descriptors, wherein the global identification vector table contains disk file identification vectors and the corresponding virtual machine disk file paths;
[0011] The asynchronous I / O request transmitted by the user program to the host kernel is intercepted, the PID and process name of the current process are obtained, and the asynchronous I / O request of non-tapdisk process is filtered;
[0012] The disk write position information is obtained by analyzing the asynchronous I / O request, the virtual machine disk file path of the current process is matched according to the global identification vector table, and then the disk file change data is obtained according to the disk write data address in the asynchronous I / O request;
[0013] A backup structure is created, the disk write position information, the virtual machine disk file path of the current process and the disk file change data are written into the backup structure, and then the structure data is written into the kernel buffer for temporary storage, wherein the kernel buffer is created in the initialization;
[0014] The data in the kernel buffer is asynchronously transmitted to the backup service program.
[0015] In the second aspect, the present application provides a Xen full virtualization agentless real-time backup method, which is used for a backup server to process the backup data from the backup driver in the production end host operating system. The method comprises the following steps:
[0016] The backup service program receives the backup structure data transmitted from the backup driver;
[0017] The backup service program writes the received backup structure data into a receiving structure same as the backup structure, and writes the target content in the receiving structure into a log file; the backup structure is formed by writing disk write position information, a virtual machine disk file path of a current process and disk file change data; the backup driver is used to write the structure data into a kernel buffer temporarily created at initialization; the backup driver is also used to parse the disk write position information from the asynchronous I / O request, match the virtual machine disk file path of the current process according to a global identification vector table, and then acquire the disk file change data according to the disk write data address in the asynchronous I / O request; the backup driver is also used to intercept the asynchronous I / O request transmitted by the user program to the host kernel, acquire the PID and process name of the current process, and filter the asynchronous I / O request of the non-tapdisk process; the backup driver is also used to acquire and generate the global identification vector table by the PID and corresponding disk file descriptor of all tapdisk processes in the host at initialization, wherein the global identification vector table contains a disk file identification vector and a corresponding virtual machine disk file path.
[0018] The third aspect also provides a Xen full-virtualization agentless real-time backup system, which is executed by a backup driver in a production end host operating system, and the system comprises:
[0019] An initialization module, which is used to acquire and generate a global identification vector table by the PID and corresponding disk file descriptor of all tapdisk processes in the host at initialization, wherein the global identification vector table contains a disk file identification vector and a corresponding virtual machine disk file path;
[0020] An interception module, which is used to intercept the asynchronous I / O request transmitted by the user program to the host kernel, acquire the PID and process name of the current process, and filter the asynchronous I / O request of the non-tapdisk process;
[0021] A data acquisition module, which is used to parse the disk write position information from the asynchronous I / O request, match the virtual machine disk file path of the current process according to the global identification vector table, and then acquire the disk file change data according to the disk write data address in the asynchronous I / O request;
[0022] A data loading module, which is used to create a backup structure, write the disk write position information, the virtual machine disk file path of the current process and the disk file change data into the backup structure, and then write the structure data into a kernel buffer temporarily created at initialization;
[0023] A sending module, which is used to asynchronously send the data in the kernel buffer to a backup service program.
[0024] The fourth aspect further provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the Xen full virtualization agentless real-time backup method.
[0025] The present application has the following advantages:
[0026] (1) The present application realizes continuous protection of virtual machine data by continuously monitoring and automatically backing up disk files of a production system, so that when the system fails or disk data is damaged, the recovery process can be accelerated and the business interruption time can be shortened, thereby enhancing the continuous operation capability of the business and ensuring stable operation of the business system.
[0027] (2) The present application can provide real-time data protection for all virtual machines running in a Xen full virtualization environment by installing a backup driver only in a host machine, without installing a backup agent program in all virtual machines, so that faster recovery time (RTO) and shorter data loss window (RPO) can be provided, and the present application has the advantages of simple deployment, simplified management and reduced resource occupation.
[0028] (3) The present application creates a global identification vector table when the backup driver is initialized, which greatly simplifies the process of identifying disk files when the backup driver intercepts disk change data, and the global identification vector table can be dynamically updated for newly created virtual machines when the backup driver is running, thereby effectively improving the execution efficiency of the backup driver.
[0029] (4) The present application designs a method for intercepting disk change data by using the I / O characteristics of virtual machines in a Xen full virtualization environment, and the backup driver can efficiently obtain change data of asynchronous disk writing in the host kernel by monitoring the operations of tapdisk on disk files, which has little influence on the virtual machine request processing program running in the user space of the host. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0031] Figure 1 The Xen full virtualization agentless real-time backup method for the production end in the embodiment 1 of the present application is shown in the flowchart.
[0032] Figure 2 The I / O route architecture diagram of the virtual machine in the Xen full virtualization environment in the embodiment 1 of the present application is shown in the figure.
[0033] Figure 3This is a flowchart of the agentless real-time backup method for Xen full virtualization used in Embodiment 2 of the present invention for backing up a server.
[0034] Figure 4 This is a schematic diagram of the agentless real-time backup system architecture of Xen full virtualization technology used in production in Embodiment 3 of the present invention.
[0035] Figure 5 This is a schematic diagram of the initialization module in Embodiment 3 of the present invention.
[0036] Figure 6 This is a schematic diagram of the interception module in Embodiment 3 of the present invention.
[0037] Figure 7 This is a schematic diagram of the data acquisition module in Embodiment 3 of the present invention.
[0038] Figure 8 This is a schematic diagram of the data loading module in Embodiment 3 of the present invention.
[0039] The attached diagram lists the components represented by each number as follows:
[0040] 3001. Initialization Module; 3002. Interception Module; 3003. Data Acquisition Module; 3004. Data Loading Module; 3005. Sending Module; 30011. Query Unit; 30012. Disk File Path Construction Unit; 30013. Identifier Vector Table Generation Unit; 30021. Probe Point Setting Unit; 30022. Blocking Unit; 30023. Parameter Acquisition Unit; 30024. Filtering Unit; 30031. Disk Write Location Information Acquisition Unit; 30032. Identifier Vector Calculation Unit; 30033. Matching Unit; 30034. Change Data Acquisition Unit; 30041. Backup Structure Creation Unit; 30042. Data Loading Unit; 30043. Data Transfer Unit; 30044. Sending Thread Wake-up Unit. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0042] Example 1
[0043] In this embodiment, as Figure 1 As shown, a method for agentless real-time backup of Xen fully virtualized systems is provided, executed by a backup driver located in the production host operating system. The method includes the following steps:
[0044] S101. In the initialization, a global identification vector table is obtained and generated by the PIDs of all tapdisk processes in the host and their corresponding disk file descriptors, wherein the global identification vector table contains disk file identification vectors and their corresponding virtual machine disk file paths.
[0045] It is worth mentioning that the tapdisk program is an important component in the Xen virtualization environment, which is located in the user space of the host and is mainly responsible for managing the disk I / O operations of the virtual machine, such as disk image management, I / O request forwarding, snapshot and backup, etc. Figure 2 As shown in the figure, the user program of the domU generates an I / O request and passes it to the system call in the kernel space of the domU for processing the I / O operation. Through the system call, the I / O of the application program in the user space can enter the system kernel for execution and then write to the physical device of the block layer. However, since the domU cannot directly operate the disk, the I / O request generated by the user program of the domU is transmitted by the device driver to the hardware device simulated by QEMU in the dom0 for processing the I / O request, and then the tapdisk program is operated. The tapdisk converts the request into a format that can be processed by the physical device and transmits the request to the asynchronous I / O queue. The operating system calls the asynchronous I / O write function to write data to the virtual machine disk file, and finally the physical drive of the dom0 kernel writes the data of the virtual machine disk file to the physical disk.
[0046] When the virtual machine adopts multi-disk management or the tapdisk performs the backup and snapshot functions, the tapdisk may open multiple disk files. At the same time, there are usually more than one virtual machine in a host, and different virtual machines are managed by different tapdisk processes, and one virtual machine corresponds to two different tapdisk processes. For such a complex disk file management environment, a global identification vector table needs to be established for the processes and the disk files opened by them for one-to-one correspondence, so that the backup driver can quickly judge the disk files processed by the tapdisk during the data interception process.
[0047] It is also worth mentioning that the global identification vector table is created during the initialization of the backup driver, which contains the disk file identification vector and the virtual machine disk file path. The disk file identification vector is obtained by performing a bitwise operation on the PID of the tapdisk process and the disk file descriptor, and the virtual machine disk file path needs to be obtained from the file descriptor list of the tapdisk process. The disk file opened by the tapdisk process is a temporary file soft link created by Xen, which points to the real file where the host actually writes data.
[0048] Optionally, the S101 step comprises:
[0049] S1011. In the initialization, the process list is traversed to search for a process with the name tapdisk, and after the tapdisk process is queried, the process PID thereof is obtained;
[0050] S1012. The process structure information is obtained according to the tapdisk process PID, the file descriptor table of the tapdisk process is traversed, and after the disk file used by the virtual machine and the disk file descriptor thereof are queried, the virtual machine disk file path is constructed;
[0051] S1013. The tapdisk process PID and the disk file descriptor are subjected to bit operation to obtain the virtual machine disk identification vector of the process, and the virtual machine disk identification vector and the virtual machine disk file path corresponding thereto are written into the global identification vector table.
[0052] It is worth noting that the disk file identification vector obtained by using the tapdisk process PID and the disk file descriptor to perform bit operation can effectively save table space and improve the identification efficiency of the disk file in the interception process.
[0053] S102. The asynchronous I / O request transmitted by the user program to the host kernel is intercepted, the PID and the process name of the current process are obtained, and the asynchronous I / O request of the non-tapdisk process is filtered.
[0054] Optionally, the S102 step comprises:
[0055] S1021. When the tapdisk converts the disk write request from the virtual machine into a corresponding physical storage operation and submits the disk write request to the dom0 kernel for asynchronous I / O processing flow, the asynchronous I / O write function is set as the detection point of the interception tool;
[0056] S1022. When the interception tool detects that the asynchronous I / O write function is about to run, the execution of the asynchronous I / O write function is immediately blocked, and then the callback processing function of the interception tool is triggered;
[0057] S1023. The interception tool takes the parameters of the asynchronous I / O write function from the register as the parameters of the callback processing function;
[0058] S1024. In the callback function, the PID and the process name of the current process are obtained, and if it is a tapdisk process, the next step is performed, and if it is not, the callback function is ended.
[0059] It is worth mentioning that the interception tool uses Kprobes in the Linux kernel, which is used to dynamically track and monitor function calls and variables in the kernel. Kprobes has very little impact on the performance of the system. The asynchronous I / O write function running in the host kernel is set as the probe point of Kprobes, so that the backup driver can intercept the disk write operation of the tapdisk process and obtain the data changes of the disk.
[0060] It is also worth mentioning that after the tapdisk in the user space virtual machine I / O request handler converts the disk write request from the virtual machine into a corresponding physical storage operation, it transmits the I / O request to the asynchronous I / O queue in the kernel space and hands it over to the asynchronous I / O handler in the kernel to write into the physical disk. The asynchronous method can enable multiple virtual machines to process I / O concurrently, while significantly improving the performance and response speed of I / O processing of a single virtual machine. Using the asynchronous I / O write function as the probe point can make the change data interception operation of the backup driver more efficient and fast, while having less impact on the running virtual machine.
[0061] S103. Analyzing the asynchronous I / O request to obtain disk write position information, matching the virtual machine disk file path of the current process according to the global identification vector table, and then obtaining the disk file change data according to the disk write data address in the asynchronous I / O request.
[0062] Optionally, the S103 step comprises:
[0063] S1031. Analyzing the asynchronous I / O request to obtain disk write position information, wherein the disk write position information includes: disk file descriptor, write offset and write length;
[0064] S1032. Performing a bitwise operation on the current process PID and the disk file descriptor in the disk write position information to obtain the virtual machine disk identification vector of the current process;
[0065] S1033. Matching the virtual machine disk identification vector of the current process in the global identification vector table. If the matching is successful, the virtual machine disk file path is obtained. If the matching fails, the current process structure information is obtained according to the current process PID, the file descriptor table of the current process is traversed, the disk file used by the virtual machine is queried, and then the virtual machine disk file path is constructed. The obtained virtual machine disk identification vector and virtual machine disk file path are written into the global identification vector table;
[0066] S1034. According to the intercepted parameter value, it is judged whether the asynchronous I / O write function uses the scatter / gather I / O mode. If yes, the disk file change data is obtained according to the disk write data array one by one; if no, the disk file change data is obtained according to the disk write data address directly, wherein the disk write data array stores multiple disk write data addresses and write offsets.
[0067] It is worth mentioning that in the step S1033, when the virtual machine disk identifier vector of the current process is matched in the global identifier vector table, if the matching is unsuccessful, it indicates that the current tapdisk process is newly created by the system, and there can be a newly started or newly created virtual machine in the system, and at this time, the global identifier vector table needs to be updated.
[0068] It is also worth mentioning that the scatter / gather I / O mode is a data transmission technology in a computer system, which is used to improve the data efficiency of multiple non-continuous storage areas. This technology has a wide application in processing network communication and high-performance file system operation. When the asynchronous I / O write function uses the scatter / gather I / O mode, it uses a disk write data array to store multiple non-continuous storage area write data addresses and write offsets. In this way, the mode of processing multiple data in one I / O request can reduce the number of I / O requests initiated by the virtual machine, thereby improving the I / O efficiency. When the backup driver processes the I / O request of this I / O mode, it needs to take out the write data address and write offset from the disk write data array one by one.
[0069] S104. Creating a backup structure, writing the disk write position information, the virtual machine disk file path of the current process, and the disk file change data into the backup structure, and then writing the structure data into the kernel buffer for temporary storage, wherein the kernel buffer is created during initialization.
[0070] Optionally, the step S104 comprises:
[0071] S1041. Creating a backup structure, which contains, in sequence, disk write information, a virtual machine disk file path of a current process, and a disk file change data structure array, wherein the disk file change data structure array contains data length and actual disk write data;
[0072] S1042. Writing the obtained disk write information, the virtual machine disk file path of the current process, and the disk file change data into the backup structure;
[0073] S1043. After the data contained in the backup structure is loaded, the backup structure is written into the kernel buffer for temporary storage, wherein the kernel buffer is created during initialization.
[0074] S1044. Terminate the execution of the interception tool's callback function and simultaneously wake up the asynchronous sending thread.
[0075] S105. Asynchronously send the data in the kernel buffer to the backup service program.
[0076] This embodiment designs a method for intercepting disk change data based on the virtual machine I / O execution path in Xen full virtualization technology. It utilizes the characteristic that the virtual machine's I / O requests are submitted to the host machine's asynchronous I / O queue after being processed by the tapdisk process. The method intercepts the data that is about to be written to the disk in the host machine kernel, sends copies of these data to the backup server for backup, and combines a global identifier vector table to quickly identify the virtual machine disk files in the process of intercepting disk change data.
[0077] Example 2
[0078] In this embodiment, as Figure 3 As shown, a fully virtualized agentless real-time backup method for Xen is provided, applied to the backup server to process backup data from the production end. The method includes the following steps:
[0079] S201. The backup service program receives backup structure data transmitted from the backup driver;
[0080] S202. The backup service program writes the received backup structure data into a receiving structure with the same structure as the backup structure, and then writes the target content in the receiving structure into a log file; the backup structure is formed by writing disk write location information, the virtual machine disk file path of the current process, and disk file change data; the backup driver is used to write the structure data into the kernel buffer for temporary storage, and the kernel buffer is created during initialization; the backup driver is also used to parse asynchronous I / O requests to obtain disk write location information, match the virtual machine disk file path of the current process according to the global identifier vector table, and then obtain the disk file change data according to the disk write data address in the asynchronous I / O request; the backup driver is also used to intercept asynchronous I / O requests transmitted by user programs to the host kernel, obtain the PID and process name of the current process, and filter asynchronous I / O requests from non-tapdisk processes; the backup driver is also used to obtain and generate a global identifier vector table through the PIDs of all tapdisk processes in the host machine and their corresponding disk file descriptors during initialization, wherein the global identifier vector table contains disk file identifier vectors and their corresponding virtual machine disk file paths.
[0081] It is worth noting that the backup service program uses the receive structure to stamp the target data belonging to the same I / O request with the same timestamp based on the page flag in it, and then writes it to the target log file so that when it is necessary to restore to a specified time point in the future, the I / O data at that time point can be located.
[0082] In this embodiment, the backup data from the production end is sorted into a log format and saved into a log file, laying a foundation for subsequent data recovery.
[0083] Embodiment 3
[0084] In this embodiment, as shown in Figure 4 An agentless real-time backup system of Xen full virtualization technology is provided, applied to a production end, and the system comprises:
[0085] The initialization module 3001 is configured to acquire and generate a global identification vector table by using PIDs of all tapdisk processes in the host and disk file descriptors corresponding to the PIDs during initialization, wherein the global identification vector table comprises disk file identification vectors and virtual machine disk file paths corresponding to the disk file identification vectors.
[0086] The interception module 3002 is configured to intercept an asynchronous I / O request transmitted by a user program to a kernel of the host, acquire a PID and a process name of a current process, and filter asynchronous I / O requests of non-tapdisk processes.
[0087] The data acquisition module 3003 is configured to parse the asynchronous I / O request to acquire disk write position information, match a virtual machine disk file path of the current process according to the global identification vector table, and then acquire disk file change data according to a disk write data address in the asynchronous I / O request.
[0088] The data loading module 3004 is configured to create a backup structure, write the disk write position information, the virtual machine disk file path of the current process and the disk file change data into the backup structure, and then write structure data into a kernel buffer for temporary storage, wherein the kernel buffer is created during initialization.
[0089] The sending module 3005 is configured to asynchronously send data in the kernel buffer to a backup service program.
[0090] Optionally, as shown in Figure 5 The initialization module 3001 comprises:
[0091] The query unit 30011 is configured to search for a tapdisk process by traversing a process list during initialization, and acquire a process PID of the tapdisk process after the tapdisk process is queried.
[0092] The disk file path construction unit 30012 is configured to acquire process structure information according to the tapdisk process PID, traverse a file descriptor table of the tapdisk process, and construct a virtual machine disk file path after a disk file used by a virtual machine and a disk file descriptor of the disk file are queried.
[0093] The identification vector table generating unit 30013 is configured to perform a bit operation on the tapdisk process PID and the disk file descriptor to obtain a virtual machine disk identification vector of the process, and write the virtual machine disk identification vector and a virtual machine disk file path corresponding to the virtual machine disk identification vector into a global identification vector table.
[0094] Optionally, as shown in Figure 6 The interception module 3002 includes:
[0095] The probe point setting unit 30021 is configured to set an asynchronous I / O write function as a probe point of the interception tool when the tapdisk converts a disk write request from a virtual machine into a corresponding physical storage operation and submits the disk write request to a dom0 kernel for an asynchronous I / O processing flow.
[0096] The blocking unit 30022 is configured to block execution of the asynchronous I / O write function immediately when the interception tool detects that the asynchronous I / O write function is about to run, and then trigger a callback processing function of the interception tool.
[0097] The parameter obtaining unit 30023 is configured to obtain, by the interception tool, parameters of the asynchronous I / O write function from a register as parameters of the callback processing function.
[0098] The filtering unit 30024 is configured to obtain, in the callback function, a PID and a process name of a current process, and if the current process is a tapdisk process, perform a next step, and if the current process is not the tapdisk process, end running of the callback function.
[0099] Optionally, as shown in Figure 7 The data obtaining module 3003 includes:
[0100] The disk write position information obtaining unit 30031 is configured to parse an asynchronous I / O request to obtain disk write position information, the disk write position information including a disk file descriptor, a write offset, and a write length.
[0101] The identification vector calculating unit 30032 is configured to perform a bit operation on the current process PID and the disk file descriptor in the disk write position information to obtain a virtual machine disk identification vector of the current process.
[0102] The matching unit 30033 is configured to match the virtual machine disk identification vector of the current process in the global identification vector table, and if the matching is successful, obtain a virtual machine disk file path; if the matching fails, obtain current process structure information according to the current process PID, traverse a file descriptor table of the current process, query a disk file used by a virtual machine, construct a virtual machine disk file path, and then write the obtained current virtual machine disk identification vector and the virtual machine disk file path into the global identification vector table.
[0103] The change data acquisition unit 30034 is configured to determine whether the asynchronous I / O write function uses the scatter / gather I / O mode according to the intercepted parameter value, and if yes, acquire the disk file change data according to the disk write data array one by one; if no, acquire the disk file change data directly according to the disk write data address, wherein the disk write data array stores a plurality of disk write data addresses and write offsets.
[0104] Optionally, as shown in Figure 8 The data loading module 3004 comprises:
[0105] The backup structure creation unit 30041 is configured to create a backup structure, and the backup structure comprises, in sequence, disk write information, a virtual machine disk file path of a current process, and a disk file change data structure array, wherein the disk file change data structure array comprises a data length and actual disk write data.
[0106] The data loading unit 30042 is configured to write the acquired disk write information, virtual machine disk file path of the current process, and disk file change data into the backup structure.
[0107] The data transfer unit 30043 is configured to write the backup structure into a kernel buffer for temporary storage after the data in the backup structure is loaded, wherein the kernel buffer is created during initialization.
[0108] The sending thread awakening unit 30044 is configured to end the callback function of the interception tool and awaken the asynchronous sending thread.
[0109] The technical scheme of the embodiment comprises an initialization module 3001 configured to initialize a backup driver; an interception module 3002 configured to intercept an asynchronous I / O function; a data acquisition module 3003 configured to acquire disk change data, write position information, and a virtual machine disk file path; a data loading module 3004 configured to write the disk write position information, virtual machine disk file path of the current process, and disk file change data into a kernel buffer for temporary storage; and a sending module 3005 configured to send the data in the kernel buffer to a backup server. The embodiment can monitor I / O data of a virtual machine in real time through a backup driver in a Xen full virtualization environment, capture data changes of a virtual machine disk file without interruption, and continuously send the change data to a backup server for backup, thereby providing real-time data protection for a virtual machine running in the Xen full virtualization, reducing data loss, and improving business continuity and operation resilience.
[0110] Embodiment 4
[0111] In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the Xen full virtualization proxy-less real-time backup method of embodiment 1.
[0112] The computer storage medium of the embodiments of the present application can adopt any combination of one or more computer readable media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium includes, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples (non-exhaustive list) of the computer readable storage medium include: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, device or apparatus.
[0113] The above described embodiments only express several implementation manners of the present application, which are described in a more specific and detailed manner, but should not be understood as a limitation on the patent scope of the present application. It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, which all belong to the protection scope of the present application. Therefore, the patent protection scope of the present application should be subject to the appended claims.
Claims
1. A Xen full-virtualized agentless live backup method, characterized in that, The step of being executed by a backup driver in a production end host operating system, comprising: obtaining a global identification vector table by PIDs of all tapdisk processes in the host and corresponding disk file descriptors during initialization, wherein the global identification vector table contains virtual machine disk identification vectors and corresponding virtual machine disk file paths; intercepting asynchronous I / O requests transmitted by a user program to a host kernel, obtaining a PID and a process name of a current process, and filtering asynchronous I / O requests of non-tapdisk processes; obtaining disk write position information by analyzing the asynchronous I / O requests, wherein the disk write position information contains a disk file descriptor, a write offset and a write length; performing a bit operation on the PID of the current process and the disk file descriptor in the disk write position information to obtain a virtual machine disk identification vector of the current process; matching the virtual machine disk identification vector of the current process in the global identification vector table, and obtaining a virtual machine disk file path if the matching is successful; if the matching fails, obtaining process structure information according to the PID of the current process, traversing a file descriptor table of the current process, querying a disk file used by a virtual machine to construct a virtual machine disk file path, and then writing the obtained virtual machine disk identification vector and the virtual machine disk file path into the global identification vector table; and obtaining disk file change data according to a disk write data address in the asynchronous I / O request; creating a backup structure, writing the disk write position information, the virtual machine disk file path of the current process and the disk file change data into the backup structure, and then writing structure data into a kernel buffer for temporary storage, wherein the kernel buffer is created during initialization; asynchronously sending data in the kernel buffer to a backup service program.
2. The Xen full-virtualized, agentless, live backup method of claim 1, wherein, The step of obtaining the global identification vector table by PIDs of all tapdisk processes in the host and corresponding disk file descriptors during initialization, comprising: during initialization, traversing a process list, searching for a tapdisk process, and obtaining a process PID of the tapdisk process after the tapdisk process is queried; obtaining process structure information according to the PID of the tapdisk process, traversing a file descriptor table of the tapdisk process, and constructing a virtual machine disk file path after a disk file used by a virtual machine and a disk file descriptor of the disk file are queried; writing the virtual machine disk identification vector and the corresponding virtual machine disk file path into the global identification vector table.
3. The Xen full-virtualization, agentless, live backup method of claim 1, wherein, The step of intercepting asynchronous I / O requests transmitted by a user program to a host kernel, obtaining a PID and a process name of a current process, and filtering asynchronous I / O requests of non-tapdisk processes, comprising: when a tapdisk converts a disk write request from a virtual machine into a corresponding physical storage operation, and submits the disk write request to a dom0 kernel for an asynchronous I / O processing flow, setting an asynchronous I / O write function as a detection point of an interception tool; when the interception tool detects that the asynchronous I / O write function is about to run, immediately blocking execution of the asynchronous I / O write function, and then triggering a callback processing function of the interception tool; The interception tool takes out the parameters of the asynchronous I / O write function from the register as the parameters of the callback processing function; In the callback processing function, the PID and the process name of the current process are obtained, and if it is the tapdisk process, the next step is performed, and if it is not, the callback processing function is ended.
4. The Xen full-virtualization, agentless, live backup method of claim 3, wherein, The operation of obtaining the disk file change data according to the disk write data address in the asynchronous I / O request is specifically: According to the interception parameter value, it is judged whether the asynchronous I / O write function uses the scatter / gather I / O mode, if yes, the disk file change data is obtained according to the disk write data array one by one, and if not, the disk file change data is directly obtained according to the disk write data address, wherein the disk write data array stores multiple disk write data addresses and write offsets.
5. The Xen full-virtualization, agentless, live backup method of claim 1, wherein, The step of creating a backup structure, writing the disk write position information, the virtual machine disk file path of the current process and the disk file change data into the backup structure, and then writing the structure data into the kernel buffer for temporary storage, comprises: A backup structure is created, and the backup structure comprises, in sequence, disk write position information, a virtual machine disk file path of a current process and a disk file change data structure array, wherein the disk file change data structure array comprises a data length and actual disk write data; The obtained disk write position information, the virtual machine disk file path of the current process and the disk file change data are written into the backup structure; After the data contained in the backup structure is loaded, the backup structure is written into the kernel buffer for temporary storage, wherein the kernel buffer is created during initialization; The callback processing function of the interception tool is ended, and the asynchronous sending thread is awakened.
6. A Xen full-virtualization agentless live backup method, characterized in that, The application is applied to a backup server, and processes backup data from a backup driver in a production end host operating system, and comprises the following steps: The backup service program receives backup structure data transmitted from the backup driver; The backup service program writes the received backup structure data into a receiving structure which has the same structure as the backup structure, and writes target contents in the receiving structure into a log file; the backup structure is formed by writing disk write position information, a virtual machine disk file path of a current process and disk file change data; the backup driver is used for writing structure data into a kernel buffer for temporary storage, and the kernel buffer is created during initialization; The backup driver is also used for analyzing asynchronous I / O requests to obtain disk write position information, and the disk write position information comprises a disk file descriptor, a write offset and a write length; a virtual machine disk identification vector of the current process is obtained by performing a bit operation on the PID of the current process and the disk file descriptor in the disk write position information; the virtual machine disk identification vector of the current process is matched in a global identification vector table, and if the matching is successful, a virtual machine disk file path is obtained. If the matching fails, the current process structure information is obtained according to the current process PID, the file descriptor table of the current process is traversed, the virtual machine disk file path is constructed after the disk file used by the virtual machine is queried, and then the current virtual machine disk identification vector and the virtual machine disk file path obtained are written into the global identification vector table; the disk file change data is obtained according to the disk write data address in the asynchronous I / O request; the backup driver is also used for intercepting the asynchronous I / O request transmitted by the user program to the host kernel, obtaining the PID and process name of the current process, and filtering the asynchronous I / O request of the non-tapdisk process; the backup driver is also used for obtaining and generating the global identification vector table through the PID of all tapdisk processes in the host and the disk file descriptor corresponding thereto during initialization, wherein the global identification vector table contains the virtual machine disk identification vector and the virtual machine disk file path corresponding thereto.
7. A Xen full-virtualization, agentless, live backup system, characterized in that, The backup driver located in the production end host operating system is executed, and the system comprises: An initialization module is configured to obtain and generate a global identification vector table through the PID of all tapdisk processes in the host and the disk file descriptor corresponding thereto during initialization, wherein the global identification vector table contains a virtual machine disk identification vector and a virtual machine disk file path corresponding thereto; An intercepting module is configured to intercept an asynchronous I / O request transmitted by a user program to a host kernel, obtain a PID and a process name of a current process, and filter an asynchronous I / O request of a non-tapdisk process; A data obtaining module is configured to parse the asynchronous I / O request to obtain disk write position information, the disk write position information comprising a disk file descriptor, a write offset, and a write length; perform a bit operation on the PID of the current process and the disk file descriptor in the disk write position information to obtain a virtual machine disk identification vector of the current process; match the virtual machine disk identification vector of the current process in the global identification vector table, if the matching is successful, obtain a virtual machine disk file path; if the matching fails, obtain current process structure information according to the current process PID, traverse the file descriptor table of the current process, construct a virtual machine disk file path after the disk file used by the virtual machine is queried, and then write the current virtual machine disk identification vector and the virtual machine disk file path obtained into the global identification vector table; obtain disk file change data according to the disk write data address in the asynchronous I / O request; A data loading module is configured to create a backup structure, write the disk write position information, the virtual machine disk file path of the current process, and the disk file change data into the backup structure, and then write the structure data into a kernel buffer for temporary storage, wherein the kernel buffer is created during initialization; A sending module is configured to asynchronously send data in the kernel buffer to a backup service program.
8. The Xen full-virtualization, agentless, live backup system of claim 7, wherein, The initialization module comprises: A query unit is configured to, during initialization, traverse a process list, search for a process with a name of tapdisk, and obtain a process PID of the tapdisk process after the tapdisk process is queried; The disk file path unit is configured to obtain process structure information according to a tapdisk process PID, traverse a file descriptor table of the tapdisk process, and obtain a disk file used by the virtual machine and a disk file descriptor of the disk file to construct a virtual machine disk file path. The identification vector table generating unit is configured to write the virtual machine disk identification vector and the corresponding virtual machine disk file path into a global identification vector table.
9. The Xen full-virtualization, agentless, live backup system of claim 7, wherein, The intercepting module comprises: The probe point setting unit is configured to set the asynchronous I / O write function as a probe point of the intercepting tool when the tapdisk converts a disk write request from the virtual machine into a corresponding physical storage operation and submits the disk write request to the dom0 kernel for asynchronous I / O processing. The blocking unit is configured to block the execution of the asynchronous I / O write function immediately when the intercepting tool detects that the asynchronous I / O write function is about to run, and then trigger a callback processing function of the intercepting tool. The parameter obtaining unit is configured to obtain the parameters of the asynchronous I / O write function from the register as the parameters of the callback processing function. The filtering unit is configured to obtain the PID and the process name of the current process in the callback processing function, and if the process is the tapdisk process, the next step is performed, and if the process is not the tapdisk process, the callback processing function is ended. In addition, the data obtaining module comprises: The changed data obtaining unit is configured to determine whether the asynchronous I / O write function uses the scatter / gather I / O mode according to the intercepting parameter value, and if yes, the changed data of the disk file is obtained according to the disk write data array one by one, and if no, the changed data of the disk file is obtained directly according to the disk write data address, wherein the disk write data array stores a plurality of disk write data addresses and write offsets. In addition, the data loading module comprises: The backup structure creating unit is configured to create a backup structure, and the backup structure comprises, in sequence, disk write position information, a virtual machine disk file path of the current process, and a disk file changed data structure array, wherein the disk file changed data structure array comprises a data length and actual disk write data. The data loading unit is configured to write the obtained disk write position information, the virtual machine disk file path of the current process, and the disk file changed data into the backup structure. The data transfer unit is configured to write the backup structure into a kernel buffer for temporary storage after the data in the backup structure is loaded, and the kernel buffer is created during initialization.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the Xen full-virtualized agentless real-time backup method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Xen-based agent-free backup and recovery method and system
CN106598787A
Proxy-free virtualized backup recovery method based on XEN
CN108182128A
Streaming data access method, device and system, electronic equipment and storage medium
CN115905747A
Xen para-virtualization agent-free real-time backup method, system and recovery method
CN117851133A