Method and apparatus for saving fault information of virtual machine, and storage medium and electronic device

By obtaining and converting the fault information of a virtual machine to the host when it fails, the problem of difficulty in obtaining fault information inside the virtual machine is solved, achieving rapid fault location and saving storage space.

WO2024174740A1PCT designated stage expired Publication Date: 2024-08-29ZTE CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/143720
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-23
Filing Date
2023-12-30
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

When a virtual machine fails internally, the lack of kdump service results in the inability to obtain kernel or user mode fault information, making it difficult to locate the fault, resulting in security risks and economic losses.

Method used

When a virtual machine fails, its internal fault information is obtained, the physical address is converted into the virtual address of the host, and the fault information is saved to the host to realize the storage and location of the fault information.

Benefits of technology

You can quickly locate faults without entering the inside of the virtual machine, saving fault location time and cost, and saving virtual machine storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023143720_29082024_PF_FP_ABST
    Figure CN2023143720_29082024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a method and apparatus for storing fault information of a virtual machine, and a storage medium and an electronic device. The method comprises: when a virtual machine has a fault, acquiring internal fault information of the virtual machine, wherein the virtual machine runs on a host machine; converting a physical address of the virtual machine in the internal fault information into a virtual address of the host machine; and acquiring the internal fault information of the virtual machine according to the virtual address, and storing the internal fault information in the host machine.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, storage medium and electronic device for storing virtual machine fault information

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] The present disclosure is based on Chinese patent application No. 2023102029060, filed on February 23, 2023, entitled “Method, device, storage medium and electronic device for saving virtual machine fault information”, and claims the priority of the patent application, and all the contents disclosed therein are incorporated into the present disclosure by reference. Technical Field

[0003] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a method, device, storage medium, and electronic device for storing virtual machine fault information. Background Art

[0004] The use of virtualization technology can effectively reduce management costs, improve resource utilization and system compatibility, and has strong usability and portability. With the rapid development of virtualization technology, virtual machines have been widely used in the commercial field.

[0005] However, when a fault occurs within a virtual machine, due to insufficient storage space and the lack of a kdump service (kdump refers to a tool and service used to dump memory operating parameters when the system crashes, deadlocks, or freezes), it is impossible to obtain kernel or user-mode fault information, making it difficult to locate the virtual machine fault, which will cause great security risks and economic losses.

[0006] Currently, no effective solution has been found for the above-mentioned problems existing in the related technologies.

[0007] Summary of the Invention

[0008] Embodiments of the present disclosure provide a method, device, storage medium, and electronic device for storing virtual machine fault information.

[0009] According to one aspect of an embodiment of the present disclosure, a method for saving virtual machine fault information is provided, comprising: when a virtual machine fails, obtaining internal fault information of the virtual machine, wherein the virtual machine runs on a host machine; converting the physical address of the virtual machine in the internal fault information into a virtual address of the host machine; obtaining the internal fault information of the virtual machine based on the virtual address, and saving the internal fault information to the host machine.

[0010] According to another aspect of an embodiment of the present disclosure, a device for saving virtual machine fault information is provided, including: an acquisition module, configured to obtain internal fault information of the virtual machine when a fault occurs in the virtual machine, wherein the virtual machine runs on a host machine; a conversion module, configured to convert the physical address of the virtual machine in the internal fault information into a virtual address of the host machine; a storage module, configured to obtain the internal fault information of the virtual machine based on the virtual address, and save the internal fault information to the host machine.

[0011] According to another aspect of an embodiment of the present disclosure, a storage medium is further provided. The storage medium includes a stored program, and the above steps are executed when the program is run.

[0012] According to another aspect of an embodiment of the present disclosure, an electronic device is also provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: the memory is configured to store a computer program; and the processor is configured to execute the steps in the above method by running the program stored in the memory.

[0013] The embodiment of the present disclosure further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps in the above method. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the drawings:

[0015] FIG1 is a block diagram of the hardware structure of a computer according to an embodiment of the present disclosure;

[0016] FIG2 is a flowchart of a method for storing virtual machine fault information according to an embodiment of the present disclosure;

[0017] FIG3 is a system structure diagram in an implementation scenario according to the first embodiment of the present disclosure;

[0018] FIG4 is a flow chart of a method for storing virtual machine fault information in an implementation scenario according to an embodiment of the present disclosure;

[0019] FIG5 is a structural block diagram of an apparatus for storing virtual machine fault information according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure. It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other in the absence of conflict.

[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] Example 1

[0023] The method embodiment provided in the first embodiment of the present disclosure can be executed in a server, a computer, a mobile phone, or a similar computing device. Taking running on a computer as an example, FIG1 is a hardware structure block diagram of a computer in an embodiment of the present disclosure. As shown in FIG1 , the computer may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 configured to store data. The above-mentioned computer may also include a transmission device 106 and an input and output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is only for illustration, and it does not limit the structure of the above-mentioned computer. For example, the computer may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .

[0024] The memory 104 can be configured to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for preserving virtual machine fault information in an embodiment of the present disclosure. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0025] The transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a computer's telecommunications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.

[0026] In this embodiment, a method for saving virtual machine fault information is provided. FIG2 is a flow chart of a method for saving virtual machine fault information according to an embodiment of the present disclosure. As shown in FIG2 , the flow chart includes the following steps:

[0027] S1, when a virtual machine fails, obtaining internal fault information of the virtual machine, wherein the virtual machine runs on a host machine;

[0028] The application scenario of the embodiments of the present disclosure is a host machine that supports virtualization scenarios, which can be a physical server or computer. It also requires the installation of a virtual machine on the physical device, and can be applied to a virtualized environment with one or more virtual machines. A virtual machine refers to a complete computer system with complete hardware system functions, running in a completely isolated environment, simulated by software on the host machine. The host machine includes, but is not limited to, a physical server or computer that supports virtualization scenarios and includes hardware devices such as a central processing unit, disks, and network cards.

[0029] The execution subject of the embodiments of the present disclosure can be a host machine, or it can be other computers, servers or similar computing devices with computing processing capabilities, such as a virtual machine monitor, a software layer installed on the physical hardware of the host machine, configured to create and run virtual machine software, firmware or hardware, and provide a virtual operating platform to run and manage the virtual machine operating system.

[0030] A fault saving device is provided on the virtual machine monitor, wherein the fault saving device is a virtual device of the virtual machine monitor, and is configured to save the last words or key logs of the kernel or user state before the virtual machine becomes abnormal.

[0031] When a virtual machine fails, such as shutting down or crashing, a fault saving device on the virtual machine monitor obtains internal fault information of the virtual machine and saves the fault information in the host machine.

[0032] S2, converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine;

[0033] The virtual machine monitor is responsible for the actual physical memory and needs to allocate and manage the physical memory of each virtual machine. When virtualization is enabled, the physical address of the virtual machine cannot be directly sent to the system bus. The virtual machine monitor needs to convert the physical address of the virtual machine into an actual physical address before handing it over to the physical processor for execution. Therefore, in this example, after obtaining the fault information of the virtual machine, the physical address of the virtual machine in the fault information needs to be converted into the virtual address of the host machine. The conversion method can be achieved by establishing a mapping table between the physical address of the virtual machine and the virtual address of the host machine, and converting the physical address of the virtual machine into the virtual address of the host machine according to the mapping relationship in the mapping table.

[0034] S3: Obtain internal fault information of the virtual machine according to the virtual address, and save the internal fault information to the host machine.

[0035] Afterwards, the fault saving device obtains information about the virtual machine fault from the information after the address conversion, and saves the fault information in the host machine.

[0036] The disclosed embodiment obtains internal fault information of the virtual machine, converts the physical address of the virtual machine in the internal fault information into the virtual address of the host machine, and saves the internal fault information to the host machine, thereby realizing the storage of the virtual machine fault information. By storing the fault information on the host machine, even if the virtual machine does not support the kdump service, the fault can be located based on the fault information stored on the host machine without entering the virtual machine, effectively saving the time cost of fault location. In addition, the stored fault information does not occupy the virtual machine memory, thus saving the storage space of the virtual machine.

[0037] In an implementation of this embodiment, before S1, obtaining internal fault information of the virtual machine, the method further includes:

[0038] S01, receiving a fault save signal sent by a fault notification device calling an exception notification function, wherein the fault notification device is a driver module within the virtual machine operating system, and the exception notification function is registered in the notification chain of the virtual machine operating system crash process and is used to instruct to perform a fault save when the virtual machine fails;

[0039] In this example, the virtual machine is provided with a fault notification device, which is a driver module inside the virtual machine operating system. The fault notification device can be abstracted as a character device and configured to notify the fault saving device in the virtual machine monitor to perform fault saving when the virtual machine operating system crashes.

[0040] When a fault occurs inside the virtual machine, the fault notification device inside the virtual machine will be triggered to call the abnormal notification function registered in the abnormal process of the virtual machine to send a fault saving signal, notifying the fault saving device in the virtual machine monitor to save the fault information.

[0041] S02, responding to the fault saving signal, confirming to obtain internal fault information of the virtual machine.

[0042] After receiving the fault saving signal sent by the fault notification device, the fault saving device responds to the signal, obtains the internal fault information of the virtual machine, and saves the fault information in the host machine.

[0043] The embodiment of the present disclosure saves the fault by receiving a fault saving signal sent by a fault notification device in a virtual machine using an abnormal notification function, so that the fault saving is more timely.

[0044] In another example, when an application process crashes, the application program may write fault information to the read / write interface of the fault notification device, actively triggering the abnormal notification function of the notification device to send a signal to notify the fault saving device in the virtual machine monitor.

[0045] In one example, S1, obtaining internal fault information of the virtual machine, includes:

[0046] S11. Obtain internal fault information sent by the virtual machine using a first physical address from the physical memory of the virtual machine, wherein the physical memory is used to store the runtime fault information of the virtual machine, and the internal fault information includes kernel fault information stored using a second physical address and a first configuration parameter, and user-mode fault information stored using a third physical address and a second configuration parameter.

[0047] The first physical address is the physical first address of the memory in the virtual machine fault notification device for storing the virtual machine runtime fault information, and can be set when the virtual machine is initialized.

[0048] User state and kernel state are designed to protect permissions by setting different scopes for resources. When executing in user state, a process is restricted in the memory space and objects it can access, and its occupied processor is preemptible. When executing in kernel state, it can access all memory spaces and objects, and its occupied processor cannot be preempted.

[0049] In this example, the second physical address and the first configuration parameters are used to store kernel fault information when the virtual machine fails, and the third physical address and the second configuration parameters are used to store user-state fault information when the virtual machine fails. The second physical address is the physical first address for storing the virtual machine kernel fault information, and the third physical address is the physical first address for storing the user-state fault information. The configuration parameters are the data format, content, length, etc. of the fault information storage. The physical address and configuration parameters can be configured through the read and write interface of the virtual machine.

[0050] In one example, before obtaining, from a physical memory of a virtual machine, internal fault information sent by the virtual machine using a first physical address, the method includes:

[0051] Creating a ring-shaped storage physical memory in the virtual machine, and configuring the first address of the physical memory as a first physical address;

[0052] Ring storage refers to a custom or dynamically allocated continuous data storage area. Data is read and written in this continuous storage area through two indexes, head and tail, thus forming a closed loop for this continuous data storage area. In this example, the host machine starts normally, the virtualization environment is successfully configured, the virtual machine operating system is started, and the fault notification device in the virtual machine applies for a section of memory for storing virtual machine runtime fault information. This is managed using a ring storage method and the physical starting address of this memory segment is configured as the first physical address GPA1, where GPA (full name: Guest Physical Address) represents the physical address of the virtual machine.

[0053] The second physical address and the first configuration parameter about the kernel fault information are configured in the physical memory through the read / write interface of the virtual machine, and the third physical address and the second configuration parameter about the user state fault information are configured.

[0054] The fault notification device on the virtual machine provides a kernel state and user state read and write interface, through which the kernel fault information physical first address GPA2 and related parameters args are transmitted. a(i.e. the first configuration parameter) and the virtual machine user state fault information physical first address GPA3 and related parameters args b (i.e. the second configuration parameter) is saved to the physical memory of the ring storage. Among them, the first configuration parameter args of the kernel fault information a ={arg a0 ,arg a1 ,arg a2 ,...}, which are respectively the kernel log content, log line number, log level, log current readable index number, log readable location, log current writable index number, log writable location, etc. The second configuration parameter args for user state fault information b= {arg b0 ,arg b1 ,arg b2 ,...}, which are respectively the user-mode log content, log line number, log level, current readable log index number, log readable location, current writable log index number, log writable location, etc.

[0055] The disclosed embodiment implements the creation of physical memory, physical address, and configuration parameters.

[0056] In one example, S2, converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine, includes:

[0057] S21, obtaining a first physical address in the internal fault information, and converting the first physical address into a first virtual address of a host machine;

[0058] The first physical address is the first physical memory address of the virtual machine. GPA1 is transmitted to the fault saving device through the input and output ports. The fault saving device converts GPA1 into a virtual address HVA1 in the host machine, where HVA stands for Host Virtual Address, which represents the host machine virtual address.

[0059] S22: acquiring, from the internal fault information based on the first virtual address, kernel fault information stored using the second physical address and the first configuration parameter, and user state fault information stored using the third physical address and the second configuration parameter;

[0060] After converting GPA1 to HVA1, the host uses HVA1 to retrieve the physical address GPA2 of the kernel state fault information, the physical address GPA3 of the user state fault information, and the related parameters args a and args b .

[0061] S23, converting the second physical address into a second virtual address of the host machine;

[0062] S24: Convert the third physical address into a third virtual address of the host machine.

[0063] GPA2 and GPA3 are converted into virtual addresses HVA2 and HVA3 in the host machine respectively according to the mapping relationship in the mapping table.

[0064] This embodiment realizes the conversion between the physical address of the virtual machine and the virtual address of the host machine.

[0065] In one example, S3, obtaining internal fault information of the virtual machine according to the virtual address, and saving the internal fault information to the host machine, includes:

[0066] S31, obtaining kernel log information and user state information of the virtual machine according to the virtual address;

[0067] S32: Save the kernel log information and the user state information to the host machine.

[0068] After converting the virtual machine's physical addresses GPA2 and GPA3 into the host machine's virtual addresses HVA2 and HVA3, this example is based on HVA2, HVA3, args a and args b Obtain the contents of the virtual machine kernel log information and user state information, such as the kernel state and user state log content, log line number, log level, current readable log index number, log readable location, current writable log index number, log writable location, etc. when the above-mentioned fault occurs, and save them to the host machine.

[0069] In one embodiment, S32, saving the kernel log information and the user state information to the host machine, includes:

[0070] S321, determining the time when the failure of the virtual machine occurs;

[0071] In this example, virtual machine fault information is managed by time. You can determine the time when the fault occurred by querying the log information.

[0072] S322: Save the kernel log information and the user state information to the host machine according to the fault occurrence time.

[0073] The fault information is saved according to the time when the fault occurred. For example, a suffix representing the fault time is added to the file name of the fault information, and the kernel log information and user state information are stored in chronological order.

[0074] In this example, fault information is managed according to the time of fault occurrence, making the storage of fault information more standardized and clear.

[0075] The following fully explains the embodiments of the present disclosure through an implementation scenario.

[0076] 3 , which is a system structure diagram in an implementation scenario according to an embodiment of the present disclosure, as shown in FIG3 , the system includes: a host machine 101, a virtual machine monitor 102, a virtual machine 103, a virtual machine operating system 104, a fault notification device 105, and a fault saving device 106, wherein,

[0077] Host machine 101, which includes but is not limited to a physical server or computer with hardware devices such as a central processing unit, disks, and network cards, and can support virtualization scenarios;

[0078] A virtual machine monitor 102 is configured to be software, firmware, or hardware for creating and running virtual machines, providing a virtual operating platform for running and managing virtual machine operating systems;

[0079] The virtual machine 103 is a complete computer system with complete hardware system functions and running in a completely isolated environment, which is simulated by software in the host machine 101;

[0080] A virtual machine operating system 104 configured to manage and control the hardware and software resources of the host machine 101;

[0081] The fault notification device 105 is a driver module inside the virtual machine operating system 104, which is configured to notify the fault saving device in the virtual machine monitor 102 when 104 crashes;

[0082] The fault saving device 106 is a virtual device of the virtual machine monitor 102, and is configured to save the last words or key logs of the kernel or user state before the virtual machine exception occurs.

[0083] 4 , which is a flow chart of a method for storing virtual machine fault information in an implementation scenario according to an embodiment of the present disclosure, and applied to the system in FIG. 3 , as shown in FIG. 4 , the process includes:

[0084] S401, the virtual machine operating system starts;

[0085] The host machine starts normally, the virtualization environment is configured successfully, and the fault saving device is initialized in the virtual machine monitor.

[0086] For example, the Hygon physical server serving as the host machine is started normally, the virtualization environment is configured, a qemu virtual machine is created on the Hygon server, qemu-kvm is used as the virtual machine monitor, and the virtualization of the fault saving device is completed in qemu.

[0087] S402, initialization of the fault notification device;

[0088] The virtual machine operating system starts and completes the initialization of the fault notification device, including:

[0089] In the virtual machine, a memory segment is allocated for the fault notification device to store the fault information during the virtual machine runtime, and is managed in a ring storage manner. The physical first address of the memory segment is GPA1.

[0090] Abstract the fault notification device as a character device and register it to provide kernel and user mode read and write interfaces. Use the read and write interfaces to send the kernel fault information physical first address GPA2 and related parameters args a And the virtual machine user state fault information physical first address GPA3 and related parameters args b Save to the exposed physical memory, where args a ={arg a0 ,arg a1 ,arg a2 ,...}; args b ={arg b0 ,arg b1 ,arg b2 ,...};

[0091] Specifically, args a ={arg a0 =content, arg a1 =Number of lines,arg a2 = Current readable index number of user state information, arg a3 =Location where the log is readable, arg a4 =The current writable index number of the log, arg a5 = location where the log can be written}; args b ={arg b0 =Log content,arg b1 =Number of log lines,arg b2 =log level,arg b3 =The index number of the log currently readable, arg b4 =Location where the log is readable, arg b5 =The current writable index number of the log, arg b6 =Location where the log can be written};

[0092] An abnormal notification function in the fault notification device for notifying the fault saving device is registered on a notification chain of a virtual machine operating system crash process.

[0093] S403, determine whether the virtual machine is down, if the virtual machine is down, execute S404;

[0094] S404, the fault notification device sends a signal to the fault storage device;

[0095] When a fault occurs inside the virtual machine, the fault notification device uses the above-mentioned exception notification function to send a signal to notify the fault saving device in the virtual machine monitor.

[0096] S405: The fault saving device saves the virtual machine kernel information to the host machine.

[0097] After receiving the save notification, the fault save device of the virtual machine monitor converts GPA1 into the virtual address HVA1 in the host machine, and uses HVA1 to retrieve GPA2, GPA3, and args a and args b ;

[0098] Convert GPA2 and GPA3 to virtual addresses HVA2 and HVA3 in the host machine respectively, and based on HVA2, HVA3, args a and args b Obtain the contents of the virtual machine kernel log information and user state information and save them to the host machine;

[0099] The fault storage device is used to manage the logs in the host machine according to the date based on the time when the fault occurred.

[0100] The embodiment of the present disclosure triggers a fault notification device inside the virtual machine to notify a fault preservation device in the virtual machine monitor when a fault occurs inside the virtual machine. The fault preservation device saves the last words or key logs of the kernel or user state before the virtual machine abnormality by retaining the internal memory of the virtual machine. The key information when the virtual machine crashes is saved in the host machine in a lightweight manner, and the fault can be quickly located without entering the virtual machine, thereby effectively saving the time cost of fault location.

[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0102] Example 2

[0103] This embodiment also provides a device for storing virtual machine fault information, configured to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0104] FIG5 is a structural block diagram of a device for storing virtual machine fault information according to an embodiment of the present disclosure. As shown in FIG5 , the device includes: an acquisition module 100, a conversion module 200, and a storage module 300, wherein:

[0105] an acquisition module 100 configured to acquire internal fault information of a virtual machine when a fault occurs in the virtual machine, wherein the virtual machine runs on a host machine;

[0106] The conversion module 200 is configured to convert the physical address of the virtual machine in the internal fault information into the virtual address of the host machine;

[0107] The storage module 300 is configured to obtain internal fault information of the virtual machine according to the virtual address, and save the internal fault information to the host machine.

[0108] Optionally, the device also includes: a receiving module, configured to receive a fault save signal sent by a fault notification device calling an exception notification function, wherein the fault notification device is a driver module inside the virtual machine operating system, and the exception notification function is registered on the notification chain of the virtual machine operating system crash process, and is used to instruct fault saving when the virtual machine fails; a confirmation module, configured to respond to the fault save signal and confirm the acquisition of internal fault information of the virtual machine.

[0109] Optionally, the acquisition module also includes: a first acquisition unit, configured to obtain internal fault information sent by the virtual machine using a first physical address from the physical memory of the virtual machine, wherein the physical memory is configured to store the runtime fault information of the virtual machine, and the internal fault information includes kernel fault information stored using a second physical address and a first configuration parameter, and user state fault information stored using a third physical address and a second configuration parameter.

[0110] Optionally, the acquisition module also includes: a creation unit, configured to create a physical memory for circular storage in the virtual machine, and configure the first address of the physical memory as a first physical address; a configuration unit, configured to configure a second physical address and a first configuration parameter about kernel fault information in the physical memory through the read-write interface of the virtual machine, and configure a third physical address and a second configuration parameter about user-state fault information.

[0111] Optionally, the conversion module includes: a first conversion unit, configured to obtain the first physical address in the internal fault information and convert the first physical address into a first virtual address of the host machine; a second acquisition unit, configured to obtain kernel fault information stored using a second physical address and first configuration parameters, and user-mode fault information stored using a third physical address and second configuration parameters from the internal fault information based on the first virtual address; a second conversion unit, configured to convert the second physical address into a second virtual address of the host machine; and a third conversion unit, configured to convert the third physical address into a third virtual address of the host machine.

[0112] Optionally, the storage module includes: a third acquisition unit, configured to obtain kernel log information and user state information of the virtual machine according to the virtual address; and a storage unit, saving the kernel log information and the user state information to the host machine.

[0113] Optionally, the storage unit includes: a storage subunit, configured to determine the time when the failure of the virtual machine occurs; and save the kernel log information and the user state information to the host machine according to the time when the failure occurs.

[0114] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0115] Example 3

[0116] An embodiment of the present disclosure further provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0117] In this embodiment, the storage medium may be configured to store a computer program configured to perform the following steps:

[0118] S1, when a virtual machine fails, obtaining internal fault information of the virtual machine, wherein the virtual machine runs on a host machine;

[0119] S2, converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine;

[0120] S3: Obtain internal fault information of the virtual machine according to the virtual address, and save the internal fault information to the host machine.

[0121] In this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0122] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0123] The electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0124] In this embodiment, the processor may be configured to execute the following steps through a computer program:

[0125] S1, when a virtual machine fails, obtaining internal fault information of the virtual machine, wherein the virtual machine runs on a host machine;

[0126] S2, converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine;

[0127] S3: Obtain internal fault information of the virtual machine according to the virtual address, and save the internal fault information to the host machine.

[0128] Through the embodiments of the present disclosure, when a virtual machine fails, internal fault information of the virtual machine is obtained, wherein the virtual machine runs on a host machine; the physical address of the virtual machine in the internal fault information is converted into a virtual address of the host machine; the internal fault information of the virtual machine is obtained according to the virtual address, and the internal fault information is saved in the host machine, thereby realizing the storage of the virtual machine fault information, and the acquired fault information is stored on the host machine. Even in the case that the virtual machine does not support the kdump service, the fault can be located according to the fault information stored on the host machine, thereby eliminating the need to enter the virtual machine, effectively saving the time cost of fault location, and the stored fault information does not occupy the virtual machine memory, saving the virtual machine storage space.

[0129] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0130] The serial numbers of the above-mentioned embodiments of the present disclosure are for description only and do not represent the advantages or disadvantages of the embodiments.

[0131] In the above embodiments of the present disclosure, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0132] In the several embodiments provided in the present disclosure, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0133] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0134] In addition, the functional units in the various embodiments of the present disclosure may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0136] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present disclosure. These improvements and modifications should also be regarded as within the scope of protection of the present disclosure.

Claims

1. A method for storing virtual machine fault information, the method comprising: When a virtual machine fails, internal fault information of the virtual machine is obtained, wherein the virtual machine runs on a host machine; Converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine; The internal fault information of the virtual machine is obtained according to the virtual address, and the internal fault information is saved in the host machine.

2. The method of claim 1, wherein: Before obtaining the internal fault information of the virtual machine, the method further includes: Receive a fault saving signal sent by a fault notification device calling an abnormal notification function, wherein the fault notification device is a driver module inside the virtual machine operating system, and the abnormal notification function is registered in the notification chain of the virtual machine operating system crash process, and is used to instruct fault saving when the virtual machine fails; In response to the fault saving signal, confirm obtaining the internal fault information of the virtual machine.

3. The method of claim 1, wherein: The obtaining of internal fault information of the virtual machine includes: Obtain internal fault information sent by the virtual machine using a first physical address from the physical memory of the virtual machine, wherein the physical memory is used to store the runtime fault information of the virtual machine, and the internal fault information includes kernel fault information stored using a second physical address and a first configuration parameter, and user state fault information stored using a third physical address and a second configuration parameter.

4. The method of claim 3, wherein: Before obtaining the internal fault information sent by the virtual machine using the first physical address from the physical memory of the virtual machine, the method includes: Creating a physical memory of a ring storage in the virtual machine, and configuring a first address of the physical memory as a first physical address; The second physical address and the first configuration parameter about the kernel fault information are configured in the physical memory through the read / write interface of the virtual machine, and the third physical address and the first configuration parameter about the user state fault information are configured. address and second configuration parameters.

5. The method of claim 4, wherein: The converting the physical address of the virtual machine in the internal fault information into the virtual address of the host machine includes: Acquire a first physical address in the internal fault information, and convert the first physical address into a first virtual address of a host machine; Based on the first virtual address, obtaining kernel fault information stored using a second physical address and a first configuration parameter, and user state fault information stored using a third physical address and a second configuration parameter from the internal fault information; Converting the second physical address into a second virtual address of the host machine; The third physical address is converted into a third virtual address of the host machine.

6. The method of claim 1, wherein: The acquiring the internal fault information of the virtual machine according to the virtual address and saving the internal fault information to the host machine includes: Acquire kernel log information and user state information of the virtual machine according to the virtual address; The kernel log information and the user state information are saved in the host machine.

7. The method of claim 6, wherein: The step of saving the kernel log information and the user state information to the host machine includes: Determining the time when the failure of the virtual machine occurred; The kernel log information and the user state information are saved in the host machine according to the fault occurrence time.

8. A device for storing virtual machine fault information, the device comprising: an acquisition module, configured to acquire internal fault information of the virtual machine when a fault occurs in the virtual machine, wherein the virtual machine runs on the host machine; A conversion module, configured to convert the physical address of the virtual machine in the internal fault information into the virtual address of the host machine; The storage module is configured to obtain the internal fault information of the virtual machine according to the virtual address, and save the internal fault information to the host machine.

9. A storage medium comprising a stored program, wherein: When the program is executed, the steps of the method according to any one of claims 1 to 7 are executed.

10. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface, and the memory communicate with each other via a communication bus; wherein: a memory arranged to store a computer program; A processor, configured to execute the steps of any one of the methods of claims 1 to 7 by running a program stored in a memory.

Citation Information

Patent Citations

  • XenServer-platform-oriented Virtual machine memory evidence collection method

    CN107621971A

  • A method and device for processing information

    CN109597677A

  • Data processing method and system

    CN114756325A

  • Apparatus and control method for hypervisor to obtain faulting instruction

    US20150169348A1