Virtual machine live migration method and device, electronic equipment and storage medium
By monitoring the remaining amount of dirty memory data in virtual machines and executing virtual processor tasks in parallel, the problem of excessive downtime during virtual machine hot migration is solved, achieving more efficient business continuity and adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-03-27
AI Technical Summary
During virtual machine hot migration, as the number of virtual processors increases, the cumulative time spent waiting and processing tasks on each vCPU increases, resulting in longer downtime during hot migration and affecting normal business operations.
By monitoring the amount of dirty memory data remaining in the virtual machine, the virtual processor threads are paused when the remaining amount is less than a preset threshold, and the target task is executed in parallel until all threads are completed and the memory data is sent to the destination host machine.
It effectively reduces business interruption time during virtual machine hot migration and improves the adaptability of high-core virtual machines and scenarios with high business continuity requirements.
Smart Images

Figure CN121742977A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a virtual machine hot migration method, apparatus, electronic device, and storage medium. Background Technology
[0002] In virtualization, virtual machine hot migration is one of the core technologies for realizing dynamic resource scheduling, fault recovery and system maintenance. Its key performance indicator is hot migration downtime, which directly determines the degree of impact of hot migration operation on business continuity. Therefore, it is necessary to reduce hot migration downtime to improve the overall competitiveness and market adaptability of the virtualization platform.
[0003] Currently, in the virtual machine hot migration process, there is a type of necessary data processing task that requires the joint participation of all virtual processors (vCPUs).
[0004] In the existing technology, when the virtual processor is processing the above tasks, as the number of vCPUs configured in the virtual machine increases, the waiting time and cumulative task processing time of each vCPU will increase synchronously, resulting in a long downtime for hot migration, which seriously affects the processing of normal business. Summary of the Invention
[0005] To address the aforementioned technical problems, this disclosure provides a virtual machine hot migration method, apparatus, electronic device, and storage medium.
[0006] In a first aspect, embodiments of this disclosure provide a virtual machine hot migration method applied to a source host machine, the method comprising: Receive migration instructions, and based on the migration instructions, send the memory data of the virtual machine running on the source host to the destination host, wherein the virtual machine has at least two first virtual processor threads running in it; Monitor the remaining amount of dirty memory data in the virtual machine, and if the remaining amount of dirty memory data is less than a preset threshold, suspend the execution of at least two first virtual processor threads; Control each of the at least two first virtual processor threads to execute the target task in parallel; If it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0007] In some embodiments, before controlling each of the at least two first virtual processor threads to execute the target task in parallel, the method further includes: Obtain the configured parallel switch parameters, which are used to indicate the function of enabling each first virtual processor thread to execute the target task in parallel.
[0008] In some embodiments, the main thread runs in the source host machine; The suspension of the at least two first virtual processor threads includes: The main thread sends a first notification message to each of the at least two first virtual processor threads; Each of the first virtual processor threads is suspended based on the first notification message.
[0009] In some embodiments, the main thread runs in the source host machine; The step of controlling each of the at least two first virtual processor threads to execute the target task in parallel includes: The main thread generates a second notification message based on the parallel switch parameters and sends the second notification message to each of the first virtual processor threads. Each of the first virtual processor threads executes the target task in parallel based on the second notification message.
[0010] In some embodiments, after controlling each of the at least two first virtual processor threads to execute the target task in parallel, the method further includes: Monitor the running status of each of the first virtual processor threads; When the running state of each of the first virtual processor threads is in a stopped state, it is determined that each of the first virtual processor threads has ended the execution of the target task.
[0011] Secondly, embodiments of this disclosure provide a virtual machine hot migration method applied to a destination host machine, the method comprising: Receive migration instructions; Based on the migration instruction, the source host machine sends memory data, and the memory data is stored in a virtual machine running on the destination host machine; the virtual machine has at least two second virtual processor threads running in it. Control each of the at least two second virtual processor threads to execute the target task in parallel; If it is detected that each of the second virtual processor threads has finished executing the target task, dirty memory data sent by the destination host is received to migrate the virtual machine from the source host to the destination host.
[0012] Thirdly, embodiments of this disclosure provide a virtual machine hot migration apparatus, applied to a source host machine, comprising: The sending module is used to receive migration instructions and send the memory data of the virtual machine running on the source host to the destination host based on the migration instructions. The virtual machine has at least two first virtual processor threads running in it. The stop module is used to monitor the remaining amount of dirty memory data in the virtual machine, and to suspend the execution of at least two first virtual processor threads when the remaining amount of dirty memory data is less than a preset threshold. The control module is used to control each of the at least two first virtual processor threads to execute the target task in parallel; The processing module is configured to send the dirty memory data to the destination host machine when it is detected that each of the first virtual processor threads has finished executing the target task, so as to migrate the virtual machine from the source host machine to the destination host machine.
[0013] Fourthly, embodiments of this disclosure provide a virtual machine hot migration apparatus, applied to a destination host machine, comprising: The receiving module is used to receive migration instructions; The storage module is used to receive memory data sent by the source host based on the migration instruction, and store the memory data in a virtual machine running on the destination host; the virtual machine runs at least two second virtual processor threads; The control module is used to control each of the at least two second virtual processor threads to execute the target task in parallel. The processing module is configured to receive dirty memory data sent by the destination host machine when it is detected that each of the second virtual processor threads has finished executing the target task, so as to migrate the virtual machine from the source host machine to the destination host machine.
[0014] Fifthly, embodiments of this disclosure provide an electronic device, including: Memory; Processor; and Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in the first aspect.
[0015] In a sixth aspect, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method as described in the first aspect.
[0016] In a seventh aspect, embodiments of this disclosure also provide a computer program product comprising a computer program or instructions that, when executed by a processor, implement the method described in the first aspect.
[0017] The virtual machine hot migration method, apparatus, electronic device, and storage medium provided in this disclosure receive a migration instruction and, based on the migration instruction, send the memory data of a virtual machine running on a source host to a destination host. The virtual machine runs at least two first virtual processor threads. The remaining amount of dirty memory data in the virtual machine is monitored. If the remaining amount of dirty memory data is less than a preset threshold, the execution of the at least two first virtual processor threads is paused. Each of the at least two first virtual processor threads is controlled to execute a target task in parallel. Once it is detected that each first virtual processor thread has finished executing the target task, the dirty memory data is sent to the destination host to migrate the virtual machine from the source host to the destination host. Compared to existing technologies, this disclosure, by controlling each of the at least two first virtual processor threads to execute the target task in parallel, can effectively reduce the service interruption time during virtual machine hot migration and improve the adaptability of hot migration technology to scenarios with high-core virtual machines and high business continuity requirements. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0019] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart of a virtual machine hot migration method provided in this embodiment of the disclosure; Figure 2 This is a schematic diagram of the overall process of the virtual machine hot migration method provided in the embodiments of this disclosure; Figure 3 A flowchart of a virtual machine hot migration method provided in another embodiment of this disclosure; Figure 4 A flowchart of a virtual machine hot migration method provided in another embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of the virtual machine hot migration device provided in the embodiments of this disclosure; Figure 6 This is a schematic diagram of the structure of the virtual machine hot migration device provided in the embodiments of this disclosure; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0021] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0022] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0023] In virtualization, virtual machine hot migration is one of the core technologies for realizing dynamic resource scheduling, fault recovery and system maintenance. Its key performance indicator is hot migration downtime, which directly determines the degree of impact of hot migration operation on business continuity. Therefore, it is necessary to reduce hot migration downtime to improve the overall competitiveness and market adaptability of the virtualization platform.
[0024] Currently, in the virtual machine hot migration process, there is a type of necessary data processing task that requires the joint participation of all virtual processors (vCPUs).
[0025] In the existing technology, when the virtual processor is processing the above tasks, as the number of vCPUs configured in the virtual machine increases, the waiting time and cumulative task processing time of each vCPU will increase synchronously, resulting in a long downtime for hot migration, which seriously affects the processing of normal business.
[0026] To address this issue, this disclosure provides a method for hot migration of virtual machines, which will be described below with reference to specific embodiments.
[0027] Figure 1 This is a flowchart of a virtual machine hot migration method provided in this embodiment. The execution subject of this method is an electronic device, which can specifically be a source host machine. This method can be applied to scenarios involving hot migration of virtual machines, as well as scenarios involving migrating virtual machines from a source host machine to a destination host machine.
[0028] It is understood that the virtual machine hot migration method provided in this disclosure can also be applied in other scenarios.
[0029] The following is about Figure 1The virtual machine hot migration method shown is introduced. This method can be applied to electronic devices. Taking an electronic device as the source host machine, the specific steps of the method are as follows: S101. Receive migration instructions and send the memory data of the virtual machine running on the source host to the destination host based on the migration instructions. The virtual machine has at least two first virtual processor threads running in it.
[0030] In this step, the source host machine receives a migration command, which can be user-triggered and is not limited in scope. Further, based on the migration command, the source host machine sends the memory data of the virtual machine running on the source host machine to the destination host machine. The virtual machine contains at least two first virtual processor threads. Figure 2 As shown, the virtual machine runs multiple first virtual processor threads such as vCPU0 and vCPU1.
[0031] A virtual machine (VM) is a computer system simulated by software, possessing a complete hardware system and running in an isolated environment. It has the same operating and runtime environment as a physical computer. There are many types of VMs, each simulating different devices and virtualization types using different virtualization management software and hardware virtualization technologies.
[0032] Hot migration refers to the technology of migrating a virtual machine from a source host to a destination host without interrupting virtual machine services.
[0033] S102. Monitor the remaining amount of dirty memory data in the virtual machine. If the remaining amount of dirty memory data is less than a preset threshold, suspend the operation of the at least two first virtual processor threads.
[0034] In this step, the source host machine monitors the remaining amount of dirty memory data in the virtual machine in real time and determines whether the remaining amount of dirty memory data is less than a preset threshold. If the remaining amount of dirty memory data is less than the preset threshold, the at least two first virtual processor threads will be suspended. When the first virtual processor threads stop, the virtual machine state data is static, and the restriction on serial execution is lifted. Optionally, the preset threshold can be 5% or other values, without specific limitations.
[0035] S103. Control each of the at least two first virtual processor threads to execute the target task in parallel.
[0036] In this step, after pausing the execution of the at least two first virtual processor threads, the source host machine controls each of the at least two first virtual processor threads to execute the target task in parallel. This avoids resource waste caused by idle vCPU threads waiting and can effectively reduce service interruption time during virtual machine hot migration. Optionally, the target task is a task used to migrate the virtual machine from the source host machine to the destination host machine. For example, the target task can be memory verification, cache refresh, I / O state synchronization, register state backup, APIC interrupt controller registration, context data saving, etc., without limitation.
[0037] S104. If it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0038] In this step, the source host machine monitors whether each first virtual processor thread has completed the target task, and monitors the task status of each first vCPU thread in real time to ensure that all first virtual processor threads have completed their tasks before continuing the migration. If it is detected that each first virtual processor thread has finished executing the target task, the source host machine sends the remaining dirty memory data to the destination host machine, thereby migrating the virtual machine from the source host machine to the destination host machine, realizing the hot migration of the virtual machine.
[0039] This embodiment of the disclosure receives a migration command and, based on the migration command, sends the memory data of a virtual machine running on the source host to the destination host. The virtual machine runs at least two first virtual processor threads. The remaining amount of dirty memory data in the virtual machine is monitored. If the remaining amount of dirty memory data is less than a preset threshold, the execution of the at least two first virtual processor threads is paused. Each of the at least two first virtual processor threads is controlled to execute a target task in parallel. Once it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host, thereby migrating the virtual machine from the source host to the destination host. Compared to existing technologies, this embodiment of the disclosure, by controlling each of the at least two first virtual processor threads to execute the target task in parallel, can effectively reduce the service interruption time during virtual machine hot migration and improve the adaptability of hot migration technology to high-core virtual machines and scenarios with high business continuity requirements.
[0040] Figure 3 This is a flowchart of a virtual machine hot migration method provided in another embodiment of this disclosure, applied to the source host machine, such as... Figure 3As shown, the method includes the following steps: S201. Receive migration instructions and send the memory data of the virtual machine running on the source host to the destination host based on the migration instructions. The virtual machine has at least two first virtual processor threads running in it.
[0041] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.
[0042] S202. Monitor the remaining amount of dirty memory data in the virtual machine. If the remaining amount of dirty memory data is less than a preset threshold, suspend the operation of the at least two first virtual processor threads.
[0043] Specifically, the implementation process and principle of S202 and S102 are the same, and will not be repeated here.
[0044] In some embodiments, the main thread runs in the source host machine.
[0045] Specifically, S202 suspends the execution of at least two first virtual processor threads, which may include, but is not limited to, S2021 and S2022: S2021, The main thread sends a first notification message to each of the at least two first virtual processor threads; S2022, Each of the first virtual processor threads suspends operation based on the first notification message.
[0046] In this embodiment, as Figure 2 As shown, a main thread runs on the source host machine, and the main thread sends a first notification message to each first virtual processor thread. The first notification message is used to notify the first virtual processor thread to pause execution. Furthermore, each first virtual processor thread pauses execution based on the first notification message. The pause of the first virtual processor thread is achieved through the interaction between the main thread and each first virtual processor thread.
[0047] S203. Obtain the configured parallel switch parameters.
[0048] The parallel switch parameter is used to indicate the function of enabling each first virtual processor thread to execute the target task in parallel.
[0049] In this step, the source host machine can configure the parallel switch parameters according to the configuration file, and the source host machine can obtain the configured parallel switch parameters. By configuring the parallel switch parameters, the function of executing tasks in parallel can be realized.
[0050] S204. The main thread generates a second notification message based on the parallel switch parameters and sends the second notification message to each of the first virtual processor threads.
[0051] In this step, after obtaining the configured parallel switch parameters, such as Figure 2 As shown, the main thread running on the source host machine generates a second notification message based on the parallel switch parameters and sends the second notification message to each of the first virtual processor threads. The second notification message is used to notify each first virtual processor thread to execute the target task in parallel.
[0052] S205, Each of the first virtual processor threads executes the target task in parallel based on the second notification message.
[0053] In this step, such as Figure 2 As shown, each first virtual processor thread will execute the target task in parallel based on the second notification message. Through the interaction between the main thread and each first virtual processor, each first virtual processor can execute the target task in parallel, eliminating the serial processing bottleneck and effectively reducing the business interruption time during the virtual machine hot migration process.
[0054] In some embodiments, Figure 3 Steps S204 and S205 shown can be used as Figure 1 A specific implementation of step S103 shown.
[0055] S206. Monitor the running status of each first virtual processor thread.
[0056] In this step, the source host machine will monitor the running status of each first virtual processor thread in real time, which can promptly carry out subsequent migration processes, improve the real-time performance of migration, and reduce business interruption time.
[0057] S207. When the running state of each of the first virtual processor threads is in a stopped state, it is determined that each of the first virtual processor threads has ended the execution of the target task.
[0058] If the running status of each first virtual processor thread is detected to be stopped, the source host machine determines that each first virtual processor thread has finished executing the target task.
[0059] S208. If it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0060] Specifically, the implementation process and principle of S208 and S104 are the same, and will not be repeated here.
[0061] This embodiment of the disclosure receives a migration instruction and, based on the migration instruction, sends the memory data of a virtual machine running on the source host to the destination host. The virtual machine runs at least two first virtual processor threads. The remaining amount of dirty memory data in the virtual machine is monitored. If the remaining amount of dirty memory data is less than a preset threshold, the execution of the at least two first virtual processor threads is paused. Then, configured parallel switch parameters are obtained, and the main thread generates a second notification message based on the parallel switch parameters and sends the second notification message to each first virtual processor thread. Each first virtual processor thread executes the target task in parallel based on the second notification message. Further, the running status of each first virtual processor thread is monitored. When the running status of each first virtual processor thread is in a stopped state, it is determined that each first virtual processor thread has finished executing the target task. Then, upon detecting that each first virtual processor thread has finished executing the target task, the dirty memory data is sent to the destination host to migrate the virtual machine from the source host to the destination host. By using this method, the embodiments of this disclosure can reduce the waiting time of each vCPU and the time spent on task processing by executing the target task in parallel, thereby reducing downtime during hot migration and not affecting the processing of normal business.
[0062] The solutions in the embodiments of this disclosure can be used individually or in combination without conflict. For example, S203, obtaining the configured parallel switch parameters, and S103, controlling each of the at least two first virtual processor threads to execute the target task in parallel, can be used in combination.
[0063] Figure 4 This is a flowchart of a virtual machine hot migration method provided in another embodiment of this disclosure, applied to the destination host machine, such as... Figure 4 As shown, the method includes the following steps: S301, Receive migration instructions.
[0064] In this step, the destination host machine will receive migration instructions, which can be triggered by the user and are not limited to this step.
[0065] S302. Receive memory data sent by the source host machine based on the migration instruction, and store the memory data in a virtual machine running on the destination host machine; the virtual machine runs at least two second virtual processor threads.
[0066] Furthermore, the destination host machine will receive memory data sent by the source host machine based on the migration instruction, and store the memory data in a virtual machine running on the destination host machine; the virtual machine runs at least two second virtual processor threads.
[0067] S303, Control each of the at least two second virtual processor threads to execute the target task in parallel.
[0068] In this step, the destination host machine controls each of the at least two second virtual processor threads to execute the target task in parallel, avoiding resource waste caused by idle vCPU threads and effectively reducing service interruption time during virtual machine hot migration. Optionally, the target task is a task used to migrate the virtual machine from the source host machine to the destination host machine. For example, the target task can be memory verification, cache refresh, I / O state synchronization, etc., without limitation.
[0069] In some embodiments, before controlling each of the at least two second virtual processor threads to execute the target task in parallel, the method further includes: obtaining configured parallel switch parameters, the parallel switch parameters being used to indicate enabling the function of each second virtual processor thread to execute the target task in parallel.
[0070] In some embodiments, a main thread runs in the target host machine; controlling each of the at least two second virtual processor threads to execute the target task in parallel includes: the main thread generating a second notification message based on the parallel switch parameters and sending the second notification message to each of the second virtual processor threads; each of the second virtual processor threads executing the target task in parallel based on the second notification message.
[0071] In some embodiments, after controlling each of the at least two second virtual processor threads to execute the target task in parallel, the method further includes: monitoring the running state of each second virtual processor thread; and determining that each second virtual processor thread has ended execution of the target task when the running state of each second virtual processor thread is a stopped state.
[0072] S304. If it is detected that each of the second virtual processor threads has finished executing the target task, receive dirty memory data sent by the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0073] In this step, the destination host machine monitors whether each second virtual processor thread has completed the target task, and monitors the task status of each second vCPU thread in real time to ensure that all second virtual processor threads have completed their tasks before continuing the migration. If it is detected that each second virtual processor thread has finished executing the target task, the destination host machine receives dirty memory data sent by the destination host machine, thereby migrating the virtual machine from the destination host machine to the destination host machine, realizing the hot migration of the virtual machine.
[0074] This embodiment of the disclosure receives a migration instruction, receives memory data sent by the source host based on the migration instruction, and stores the memory data in a virtual machine running on the destination host. The virtual machine runs at least two second virtual processor threads, and each of these threads is controlled to execute a target task in parallel. Upon detecting that each of the second virtual processor threads has finished executing the target task, dirty memory data sent by the destination host is received, thereby migrating the virtual machine from the source host to the destination host. Compared to existing technologies, this embodiment of the disclosure, by controlling each of the at least two second virtual processor threads to execute the target task in parallel, can effectively reduce service interruption time during virtual machine hot migration and improve the adaptability of hot migration technology to high-core virtual machines and scenarios with high business continuity requirements.
[0075] Figure 5 This is a schematic diagram of the structure of a virtual machine hot migration apparatus provided in this embodiment. The virtual machine hot migration apparatus can be the source host machine as described in the above embodiment, or it can be a component or part within the source host machine. The virtual machine hot migration apparatus provided in this embodiment can execute the processing flow provided in the virtual machine hot migration method embodiment, such as... Figure 5As shown, the virtual machine hot migration device 50 is applied to the source host machine and includes: a sending module 51, a stopping module 52, a control module 53, and a processing module 54. The sending module 51 receives migration instructions and, based on these instructions, sends the memory data of the virtual machine running on the source host machine to the destination host machine. The virtual machine runs at least two first virtual processor threads. The stopping module 52 monitors the remaining amount of dirty memory data in the virtual machine and, if the remaining amount of dirty memory data is less than a preset threshold, suspends the execution of the at least two first virtual processor threads. The control module 53 controls each of the at least two first virtual processor threads to execute the target task in parallel. The processing module 54, upon detecting that each first virtual processor thread has finished executing the target task, sends the dirty memory data to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0076] Optionally, before controlling each of the at least two first virtual processor threads to execute the target task in parallel, the device 50 further includes: an acquisition module 55; the acquisition module 55 is used to acquire configured parallel switch parameters, the parallel switch parameters being used to indicate enabling the function of each first virtual processor thread to execute the target task in parallel.
[0077] Optionally, the main thread runs in the source host machine; When the stop module 52 suspends the operation of the at least two first virtual processor threads, it is specifically used for: the main thread sending a first notification message to each of the at least two first virtual processor threads; and each first virtual processor thread suspending operation based on the first notification message.
[0078] Optionally, the main thread runs in the source host machine; When the control module 53 controls each of the at least two first virtual processor threads to execute the target task in parallel, it is specifically used for: the main thread generating a second notification message based on the parallel switch parameters and sending the second notification message to each of the first virtual processor threads; and each first virtual processor thread executing the target task in parallel based on the second notification message.
[0079] Optionally, after controlling each of the at least two first virtual processor threads to execute the target task in parallel, the device further includes: a determining module 56; the determining module 56 is used to monitor the running state of each first virtual processor thread; when the running state of each first virtual processor thread is a stopped state, it determines that each first virtual processor thread has ended the execution of the target task.
[0080] Figure 5 The virtual machine hot migration device shown in the embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.
[0081] Figure 6 This is a schematic diagram of the structure of a virtual machine hot migration apparatus provided in an embodiment of this disclosure. The virtual machine hot migration apparatus can be the destination host machine as described in the above embodiment, or it can be a component or part within the destination host machine. The virtual machine hot migration apparatus provided in this embodiment can execute the processing flow provided in the virtual machine hot migration method embodiment, such as... Figure 6 As shown, the virtual machine hot migration device 60 is applied to the destination host machine and includes: a receiving module 61, a storage module 62, a control module 63, and a processing module 64. The receiving module 61 receives migration instructions; the storage module 62 receives memory data sent by the source host machine based on the migration instructions and stores the memory data in a virtual machine running on the destination host machine; the virtual machine runs at least two second virtual processor threads; the control module 63 controls each of the at least two second virtual processor threads to execute the target task in parallel; and the processing module 64 receives dirty memory data sent by the destination host machine when it detects that each second virtual processor thread has finished executing the target task, so as to migrate the virtual machine from the source host machine to the destination host machine.
[0082] Figure 6 The virtual machine hot migration device shown in the embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.
[0083] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 7 It shows a schematic diagram of a structure suitable for implementing the electronic device 600 in the embodiments of this disclosure. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0084] like Figure 7As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603 to implement the virtual machine hot migration method as described in the embodiments of this disclosure. Various programs and data required for the operation of electronic device 600 are also stored in RAM 603. The processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0085] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0086] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the virtual machine hot migration method described above. In such embodiments, the computer program can be downloaded and installed from a network via communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0087] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0088] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0089] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0090] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: Receive migration instructions, and based on the migration instructions, send the memory data of the virtual machine running on the source host to the destination host, wherein the virtual machine has at least two first virtual processor threads running in it; Monitor the remaining amount of dirty memory data in the virtual machine, and if the remaining amount of dirty memory data is less than a preset threshold, suspend the execution of at least two first virtual processor threads; Control each of the at least two first virtual processor threads to execute the target task in parallel; If it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
[0091] Optionally, when one or more of the above-described procedures are executed by the electronic device, the electronic device may also execute other steps of the above embodiments.
[0092] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0094] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0095] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0096] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0097] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0098] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0099] Although the subject matter has been described using language specific to structural features and / or methodological logic, 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. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for hot migration of virtual machines, characterized in that, Applied to the source host machine, the method includes: Receive migration instructions, and based on the migration instructions, send the memory data of the virtual machine running on the source host to the destination host, wherein the virtual machine has at least two first virtual processor threads running in it; Monitor the remaining amount of dirty memory data in the virtual machine, and if the remaining amount of dirty memory data is less than a preset threshold, suspend the execution of at least two first virtual processor threads; Control each of the at least two first virtual processor threads to execute the target task in parallel; If it is detected that each of the first virtual processor threads has finished executing the target task, the dirty memory data is sent to the destination host machine to migrate the virtual machine from the source host machine to the destination host machine.
2. The method according to claim 1, characterized in that, Before controlling each of the at least two first virtual processor threads to execute the target task in parallel, the method further includes: Obtain the configured parallel switch parameters, which are used to indicate the function of enabling each first virtual processor thread to execute the target task in parallel.
3. The method according to claim 1, characterized in that, The main thread runs in the source host machine; The suspension of the at least two first virtual processor threads includes: The main thread sends a first notification message to each of the at least two first virtual processor threads; Each of the first virtual processor threads is suspended based on the first notification message.
4. The method according to claim 2, characterized in that, The main thread runs in the source host machine; The step of controlling each of the at least two first virtual processor threads to execute the target task in parallel includes: The main thread generates a second notification message based on the parallel switch parameters and sends the second notification message to each of the first virtual processor threads. Each of the first virtual processor threads executes the target task in parallel based on the second notification message.
5. The method according to claim 1, characterized in that, After controlling each of the at least two first virtual processor threads to execute the target task in parallel, the method further includes: Monitor the running status of each of the first virtual processor threads; When the running state of each of the first virtual processor threads is in a stopped state, it is determined that each of the first virtual processor threads has ended the execution of the target task.
6. A method for hot migration of virtual machines, characterized in that, Applied to the target host machine, the method includes: Receive migration instructions; Based on the migration instruction, the source host machine sends memory data, and the memory data is stored in a virtual machine running on the destination host machine; the virtual machine has at least two second virtual processor threads running in it. Control each of the at least two second virtual processor threads to execute the target task in parallel; If it is detected that each of the second virtual processor threads has finished executing the target task, dirty memory data sent by the destination host is received to migrate the virtual machine from the source host to the destination host.
7. A virtual machine hot migration device, characterized in that, Applied to the source host machine, including: The sending module is used to receive migration instructions and send the memory data of the virtual machine running on the source host to the destination host based on the migration instructions. The virtual machine has at least two first virtual processor threads running in it. The stop module is used to monitor the remaining amount of dirty memory data in the virtual machine, and to suspend the execution of at least two first virtual processor threads when the remaining amount of dirty memory data is less than a preset threshold. The control module is used to control each of the at least two first virtual processor threads to execute the target task in parallel; The processing module is configured to send the dirty memory data to the destination host machine when it is detected that each of the first virtual processor threads has finished executing the target task, so as to migrate the virtual machine from the source host machine to the destination host machine.
8. A virtual machine hot migration device, characterized in that, Applied to the destination host machine, including: The receiving module is used to receive migration instructions; The storage module is used to receive memory data sent by the source host based on the migration instruction, and store the memory data in a virtual machine running on the destination host; the virtual machine runs at least two second virtual processor threads; The control module is used to control each of the at least two second virtual processor threads to execute the target task in parallel. The processing module is configured to receive dirty memory data sent by the destination host machine when it is detected that each of the second virtual processor threads has finished executing the target task, so as to migrate the virtual machine from the source host machine to the destination host machine.
9. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6.