Virtual machine hot migration method and device, electronic device and storage medium

By switching the tunnel message address and port during the virtual machine migration process, the problems of high network overhead and high latency during virtual machine migration are solved, and low-overhead and low-latency hot migration is achieved.

CN115309503BActive Publication Date: 2025-10-03BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210893548.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2025-10-03
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

The existing virtual machine migration process has high network overhead and large data transmission delay. The existing technology is complex and cannot ensure network-aware migration.

Method used

By swapping the inner destination address and outer source address of the tunnel message during the virtual machine migration process, calculating the outer source port, and sending the switched tunnel message after the host machine migration, the outer five-tuple is ensured to remain unchanged, thus achieving same-flow and same-station gateway processing.

Benefits of technology

While reducing network overhead, it also lowers data transmission latency, enables hot migration of virtual machines, and ensures network transparency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309503B_ABST
    Figure CN115309503B_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for hot migration of a virtual machine, an electronic device, and a storage medium. The method comprises: swapping the content of a first target field and a second target field in a first tunnel message to obtain a second tunnel message, wherein the swapped first target field is used to represent an inner destination address, and the swapped second target field is used to represent an outer source address; calculating the target content based on the inner five-tuple of the first tunnel message before the swap, and setting the target content to the content of a third target field in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent an outer source port; after the virtual machine is migrated from the first host machine to the second host machine, sending the third tunnel message to the target gateway device via the target switch. This application solves the problems of high network overhead and large data transmission delay during virtual machine migration in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for hot migration of a virtual machine, an electronic device, and a storage medium. Background Art

[0002] Virtual machine migration is a common feature in cloud computing network scenarios. It enables efficient and timely response to failures, flexible utilization of computing resources, and efficient implementation of software or hardware upgrades. Existing virtual machine migration methods mostly rely on inter-cluster server session synchronization. This involves each server synchronizing its local session with other servers in the cluster in real time through a specific mechanism, ensuring that different servers can handle client connection information before and after the client migration. However, existing virtual machine migration implementations are complex, incur additional network overhead, and, due to limitations such as synchronization latency, cannot guarantee seamless network performance before and after the virtual machine migration. Summary of the Invention

[0003] The purpose of the embodiments of the present application is to provide a method and apparatus for hot migration of a virtual machine, an electronic device, and a storage medium, which solve the problems of high network overhead and large data transmission delay during virtual machine migration in the prior art. The specific technical solution is as follows:

[0004] In the first aspect of the implementation of the present application, a method for hot migration of a virtual machine is first provided, including: swapping the content of the first target field and the content of the second target field in the first tunnel message to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, and the switched first target field is used to represent the inner destination address, and the switched second target field is used to represent the outer source address; calculating the target content based on the inner five-tuple of the first tunnel message before the switching, and setting the target content to the third target field content in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent the outer source port; after the virtual machine migrates from the first host machine to the second host machine, sending the third tunnel message to the target gateway device through the target switch.

[0005] In the second aspect of the implementation of the present application, a hot migration device for a virtual machine is also provided, including: a switching module, used to switch the content of the first target field in the first tunnel message with the content of the second target field to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, and the switched first target field is used to represent the inner destination address, and the switched second target field is used to represent the outer source address; a calculation module, used to calculate the target content based on the inner five-tuple of the first tunnel message before the switching, and set the target content to the third target field content in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent the outer source port; a sending module, used to send the third tunnel message to the target gateway device through the target switch after the virtual machine migrates from the first host machine to the second host machine.

[0006] In a third aspect of the implementation of the present application, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.

[0007] In a fourth aspect of the implementation of the present application, a computer program product comprising instructions is further provided, which, when executed on a computer, enables the computer to execute the method described in the first aspect.

[0008] In an embodiment of the present application, the inner destination address and the outer source address in the first tunnel message to be sent by the virtual machine to the target gateway device through the target switch are switched to obtain a second tunnel message, and the outer source port is calculated from the inner five-tuple of the first tunnel message before the switching, and the third tunnel message is obtained based on the calculated outer source port and the second tunnel message, and the third tunnel message is sent after the host machine is migrated. Since the outer destination address is the gateway device address, the outer destination port is the fixed port of the tunnel, and the inner destination address is related to the data flow (including the tunnel message), that is, different data flows have different destination addresses, and for the same data flow, the inner address is fixed, and the outer source address is the host machine address where the virtual machine is located, so during the flow migration process, the address will change to the new host machine address. Based on this, the outer source address (host machine address) is exchanged to the inner layer, and the inner destination address is exchanged to the outer source address position, it can be ensured that the outer five-tuple ( Figure 3 The content of the outer five-tuple in the packet remains unchanged, so the switch can ensure that the same flow is sent to the same gateway device for processing. When the network overhead is small, the data transmission delay can also be small, realizing the hot migration of virtual machines, and solving the problems of high network overhead and large data transmission delay during virtual machine migration in the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.

[0010] Figure 1 A schematic diagram of the structure of a tunnel message in the prior art;

[0011] Figure 2 This is a flow chart of a hot migration method for a virtual machine in an embodiment of the present application;

[0012] Figure 3 This is a schematic diagram of the structure of the tunnel message after switching in an embodiment of the present application;

[0013] Figure 4 This is a schematic diagram of the cloud gateway cluster deployment structure in an embodiment of the present application;

[0014] Figure 5 This is a schematic diagram of the hot migration structure of a virtual machine in an embodiment of the present application;

[0015] Figure 6 This is a schematic diagram of the structure of a hot migration device for a virtual machine in an embodiment of the present application;

[0016] Figure 7 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0017] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0018] In the following description, the suffixes such as "module" and "unit" used to represent elements are only used to facilitate the description of this application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.

[0019] First, the tunnel message in the embodiment of the present application is explained. Figure 1 The following is a schematic diagram of the structure of the tunnel message. Figure 1 The upper layer of the tunnel message includes the outer source address, outer destination address, outer protocol, outer source port, outer destination port, and tunnel encapsulation protocol; the lower layer of the tunnel message includes: inner source address, inner destination address, inner protocol, inner source port, inner destination port, and data payload.

[0020] The following will describe the technical solution in the embodiment of the present application in conjunction with the accompanying drawings. The embodiment of the present application provides a method for hot migration of a virtual machine, such as Figure 2 As shown, the method includes the following steps:

[0021] Step 202: Swap the contents of the first destination field and the second destination field in the first tunnel message to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, the swapped first destination field is used to represent the inner destination address, and the swapped second destination field is used to represent the outer source address;

[0022] Step 204: Calculate the content of the third destination field in the second tunnel message based on the inner quintuple of the first tunnel message before the switching, and set the destination content to the content of the third destination field in the second tunnel message to obtain a third tunnel message, wherein the third destination field is used to represent the outer source port;

[0023] Step 206: After the virtual machine is migrated from the first host machine to the second host machine, a third tunnel message is sent to the target gateway device through the target switch.

[0024] Through the above steps 102 to 106, the inner destination address and the outer source address in the first tunnel message to be sent by the virtual machine to the target gateway device through the target switch are switched to obtain a second tunnel message, and the outer source port is calculated from the inner five-tuple of the first tunnel message before the switching, and the third tunnel message is obtained based on the calculated outer source port and the second tunnel message, and the third tunnel message is sent after the host machine is migrated. Since the outer destination address is the gateway device address, the outer destination port is the fixed port of the tunnel, and the inner destination address is related to the data flow (including the tunnel message), that is, different data flows have different destination addresses, and for the same data flow, the inner address is fixed, and the outer source address is the host machine address where the virtual machine is located, so during the flow migration process, the address will change to the new host machine address. Based on this, the outer source address (host machine address) is exchanged to the inner layer, and the inner destination address is exchanged to the outer source address position, it can be ensured that the outer five-tuple ( Figure 3 The content of the outer five-tuple in the packet remains unchanged, so the switch can ensure that the same flow is sent to the same gateway device for processing. When the network overhead is small, the data transmission delay can also be small, realizing the hot migration of virtual machines, and solving the problems of high network overhead and large data transmission delay during virtual machine migration in the existing technology.

[0025] In an optional implementation manner of the embodiment of the present application, the method of switching the content of the first destination field and the content of the second destination field in the first tunnel message involved in step 202 to obtain the second tunnel message may further include:

[0026] Step 11, determining an outer source address in a first destination field in the first tunnel message and an inner destination address in a second destination field in the first tunnel message;

[0027] Step 12: Set the inner destination address in the first destination field and the outer source address in the second destination field to obtain a second tunnel message.

[0028] like Figure 1 As shown, the outer five-tuple of the first tunnel message includes: outer source address, outer destination address, outer protocol, outer source port and outer destination port; the inner five-tuple of the first tunnel message includes: inner source address, inner destination address, inner protocol, inner source port and inner destination port. Based on the above steps 11 and 12, the outer source address and inner destination address in the first tunnel message can be switched. After the switching, Figure 3 As shown. After the switching, the second tunnel message is obtained, and the outer five-tuple of the second tunnel message includes: inner destination address, outer destination address, outer protocol, outer source port and outer destination port. The outer destination address is the gateway address, and the outer destination port is the fixed port of the tunnel. The inner destination address is related to the data flow, that is, different data flows have different destination addresses. For the same data flow, the destination address is fixed. The outer source address is the host address where the virtual machine client is located. During the flow migration process, the address will change to the new host address. Therefore, by exchanging the outer source address (host IP) to the inner layer and exchanging the inner destination address to the outer source address position, it can be ensured that the outer five-tuple of the third tunnel message obtained from the second tunnel message remains unchanged before and after the data flow migration, so that the switch can ensure that the same flow is transmitted to the same gateway for processing.

[0029] In a specific example of an embodiment of the present application, the gateway device in the present application may be a gateway cluster server in a cloud gateway cluster, and the switch is a gateway uplink switch connected to the gateway cluster server, which may be specifically as follows: Figure 4As shown, the gateway servers Y1, Y2, and Y3 rely on the load balancing of the upstream switches SW1 and SW2 to form a cluster and provide services to the outside world. For cloud network services such as NAT (Network Address Translation) and SLB (Server Load Balancer), when each flow passes through a gateway, the device will form session information for the flow and locally record and cache it for subsequent forwarding of the flow. Since its forwarding needs to rely on session information, it is necessary to ensure that each flow is processed by the same gateway within its life cycle. By switching the outer source address (client host address) and the inner destination address (server IP) in this application, and configuring the upstream switch to be based on the outer five-tuple hash of the tunnel message, the same flow is processed by the same gateway.

[0030] In another optional implementation of an embodiment of the present application, the method of calculating the target content from the inner five-tuple of the first tunnel message before switching involved in the above step 204 can further include: calculating the target content based on a preset hash algorithm and the inner five-tuple of the first tunnel message before switching; wherein, the inner five-tuple of the first tunnel message before switching includes: inner source address, inner destination address, inner protocol, inner source port, and inner destination port.

[0031] It should be noted that the preset hash algorithms involved in the embodiments of the present application may be MD5, sha-1, Jhash, CRC, etc. The outer five-tuple of the first tunnel message after switching, that is, the second tunnel message, includes: an inner destination address, an outer destination address, an outer protocol, an outer source port, and an outer destination port, wherein the outer destination address is the gateway address, and the outer destination port is a fixed tunnel port. The inner destination address is related to the flow, that is, the destination addresses of different flows are different. For the same flow, the inner destination address is fixed. The outer source port is calculated based on the inner five-tuple in the first pair of messages, and the inner five-tuple of the first tunnel message does not change before the virtual machine migration. Therefore, the calculated outer source port is also fixed, thereby ensuring that the outer five-tuple in the third tunnel message obtained based on the second tunnel message remains unchanged.

[0032] In an embodiment of the present application, a method for migrating a virtual machine from a first host machine to a second host machine includes: determining the address of the second host machine as the outer source address in the third tunnel message.

[0033] In addition, in an embodiment of the present application, the method of sending the second tunnel message to the target gateway device through the target switch involved in the above step 206 can further be: sending the third tunnel message to the target gateway device based on the outer five-tuple in the third tunnel message, wherein the outer five-tuple includes: outer source address, inner destination address, outer protocol, outer source port, and outer destination port.

[0034] Since the outer destination address is the gateway address, the outer destination port is the fixed port of the tunnel. The inner destination address is related to the data flow, that is, different data flows have different destination addresses. For the same data flow, the destination address is fixed. The outer source address is the host address where the virtual machine client is located. Figure 5 As shown in the figure, after client VM X migrates from host A to host B, the outer source address changes to the new host (host B). However, the outer five-tuple of the tunnel message remains unchanged, ensuring that the switch can transmit the same flow to the same gateway for processing. That is, after client VM X migrates from host A to host B, it can still transmit the flow to server Z1 through gateway cluster server Y2.

[0035] Corresponding to the above Figure 2 The embodiment of the present application provides a hot migration device for a virtual machine, such as Figure 6 As shown, the device includes:

[0036] a switching module 62 configured to swap the contents of the first destination field and the second destination field in the first tunnel message to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, the swapped first destination field is used to represent the inner destination address, and the swapped second destination field is used to represent the outer source address;

[0037] a calculation module 64 configured to calculate a target content based on the inner quintuple of the first tunnel message before the switching, and set the target content to the content of the third target field in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent the outer source port;

[0038] The sending module 66 is configured to send a third tunnel message to the target gateway device through the target switch after the virtual machine is migrated from the first host machine to the second host machine.

[0039] Through the device of the embodiment of the present application, the inner destination address and the outer source address in the first tunnel message to be sent by the virtual machine to the target gateway device through the target switch are switched to obtain a second tunnel message, and the outer source port is calculated from the inner five-tuple of the first tunnel message before the switching, and the third tunnel message is obtained based on the calculated outer source port and the second tunnel message, and the third tunnel message is sent after the host machine is migrated. Since the outer destination address is the gateway device address, the outer destination port is the fixed port of the tunnel, and the inner destination address is related to the data flow (including the tunnel message), that is, different data flows have different destination addresses, and for the same data flow, the inner address is fixed, and the outer source address is the host machine address where the virtual machine is located, so during the flow migration process, the address will change to the new host machine address. Based on this, the outer source address (host machine address) is exchanged to the inner layer, and the inner destination address is exchanged to the outer source address position, it can be ensured that the outer five-tuple ( Figure 3 The content of the outer five-tuple in the packet remains unchanged, so the switch can ensure that the same flow is sent to the same gateway device for processing. When the network overhead is small, the data transmission delay can also be small, realizing the hot migration of virtual machines, and solving the problems of high network overhead and large data transmission delay during virtual machine migration in the existing technology.

[0040] Optionally, the switching module 62 implemented in the present application may further include: a determination unit, used to determine the outer source address in the first destination field in the first tunnel message, and the inner destination address in the second destination field in the first tunnel message; a setting unit, used to set the inner destination address in the first destination field, and set the outer source address in the second destination field to obtain a second tunnel message.

[0041] like Figure 1 As shown, the outer five-tuple of the first tunnel message includes: outer source address, outer destination address, outer protocol, outer source port and outer destination port; the inner five-tuple of the first tunnel message includes: inner source address, inner destination address, inner protocol, inner source port and inner destination port. Based on the above steps 11 and 12, the outer source address and inner destination address in the first tunnel message can be switched. After the switching, Figure 3As shown. After the switching, the second tunnel message is obtained, and the outer five-tuple of the second tunnel message includes: inner destination address, outer destination address, outer protocol, outer source port and outer destination port. The outer destination address is the gateway address, and the outer destination port is the fixed port of the tunnel. The inner destination address is related to the data flow, that is, different data flows have different destination addresses. For the same data flow, the destination address is fixed. The outer source address is the host address where the virtual machine client is located. During the flow migration process, the address will change to the new host address. Therefore, by exchanging the outer source address (host IP) to the inner layer and exchanging the inner destination address to the outer source address position, it can be ensured that the outer five-tuple in the third tunnel message obtained based on the second tunnel message remains unchanged before and after the data flow migration, so that the switch can ensure that the same flow is transmitted to the same gateway for processing.

[0042] Optionally, the calculation module 64 in the embodiment of the present application may further include: a calculation unit, used to calculate the target content based on a preset hash algorithm and the inner five-tuple of the first tunnel message before switching; wherein, the inner five-tuple of the first tunnel message before switching includes: inner source address, inner protocol, inner destination address, inner source port, and inner destination port.

[0043] It should be noted that the preset hash algorithms involved in the embodiments of the present application may be MD5, sha-1, Jhash, CRC, etc. The outer five-tuple of the first tunnel message after switching, that is, the second tunnel message, includes: an inner destination address, an outer destination address, an outer protocol, an outer source port, and an outer destination port, wherein the outer destination address is the gateway address, and the outer destination port is a fixed tunnel port. The inner destination address is related to the flow, that is, the destination addresses of different flows are different. For the same flow, the inner destination address is fixed. The outer source port is calculated based on the inner five-tuple in the first pair of messages, and the inner five-tuple of the first tunnel message does not change before the virtual machine migration. Therefore, the calculated outer source port is also fixed, thereby ensuring that the outer five-tuple in the third tunnel message obtained based on the second tunnel message remains unchanged.

[0044] Optionally, the apparatus of the embodiment of the present application may further include: a migration module, configured to determine the address of the second host machine as the outer source address in the third tunnel message.

[0045] Based on this, the sending module 66 in the embodiment of the present application may further include: a sending unit, used to send the third tunnel message to the target gateway device based on the outer five-tuple in the third tunnel message, wherein the outer five-tuple includes: outer source address, inner destination address, outer protocol, outer source port, and outer destination port.

[0046] Since the outer destination address is the gateway address, the outer destination port is the fixed port of the tunnel. The inner destination address is related to the data flow, that is, different data flows have different destination addresses. For the same data flow, the destination address is fixed. The outer source address is the host address where the virtual machine client is located. Figure 5 As shown in the figure, after client VM X migrates from host A to host B, the outer source address changes to the new host (host B). However, the outer five-tuple of the tunnel message remains unchanged, ensuring that the switch can transmit the same flow to the same gateway for processing. That is, after client VM X migrates from host A to host B, it can still transmit the flow to server Z1 through gateway cluster server Y2.

[0047] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0048] Memory 703, used for storing computer programs;

[0049] Processor 701 is used to execute the program stored in memory 703 to achieve Figure 2 The method steps in Figure 2 The method and steps are the same as in , and will not be repeated here.

[0050] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0051] The communication interface is used for communication between the above terminal and other devices.

[0052] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0053] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0054] In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the hot migration method of the virtual machine described in any of the above embodiments.

[0055] In another embodiment provided by the present application, a computer program product including instructions is further provided, which, when executed on a computer, enables the computer to execute the hot migration method of a virtual machine described in any one of the above embodiments.

[0056] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0057] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0058] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.

[0059] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the scope of protection of the present application.

Claims

1. A method for hot migration of a virtual machine, characterized in that: include: Swap the contents of the first destination field and the second destination field in the first tunnel message to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, the switched first destination field is used to represent the inner destination address, and the switched second destination field is used to represent the outer source address; the outer five-tuple of the first tunnel message includes: the outer source address, the outer destination address, the outer protocol, the outer source port, and the outer destination port; the inner five-tuple of the first tunnel message includes: the inner source address, the inner destination address, the inner protocol, the inner source port, and the inner destination port; Calculating a target content based on the inner quintuple of the first tunnel message before switching, and setting the target content to the third target field content in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent the outer source port; After the virtual machine is migrated from the first host machine to the second host machine, sending the third tunnel message to the target gateway device through the target switch; Among them, the switching of the content of the first destination field in the first tunnel message with the content of the second destination field to obtain the second tunnel message includes: determining the outer source address in the first destination field in the first tunnel message, and the inner destination address in the second destination field in the first tunnel message; setting the inner destination address in the first destination field, and setting the outer source address in the second destination field to obtain the second tunnel message; the outer five-tuple of the second tunnel message includes: inner destination address, outer destination address, outer protocol, outer source port and outer destination port.

2. The method according to claim 1, characterized in that The target content calculated based on the inner quintuple of the first tunnel message before the switching includes: The target content is calculated based on a preset hash algorithm and the inner five-tuple of the first tunnel message before switching; wherein, the inner five-tuple of the first tunnel message before switching includes: inner source address, inner destination address, inner protocol, inner source port, and inner destination port.

3. The method according to claim 1, characterized in that Migrating the virtual machine from the first host machine to the second host machine includes: The address of the second host machine is determined as the outer source address in the third tunnel message.

4. The method according to claim 3, characterized in that The sending the third tunnel message to the target gateway device through the target switch includes: The third tunnel message is sent to the target gateway device based on the outer quintuple in the third tunnel message, wherein the outer quintuple includes: inner destination address, outer destination address, outer protocol, outer source port and outer destination port.

5. A hot migration device for a virtual machine, characterized in that: include: A switching module, configured to swap the content of the first destination field and the content of the second destination field in the first tunnel message to obtain a second tunnel message, wherein the first tunnel message is a tunnel message to be sent by the virtual machine to the target gateway device through the target switch, the switched first destination field is used to represent the inner destination address, and the switched second destination field is used to represent the outer source address; the outer five-tuple of the first tunnel message includes: the outer source address, the outer destination address, the outer protocol, the outer source port, and the outer destination port; the inner five-tuple of the first tunnel message includes: the inner source address, the inner destination address, the inner protocol, the inner source port, and the inner destination port; a processing module, configured to calculate a target content based on the inner quintuple of the first tunnel message before switching, and set the target content to the third target field content in the second tunnel message to obtain a third tunnel message, wherein the third target field is used to represent an outer source port; a sending module, configured to send the third tunnel message to the target gateway device through the target switch after the virtual machine is migrated from the first host machine to the second host machine; Among them, the switching module includes: a determination unit, used to determine the outer source address in the first destination field in the first tunnel message, and the inner destination address in the second destination field in the first tunnel message; a setting unit, used to set the inner destination address in the first destination field, and set the outer source address in the second destination field to obtain the second tunnel message; the outer five-tuple of the second tunnel message includes: inner destination address, outer destination address, outer protocol, outer source port and outer destination port.

6. The device according to claim 5, characterized in that The processing module includes: A calculation unit is used to calculate the target content based on a preset hash algorithm and the inner five-tuple of the first tunnel message before switching; wherein, the inner five-tuple of the first tunnel message before switching includes: inner source address, inner destination address, inner protocol, inner source port, and inner destination port.

7. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 4 when executing a program stored in a memory.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • A tunnel link detection method and related equipment

    CN109787878A

  • Gateway determination method and device, server, distributor, gateway determination system and storage medium

    CN112333135A