Hot upgrade method and equipment for virtual machine

By creating QEMU components of multiple child threads on the DPU and synchronizing status information during the virtual machine hot upgrade, the problem of long downtime in the virtual machine hot upgrade is solved, and zero downtime and performance improvement is achieved.

CN119201190AActive Publication Date: 2024-12-27BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411376852.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-27
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

In the prior art, there is a long downtime during the thermal upgrade of virtual machines, which affects business performance.

Method used

Create QEMU components of multiple child threads on the data processor DPU, create new QEMU components in response to hot upgrade instructions, pause the old components and synchronize status information, and receive IO requests through the new components to avoid pausing VCPU threads on the physical machine.

Benefits of technology

实现了虚拟机热升级的零宕机时间,减少了虚拟机升级过程中的宕机时间,提高了业务性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201190A_ABST
    Figure CN119201190A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a hot upgrade method and equipment for virtual machines, and the method comprises the steps: creating a QEMU component corresponding to each virtual machine on a DPU (Data Processing Unit), and enabling sub-threads in the QEMU component to be in one-to-one correspondence with VCPU (Virtual Central Processing Unit) threads at a physical machine side, and to be used for receiving and processing IO (Input / Output) requests sent by the VCPU threads; in response to a hot upgrade instruction for a target QEMU component corresponding to the target virtual machine, creating a new QEMU component corresponding to the target virtual machine on the DPU; suspending a target QEMU component on the DPU, storing state information of each sub-thread in the target QEMU component, and synchronizing the state information of each sub-thread to a new QEMU component; and receiving and processing an IO request sent by the VCPU thread through the new QEMU component. According to the method, the downtime in the hot upgrade process of the virtual machine can be shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the technical field of virtual machines, and in particular to a method and device for hot upgrading a virtual machine. Background Art

[0002] In virtualization scenarios, feature iterations and bug fixes for virtual machines require the release of new component versions. In order not to affect running virtual machines, hot upgrade capabilities are usually used to upgrade virtual machine components to the latest versions.

[0003] In the prior art, the hot upgrade process of a virtual machine is similar to the hot migration of a virtual machine, specifically including: using a new KVM (Kernel-Based Virtual Machine) component and a QEMU (Quick Emulator) component to start a new virtual machine, then pausing the running virtual machine, synchronizing the state that the virtual machine needs to guarantee to the new virtual machine, then starting the new virtual machine to run, and exiting the old virtual machine at the same time, so that there is no need to restart the virtual machine to achieve the hot upgrade of the QEMU component and the KVM component. Although the hot upgrade does not require the virtual machine to be shut down and restarted, it is also necessary to pause the virtual machine to save and restore the state. Therefore, there will be a short period of virtual machine service unavailability during the hot upgrade. This period of time is called the downtime of the virtual machine hot upgrade.

[0004] The inventors have discovered that the prior art has at least the following technical problems: when a virtual machine is hot-upgraded using the prior art, the virtual machine experiences a long downtime. Summary of the invention

[0005] The embodiments of the present disclosure provide a method and device for hot upgrading a virtual machine, which can reduce the downtime during the hot upgrading of the virtual machine.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for hot upgrading a virtual machine, comprising:

[0007] A fast simulator QEMU component corresponding to each virtual machine is created on a data processor DPU, wherein the QEMU component includes a plurality of sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process IO (Input / Output) requests sent by the VCPU threads corresponding thereto;

[0008] In response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, creating a new QEMU component corresponding to the target virtual machine on the DPU;

[0009] Pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component;

[0010] The IO request sent by the VCPU thread is received and processed by the new QEMU component.

[0011] In a second aspect, an embodiment of the present disclosure provides a hot upgrade device for a virtual machine, including:

[0012] A creation unit, used to create a fast simulator QEMU component corresponding to each virtual machine on a data processor DPU, wherein the QEMU component includes a plurality of sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding thereto;

[0013] A hot upgrade unit, configured to create a new QEMU component corresponding to the target virtual machine on the DPU in response to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine;

[0014] A synchronization unit, configured to pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component;

[0015] A processing unit is used to receive and process the IO request sent by the VCPU thread through the new QEMU component.

[0016] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;

[0017] The memory stores computer-executable instructions;

[0018] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the hot upgrade method of the virtual machine as described in the first aspect and various possible designs of the first aspect.

[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the hot upgrade method of the virtual machine described in the first aspect and various possible designs of the first aspect is implemented.

[0020] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the hot upgrade method of a virtual machine as described in the first aspect and various possible designs of the first aspect.

[0021] The hot upgrade method and device of a virtual machine provided in this embodiment include: creating a fast simulator QEMU component corresponding to each virtual machine on a data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding to them; in response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, creating a new QEMU component corresponding to the target virtual machine on the DPU; pausing the target QEMU component on the DPU, saving the status information of each sub-thread in the target QEMU component, and synchronizing the status information of each sub-thread to the new QEMU component; receiving and processing the IO requests sent by the VCPU threads through the new QEMU component. In this technical solution, when upgrading the QEMU component, it is only necessary to pause the QEMU component running on the DPU card without pausing the VCPU thread on the physical machine. In this way, when upgrading the QEMU component, the VCPU thread of the virtual machine runs normally, achieving zero downtime for hot upgrade of the QEMU component, thereby reducing the downtime during the hot upgrade of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0023] Figure 1 A schematic diagram of an application scenario of the hot upgrade method of a virtual machine provided in an embodiment of the present disclosure;

[0024] Figure 2 The process of the hot upgrade method of the virtual machine provided in the embodiment of the present disclosure is Figure 1 ;

[0025] Figure 3 Schematic diagram of the hot upgrade method of the virtual machine provided in the embodiment of the present disclosure Figure 1 ;

[0026] Figure 4 The process of the hot upgrade method of the virtual machine provided in the embodiment of the present disclosure is Figure 2 ;

[0027] Figure 5 Schematic diagram of the hot upgrade method of the virtual machine provided in the embodiment of the present disclosure Figure 2 ;

[0028] Figure 6 A schematic diagram of the structure of a hot upgrade device for a virtual machine provided in an embodiment of the present disclosure;

[0029] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution 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 part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution 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 part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0032] In a virtualization scenario, the function iteration and bug fixes of a virtual machine require the release of a new component version. In order not to affect the running virtual machine, the components of the virtual machine are usually upgraded to the latest version with the help of hot upgrade capabilities. In some embodiments, the virtualized data plane component includes a QEMU component and a KVM component. Among them, the QEMU component is a user-mode program, and the KVM component is a kernel module. One virtual machine corresponds to one QEMU component, and the QEMU component contains multiple sub-threads, and each virtual processor (VCPU) in the virtual machine corresponds to a sub-thread in the QEMU component.

[0033] In the prior art, the hot upgrade process of a virtual machine is similar to the hot migration of a virtual machine, which specifically includes: using a new KVM and QEMU to start a new virtual machine, then pausing the running virtual machine, synchronizing the state that the virtual machine needs to guarantee to the new virtual machine, and then starting the new virtual machine to run, while exiting the old virtual machine, so that there is no need to restart the virtual machine to achieve the hot upgrade of QEMU and KVM components. Although hot upgrades do not require the virtual machine to be shut down and restarted, they also need to pause the virtual machine to save and restore the state. Therefore, there will be a short period of virtual machine service unavailability during the hot upgrade. This period of time is called the downtime of the virtual machine hot upgrade. It can be understood that the less downtime the virtual machine hot upgrade has, the smaller the impact on the business performance jitter of the client virtual machine.

[0034] The inventors have discovered that the prior art has at least the following technical problems: when a virtual machine is hot-upgraded using the prior art, the virtual machine experiences a long downtime.

[0035] Therefore, it can be seen that how to reduce the downtime of the virtual machine during the hot upgrade of the virtual machine to improve the performance of the user's virtual machine is a technical problem that needs to be solved urgently.

[0036] In view of the technical problems in the prior art, the inventor's technical conception is as follows: First, a fast simulator QEMU component corresponding to each virtual machine is created on the data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process the input and output IO requests sent by the VCPU threads corresponding to them. Secondly, in response to the hot upgrade instruction of the target QEMU component corresponding to the target virtual machine, a new QEMU component corresponding to the target virtual machine is created on the DPU; finally, the target QEMU component on the DPU is paused, the state information of each sub-thread in the target QEMU component is saved, and the state information of each sub-thread is synchronized to the new QEMU component; the IO requests sent by the VCPU threads are received and processed through the new QEMU component.

[0037] In this technical solution, when upgrading the QEMU component, it is only necessary to pause the QEMU component running on the DPU card without pausing the VCPU thread on the physical machine. In this way, when upgrading the QEMU component, the VCPU thread of the virtual machine runs normally, achieving zero downtime for hot upgrade of the QEMU component, thereby reducing the downtime during the hot upgrade of the virtual machine.

[0038] The application scenarios of the embodiments of the present disclosure are explained below:

[0039] The hot upgrade method of a virtual machine provided in the embodiment of the present disclosure can be applied in a DPU scenario. Figure 1A schematic diagram of an application scenario of a hot upgrade method for a virtual machine provided in an embodiment of the present disclosure. Figure 1 As shown, the DPU (Data Processing Unit) architecture is used to offload the QEMU component in the virtualization component to the DPU card for operation, while the KVM component still runs on the physical machine. In this way, based on the DPU architecture, the independent hot upgrade capability of the QEMU component and the KVM component can be realized. Among them, the QEMU component includes sub-thread X and sub-thread Y. Thread X corresponds to the VCPU thread X deployed by the virtual machine on the physical machine; thread Y corresponds to the VCPU thread Y deployed by the virtual machine on the physical machine. Among them, the sub-thread X in the QEMU component is used to receive and process the IO requests sent by the VCPU thread X corresponding to it. The sub-thread Y in the QEMU component is used to receive and process the IO requests sent by the VCPU thread Y corresponding to it.

[0040] When a hot upgrade of a virtual machine is required, the QEMU component and the KVM component may be hot upgraded using the hot upgrade method of the virtual machine provided in the embodiments of the present disclosure.

[0041] The following is a specific implementation process of the hot upgrade method and device of the virtual machine involved in the embodiment of the present disclosure, and some examples are only for example and not for limitation. The execution subject of the hot upgrade method of the virtual machine involved in the embodiment of the present disclosure is an electronic device, which can be a terminal, a server, etc.

[0042] Figure 2 A hot upgrade method process of a virtual machine provided in an embodiment of the present disclosure Figure 1 ,like Figure 2 As shown, the hot upgrade method of the virtual machine may include:

[0043] S201. Create a fast simulator QEMU component corresponding to each virtual machine on the data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding to them.

[0044] In the disclosed embodiment, since the QEMU component runs on the DPU card and the KVM component is deployed on the physical machine, under the DPU architecture, there will also be a VCPU thread on the physical machine side to execute the KVM code, and the VCPU thread on the physical machine side corresponds one-to-one to the sub-thread in the QEMU component.

[0045] It should be noted that when the virtual machine has an IO request that requires the QEMU component to intervene and process, the VCPU thread on the physical machine will send the IO request to the corresponding child thread on the DPU for processing. In some embodiments, there will be a large number of IO requests that need to be processed by the QEMU component at startup; during the normal operation of the virtual machine, there are no IO requests that exit to the QEMU component.

[0046] Exemplarily, the QEMU component corresponding to the virtual machine includes a subthread X and a subthread Y. The VCPU thread on the physical machine side includes a VCPU thread X and a VCPU thread Y. Among them, the subthread X corresponds to the VCPU thread X one-to-one, and the subthread Y corresponds to the VCPU thread Y one-to-one.

[0047] S202: In response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, create a new QEMU component corresponding to the target virtual machine on the DPU.

[0048] In the embodiment of the present disclosure, the multiple sub-threads included in the new QEMU component created on the DPU are the same as the multiple sub-threads included in the target QEMU component.

[0049] For example, Figure 3 As shown, the target QEMU component corresponding to the target virtual machine includes sub-thread X and sub-thread Y. The new QEMU component includes sub-thread X and sub-thread Y.

[0050] S203, pausing the target QEMU component on the DPU, saving the status information of each sub-thread in the target QEMU component, and synchronizing the status information of each sub-thread to the new QEMU component.

[0051] In the disclosed embodiment, during the hot upgrade of the QEMU component, it is first necessary to suspend the processing of IO requests from the VCPU thread on the physical machine side. Then the device state of the old QEMU component (i.e., the target QEMU component) is saved and sent to the new QEMU component. After loading the device state, the new QEMU component begins to receive IO requests submitted by the VCPU thread on the physical machine. Among them, the device state of the old QEMU component includes the status information of each child thread.

[0052] In some embodiments, pausing the target QEMU component on the DPU means stopping processing IO requests.

[0053] For example, Figure 3 As shown, the target QEMU component corresponding to the target virtual machine includes a sub-thread X and a sub-thread Y. Accordingly, pausing the target QEMU component on the DPU includes: pausing the sub-thread X to process IO requests, and stopping the sub-thread Y to process IO requests.

[0054] Optionally, the process of synchronizing the state information of each child thread to the new QEMU component is the process of loading the state information of each child thread into the new QEMU component.

[0055] It should be noted that when pausing the target QEMU component on the DPU, there is no need to suspend the VCPU thread on the physical machine. That is, when upgrading the QEMU component, the VCPU thread of the virtual machine is running normally.

[0056] In some embodiments, the target QEMU component includes multiple target sub-threads; the target sub-thread corresponds to a target VCPU thread on the physical machine; accordingly, the method also includes: responding to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine, continuing to run the target VCPU thread on the physical machine.

[0057] S204: Receive and process the IO request sent by the VCPU thread through the new QEMU component.

[0058] In some embodiments, Figure 3 As shown, this step includes: receiving and processing the IO request sent by the VCPU thread X through the sub-thread X in the new QEMU component, and receiving and processing the IO request sent by the VCPU thread Y through the sub-thread Y in the new QEMU component.

[0059] In some embodiments, Figure 3 As shown, after receiving and processing the IO request sent by the VCPU thread through the new QEMU component, the method also includes: shutting down the target QEMU component on the DPU.

[0060] The disclosed embodiment provides a method for hot upgrading a virtual machine: first, a fast simulator QEMU component corresponding to each virtual machine is created on a data processor DPU, wherein the QEMU component includes a plurality of sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process the input and output IO requests sent by the VCPU threads corresponding thereto. Secondly, in response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, a new QEMU component corresponding to the target virtual machine is created on the DPU; finally, the target QEMU component on the DPU is paused, the state information of each sub-thread in the target QEMU component is saved, and the state information of each sub-thread is synchronized to the new QEMU component; the IO requests sent by the VCPU threads are received and processed through the new QEMU component. In this technical solution, when upgrading the QEMU component, it is only necessary to pause the QEMU component running on the DPU card without pausing the VCPU thread on the physical machine. In this way, when upgrading the QEMU component, the VCPU thread of the virtual machine runs normally, achieving zero downtime for hot upgrade of the QEMU component, thereby reducing the downtime during the hot upgrade of the virtual machine.

[0061] In the disclosed embodiment, a KVM component corresponding to a virtual machine is deployed on a physical machine, and multiple VCPU threads deployed by the virtual machine on the physical machine process service requests through the KVM component. In this case, by reconstructing the virtualized VCPU architecture, independent hot upgrades of virtualized components (QEMU components, KVM components) are achieved, and on this basis, the impact of hot upgrades of QEMU components on virtual machine performance is eliminated.

[0062] In some embodiments, the downtime of the hot upgrade of the KVM component is optimized, and the VCPU state can be saved and restored in parallel to reduce the downtime. Figure 4 As shown, the method also includes:

[0063] S401. In response to a hot upgrade instruction for a target KVM component corresponding to a target virtual machine, a hot upgrade thread is created on a DPU, wherein the target KVM component corresponds to a plurality of target VCPU threads deployed by the target virtual machine on a physical machine.

[0064] In this step, if Figure 5 As shown in the figure, the created hot upgrade thread is only responsible for controlling the upgrade process. The preservation and recovery of the virtual machine state are completed by the new and old VCPU threads respectively. Compared with the traditional hot upgrade solution (all processes are completed by the upgrade thread in serial execution), the new hot upgrade solution has a more obvious optimization of downtime. Among them, the virtual machine state includes the state information of each VCPU thread.

[0065] S402: Create a new VCPU thread corresponding to each target VCPU thread on the physical machine by calling the hot upgrade thread.

[0066] In this step, if Figure 5 As shown, a new VCPU thread can be initialized by a hot upgrade thread to create a new VCPU thread corresponding to each target VCPU thread. The initialization of the new VCPU thread can send a creation instruction of the new VCPU thread to the physical machine, and the physical machine receives the creation instruction and creates a new VCPU thread. It can be understood that the created new VCPU thread corresponds to the target VCPU thread one by one.

[0067] Alternatively, if Figure 5 As shown, for each target VCPU thread, before saving and restoring the state information of the target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method further includes: pausing multiple target VCPU threads deployed by the target virtual machine on the physical machine by calling the hot upgrade thread. In this way, the state information of the target VCPU thread can be saved through the target VCPU thread.

[0068] S403 . For each target VCPU thread, save and restore the state information of the target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto.

[0069] In some embodiments, the state information of the VCPU thread can be saved through the target VCPU thread (old VCPU thread), the state information of the VCPU thread can be loaded through the created new VCPU thread, and the state information of the target VCPU thread can be saved and restored through the upgrade of the old and new VCPU threads. Accordingly, this step may include: for each target VCPU thread, saving the state information of the target VCPU thread through the target VCPU thread; synchronizing the state information of the target VCPU thread to the new VCPU thread corresponding thereto.

[0070] Alternatively, if Figure 5 As shown, the step of synchronizing the state information of the target VCPU thread to the new VCPU thread corresponding to it may include: if the target VCPU thread completes saving the state information of the target VCPU thread, feeding back the saving completion information to the hot upgrade thread; sending an information loading instruction to the new VCPU thread corresponding to the target VCPU thread through the hot upgrade thread, and loading the state information of the target VCPU thread through the new VCPU thread.

[0071] It should be noted that the hot upgrade thread can send information loading instructions to the new VCPU threads corresponding to multiple target VCPU threads. At this time, the state information of the target VCPU threads loaded by the multiple new VCPU threads can be processed in parallel, that is, the VCPU state is saved and restored in parallel, reducing downtime.

[0072] Alternatively, if Figure 5 As shown, for each target VCPU thread, after saving and restoring the state information of the target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method also includes: processing the business request of the target virtual machine through the new VCPU thread corresponding to each target VCPU thread; and shutting down multiple target VCPU threads deployed by the target virtual machine on the physical machine.

[0073] In the disclosed embodiment, the hot upgrade data of the VCPU thread is saved and restored with the help of the VCPU thread, the concurrency of data saving and restoration is improved, the impact on the performance of the virtual machine when the KVM component of a large-scale virtual machine is hot upgraded is reduced, and the user experience is improved.

[0074] Figure 6 A schematic diagram of the structure of a hot upgrade device for a virtual machine provided in an embodiment of the present disclosure, such as Figure 6 As shown, the hot upgrade equipment of the virtual machine includes:

[0075] A creation unit 601 is used to create a fast simulator QEMU component corresponding to each virtual machine on a data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding to them;

[0076] A hot upgrade unit 602 is used to create a new QEMU component corresponding to the target virtual machine on the DPU in response to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine;

[0077] A synchronization unit 603 is used to pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component;

[0078] The processing unit 604 is used to receive and process the IO request sent by the VCPU thread through the new QEMU component.

[0079] According to one or more embodiments of the present disclosure, the target QEMU component includes multiple target sub-threads; the target sub-thread corresponds to a target VCPU thread on the physical machine; the hot upgrade unit 602 is also used to respond to the hot upgrade instruction of the target QEMU component corresponding to the target virtual machine, and continue to run the target VCPU thread on the physical machine.

[0080] According to one or more embodiments of the present disclosure, the synchronization unit 603 is further configured to shut down the target QEMU component on the DPU.

[0081] According to one or more embodiments of the present disclosure, a KVM component corresponding to a virtual machine is deployed on the physical machine, and multiple VCPU threads deployed by the virtual machine on the physical machine process business requests through the KVM component; accordingly, the device also includes: a saving unit, the saving unit is used to create a hot upgrade thread on the DPU in response to a hot upgrade instruction for a target KVM component corresponding to a target virtual machine, wherein the target KVM component corresponds to multiple target VCPU threads deployed by the target virtual machine on the physical machine; a new VCPU thread corresponding to each target VCPU thread is created on the physical machine by calling the hot upgrade thread; for each target VCPU thread, the state information of the target VCPU thread is saved and restored through the target VCPU thread and the new VCPU thread corresponding thereto.

[0082] According to one or more embodiments of the present disclosure, the saving unit saves and restores the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, including: for each target VCPU thread, saving the state information of the target VCPU thread through the target VCPU thread; synchronizing the state information of the target VCPU thread to the new VCPU thread corresponding thereto.

[0083] According to one or more embodiments of the present disclosure, the saving unit synchronizes the status information of the target VCPU thread to the new VCPU thread corresponding thereto, including: if the target VCPU thread completes saving the status information of the target VCPU thread, feeding back the saving completion information to the hot upgrade thread; sending an information loading instruction to the new VCPU thread corresponding to the target VCPU thread through the hot upgrade thread, and loading the status information of the target VCPU thread through the new VCPU thread.

[0084] According to one or more embodiments of the present disclosure, the saving unit is further configured to suspend multiple target VCPU threads of the target virtual machine deployed on the physical machine by calling the hot upgrade thread.

[0085] According to one or more embodiments of the present disclosure, the processing unit 604 is further used to process the service request of the target virtual machine through the new VCPU thread corresponding to each target VCPU thread; and shut down multiple target VCPU threads deployed by the target virtual machine on the physical machine.

[0086] refer to Figure 7 , which shows a schematic diagram of the structure of an electronic device 700 suitable for implementing the embodiment of the present disclosure, and the electronic device 700 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers, portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0087] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 to a random access memory (RAM) 703. Various programs and data required for the operation of the electronic device 700 are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0088] Typically, the following devices may be connected to the I / O interface 705: input devices 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 708 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 709. The communication devices 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0089] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0090] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0091] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0092] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0093] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0094] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0095] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0096] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0097] In a first aspect, according to one or more embodiments of the present disclosure, a method for hot upgrading a virtual machine is provided, comprising:

[0098] Create a fast simulator QEMU component corresponding to each virtual machine on the data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding to them;

[0099] In response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, creating a new QEMU component corresponding to the target virtual machine on the DPU;

[0100] Pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component;

[0101] The IO request sent by the VCPU thread is received and processed by the new QEMU component.

[0102] According to one or more embodiments of the present disclosure, the target QEMU component includes multiple target sub-threads; the target sub-thread corresponds to a target VCPU thread on the physical machine; the method also includes: responding to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine, continuing to run the target VCPU thread on the physical machine.

[0103] According to one or more embodiments of the present disclosure, after receiving and processing the IO request sent by the VCPU thread through the new QEMU component, the method further includes: shutting down the target QEMU component on the DPU.

[0104] According to one or more embodiments of the present disclosure, a KVM component corresponding to a virtual machine is deployed on the physical machine, and multiple VCPU threads deployed by the virtual machine on the physical machine process business requests through the KVM component; accordingly, the method also includes: in response to a hot upgrade instruction for a target KVM component corresponding to a target virtual machine, creating a hot upgrade thread on the DPU, wherein the target KVM component corresponds to multiple target VCPU threads deployed by the target virtual machine on the physical machine; creating a new VCPU thread corresponding to each target VCPU thread on the physical machine by calling the hot upgrade thread; and for each target VCPU thread, saving and restoring the state information of the target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto.

[0105] According to one or more embodiments of the present disclosure, for each target VCPU thread, the state information of the target VCPU thread is saved and restored through the target VCPU thread and the new VCPU thread corresponding thereto, including: for each target VCPU thread, the state information of the target VCPU thread is saved through the target VCPU thread; and the state information of the target VCPU thread is synchronized to the new VCPU thread corresponding thereto.

[0106] According to one or more embodiments of the present disclosure, synchronizing the state information of the target VCPU thread to the new VCPU thread corresponding thereto includes: if the target VCPU thread completes saving the state information of the target VCPU thread, feeding back the saving completion information to the hot upgrade thread; sending an information loading instruction to the new VCPU thread corresponding to the target VCPU thread through the hot upgrade thread, and loading the state information of the target VCPU thread through the new VCPU thread.

[0107] According to one or more embodiments of the present disclosure, before saving and restoring the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method also includes: pausing multiple target VCPU threads deployed by the target virtual machine on the physical machine by calling the hot upgrade thread.

[0108] According to one or more embodiments of the present disclosure, after saving and restoring the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method further includes: processing the business request of the target virtual machine through the new VCPU thread corresponding to each target VCPU thread; and shutting down multiple target VCPU threads of the target virtual machine deployed on the physical machine.

[0109] In a second aspect, according to one or more embodiments of the present disclosure, a hot upgrade device for a virtual machine is provided, comprising:

[0110] A creation unit, used to create a fast simulator QEMU component corresponding to each virtual machine on a data processor DPU, wherein the QEMU component includes a plurality of sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding thereto;

[0111] A hot upgrade unit, configured to create a new QEMU component corresponding to the target virtual machine on the DPU in response to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine;

[0112] A synchronization unit, configured to pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component;

[0113] A processing unit is used to receive and process the IO request sent by the VCPU thread through the new QEMU component.

[0114] According to one or more embodiments of the present disclosure, the target QEMU component includes multiple target sub-threads; the target sub-thread corresponds to a target VCPU thread on the physical machine; the hot upgrade unit is also used to respond to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine, and continue to run the target VCPU thread on the physical machine.

[0115] According to one or more embodiments of the present disclosure, the synchronization unit is further used to shut down the target QEMU component on the DPU.

[0116] According to one or more embodiments of the present disclosure, a KVM component corresponding to a virtual machine is deployed on the physical machine, and multiple VCPU threads deployed by the virtual machine on the physical machine process business requests through the KVM component; accordingly, the device also includes: a saving unit, the saving unit is used to create a hot upgrade thread on the DPU in response to a hot upgrade instruction for a target KVM component corresponding to a target virtual machine, wherein the target KVM component corresponds to multiple target VCPU threads deployed by the target virtual machine on the physical machine; a new VCPU thread corresponding to each target VCPU thread is created on the physical machine by calling the hot upgrade thread; for each target VCPU thread, the state information of the target VCPU thread is saved and restored through the target VCPU thread and the new VCPU thread corresponding thereto.

[0117] According to one or more embodiments of the present disclosure, the saving unit saves and restores the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, including: for each target VCPU thread, saving the state information of the target VCPU thread through the target VCPU thread; synchronizing the state information of the target VCPU thread to the new VCPU thread corresponding thereto.

[0118] According to one or more embodiments of the present disclosure, the saving unit synchronizes the status information of the target VCPU thread to the new VCPU thread corresponding thereto, including: if the target VCPU thread completes saving the status information of the target VCPU thread, feeding back the saving completion information to the hot upgrade thread; sending an information loading instruction to the new VCPU thread corresponding to the target VCPU thread through the hot upgrade thread, and loading the status information of the target VCPU thread through the new VCPU thread.

[0119] According to one or more embodiments of the present disclosure, the saving unit is further configured to suspend multiple target VCPU threads of the target virtual machine deployed on the physical machine by calling the hot upgrade thread.

[0120] According to one or more embodiments of the present disclosure, the processing unit is further used to process the business request of the target virtual machine through the new VCPU thread corresponding to each target VCPU thread; and shut down multiple target VCPU threads deployed by the target virtual machine on the physical machine.

[0121] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;

[0122] The memory stores computer-executable instructions;

[0123] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the hot upgrade method of the virtual machine as described in the first aspect and various possible designs of the first aspect.

[0124] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the hot upgrade method of the virtual machine described in the first aspect and various possible designs of the first aspect is implemented.

[0125] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the hot upgrade method of the virtual machine as described in the first aspect and various possible designs of the first aspect.

[0126] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0127] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0128] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A hot upgrade method for a virtual machine, characterized in that: include: Create a fast simulator QEMU component corresponding to each virtual machine on the data processor DPU, wherein the QEMU component includes multiple sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding to them; In response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, creating a new QEMU component corresponding to the target virtual machine on the DPU; Pause the target QEMU component on the DPU, save the state information of each sub-thread in the target QEMU component, and synchronize the state information of each sub-thread to the new QEMU component; The IO request sent by the VCPU thread is received and processed by the new QEMU component.

2. The method according to claim 1, characterized in that The target QEMU component includes a plurality of target sub-threads; the target sub-thread corresponds to a target VCPU thread on the physical machine; the method further includes: In response to a hot upgrade instruction for a target QEMU component corresponding to a target virtual machine, the target VCPU thread on the physical machine continues to run.

3. The method according to claim 1, characterized in that After receiving and processing the IO request sent by the VCPU thread through the new QEMU component, the method further includes: Shut down the target QEMU component on the DPU.

4. The method according to claim 1, characterized in that The physical machine is deployed with a kernel virtual machine KVM component corresponding to the virtual machine, and multiple VCPU threads deployed by the virtual machine on the physical machine process service requests through the KVM component; accordingly, the method further includes: In response to a hot upgrade instruction for a target KVM component corresponding to a target virtual machine, creating a hot upgrade thread on the DPU, wherein the target KVM component corresponds to a plurality of target VCPU threads deployed by the target virtual machine on a physical machine; Creating a new VCPU thread corresponding to each target VCPU thread on the physical machine by calling the hot upgrade thread; For each target VCPU thread, the state information of the target VCPU thread is saved and restored through the target VCPU thread and the new VCPU thread corresponding thereto.

5. The method according to claim 4, characterized in that For each target VCPU thread, saving and restoring the state information of the target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto includes: For each target VCPU thread, saving the state information of the target VCPU thread through the target VCPU thread; The state information of the target VCPU thread is synchronized to the new VCPU thread corresponding thereto.

6. The method according to claim 5, characterized in that The step of synchronizing the state information of the target VCPU thread to a new VCPU thread corresponding thereto includes: If the target VCPU thread completes saving the state information of the target VCPU thread, feedback the saving completion information to the hot upgrade thread; An information loading instruction is sent to a new VCPU thread corresponding to the target VCPU thread through the hot upgrade thread, and the state information of the target VCPU thread is loaded through the new VCPU thread.

7. The method according to claim 4, characterized in that Before saving and restoring the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method further includes: The multiple target VCPU threads deployed by the target virtual machine on the physical machine are paused by calling the hot upgrade thread.

8. The method according to claim 4, characterized in that After saving and restoring the state information of each target VCPU thread through the target VCPU thread and the new VCPU thread corresponding thereto, the method further comprises: Processing the service request of the target virtual machine through the new VCPU thread corresponding to each target VCPU thread; Shut down multiple target VCPU threads deployed by the target virtual machine on the physical machine.

9. A hot upgrade device for a virtual machine, characterized in that: include: A creation unit, used to create a fast simulator QEMU component corresponding to each virtual machine on a data processor DPU, wherein the QEMU component includes a plurality of sub-threads, wherein the sub-threads in the QEMU component correspond one-to-one to the VCPU threads on the physical machine side, and the sub-threads in the QEMU component are used to receive and process input and output IO requests sent by the VCPU threads corresponding thereto; A hot upgrade unit, configured to create a new QEMU component corresponding to the target virtual machine on the DPU in response to a hot upgrade instruction for the target QEMU component corresponding to the target virtual machine; A synchronization unit, configured to pause the target QEMU component on the DPU, save the status information of each sub-thread in the target QEMU component, and synchronize the status information of each sub-thread to the new QEMU component; A processing unit is used to receive and process the IO request sent by the VCPU thread through the new QEMU component.

10. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the hot upgrade method for a virtual machine according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the hot upgrade method of the virtual machine according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the hot upgrade method of a virtual machine according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • A software watchdog system and method

    CN103793288B

  • Virtual machine hot upgrade method, host device and storage medium

    CN113296802A

  • Method for precessing I / O of virtual machine

    KR101982447B1

  • End-to-end quality of service mechanism for storage system using prioritized thread queues

    US20210406066A1