Shared file system repairing method and computing device
By automatically obtaining the health status of the shared file system and repairing it, the problem that the virtual machine needs to be shut down due to corruption of the shared file system metadata is solved, and the non-interrupted repair process is achieved, improving the reliability and user experience of the system.
Patent Information
- Application Number
- CN202411803930.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-04
AI Technical Summary
When the metadata of the shared file system is corrupted, the prior art requires shutting down the virtual machine for repair, resulting in user business interruptions and economic losses.
By obtaining the health status of the shared file system, hanging the input and output requests of the virtual machine, closing the virtual disk image file, uninstalling the mount point, and automatically repairing it to avoid shutting down the virtual machine.
It realizes the repair of shared file systems without interrupting the operation of virtual machines, avoids business interruptions and related economic losses, and improves the reliability and user experience of the system.
Smart Images

Figure CN119759623A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and computing device for repairing a shared file system. Background Art
[0002] Virtualization technology allows one or more virtual machines (VMs) to run on the same physical server. Each virtual machine has its own operating system and application, which improves the utilization and flexibility of the server's hardware resources. Traditional virtualization technology is usually limited by the limitations of a single storage system, which means that the virtual disk image file (Virtual Disk Image File) corresponding to each virtual machine running on the server can only be stored on one storage device.
[0003] The design, construction and optimization of the Shared File System are aimed at the virtual machine environment, aiming to allow multiple virtual machines to access an integrated cluster storage pool together, that is, the shared file system can uniformly manage multiple storage devices and virtualize the multiple storage devices into a logically integrated cluster storage pool. Through the shared file system, the virtual disk image file corresponding to each virtual machine on the host can be stored on the shared file system, so as to achieve distributed storage of virtual disk image files on different storage devices, thereby significantly improving resource utilization. By using a shared file system, virtualization technology is no longer limited by the limitations of a single storage system, and virtualization across multiple storage devices is achieved, making the virtualization environment more efficient, reliable and flexible.
[0004] However, when the metadata of the shared file system is damaged, the virtual machine cannot read and write its corresponding virtual disk normally, which eventually causes the user business to fail to function normally. In the current shared file system repair method, when the metadata of the shared file system is damaged, the virtual machine needs to be shut down and then restarted after the repair is completed. Summary of the invention
[0005] The embodiments of the present application provide a method for repairing a shared file system and a computing device, which can repair a shared file system without shutting down a virtual machine.
[0006] In the first aspect, the embodiment of the present application provides a method for repairing a shared file system, including: obtaining the health status of the shared file system; the health status is used to characterize the running status of the shared file system, the health status includes a fault status, and the fault status includes: the metadata of the shared file system is in a damaged state; in response to the health status being a fault status, suspending the input and output requests sent by the virtual machine to the corresponding virtual disk, closing the virtual disk image file stored in the shared file system, unmounting the mount point of the shared file system, and repairing the shared file system; in response to the completion of the repair of the shared file system, re-mounting the shared file system to the mount point; releasing the suspension of the input and output requests, and opening the virtual machine disk image file stored in the shared file system. In the embodiment of the present application, when there is a fault / problem in the shared file system, it is only necessary to suspend the input and output requests sent by the virtual machine and close the virtual disk image file, but it is not necessary to shut down the virtual machine, thereby avoiding the interruption of user services, and further avoiding the economic losses that may be caused by business interruption.
[0007] In a possible implementation, based on a preset period, the health status of a shared file system is periodically obtained, and the health status includes a fault status and a normal status. In response to the completion of the repair of the shared file system, the health status of the shared file system is set to a normal status. The health status of the shared file system is periodically obtained, and the user does not need to trigger the computing device to obtain the health status of the shared file system, and the shared file system can be repaired without the user's intervention, thereby avoiding the waste of human resources, making the user feel nothing during the whole process, and improving the user experience. Furthermore, in response to the completion of the repair of the shared file system, the health status of the shared file system can be actively modified from the repair status to the normal status, and the health status of the shared file system can be modified in time, so as to timely trigger the subsequent opening of the virtual disk image file and the release of the IO suspension operation, which can further shorten the time consumption of the shared file system repair process.
[0008] In a possible implementation, after the shared file system is remounted on the mount point, the health status of the shared file system is set to normal, so as to avoid the situation where, in response to the shared file system's health status becoming normal, the shared file system has not yet been mounted when the virtual machine sends a new IO request to the corresponding virtual disk, resulting in abnormal interruption of the IO request (user service).
[0009] In a possible implementation, based on a preset period, the health status module corresponding to the shared file system is periodically read to obtain the health status of the shared file system. By periodically reading the health status module corresponding to the shared file system, the health status of the shared file system is periodically obtained, so as to timely monitor the situation that the health status of the shared file system is a fault state, and start the repair process of the shared file system, and the health status module is periodically read without user intervention / triggering the acquisition of the health status of the shared file system.
[0010] In a possible implementation, the health status also includes a repair status, and in response to the health status being a fault status, the fault status is modified to a repair status. That is, in the process of suspending IO requests and closing virtual disk image files, the fault status stored in the health status module is modified to a repair status, so as to indicate that the shared file system is in the repair process.
[0011] In a possible implementation, in response to the health status being a normal state, it is determined whether the previous health status of the shared file system was a repairing state; in response to the previous health status being a repairing state, the virtual machine management software triggers its own IO hang mechanism to release the suspension of input and output requests. In response to the health status being a normal state, and the previous health status being a repairing state, that is, the health status of the shared file system changes from a repairing state to a normal state, indicating that the shared file system changes from having a problem / fault to not having a problem / fault, indicating that the shared file system has been repaired and successfully repaired, so the suspension of IO requests is achieved through the IO hang mechanism of the virtual machine management software itself, without the need to add an additional mechanism.
[0012] In a possible implementation, in response to the health status being an abnormal state, an abnormal prompt message is generated to prompt that the health status of the shared file system is an abnormal state. When it is determined that the health status of the shared file system is an abnormal state (that is, when the health status of the shared file system is not a normal state, a fault state, or a repair state), an abnormal prompt message is generated to prompt that the health status of the shared file system is an abnormal state, indicating that the current shared file system cannot be repaired by self-healing, thereby prompting the user to manually check and repair the shared file system.
[0013] In a possible implementation, in response to the health status being a fault state, the virtual machine management software triggers its own IO hang mechanism to suspend the input and output requests sent by the virtual machine to the corresponding virtual disk. The suspension of IO requests is automatically implemented through the IO hang mechanism of the virtual machine management software itself, without adding an additional mechanism.
[0014] In a possible implementation, the mount point of the shared file system is automatically unmounted. Specifically, the virtual machine management software sends a repair notification message to the host machine, thereby triggering the host machine to automatically unmount the mount point of the shared file system, without the need for a user to intervene in the unmounting of the mount point of the shared file system, and automatically triggering the unmounting of the mount point of the shared file system, thereby avoiding the waste of manual resources and the problem of a long repair process due to the user's failure to intervene / respond in time.
[0015] In a second aspect, an embodiment of the present application provides a computing device, comprising: a processor and a memory: the processor and the memory are coupled; the memory is used to store computer program instructions; the processor is used to execute the computer program instructions stored in the memory, so as to implement the shared file system repair method in the above-mentioned first aspect and its possible implementation methods.
[0016] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed on a computing device, the computing device implements the method for repairing a shared file system in the above-mentioned first aspect and its possible implementation methods.
[0017] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes computer program instructions. When the computer program instructions are executed on a computing device, the computing device implements the shared file system repair method in the first aspect and its possible implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 An example diagram of an application scenario of a method for repairing a shared file system provided in an embodiment of the present application;
[0019] Figure 2 A schematic diagram of a flow chart of a method for repairing a shared file system provided in an embodiment of the present application;
[0020] Figure 3 An example diagram of a process for a virtual machine to send an IO request to a virtual disk provided in an embodiment of the present application;
[0021] Figure 4 A flowchart of another method for repairing a shared file system provided in an embodiment of the present application;
[0022] Figure 5 An interactive schematic diagram of a method for repairing a shared file system provided in an embodiment of the present application;
[0023] Figure 6 A schematic diagram of the initialization process of a health monitoring module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The terms "first", "second", "third", etc. in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.
[0025] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0026] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:
[0027] Virtual Machine (VM): A server system simulated by software, running on a physical server (also known as a host machine) and having its own operating system and applications. Multiple virtual machines (i.e., multiple operating system instances) can run on a single physical server, thereby improving the utilization and flexibility of hardware resources. A virtual machine usually includes a set of virtualized hardware resources, including: virtual processor (vCPU), virtual memory (RAM), virtual disk (Virtual Disk), virtual network interface card (NIC), etc.
[0028] Virtual Machine Management Software (VMM or VMMS) can also be called a virtual machine management system. It is a software platform for creating, managing and running virtual machines. Virtual machine management software provides centralized management and control capabilities for virtual machines. Exemplary virtual machine management software includes: QEMU, KVM, VMware vSphere, etc. Among them, QEMU (Quick Emulator) is an open source virtual machine management software. QEMU can be used on a variety of operating systems, such as: Linux, Windows, macOS, etc.
[0029] Virtual Disk: In a virtualized environment, a virtual disk refers to a disk created inside a virtual machine. This disk is like a real hard disk to the virtual machine. A virtual disk provides storage space for the virtual machine to install disk systems, applications, and store user data. Furthermore, a virtual disk can be of fixed size or dynamically expandable.
[0030] A virtual disk image file is a file that stores the state of a virtual disk. It can contain all the data on the virtual disk, including operating system files, applications, configuration files, etc. Virtual disk image files usually have specific file extensions, such as .vhd (Microsoft Hyper-V), .vmdk (VMware), .qcow2 (QEMU), etc. Virtual disk image files can be easily migrated between different virtualization platforms, and can also be used to back up and restore the state of virtual machines.
[0031] The relationship between the virtual disk and the virtual disk image file is as follows: the virtual disk image file is a file containing virtual disk data. When the virtual machine management software loads the virtual disk image file, a virtual disk will be created in the virtual machine, and the virtual disk will simulate the behavior of a real disk. Therefore, the virtual disk image file is the basis for creating a virtual disk.
[0032] A shared file system is a type of file system that allows multiple server systems (operating systems) to access and operate files and directories in the same file system at the same time. The purpose of the shared file system is to achieve file sharing and collaboration in a distributed computing environment, thereby improving resource utilization and data consistency.
[0033] Furthermore, the shared file system is the basis for virtualization across multiple storage devices, which can enable various services such as storage hot migration, storage dynamic resource scheduling (SDS) and high availability (HA).
[0034] The metadata of a shared file system refers to the information that describes the properties and structure of files and directories in the shared file system. In short, metadata is data that describes data. The metadata of a shared file system usually includes: file name, file size, creation time, modification time, permissions, owner and other information.
[0035] As can be seen from the background art, in the current technology of restoring a shared file system, it is necessary to shut down the associated virtual machine, which causes interruption of user services and may lead to economic losses.
[0036] The embodiment of the present application provides a method for repairing a shared file system, including: obtaining the health status of the shared file system; in response to the health status being a faulty state, suspending the input and output requests sent by the virtual machine to the corresponding virtual disk, closing the virtual disk image file stored in the shared file system, unmounting the mount point of the shared file system, and repairing the shared file system; in response to the completion of the repair of the shared file system, remounting the shared file system to the mount point; releasing the suspension of the input and output requests, and opening the virtual machine disk image file stored in the shared file system. In the embodiment of the present application, when there is a fault / problem with the shared file system, it is only necessary to suspend the input and output requests sent by the virtual machine and close the virtual disk image file, but it is not necessary to shut down the virtual machine, thereby avoiding the interruption of user services, making the user unaware of the entire process, and improving the user experience.
[0037] Furthermore, in the embodiment of the present application, there is no need to shut down the virtual machine, and the time consumed in unmounting the mount point of the shared file system and repairing the shared file system is very short, so that the self-healing of the shared file system can be completed without shutting down the virtual machine, thereby avoiding the economic losses that may be caused by shutting down the virtual machine.
[0038] Embodiment 1:
[0039] Combine the following Figure 1-Figure 6 , a method for repairing a shared file system provided in an embodiment of the present application is introduced in detail.
[0040] First combine Figure 1 , an application scenario of a shared file system repair method provided in an embodiment of the present application is introduced in detail.
[0041] like Figure 1 As shown, three virtual machines are running on the server 100, namely, virtual machine 101, virtual machine 102 and virtual machine 103. The operating system of the server 100 can also be called a host machine, that is, the server 100 includes a host machine running on the hardware layer and three virtual machines running on the host machine.
[0042] The host machine is an operating system directly installed on a computing device. It manages hardware resources and provides services for various software running on it, that is, the host machine is the operating system of the server 100.
[0043] Among them, virtual machine 101 is mounted with virtual disk 111 and virtual disk 112, virtual machine 102 is mounted with virtual disk 113 and virtual disk 114, and virtual machine 103 is mounted with virtual disk 115 and virtual disk 116. That is, the three virtual machines running on server 100 are respectively mounted with two virtual disks, one of which is a system disk. The system disk is a disk required for the virtual machine to start and run the operating system, and usually contains the installation files, system files, boot loader, etc. of the operating system. Figure 1 As shown, virtual disk 111 is the system disk of virtual machine 101, virtual disk 113 is the system disk of virtual machine 102, and virtual disk 115 is the system disk of virtual machine 103; another virtual disk is a data disk, which is a disk used to expand the storage capacity of the virtual machine to store additional data of the virtual machine (for example, application data, user data, log files, etc.). Figure 1 As shown, virtual disk 112 is a data disk of virtual machine 102 , virtual disk 114 is a data disk of virtual machine 102 , and virtual disk 116 is a data disk of virtual machine 103 .
[0044] Among them, virtual disk 111 corresponds to virtual disk image file 121, that is, virtual disk 111 is created based on virtual disk image file 121 and mounted on virtual machine 101. Similarly, virtual disk 112 corresponds to virtual disk image file 122, virtual disk 113 corresponds to virtual disk image file 123, virtual disk 113 corresponds to virtual disk image file 123, virtual disk 114 corresponds to virtual disk image file 124, virtual disk 115 corresponds to virtual disk image file 125, and virtual disk 116 corresponds to virtual disk image file 126.
[0045] Among them, virtual disk image file 121 and virtual disk image file 122 are stored on storage device 131; virtual disk image file 123 and virtual disk image file 124 are stored on storage device 132; virtual disk image file 125 and virtual disk image file 126 are stored on storage device 133.
[0046] Among them, Figure 1 As shown, a shared file system 140 is running on the server 100. The shared file system 140 is a software component used to manage the data on the storage devices 131, 132, and 133, and allows multiple nodes to share the data stored on the storage devices 131, 132, and 133. That is, the shared file system 140 virtualizes the storage devices 131, 132, and 133 into a logically integrated, shared cluster storage pool. Figure 1In the application scenario shown, the shared file system 140 allows the virtual machines 111 , 112 , 113 and the server 110 to access / share data stored on the storage devices 131 , 132 and 133 .
[0047] It should be noted that the shared file system 140 manages the storage devices 131, 132, and 133. The storage device 131 stores the virtual disk image files 121 and 122, the storage device 132 stores the virtual disk image files 123 and 124, and the storage device 133 stores the virtual disk image files 125 and 126. Therefore, it can be simply understood that the virtual disk image files 121, 122, 123, 124, 125, and 126 are stored in the shared file system 140.
[0048] The above combination Figure 1 An example is given to introduce an application scenario of a shared file system repair method provided in an embodiment of the present application. Figure 2-Figure 6 , a method for repairing a shared file system provided in an embodiment of the present application is described in detail.
[0049] like Figure 2 As shown, a method for repairing a shared file system provided in an embodiment of the present application is applied to a computing device (for example: Figure 1 The server 100 shown in FIG. 1 is a server 100, a virtual machine is running on the computing device, and the virtual machine is connected to the storage resource through a shared file system. The method for repairing the shared file system includes the following steps:
[0050] S201: Obtain the health status of a shared file system.
[0051] The health status of the shared file system is a key indicator for measuring the stability and availability of the shared file system, and is used to characterize the operating status of the shared file system.
[0052] Specifically, in one possible implementation, the health status of the shared file system can be obtained by the user. For example, when the user feels that the virtual machine has a fault, the user can actively obtain the health status of the shared file system by triggering a certain instruction (such as clicking a certain physical / virtual button). In another possible implementation, when the virtual machine fails, the virtual machine management software can automatically read the health status module corresponding to the shared file system to obtain the health status of the shared file system, and display the health status to the user through the computing device.
[0053] The health status module is the storage space pre-allocated by the host for the health status of the shared file system, that is, the health status module is the storage space on the computing device used to store the health status of the shared file system. It can also be understood that the health status module is a local file pre-created on the computing device, which is used to store the health status of the shared file system / the status value corresponding to the health status.
[0054] The fault state (invalid) means that the metadata of the shared file system is damaged, causing the shared file system to fail to work properly, and the shared file system needs to be repaired. For example, the health state of the shared file system may be manifested as: the shared file system cannot be mounted, data is damaged, or performance is severely degraded.
[0055] The status value is an identifier used to indicate the health status of the shared file system, which can be a string, a number, or an identifier in other forms. The specific status value is pre-set according to the health status of the shared file system. For example, if the status value corresponding to the preset fault state is 1, then when the status value read by the virtual machine management software from the health status module is 1, it is determined that the health status of the shared file system is a fault state.
[0056] When the health status of the shared file system is a faulty state, it indicates that there is an error or problem in the shared file system and it cannot work normally, so S202-S205 are performed to implement a repair operation on the shared file system. In a possible implementation, steps S202-S205 may be triggered by a user or automatically executed by a computing device.
[0057] S202: Suspend the input / output request sent by the virtual machine to the corresponding virtual disk, and close the virtual disk image file stored in the shared file system.
[0058] The input / output request (IO request) sent by the virtual machine to the corresponding virtual disk means that the virtual machine requests the operating system or virtual machine management software to perform data reading or writing operations on the virtual disk. Specifically, the input request (Input Request) is used to request to read data from the virtual disk; the output request (Output Request) is used to request to write data to the virtual disk.
[0059] Furthermore, the virtual machine sends an IO request to the corresponding virtual disk, which involves the interaction between the virtual machine, the virtual machine management software, and the virtual disk image file (which can also be understood as the storage device storing the virtual disk image file). Figure 3 The following example describes the process of a virtual machine sending an IO request to a corresponding virtual disk.
[0060] like Figure 3 As shown, taking the example of virtual machine 310 sending an IO request to its mounted virtual disk 320, illustratively, virtual disk 320 is the virtual disk mounted by virtual machine 310, and the virtual disk image file corresponding to virtual disk 320 is virtual disk image file 321, and virtual disk image file 321 is stored in storage device 340, which is one of the multiple storage devices managed by shared file system 330.
[0061] like Figure 3 As shown, the process of the virtual machine 310 sending an IO request to the virtual disk 320 includes: when the application program or the virtual machine operating system in the virtual machine 310 needs to read or write data from the virtual disk 320, an IO request is generated to request to read data from the virtual disk 320 or write data to the virtual disk 320; the virtual machine management software captures the IO request and forwards the IO request to the shared file system 330; the shared file system 330 parses the IO request and converts the IO request into actual operations on the storage device 340; according to the actual operations on the storage device 340, the read or write operations on the virtual disk image file 321 stored in the storage device 340 are completed.
[0062] In an embodiment of the present application, when the acquired health status of the shared file system is a faulty state, the IO request sent by the virtual machine to the corresponding virtual disk is suspended and the virtual disk image file is closed, which can ensure that the virtual machine will not continue to perform IO operations when there is a problem with the shared file system. Further, the input and output requests sent by the virtual machine to the corresponding virtual disk are suspended, that is, all input and output requests sent to the virtual machine disk are paused to prevent the continued input / output operations during the period when the shared file system has errors / problems, thereby avoiding data damage or loss. And the virtual disk image file stored in the shared file system is closed, that is, the virtual disk image file stored on the storage device managed by the shared file system is closed, ensuring that the virtual disk image file no longer receives new read or write operations to itself, releasing related resources, and preventing further input and output operations from affecting the shared file system.
[0063] Specifically, the virtual machine management software suspends the input and output request sent by the virtual machine to the corresponding virtual disk, and closes the virtual disk image file stored in the shared file system.
[0064] In a possible implementation, the virtual machine management software suspends the input and output requests sent by the virtual machine to the corresponding virtual disk through an IO hang mechanism in the virtual machine management software, that is, the virtual machine management software automatically suspends the input and output requests sent by the virtual machine to the corresponding virtual machine disk through the IO hang mechanism.
[0065] Among them, the IO hang mechanism is a mechanism for detecting and processing long-term unfinished IO requests, which is mainly used for debugging, performance testing or troubleshooting in a virtualized environment. The IO hang mechanism can suspend the IO operation of the virtual machine within a specified time, that is, suspend the IO request sent by the virtual machine to the corresponding virtual disk.
[0066] Specifically, in response to obtaining that the health state is a fault state, the virtual machine management software triggers its own IO hang mechanism to suspend the IO request sent by the virtual machine to the corresponding virtual disk. Exemplarily, the virtual machine management software triggers its own IO hang mechanism to issue a suspension instruction through a suspension command (for example: QEMU monitor command) or a specified application programming interface (API), thereby suspending the IO request sent by the virtual machine to the corresponding virtual disk.
[0067] S203: Unmount the mount point of the shared file system and repair the shared file system.
[0068] In one possible implementation, a new health monitoring module in the virtual machine management software sends a repair notification message to the host machine to notify the host machine that the shared file system needs to be repaired; the host machine responds to the repair notification message, unmounts the mount point of the shared file system, and repairs the shared file system.
[0069] Unmounting the mount point of the shared file system can be understood as unmounting the shared file system. Specifically, the connection between the mount point and the shared file system is disconnected so that the operating system (host machine, virtual machine operating system, etc.) no longer accesses the shared file system through the mount point (directory). The mount point is a directory through which data in the shared file system can be accessed.
[0070] Exemplarily, the mount point of the shared file system is determined, for example, the mount point of the shared file system is determined to be / mnt / shared; an unmount command is called to unmount the mount point of the shared file system, for example, the command line is umount / mnt / shared, and the unmounting of the shared file system is completed. After the shared file system is unmounted, its corresponding mount point becomes an empty directory, making the shared file system no longer accessible.
[0071] Specifically, in response to the repair notification information, the host machine calls an unmount (umount) command to unmount the shared file system, and calls a file system repair tool to repair the shared file system.
[0072] The umount command is used to unmount a mounted file system.
[0073] Among them, the file system repair tool is a type of software tool used to detect and repair file system problems / failures. When a file system problem / failure occurs, the file system repair tool is used to restore the integrity and availability of the file system.
[0074] Specifically, fsck (File System Consistency Check) is a general file system check and repair tool applicable to various file system types. Usually, fsck will call the check tool of a specific file system. Exemplarily, the fsck.ocfs2 tool is the file system repair tool corresponding to the OCFS2 file system, that is, the sck.ocfs2 tool is used to repair the OCFS2 file system. It should be noted that each shared file system has its corresponding file system repair tool.
[0075] S204: In response to the shared file system being repaired, remount the shared file system on the mount point.
[0076] Specifically, when the file system repair tool completes the repair of the shared file system, it will output the repair result; and based on the repair result, it is determined that the problem / fault of the shared file system has been successfully repaired; when it is determined that the shared file system has been successfully repaired, the mount command is called to remount the shared file system to the mount point. Among them, calling the mount command to remount the shared file system to the mount point can be understood as remounting the shared file system so that the operating system (host machine, virtual machine operating system) can access the shared file system through the mount point.
[0077] S205: Release the suspension of the input / output request sent by the virtual machine to the corresponding virtual disk, and open the virtual disk image file stored in the shared file system.
[0078] In a possible implementation, the virtual machine management software releases the suspension of the input and output request sent by the virtual machine to the corresponding virtual disk through the IO hang mechanism in the virtual machine management software, that is, in response to obtaining that the health state has changed to the normal state, the virtual machine management software triggers its own IO hang mechanism to release the suspension of the input and output request sent by the virtual machine to the corresponding virtual disk. Exemplarily, the virtual machine management software triggers its own IO hang mechanism to issue a contact suspension instruction through a contact suspension command or a specified application programming interface, thereby contacting the suspension of the IO request sent by the virtual machine to the corresponding virtual disk.
[0079] The embodiment of the present application provides a method for repairing a shared file system, including: obtaining the health status of the shared file system; when the health status of the shared file system is a fault state, suspending the IO request sent by the virtual machine to the corresponding virtual disk and closing the virtual disk image file stored on the shared file system; uninstalling the mount point of the shared file system and repairing the shared file system; in response to the completion of the repair of the shared file system, remounting the shared file system on the mount point; releasing the suspension of the IO request sent by the virtual machine to the corresponding virtual disk, and opening the virtual disk image file stored in the shared file system. In the embodiment of the present application, when there is a fault / problem in the shared file system, it is only necessary to suspend the IO request sent by the virtual machine and close the virtual disk image file, but it is not necessary to shut down the virtual machine, so as to avoid the interruption of user business, thereby avoiding the economic losses that may be caused by the interruption of business. In addition, the IO request sent by the virtual machine is suspended and the virtual disk image file is closed, so as to ensure that in the case of a problem with the shared file system, the virtual machine will not continue to perform IO operations, and the shared file system can be repaired without shutting down the virtual machine. After the shared file system is repaired, the virtual disk image file is opened, and the suspension of the IO request sent by the virtual machine is released, and the IO operation is restored and continued, so as to ensure the continuity of the user business.
[0080] The above combination Figure 2 and Figure 3 The specific implementation steps of a shared file system repair method provided by the embodiment of the present application are described in detail. Figure 4 The specific implementation steps of another shared file system repair method provided by the embodiment of the present application are introduced. Figure 4 As shown, a method for repairing a shared file system provided in an embodiment of the present application is applied to a computing device (for example: Figure 1 The server 100 shown in FIG. 1 is a server 100, a virtual machine is running on the computing device, and the virtual machine is connected to the storage resource through a shared file system. The method for repairing the shared file system includes the following steps:
[0081] S401: Periodically obtain the health status of a shared file system based on a preset period.
[0082] The health status of the shared file system is a key indicator for measuring the stability and availability of the shared file system, and is used to characterize the operating status of the shared file system.
[0083] Specifically, the virtual machine management software periodically reads the health status module corresponding to the shared file system based on a preset period to obtain the health status of the shared file system. The virtual machine management software periodically reads the health status module corresponding to the shared file system to obtain the health status of the shared file system to ensure that changes in the health status of the shared file system can be perceived in a timely manner. That is, the virtual machine management software periodically obtains the health status of the shared file system through the newly added health monitoring module.
[0084] In a possible implementation, the virtual machine management software periodically reads the health status module corresponding to the shared file system based on a preset period, obtains a status value corresponding to the health status of the shared file system, and obtains the health status of the shared file system based on the status value.
[0085] The health status module is the storage space pre-allocated by the host for the health status of the shared file system, that is, the health status module is the storage space on the computing device used to store the health status of the shared file system. It can also be understood that the health status module is a local file pre-created on the computing device, which is used to store the health status of the shared file system / the status value corresponding to the health status.
[0086] The health status of a shared file system includes: normal status, fault status, and repair status.
[0087] Normal means that the shared file system is in a healthy state, that is, all functions of the shared file system are running normally, and no errors or problems are detected. Exemplarily, the healthy state of the shared file system is a normal state, which indicates that the shared file system can be mounted normally, and the performance indicators (such as read and write speed, IOPS, response time, etc.) are within the normal range.
[0088] The fault state (invalid) means that the metadata of the shared file system is damaged, causing the shared file system to fail to work properly, and the shared file system needs to be repaired. For example, the health state of the shared file system may be manifested as: the shared file system cannot be mounted, data is damaged, or performance is severely degraded.
[0089] The repair state (repair) means that there is a problem with the shared file system, but the repair operation is in progress and has not yet returned to normal.
[0090] The status value is an identifier used to indicate the health status of the shared file system, which can be a string, a number, or an identifier in other forms. The specific status value is pre-set according to the health status of the shared file system. For example, the status value corresponding to the normal state is preset to be 0, the status value corresponding to the fault state is preset to be 1, and the status value corresponding to the repair state is preset to be 2; when the status value read by the virtual machine management software from the health status module is 0, it is determined that the health status of the shared file system is normal.
[0091] Furthermore, the health status of the shared file system stored in the health status module / the status value corresponding to the health status is: the host periodically detects the health status of the shared file system and writes it. In addition, the host can also timely discover potential problems of the shared file system by regularly monitoring / checking the health status of the shared file system, avoiding the problem of determining that there is a problem with the shared file system when the user perceives that the user service has not responded for a long time.
[0092] It should be noted that the period during which the host machine periodically detects the health status of the shared file system and writes it into the health status module can be the same as the preset period during which the virtual machine management software periodically obtains the health status of the shared file system. For example, the host machine detects the health status of the shared file system and writes it into the health status module every 10 seconds, and the virtual machine management software also obtains the health status of the shared file system every 10 seconds. Of course, they can also be different periods, but generally the period during which the host machine detects is less than the preset period, and this application does not make specific restrictions.
[0093] When the health status of the shared file system is normal, it indicates that the shared file system currently has no problem or fault, and the shared file system does not need to be repaired.
[0094] When the health status of the shared file system is a faulty status, it indicates that there is an error or problem in the shared file system and it cannot work normally, so S402 to S404 are performed to implement a repair operation on the shared file system.
[0095] When the health status of the shared file system is in the repairing state, it indicates that the repair operation of the shared file system is being performed, that is, it indicates that the repair operation of S402-S404 is being performed, so the health status of the shared file system is periodically obtained based on the preset period until the health status is obtained to be normal or faulty. The repairing state is used to indicate that the current shared file system is being repaired, so as to avoid the repeated triggering of the repair operation of the shared file system due to the lack of the repairing state to indicate that the shared file system is in the repairing state, resulting in unnecessary waste of resources.
[0096] In a possible implementation, the health status of the shared file system includes other states in addition to the normal state, the fault state, and the repair state. These other states can be collectively referred to as abnormal states. For example, the abnormal state includes an unrepairable state, that is, the shared file system is severely damaged and cannot be repaired by existing file system repair tools.
[0097] Further, when it is determined that the health status of the shared file system is abnormal (ie, the health status of the shared file system is not normal, faulty, or repairing), abnormal prompt information is generated to prompt that the health status of the shared file system is abnormal.
[0098] Exemplarily, when the virtual machine management software determines that the health status of the shared file system is abnormal, it generates abnormal prompt information and sends it to the host machine; the host machine responds to the abnormal prompt information by displaying an abnormal prompt picture through a display device connected to the host machine to prompt the user that the health status of the shared file system is abnormal and requires manual inspection and repair.
[0099] It should be noted that determining that the health status of the shared file system is an abnormal state may be: if the health status (corresponding status value) read by the virtual machine management software from the health status module is not a normal state, a fault state, or a repair state (corresponding status values respectively), then the health status of the shared file system is determined to be an abnormal state. Alternatively, if the health status (corresponding status value) read by the virtual machine management software from the health status module is empty, then the health status of the shared file system is determined to be an abnormal state, which is not specifically limited in this application.
[0100] S402: In response to the health status being a failure status, suspend the input / output request sent by the virtual machine to the corresponding virtual disk, and close the virtual disk image file stored in the shared file system.
[0101] The input / output request (IO request) sent by the virtual machine to the corresponding virtual disk means that the virtual machine requests the operating system or virtual machine management software to perform data reading or writing operations on the virtual disk. Specifically, the input request (Input Request) is used to request to read data from the virtual disk; the output request (Output Request) is used to request to write data to the virtual disk.
[0102] Furthermore, the virtual machine sends an IO request to the corresponding virtual disk, which involves the interaction between the virtual machine, the virtual machine management software, and the virtual disk image file (which can also be understood as a storage device storing the virtual disk image file). The process of the virtual machine sending an IO request to the corresponding virtual disk is as described above and will not be repeated here.
[0103] In an embodiment of the present application, when the acquired health status of the shared file system is a faulty state, the IO request sent by the virtual machine to the corresponding virtual disk is suspended and the virtual disk image file is closed, which can ensure that the virtual machine will not continue to perform IO operations when there is a problem with the shared file system. Further, the input and output requests sent by the virtual machine to the corresponding virtual disk are suspended, that is, all input and output requests sent to the virtual machine disk are paused to prevent the continued input / output operations during the period when the shared file system has errors / problems, thereby avoiding data damage or loss. And the virtual disk image file stored in the shared file system is closed, that is, the virtual disk image file stored on the storage device managed by the shared file system is closed, ensuring that the virtual disk image file no longer receives new read or write operations to itself, releasing related resources, and preventing further input and output operations from affecting the shared file system.
[0104] Specifically, the virtual machine management software suspends the input and output request sent by the virtual machine to the corresponding virtual disk, and closes the virtual disk image file stored in the shared file system.
[0105] In a possible implementation, the virtual machine management software suspends the input and output requests sent by the virtual machine to the corresponding virtual disk through an IO hang mechanism in the virtual machine management software, that is, the virtual machine management software automatically suspends the input and output requests sent by the virtual machine to the corresponding virtual machine disk through the IO hang mechanism.
[0106] Among them, the IO hang mechanism is a mechanism for detecting and processing long-term unfinished IO requests, which is mainly used for debugging, performance testing or troubleshooting in a virtualized environment. The IO hang mechanism can suspend the IO operation of the virtual machine within a specified time, that is, suspend the IO request sent by the virtual machine to the corresponding virtual disk.
[0107] Specifically, in response to obtaining that the health state is a fault state, the virtual machine management software triggers its own IO hang mechanism to suspend the IO request sent by the virtual machine to the corresponding virtual disk. Exemplarily, the virtual machine management software triggers its own IO hang mechanism to issue a suspension instruction through a suspension command (for example: QEMU monitor command) or a specified application programming interface (API), thereby suspending the IO request sent by the virtual machine to the corresponding virtual disk.
[0108] Furthermore, when it is determined that the health status of the shared file system is a fault state, suspending IO requests and closing the virtual disk image file, at the same time / almost at the same time, the virtual machine management software will write a repair status to the health status module, that is, in response to the health status of the shared file system being a fault state, the fault state is modified to a repair state to indicate that a repair operation is being performed on the shared file system.
[0109] It should be noted that the time difference between the moment when the health status of the shared file system is obtained as a fault state and the moment when the repair state is written to the health status module is much smaller than the preset period, so as to avoid the situation where the health status / status value stored in the health status module has not yet been modified to the repair state / status value corresponding to the repair state, and the health status of the shared file system obtained at the preset period is a fault state again, and S402 is re-executed, resulting in repeated operations, thereby affecting the repair of the shared file system.
[0110] S403: Unmount the mount point of the shared file system and repair the shared file system.
[0111] Specifically, the mount point of the shared file system is automatically unmounted, and the shared file system is repaired.
[0112] In one possible implementation, a new health monitoring module in the virtual machine management software sends a repair notification message to the host machine to notify the host machine that the shared file system needs to be repaired; the host machine responds to the repair notification message, unmounts the mount point of the shared file system, and repairs the shared file system.
[0113] Unmounting the mount point of the shared file system can be understood as unmounting the shared file system. Specifically, the connection between the mount point and the shared file system is disconnected so that the operating system (host machine, virtual machine operating system, etc.) no longer accesses the shared file system through the mount point (directory). The mount point is a directory through which data in the shared file system can be accessed.
[0114] Exemplarily, the mount point of the shared file system is determined, for example, the mount point of the shared file system is determined to be / mnt / shared; an unmount command is called to unmount the mount point of the shared file system, for example, the command line is umount / mnt / shared, and the unmounting of the shared file system is completed. After the shared file system is unmounted, its corresponding mount point becomes an empty directory, making the shared file system no longer accessible.
[0115] Specifically, in response to the repair notification information, the host machine calls an unmount (umount) command to unmount the shared file system, and calls a file system repair tool to repair the shared file system.
[0116] The umount command is used to unmount a mounted file system.
[0117] Among them, the file system repair tool is a type of software tool used to detect and repair file system problems / failures. When a file system problem / failure occurs, the file system repair tool is used to restore the integrity and availability of the file system.
[0118] Specifically, fsck (File System Consistency Check) is a general file system check and repair tool that is applicable to multiple file system types. Usually, fsck will call the check tool of a specific file system. Exemplarily, the fsck.ocfs2 tool is the file system repair tool corresponding to the OCFS2 file system, that is, the sck.ocfs2 tool is used to repair the OCFS2 file system. It should be noted that each shared file system has its corresponding file system repair tool.
[0119] In the embodiment of the present application, the host machine actively uninstalls the mount point of the shared file system and repairs the shared file system, that is, the host machine responds to the repair notification information, calls the uninstall command to uninstall the mount point of the shared file, and calls the file system repair tool to repair the shared file system. Automatically repairing the shared file system speeds up the speed of repairing the shared file system, shortens the time of the overall repair process, and does not require manual intervention in the repair process of the shared file system, avoiding the problem of a long repair process due to the user's failure to intervene / respond in time.
[0120] S404: In response to the shared file system being repaired, remount the shared file system on the mount point, and set the health status of the shared file system to a normal status.
[0121] Specifically, when the file system repair tool completes the repair of the shared file system, it will output the repair result; and based on the repair result, it is determined that the problem / fault of the shared file system has been successfully repaired; when it is determined that the shared file system has been successfully repaired, the mount command is called to remount the shared file system to the mount point. Among them, calling the mount command to remount the shared file system to the mount point can be understood as remounting the shared file system so that the operating system (host machine, virtual machine operating system) can access the shared file system through the mount point.
[0122] Specifically, in response to the shared file system being repaired, the health state of the shared file system is set to a normal state.
[0123] In a possible implementation, when the shared file system is successfully repaired, the host will write a normal state to the health state module, that is, actively modify the health state of the shared file system from the repair state to the normal state.
[0124] In another possible implementation, after the shared file system is successfully repaired, the health status of the shared file system stored in the health status module will become normal. The host machine continues to periodically check that the health status of the shared file system is normal, and writes the normal status to the corresponding health status module to change the health status of the shared file system from the repair status to the normal status.
[0125] Furthermore, after the shared file system is remounted on the mount point, the health state of the shared file system is set to a normal state.
[0126] After the shared file system is remounted on the mount point, the health status of the shared file system is set to normal. This avoids the situation where the shared file system has not been mounted yet when the virtual machine sends a new IO request to the corresponding virtual disk in response to the shared file system's health status becoming normal, resulting in abnormal interruption of the IO request (user service).
[0127] S405: Determine whether the last health state of the shared file system is a repair state.
[0128] Specifically, it is determined whether the health status of the shared file system obtained in the previous cycle is a repairing status.
[0129] When the previous health status of the shared file system is the repairing status, that is, the health status of the shared file system is restored to the normal status after the change, it means that the health status of the shared file system is changed from the repairing status to the normal status, and the shared file system is changed from having problems / faults to having no problems / faults, which means that the shared file system has been repaired and successfully repaired, and then S406 is performed.
[0130] When the previous health status of the shared file system is not the repairing status, it actually means that the health status of the shared file system in the previous cycle is normal. The health status of the shared file system has not changed and has been in the normal state. In this case, the health status of the shared file system continues to be obtained periodically.
[0131] In a possible implementation, if there is no previous health status of the shared file system, it is assumed that the health status of the shared file system has not changed and is always in a normal state, and the health status of the shared file system continues to be periodically obtained.
[0132] S406: Release the suspension of the input / output request sent by the virtual machine to the corresponding virtual disk, and open the virtual disk image file stored in the shared file system.
[0133] Specifically, in response to the health state changing to a normal state, the suspension of the input / output request sent by the virtual machine to the corresponding virtual disk is released, and the virtual disk image file stored in the shared file system is opened.
[0134] When the previous health status of the shared file system is the repair status and the current health status of the shared file system is the normal status, it means that the shared file system has been repaired. That is, the shared file system was still being repaired in the previous cycle, so the IO request sent by the virtual machine to the corresponding virtual disk in the previous cycle was still suspended and the virtual disk image file was also in a closed state; in the current cycle, the problem / fault of the shared file system has been successfully repaired, so the virtual disk image file stored in the shared file system is opened, and the IO request sent by the virtual machine to the corresponding virtual disk is released to complete the repair of the shared file system, and the normal read and write operations of the virtual machine on its corresponding virtual disk are restored, that is, the user business of the virtual machine is restored to normal.
[0135] Specifically, in response to the health status changing to normal (when the previous health status of the shared file system is the repairing status and the current health status of the shared file system is the normal status), the virtual machine management software opens the virtual disk image file stored in the shared file system and releases the suspension of input and output requests sent by the virtual machine to the corresponding virtual disk.
[0136] In a possible implementation, the virtual machine management software releases the suspension of the input and output request sent by the virtual machine to the corresponding virtual disk through the IO hang mechanism in the virtual machine management software, that is, in response to obtaining that the health state has changed to the normal state, the virtual machine management software triggers its own IO hang mechanism to release the suspension of the input and output request sent by the virtual machine to the corresponding virtual disk. Exemplarily, the virtual machine management software triggers its own IO hang mechanism to issue a contact suspension instruction through a contact suspension command or a specified application programming interface, thereby contacting the suspension of the IO request sent by the virtual machine to the corresponding virtual disk.
[0137] The embodiment of the present application provides a method for repairing a shared file system, including: periodically obtaining the health status of the shared file system based on a preset period; when the health status of the shared file system is a fault state, suspending the IO request sent by the virtual machine to the corresponding virtual disk and closing the virtual disk image file stored on the shared file system; uninstalling the mount point of the shared file system and repairing the shared file system; in response to the completion of the repair of the shared file system, re-mounting the shared file system on the mount point and setting the health status of the shared file system to a normal state; in response to the health status becoming a normal state, releasing the suspension of the IO request sent by the virtual machine to the corresponding virtual disk, and opening the virtual disk image file stored in the shared file system, thereby completing the repair of the shared file system. In the embodiment of the present application, when there is a fault / problem in the shared file system, it is only necessary to suspend the IO request sent by the virtual machine and close the virtual disk image file, but it is not necessary to shut down the virtual machine, thereby avoiding the interruption of user services, and thus avoiding the economic losses that may be caused by business interruption. In addition, the IO requests sent by the virtual machine are suspended and the virtual disk image file is closed to ensure that the virtual machine will not continue to perform IO operations when there is a problem with the shared file system. The shared file system can be repaired without shutting down the virtual machine. After the shared file system is repaired, the virtual disk image file is opened, the IO requests sent by the virtual machine are unsuspended, and the IO operations are restored and continued, ensuring the continuity of user business.
[0138] Furthermore, the health status of the shared file system is periodically obtained without the need for the user to trigger the computing device to obtain the health status of the shared file system, and the above steps S402-S406 can be automatically executed by the computing device without the need for user triggering, and thus the user does not need to intervene in the repair of the shared file system. And when the health status of the shared file system is a faulty state, a series of repair operations for the shared file system are triggered (suspending IO requests, closing virtual disk image files, unmounting the mount point of the shared file system, and repairing the shared file system), without the need for manual intervention in the repair of the shared file system, and the shared file system is automatically repaired, thereby avoiding the waste of manual resources, and automatically repairing the shared file system, speeding up the speed of repairing the shared file system, shortening the time of the overall repair process, and avoiding the problem of a long repair process due to the user's failure to intervene / respond in time.
[0139] Furthermore, in the embodiment of the present application, no manual intervention is required to repair the shared file system, which reduces the technical requirements for operation and maintenance personnel; and while reducing manual intervention, the risk of misoperation is reduced and labor costs are reduced.
[0140] The above combination Figure 2 , Figure 3 and Figure 4The specific implementation steps of a shared file system repair method provided by an embodiment of the present application are described in detail. From the above description, it can be seen that the shared file system repair method provided by an embodiment of the present application is implemented based on the interaction between a newly added health monitoring (Health Monitor) module in the virtual machine management software and the host machine. Among them, the health monitoring module in the virtual machine management software can be created by adding new firmware (Firmware, FW) in the virtual machine management software.
[0141] For ease of understanding, the following Figure 5 An example is given to introduce a method for repairing a shared file system provided in an embodiment of the present application: the host machine periodically detects the health status of the shared file system in advance, and writes the status value corresponding to the health status of the shared file system into the local health status module of the host machine.
[0142] like Figure 5 As shown, the health monitoring module periodically reads the status value of the health status module based on a preset period, and obtains the health status of the corresponding shared file system based on the status value; when the health monitoring module determines that the health status of the shared file system changes from a normal state to a fault state, the IO request sent by the virtual machine to the corresponding virtual disk is suspended, the virtual disk image file stored in the shared file system is closed, and the status value stored in the health status module is modified to a status value corresponding to the repair state; the health monitoring module sends a repair notification message to the host machine; the host machine responds to the repair notification message, unmounts the mount point of the shared file system, and repairs the shared file system; when the host machine successfully repairs the shared file system, the shared file system is remounted to the mount point, and the status value stored in the health status module is modified from the status value corresponding to the repair state to the status value corresponding to the normal state; when the health monitoring module determines that the health status of the shared file system changes from a repair state to a normal state, the virtual disk image file stored in the shared file system is opened, and the suspension of the IO request sent by the virtual machine to the corresponding virtual disk is released to complete the repair of the shared file system.
[0143] Combine the following Figure 6 , the initialization process of the health monitoring module in the embodiment of the present application is introduced in detail.
[0144] like Figure 6 As shown, an initialization process of a health monitoring module provided in an embodiment of the present application includes the following steps:
[0145] S601 . In response to the initialization start, the virtual machine management software adds a new virtual disk to the virtual machine.
[0146] Specifically, in response to the initialization start, the virtual machine management software adds a new virtual disk to the virtual machine based on the virtual disk image file stored in the shared file system for storage of the virtual machine, and the added new virtual disk is associated with the virtual disk image file stored in the shared file system. It can also be understood that: in response to the initialization start, the virtual machine management software adds a new virtual disk to the virtual machine based on the virtual disk image file in the shared file system format.
[0147] Among them, the virtual disk image file in the shared file system format is: a virtual disk image file stored on a storage device in the shared file system format. The storage device in the shared file system format is actually a storage device managed by the shared file system, so that multiple nodes can access data on the storage device at the same time.
[0148] For example, taking the shared file system as the OCFS2 file system, storage device A storing virtual disk image file a, and storage device B storing virtual disk image file b as an example, storage device A and storage device B are formatted into the OCFS2 file system format. It can be understood that the OCFS2 file system virtualizes storage device A and storage device B into a logically shared clustered storage pool. Then, the virtual disk image file a and the virtual disk image file b can be understood as being stored on the OCFS2 file system, and therefore can be called virtual disk image file a and virtual disk image file b in the OCFS2 file system format.
[0149] S602: The virtual machine management software initializes a health monitoring module.
[0150] The virtual machine management software initializes the health monitoring module so that the health monitoring module can detect the health status of the shared file system.
[0151] Among them, initializing the health monitoring module includes: initializing the timer module, and initializing the detection period of the timer to a preset period, so that the timer module periodically obtains the health status of the shared file system based on the preset period. Initializing the health monitoring module also includes: defining a triggering mechanism of the health monitoring module, specifically, defining that when the health monitoring module responds to the shared file system's health status as a fault state, a repair mechanism is triggered; defining that when the health monitoring module responds to the shared file system's health status becoming a normal state (i.e., the previous health status of the shared file system is obtained as a repair state, and the current shared file system's health status is a normal state), a recovery mechanism is triggered.
[0152] The repair mechanism is as follows: the health monitoring module suspends the IO request sent by the virtual machine to the corresponding virtual disk, closes the virtual disk image file stored in the shared file system; and sends a repair notification message to the host machine, so that the host machine responds to the repair notification message, unmounts the mount point of the shared file system, and repairs the shared file system.
[0153] Furthermore, the repair mechanism also includes: when the health monitoring module sends an IO request to the corresponding virtual disk when the virtual machine is hung and the virtual disk image file stored in the shared file system is closed, the health status or status value stored in the health status module is modified to a repair status or its corresponding status value.
[0154] The recovery mechanism is as follows: the health monitoring module opens the virtual disk image file stored in the shared file system and releases the suspension of the IO request sent by the virtual machine to the corresponding virtual disk to resume the IO operation.
[0155] In a possible implementation, initializing the health monitoring module further includes: defining that if the health status of the shared file system obtained by the health monitoring module is an abnormal state, then triggering an abnormal prompt mechanism.
[0156] The abnormal prompt mechanism is: the health monitoring module generates abnormal prompt information to prompt that the health status of the shared file system is abnormal.
[0157] S603: The virtual machine management software registers a corresponding callback function.
[0158] A callback function is a programming technique that allows you to pass a function as a parameter to another parameter and call the passed function at the appropriate time.
[0159] Specifically, the virtual machine management software registers a corresponding callback function so that when the health status of the shared file system obtained by the health monitoring module is a fault state (that is, when the health status of the shared file system changes from a normal state to a fault state), the registered corresponding callback function is called to implement the corresponding repair mechanism; when the health monitoring module responds to the health status of the shared file system changing to a normal state (that is, when the previous health status of the shared file system obtained is a repair state, and the current health status of the shared file system is a normal state), the registered corresponding callback function is called to implement the corresponding recovery mechanism.
[0160] Exemplarily, one or more callback functions are defined to be called when the health monitoring module obtains that the health status is a fault state, for example: a callback function named handleIOFreeze and closeVDI is used to suspend IO requests and close the virtual disk image file; the virtual machine management software registers the above handleIOFreeze and closeVDI callback function to the health monitoring module, so that when the health monitoring module obtains that the health status of the shared file system is a fault state, it calls the handleIOFreeze and closeVDI callback function, thereby implementing the corresponding repair mechanism.
[0161] Exemplarily, one or more callback functions are defined to be called when the health monitoring module obtains that the health status has changed to a healthy status, for example: a callback function named resumeIORequests and openVDI is used to release the suspension of IO requests and open the virtual disk image file; the virtual machine management software registers the above resumeIORequestsand openVDI callback function to the health monitoring module, so that when the health monitoring module obtains that the health status of the shared file system has changed to a normal state, it calls the resumeIORequests and openVDI callback function, thereby implementing the corresponding recovery mechanism.
[0162] In a possible implementation, the callback function corresponding to the registration of the virtual machine management software also includes: a callback function called when the health status of the shared file system obtained by the health monitoring module is abnormal, so as to implement a corresponding abnormal prompt mechanism.
[0163] In addition, an embodiment of the present application further provides a computing device, the server including a processor and a memory, the processor is coupled to the memory, the memory stores computer-executable instructions, and when the processor executes the computer-executable instructions, the shared file system repair method in the above embodiment is implemented.
[0164] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer executes the method for repairing a shared file system in the above embodiment.
[0165] For the explanation of the relevant contents and description of the beneficial effects of any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.
[0166] The present application embodiment also provides a computer program product including instructions, when the instructions are run on a computer, the computer executes any one of the above-mentioned methods for repairing a shared file system. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that may be integrated with one or more available media. The available media may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD), etc.
[0167] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.
[0168] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0169] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0170] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for repairing a shared file system, characterized in that: Applied to a computing device, wherein a virtual machine is running on the computing device, the method comprises: Acquire a health status of a shared file system, where the health status is used to characterize an operation status of the shared file system, and the health status includes a fault status, where the fault status includes: metadata of the shared file system is in a damaged state; In response to the health status being a fault state, suspending the input and output request sent by the virtual machine to the corresponding virtual disk, closing the virtual disk image file stored in the shared file system, unmounting the mount point of the shared file system, and repairing the shared file system; In response to completion of repairing the shared file system, remounting the shared file system on the mount point; The suspension of the input and output request is released, and the virtual machine disk image file stored in the shared file system is opened.
2. The method according to claim 1, characterized in that The obtaining of the health status of the shared file system includes: Based on a preset period, periodically obtaining a health status of the shared file system, wherein the health status includes the fault status and the normal status; The method further includes: in response to completion of repairing the shared file system, setting the health status of the shared file system to a normal status.
3. The method according to claim 2, characterized in that The step of setting the health status of the shared file system to a normal state comprises: After re-mounting the shared file system on the mount point, the health state of the shared file system is set to a normal state.
4. The method according to claim 2, characterized in that: The periodically obtaining the health status of the shared file system based on a preset period includes: Based on a preset period, a health status module corresponding to the shared file system is periodically read to obtain the health status of the shared file system; wherein the health status module is a storage space on the computing device for storing the health status of the shared file system.
5. The method according to claim 2, characterized in that: The health status of the shared file system further includes: a repair status, and the method further includes: In response to the health state being a fault state, the fault state is modified to a repair state.
6. The method according to claim 5, characterized in that The releasing of the suspension of the input / output request comprises: In response to the health status being a normal status, determining whether a previous health status of the shared file system was a repairing status; In response to the last health state being the repair state, the virtual machine management software triggers its own IO hang mechanism to release the suspension of the input and output request.
7. The method according to claim 5, characterized in that The health status of the shared file system also includes an abnormal state, which is a general term for states other than a normal state, a fault state, and a repair state. The method further includes: In response to the health status being an abnormal state, abnormal prompt information is generated to prompt that the health status of the shared file system is an abnormal state.
8. The method according to claim 1, characterized in that: In response to the health state being a fault state, suspending the input / output request sent by the virtual machine to the corresponding virtual disk includes: In response to the health status being a fault state, the virtual machine management software triggers its own IO hang mechanism to suspend the input and output requests sent by the virtual machine to the corresponding virtual disk.
9. The method according to claim 1, characterized in that: The unmounting of the mount point of the shared file system includes: automatically unmounting the mount point of the shared file system.
10. A computing device, characterized in that include: Processor and memory: the processor and the memory are coupled; The memory is used to store computer program instructions; The processor is used to run the computer program instructions stored in the memory, so that the computing device executes the shared file system repair method according to any one of claims 1 to 9.