Method, device, computer device and medium for recycling virtual machine IP address
Patent Information
- Application Number
- CN202311160576.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-08
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-09-08
AI Technical Summary
[0003]有鉴于此,本发明提供了一种回收虚拟机IP地址的方法、装置、计算机设备及介质,以解决新的虚拟机因为DHCP地址池中的所有IP已经被占用,而无法获取到可用的IP地址的问题
[0012] The system acquires the first IP address, MAC address, and second IP address sent by the data processing unit. It then obtains the first identification information of the first virtual machine based on the MAC address. Next, it sends control commands to the nodes in the cluster, carrying the first identification information and instructing each node to create a disappearance event and a creation event for the first virtual machine. Receiving a disappearance event corresponding to the first virtual machine from any node only confirms that the first virtual machine has gone offline on that node, but not that it is globally offline. Therefore, a monitoring wait time is required. If no creation event corresponding to the first virtual machine is received from other nodes within the monitoring wait time, indicating that the first virtual machine has indeed gone offline globally, a second control command can be sent to the data processing unit, carrying the first IP address, MAC address, and second IP address. This allows the data processing unit to instruct the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address, ensuring that subsequent new virtual machines can obtain usable IP addresses from the DHCP address pool.
Smart Images

Figure CN117061486B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to methods, apparatus, computer equipment, and media for reclaiming virtual machine IP addresses. Background Technology
[0002] In cloud computing, virtual machines obtain their IP addresses from a Dynamic Host Configuration Protocol (DHCP) server. If the IP address lease hasn't expired, even if the virtual machine is shut down or deleted, the DHCP server won't immediately reassign the IP to another virtual machine, resulting in a large number of IPs being occupied. Furthermore, these occupied IP addresses cannot be obtained by new virtual machines, potentially causing new virtual machines to be unable to acquire a usable IP address because all IPs in the DHCP address pool are already taken. Summary of the Invention
[0003] In view of this, the present invention provides a method, apparatus, computer device and medium for reclaiming virtual machine IP addresses, in order to solve the problem that new virtual machines cannot obtain available IP addresses because all IPs in the DHCP address pool have been occupied.
[0004] In a first aspect, the present invention provides a method for reclaiming virtual machine IP addresses, the method being executed by a cloud platform, the method comprising:
[0005] The data processing unit obtains the first IP address and MAC address of the first virtual machine and the second IP address of the dynamic host configuration protocol server, wherein the first virtual machine is any virtual machine configured in the cluster corresponding to the cloud platform.
[0006] Based on the MAC address, determine the first identification information of the first virtual machine;
[0007] Send a first control instruction to the nodes in the cluster. The first control instruction carries first identification information and is used to instruct the nodes in the cluster to create a disappearance event and a generation event for the first virtual machine according to the first identification information.
[0008] When a disappearance event corresponding to the first virtual machine is received from any node, set a monitoring wait time;
[0009] If no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time, the first virtual machine is determined to be globally offline.
[0010] A second control instruction is sent to the data processing unit, wherein the second control instruction carries a first IP address, a MAC address, and a second IP address, so that the data processing unit instructs the Dynamic Host Configuration Protocol server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
[0011] The present invention provides a method for reclaiming virtual machine IP addresses, which has the following advantages:
[0012] The system acquires the first IP address, MAC address, and second IP address sent by the data processing unit. It then obtains the first identification information of the first virtual machine based on the MAC address. Next, it sends control commands to the nodes in the cluster, carrying the first identification information and instructing each node to create a disappearance event and a creation event for the first virtual machine. Receiving a disappearance event corresponding to the first virtual machine from any node only confirms that the first virtual machine has gone offline on that node, but not that it is globally offline. Therefore, a monitoring wait time is required. If no creation event corresponding to the first virtual machine is received from other nodes within the monitoring wait time, indicating that the first virtual machine has indeed gone offline globally, a second control command can be sent to the data processing unit, carrying the first IP address, MAC address, and second IP address. This allows the data processing unit to instruct the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address, ensuring that subsequent new virtual machines can obtain usable IP addresses from the DHCP address pool.
[0013] In one optional implementation, after obtaining the first IP address and MAC address of the first virtual machine and the second IP address of the Dynamic Host Configuration Protocol (DHCP) server sent by the data processing unit, the method further includes:
[0014] Add the first identifier information of the first virtual machine to the virtual machine monitoring queue.
[0015] Specifically, adding the first identifier information to the virtual machine monitoring queue facilitates effective monitoring of the first virtual machine in the future.
[0016] In one alternative implementation, the method further includes:
[0017] When a generation event corresponding to the second virtual machine is received from any node, the second identification information of the second virtual machine is extracted from the generation event corresponding to the second virtual machine.
[0018] The second identification information is matched with the identification information stored in the virtual machine monitoring queue;
[0019] If no match is found, the generation event corresponding to the second virtual machine will be deleted.
[0020] Specifically, when a generation event corresponding to the second virtual machine is received from any node, the second identification information of the second virtual machine is obtained. This second identification information is then matched against the identification information in the virtual machine monitoring queue. If a match is successful, it indicates that the second virtual machine has already taken effect on other nodes and is not globally offline. Alternatively, if a match is unsuccessful, it means that the generation event corresponding to the second virtual machine is not the generation event of the virtual machine that the cloud platform needs to monitor. In this case, no processing is required, and the generation event corresponding to the second virtual machine is directly deleted.
[0021] Secondly, the present invention provides a method for reclaiming virtual machine IP addresses, the method being executed by a listening application configured in a data processing unit, the method comprising:
[0022] Receive flow table matching rules issued by the cloud platform. The flow table matching rules are used to match dynamic host configuration protocol response messages that meet preset conditions.
[0023] Send flow table matching rules to the smart NIC acceleration engine;
[0024] When the Dynamic Host Configuration Protocol (DHCP) response message sent by the smart network card acceleration engine is received, the DHCP response message is parsed to obtain and save the first IP address and MAC address of the first virtual machine, as well as the second IP address of the DHCP server.
[0025] Monitor whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period;
[0026] When the monitoring application does not detect a message indicating a conflict with the first IP address within a preset time period, it sends the first IP address, MAC address, and second IP address to the cloud platform.
[0027] When a control command is received from the cloud platform, and the control command includes a first IP address, a MAC address, and a second IP address, a release message for the Dynamic Host Configuration Protocol server is generated based on the first IP address, the MAC address, and the second IP address.
[0028] The release message is sent to the target DHCP server so that the target DHCP server can reclaim the first IP address.
[0029] The present invention provides a method for reclaiming virtual machine IP addresses, which has the following advantages:
[0030] The system sends flow table matching rules to the smart NIC acceleration engine. These rules are used to match Dynamic Host Configuration Protocol (DHCP) response messages that meet preset conditions. When a DHCP response message from the smart NIC acceleration engine is received, it is parsed to obtain and save the first IP address, MAC address, and second IP address. The system checks whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period. If no such message is received, it indicates no IP address conflict, and the first IP address, MAC address, and second IP address can be sent to the cloud platform via a message channel for cloud platform monitoring. Upon receiving a control command from the cloud platform, a release message for the DHCP server is generated based on the first IP address, MAC address, and second IP address carried in the control command and sent to the DHCP server so that the DHCP server can reclaim the first IP address.
[0031] In one optional implementation, the preset condition is that the Dynamic Host Configuration Protocol (DHCP) response message carries a first IP address, a MAC address, and a second IP address, and the field values of the first IP address, the MAC address, and the second IP address are all non-empty.
[0032] In one optional implementation, when a message indicating a conflict with the first IP address is detected within a preset time period, the saved first IP address, MAC address, and second IP address are cleared.
[0033] Specifically, when a message indicating a conflict with the first IP address is detected within a preset time period, it means that the first IP address has been occupied by another virtual machine, and therefore the saved first IP address needs to be cleared.
[0034] Thirdly, the present invention provides a method for reclaiming virtual machine IP addresses, the method being executed by nodes in a cluster, the method comprising:
[0035] Receiving control commands sent by the cloud platform;
[0036] According to the control instructions, a disappearance event and a creation event are created for the first virtual machine;
[0037] Monitor the running status of the first virtual machine. The running status is used to determine whether the disappearance event of the first virtual machine is effective or whether the creation event of the first virtual machine is effective.
[0038] Send the running status to the cloud platform.
[0039] The present invention provides a method for reclaiming virtual machine IP addresses, which has the following advantages:
[0040] The system receives control commands from the cloud platform and creates disappearance and creation events for the first virtual machine based on these commands. It also monitors the running status of the first virtual machine, which may include the activation of either the disappearance event or the creation event. Regardless of the running status, data must be sent to the cloud platform. This allows the cloud platform to determine when to globally shut down the first virtual machine based on its running status, and subsequently inform the data processing unit to reclaim the first virtual machine's IP address.
[0041] Fourthly, the present invention provides an apparatus for reclaiming virtual machine IP addresses, the apparatus comprising:
[0042] The acquisition module is used to acquire the first IP address and MAC address of the first virtual machine and the second IP address of the dynamic host configuration protocol server sent by the data processing unit. The first virtual machine is any virtual machine configured in the cluster corresponding to the cloud platform.
[0043] The determination module is used to determine the first identification information of the first virtual machine based on the MAC address;
[0044] The sending module is used to send a first control instruction to the nodes in the cluster. The first control instruction carries first identification information and is used to instruct the nodes in the cluster to create a disappearance event and a generation event for the first virtual machine according to the first identification information.
[0045] The receiving module is used to receive the disappearance event corresponding to the first virtual machine from any node;
[0046] The processing module is used to set a monitoring waiting time when the receiving module receives a disappearance event corresponding to the first virtual machine from any node; and when no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time, the first virtual machine is determined to be globally offline.
[0047] The sending module is also used to send a second control instruction to the data processing unit, wherein the second control instruction carries a first IP address, a MAC address, and a second IP address, so that the data processing unit instructs the Dynamic Host Configuration Protocol server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
[0048] The device for reclaiming virtual machine IP addresses provided by this invention has the following advantages:
[0049] The system acquires the first IP address, MAC address, and second IP address sent by the data processing unit. It then obtains the first identification information of the first virtual machine based on the MAC address. Next, it sends control commands to the nodes in the cluster, carrying the first identification information and instructing each node to create a disappearance event and a creation event for the first virtual machine. Receiving a disappearance event corresponding to the first virtual machine from any node only confirms that the first virtual machine has gone offline on that node, but not that it is globally offline. Therefore, a monitoring wait time is required. If no creation event corresponding to the first virtual machine is received from other nodes within the monitoring wait time, indicating that the first virtual machine has indeed gone offline globally, a second control command can be sent to the data processing unit, carrying the first IP address, MAC address, and second IP address. This allows the data processing unit to instruct the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address, ensuring that subsequent new virtual machines can obtain usable IP addresses from the DHCP address pool.
[0050] Fifthly, the present invention provides an apparatus for reclaiming virtual machine IP addresses, the apparatus comprising:
[0051] The receiving module is used to receive flow table matching rules issued by the cloud platform. The flow table matching rules are used to match dynamic host configuration protocol response messages that meet preset conditions.
[0052] The sending module is used to send flow table matching rules to the smart network interface card acceleration engine;
[0053] The acquisition module is used to acquire the Dynamic Host Configuration Protocol (DHCP) response messages sent by the smart network interface card (NIC) acceleration engine.
[0054] The parsing module is used to parse the Dynamic Host Configuration Protocol (DHCP) response messages, obtain and save the first IP address and MAC address of the first virtual machine, and the second IP address of the DHCP server.
[0055] The monitoring module is used to monitor whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period;
[0056] The sending module is also used to send the first IP address, MAC address, and second IP address to the cloud platform when the listening application does not detect a message indicating a conflict with the first IP address within a preset time period.
[0057] The receiving module is also used to receive control commands sent by the cloud platform;
[0058] The processing module is used to generate a release message for the Dynamic Host Configuration Protocol server based on the first IP address, MAC address, and second IP address when it is determined that the control command includes a first IP address, a MAC address, and a second IP address.
[0059] The sending module is also used to send a release message to the target Dynamic Host Configuration Protocol (DHCP) server so that the target DHCP server can reclaim the first IP address.
[0060] The device for reclaiming virtual machine IP addresses provided by this invention has the following advantages:
[0061] The system sends flow table matching rules to the smart NIC acceleration engine. These rules are used to match Dynamic Host Configuration Protocol (DHCP) response messages that meet preset conditions. When a DHCP response message from the smart NIC acceleration engine is received, it is parsed to obtain and save the first IP address, MAC address, and second IP address. The system checks whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period. If no such message is received, it indicates no IP address conflict, and the first IP address, MAC address, and second IP address can be sent to the cloud platform via a message channel for cloud platform monitoring. Upon receiving a control command from the cloud platform, a release message for the DHCP server is generated based on the first IP address, MAC address, and second IP address carried in the control command and sent to the DHCP server so that the DHCP server can reclaim the first IP address.
[0062] Sixthly, the present invention provides an apparatus for reclaiming virtual machine IP addresses, the apparatus comprising:
[0063] The acquisition module is used to acquire control commands sent by the cloud platform;
[0064] The creation module is used to create disappearance and creation events for the first virtual machine according to control instructions;
[0065] The monitoring module is used to monitor the running status of the first virtual machine. The running status is used to determine whether the disappearance event of the first virtual machine is effective or whether the creation event of the first virtual machine is effective.
[0066] The sending module is used to send the running status to the cloud platform.
[0067] The device for reclaiming virtual machine IP addresses provided by this invention has the following advantages:
[0068] The system receives control commands from the cloud platform and creates disappearance and creation events for the first virtual machine based on these commands. It also monitors the running status of the first virtual machine, which may include the activation of either the disappearance event or the creation event. Regardless of the running status, data must be sent to the cloud platform. This allows the cloud platform to determine when to globally shut down the first virtual machine based on its running status, and subsequently inform the data processing unit to reclaim the first virtual machine's IP address.
[0069] In a seventh aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method for reclaiming virtual machine IP addresses described in the first aspect or any corresponding embodiment thereof.
[0070] Eighthly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method for reclaiming virtual machine IP addresses as described in the second aspect or any corresponding embodiment thereof; or, the processor executing the computer instructions to perform the method for reclaiming virtual machine IP addresses as described in the third aspect or any corresponding embodiment thereof.
[0071] In a ninth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a cloud platform to perform the method for reclaiming virtual machine IP addresses described in the first aspect or any corresponding embodiment thereof.
[0072] In a tenth aspect, the present invention provides a computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a computer device to perform the method for reclaiming virtual machine IP addresses as described in the second aspect or any corresponding embodiment thereof; or, the computer instructions being configured to cause a computer device to perform the method for reclaiming virtual machine IP addresses as described in the third aspect or any corresponding embodiment thereof. Attached Figure Description
[0073] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0074] Figure 1This is a simplified structural diagram illustrating the positional relationships between various execution entities in a cloud computing data application scenario provided by the present invention.
[0075] Figure 2 This is a flowchart illustrating a method for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0076] Figure 3 This is a flowchart illustrating another method for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0077] Figure 4 This is a flowchart illustrating another method for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0078] Figure 5 This is a structural block diagram of a device for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0079] Figure 6 This is a structural block diagram of another device for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0080] Figure 7 This is a structural block diagram of another device for reclaiming virtual machine IP addresses provided in an embodiment of the present invention;
[0081] Figure 8 This is a schematic diagram of the hardware structure of the cloud platform according to an embodiment of the present invention;
[0082] Figure 9 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0083] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0084] In the field of cloud computing, virtual machines obtain their IP addresses from DHCP servers. If the lease of an IP address has not expired, even if the virtual machine is shut down or deleted, the DHCP server will not reallocate the IP address to other virtual machines in real time. This results in a large number of IP addresses being occupied, and new virtual machines may be unable to obtain an IP address because the DHCP address pool is exhausted.
[0085] To address the aforementioned problems, this invention provides an embodiment for reclaiming virtual machine IP addresses. This method is applicable to a cloud computing data application scenario where interaction occurs between a cloud platform and nodes in a cluster. The interaction entities in this application scenario include the cloud platform, nodes in the cluster, and a DHCP server. The computing nodes in the cluster are configured with a Data Processing Unit (DPU), virtual machines, and an OVS (Open vSwitch) virtual switch. The DPU contains a smart network interface card (NIC) with an embedded CPU. A monitoring application is deployed on the smart NIC and is located on the OVS virtual switch side. See details... Figure 1 As shown, Figure 1 The diagram illustrates a simplified positional relationship between the various execution entities in this application scenario.
[0086] The specific interaction process is as follows:
[0087] Step 1: The cloud platform distributes the flow table matching rules to the compute nodes;
[0088] Step 2: The listening application configured in the data processing unit of the compute node receives the flow table matching rules issued by the cloud platform;
[0089] Step 3: The monitoring application directly sends these rules to the smart network card hardware acceleration engine through the TC FLOWER interface or the DPDK RTE interface.
[0090] Step 4: The smart network card hardware acceleration engine monitors Dynamic Host Configuration Protocol (DHCPACK) response messages that meet preset conditions.
[0091] In one optional implementation, the preset condition is that the Dynamic Host Configuration Protocol (DHCP) response message carries the IP address of the DHCP server, the IP address of the virtual machine, and the MAC address of the virtual machine, and the field values of the DHCP server's IP address, the virtual machine's IP address, and the virtual machine's MAC address are all non-empty.
[0092] Step 5: When the smart network card hardware acceleration engine determines that a DHCP ACK packet that meets the preset conditions exists, it will mirror and copy the DHCP ACK packet that meets the preset conditions to the listening application.
[0093] The original message remains unchanged and continues to be sent along the original network path.
[0094] Step 6: The application layer listens for and parses DHCP ACK packets that meet the preset conditions, extracting the client IP address (i.e., the virtual machine IP address), the DHCP server IP address, and the client MAC address (i.e., the virtual machine MAC address) from the packet.
[0095] Step 7: The monitoring application saves the virtual machine's IP address, the DHCP server's IP address, and the virtual machine's MAC address to the local machine.
[0096] Step 8: The listening application starts a virtual machine IP validity detection thread to monitor whether the virtual machine sends a message indicating an IP address conflict within a preset time period.
[0097] In an optional example, the monitoring focuses on DHCP Decline messages sent by virtual machines. This is because a virtual machine will only send a DHCP Decline message to the DHCP server if there is an IP address conflict.
[0098] In an optional implementation, besides determining whether an IP address conflicts occur using the methods described above, one or more of the following methods can also be used: For example, sending an ICMP request to the IP address to be detected. If an ICMP response is received, it indicates that an IP address conflict exists. Alternatively, checking if multiple devices are requesting the same IP address. Or, scanning the local area network to find if multiple devices are using the same IP address, etc. The specific implementation method is not limited here.
[0099] Step 9: When the monitoring application does not detect a message indicating an IP address conflict of the virtual machine within a preset time period, it sends the IP address, MAC address of the virtual machine, and the IP address of the DHCP server to the cloud platform through the message channel.
[0100] If a message indicating an IP address conflict with the virtual machine is detected within a preset time period, the listening application will clear the relevant data stored locally corresponding to the virtual machine, such as the virtual machine's IP address, the DHCP server's IP address, and the MAC address.
[0101] Step 10: The cloud platform receives the virtual machine's IP address, MAC address, and DHCP server's IP address from the listening application in the data processing unit via the message channel.
[0102] Step 11: The cloud platform obtains the identification information of the virtual machine based on the MAC address, and then sends control commands to the nodes in the cluster.
[0103] The control command carries the identification information of the virtual machine. This control command is used to instruct each node in the cluster to create a disappearance event and a creation event for the virtual machine according to the identification information.
[0104] Optionally, the cloud platform will also add the virtual machine's identification information to the virtual machine monitoring queue so that the cloud platform can monitor whether the virtual machine is online in the future.
[0105] Step 12: After receiving the control command sent by the cloud platform, any node in the cluster will register two events for the virtual machine.
[0106] One of them is a generation event, and the other is a disappearance event.
[0107] Specifically, this operation is performed by the Libvirt service on the compute node. It registers the two events mentioned above for the virtual machine, which in fact means registering the two events for the corresponding QEMU process. QEMU is a purely software-based virtualization emulator that can simulate almost any hardware device. The most familiar example is its ability to simulate a virtual machine capable of running an independent operating system. The virtual machine believes it is interacting with the hardware, but in reality, it is interacting with the hardware simulated by QEMU. QEMU translates these instructions to the actual hardware.
[0108] Step 13: The node monitors the running status of the first virtual machine. The running status is used to determine whether the virtual machine disappearance event or the virtual machine creation event is effective.
[0109] Specifically, the Libvirt service immediately captures the disappearance event when the virtual machine qemu process disappears; or, the Libvirt service on the compute node immediately captures the generation event when the virtual machine qemu process appears.
[0110] Step 14: The node sends its running status to the cloud platform.
[0111] Step 15: When the cloud platform receives a disappearance event corresponding to the aforementioned virtual machine from any node, it sets a monitoring waiting time.
[0112] Step 16: If no generation event corresponding to the aforementioned virtual machine is received from any node after the monitoring waiting time, then the virtual machine is determined to be globally offline.
[0113] Step 17: Send a control command to the data processing unit. The control command carries the virtual machine's IP address, MAC address, and the DHCP server's IP address.
[0114] Step 18: The data processing unit constructs a DHCP Release message using the virtual machine's IP address as the source IP address and sends the message to the DHCP server to notify the DHCP server to reclaim the virtual machine's IP address, thus achieving the purpose of timely reclaiming the IP address occupied by the virtual machine. The message carries the virtual machine's IP address, MAC address, and the DHCP server's IP address.
[0115] Step 19: The DHCP server reclaims the virtual machine's IP address based on the DHCP Release message.
[0116] Optionally, after step 14, if the cloud platform receives a generation event corresponding to any virtual machine from any node, the process may also include step 20, in which the cloud platform obtains the identification information of the virtual machine.
[0117] Step 21: The cloud platform matches the identification information of the virtual machine with the identification information stored in the virtual machine monitoring queue.
[0118] Step 22: If a match is not found, delete the corresponding generation event for that virtual machine.
[0119] Specifically, when the QEMU virtual machine process disappears, the Libvirt service immediately reports the disappearance event D1 to the cloud platform. The cloud platform then globally monitors the cluster to see if the virtual machine appears on other compute nodes, with a monitoring wait time T set here. When the QEMU virtual machine process is created, the Libvirt service immediately reports the creation event B1 to the cloud platform. If the virtual machine is not in the cloud platform's VM status monitoring queue, the creation event B1 is discarded. If the virtual machine is in the cloud platform's VM status monitoring queue and the creation event B1 is within the monitoring wait time T, the cloud platform considers the virtual machine to have only undergone hot migration or HA, and the virtual machine has not been globally offline. If the monitoring wait time T expires and the cloud platform still has not received the creation event B1, it considers the virtual machine to be globally offline in this cluster and needs to reclaim the virtual machine's DHCP address. After comprehensive judgment, if the cloud platform believes that the virtual machine is offline within the cluster, it notifies the monitoring application configured in the data processing unit that the virtual machine has been globally offline.
[0120] After receiving the control command from the cloud platform, the monitoring application determines that the virtual machine is offline globally. The monitoring application will construct a DHCP Release message using the virtual machine's IP address as the source IP address and send the message to the DHCP server to notify the DHCP server to reclaim the virtual machine's IP address, thus achieving the goal of timely reclaiming the IP address occupied by the virtual machine.
[0121] The above describes the entire interactive process of reclaiming a virtual machine's IP address.
[0122] This embodiment provides a method for reclaiming virtual machine IP addresses, see details below. Figure 2 As shown, Figure 2 This is a flowchart of a method for reclaiming virtual machine IP addresses according to an embodiment of the present invention. The method is executed by a cloud platform and includes the following steps:
[0123] Step S201: Obtain the first IP address and MAC address of the first virtual machine and the second IP address of the Dynamic Host Configuration Protocol server sent by the data processing unit.
[0124] The first virtual machine is any virtual machine configured on a node in the cluster corresponding to the cloud platform.
[0125] Step S202: Determine the first identification information of the first virtual machine based on the MAC address.
[0126] Step S203: Send the first control command to the nodes in the cluster.
[0127] The first control instruction carries first identification information. This first control instruction instructs the nodes in the cluster to create disappearance and creation events for the first virtual machine based on the first identification information.
[0128] Step S204: When a disappearance event corresponding to the first virtual machine is received from any node, a monitoring waiting time is set.
[0129] Step S205: If no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time, then the first virtual machine is determined to be globally offline.
[0130] In one optional implementation, besides setting a monitoring wait time upon receiving a disappearance event corresponding to the first virtual machine from any node, and determining whether the first virtual machine is globally offline if no generation event corresponding to the first virtual machine is received from any node within the monitoring wait time, other methods can also be used to determine whether the first virtual machine is globally offline.
[0131] For example, the cloud platform can periodically send heartbeat messages to the first virtual machine and wait for its response. If no response is received from the first virtual machine within a certain period, it can be determined that the first virtual machine is globally offline. Alternatively, the cloud platform can monitor the network connection status of the first virtual machine. If the first virtual machine fails to establish or maintain a network connection within a certain period, it can be considered globally offline. Furthermore, the cloud platform can monitor the resource utilization of the first virtual machine, such as CPU and memory. If the resource utilization of the first virtual machine remains low or is zero for a period of time, it can be considered globally offline.
[0132] Step S206: Send a second control command to the data processing unit.
[0133] The second control instruction carries the first IP address, the MAC address, and the second IP address, so that the data processing unit can instruct the Dynamic Host Configuration Protocol server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
[0134] The specific implementation process in this embodiment has been described in detail above, so it will not be repeated here.
[0135] The method for reclaiming virtual machine IP addresses provided in this embodiment obtains a first IP address, a MAC address, and a second IP address sent by a data processing unit. First identification information of the first virtual machine is obtained based on the MAC address. Then, a control command is sent to the nodes in the cluster. This control command carries the first identification information and instructs each node in the cluster to create a disappearance event and a generation event for the first virtual machine. When a disappearance event corresponding to the first virtual machine is received from any node, it can only be determined that the first virtual machine has gone offline on that node. However, it cannot be determined that the first virtual machine is globally offline. Therefore, a monitoring waiting time needs to be set. If no generation event corresponding to the first virtual machine is received from other nodes within the monitoring waiting time, indicating that the first virtual machine has indeed gone globally offline, a second control command can be sent to the data processing unit. This second control command carries the first IP address, the MAC address, and the second IP address, so that the data processing unit, based on the first IP address, the MAC address, and the second IP address, instructs the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address, ensuring that subsequent new virtual machines can obtain usable IP addresses from the DHCP address pool.
[0136] In an optional implementation, after obtaining the first IP address and MAC address of the first virtual machine and the second IP address of the Dynamic Host Configuration Protocol (DHCP) server sent by the data processing unit, the method further includes:
[0137] Add the first identifier information of the first virtual machine to the virtual machine monitoring queue.
[0138] Specifically, adding the first identifier information to the virtual machine monitoring queue facilitates effective monitoring of the first virtual machine in the future.
[0139] In an optional implementation, the method further includes:
[0140] When a generation event corresponding to the second virtual machine is received from any node, the second identification information of the second virtual machine is extracted from the generation event corresponding to the second virtual machine.
[0141] The second identification information is matched with the identification information stored in the virtual machine monitoring queue;
[0142] If no match is found, the generation event corresponding to the second virtual machine will be deleted.
[0143] Specifically, when a generation event corresponding to the second virtual machine is received from any node, the second identification information of the second virtual machine is obtained. This second identification information is then matched against the identification information in the virtual machine monitoring queue. If a match is successful, it indicates that the second virtual machine has already taken effect on other nodes and is not globally offline. Alternatively, if a match is unsuccessful, it means that the generation event corresponding to the second virtual machine is not the generation event of the virtual machine that the cloud platform needs to monitor. In this case, no processing is required, and the generation event corresponding to the second virtual machine is directly deleted.
[0144] This embodiment provides a method for reclaiming virtual machine IP addresses; see details below. Figure 3 As shown, Figure 3 This is a flowchart of another method for reclaiming virtual machine IP addresses provided in an embodiment of the present invention. This method is executed by the listening application configured in the data processing unit described above, see below. Figure 3 As shown, the process includes the following steps:
[0145] Step S301: Receive the flow table matching rules issued by the cloud platform.
[0146] Among them, the flow table matching rules are used to match Dynamic Host Configuration Protocol response messages that meet preset conditions.
[0147] Step S302: Send flow table matching rules to the smart network card acceleration engine.
[0148] Step S303: When the Dynamic Host Configuration Protocol (DHCP) response message sent by the smart network card acceleration engine is obtained, the DHCP response message is parsed to obtain and save the first IP address and MAC address of the first virtual machine, and the second IP address of the DHCP server.
[0149] Step S304: Monitor whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period.
[0150] Step S305: When the monitoring application does not detect a message indicating a conflict with the first IP address within a preset time period, it sends the first IP address, MAC address, and second IP address to the cloud platform.
[0151] Step S306: When a control command sent by the cloud platform is received, and the control command includes a first IP address, a MAC address, and a second IP address, a release message for the Dynamic Host Configuration Protocol server is generated based on the first IP address, the MAC address, and the second IP address.
[0152] Step S307: A release message is sent to the target Dynamic Host Configuration Protocol (DHCP) server so that the target DHCP server can reclaim the first IP address.
[0153] The specific implementation process of the above methods has been described in detail above, so it will not be repeated here.
[0154] This invention provides a method for reclaiming a virtual machine's IP address. The method involves sending flow table matching rules to a smart network interface card (NIC) acceleration engine. These rules match Dynamic Host Configuration Protocol (DHCP) response messages that meet preset conditions. When a DHCP response message from the NIC acceleration engine is received, the message is parsed to obtain and save a first IP address, a MAC address, and a second IP address. The method checks whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period. If no such message is received, it indicates no IP address conflict, and the first IP address, MAC address, and second IP address can be sent to a cloud platform via a message channel for cloud platform monitoring. Upon receiving a control command from the cloud platform, a release message for the DHCP server is generated based on the first IP address, MAC address, and second IP address carried in the control command and sent to the DHCP server to reclaim the first IP address.
[0155] In one optional implementation, the preset condition is that the Dynamic Host Configuration Protocol (DHCP) response message carries a first IP address, a MAC address, and a second IP address, and the field values of the first IP address, the MAC address, and the second IP address are all non-empty.
[0156] In an optional implementation, the method further includes:
[0157] When a message indicating a conflict with the first IP address is detected within a preset time period, the saved first IP address, MAC address, and second IP address are cleared.
[0158] Specifically, when a message indicating a conflict with the first IP address is detected within a preset time period, it means that the first IP address has been occupied by another virtual machine, and therefore the saved first IP address needs to be cleared.
[0159] This embodiment provides yet another method for reclaiming virtual machine IP addresses, which is executed by the node. See details below. Figure 4 As shown, the process includes the following steps:
[0160] Step S401: Obtain control commands sent by the cloud platform.
[0161] Among them, the control instructions are used to instruct the creation of disappearance and generation events for the first virtual machine.
[0162] Step S402: Create a disappearance event and a generation event for the first virtual machine according to the control instructions.
[0163] Step S403: Monitor the running status of the first virtual machine. The running status is used to determine whether the disappearance event of the first virtual machine is effective, or whether the creation event of the first virtual machine is effective.
[0164] Step S404: Send the running status to the cloud platform.
[0165] The specific implementation process of the above methods has been described in detail above, so it will not be repeated here.
[0166] This invention provides a method for reclaiming a virtual machine's IP address. The method involves obtaining control commands sent by a cloud platform and creating disappearance and creation events for a first virtual machine based on these commands. The method also monitors the running status of the first virtual machine, which may include the disappearance event or the creation event being active. Regardless of the running status, the data needs to be sent to the cloud platform. This allows the cloud platform to determine when to globally shut down the first virtual machine based on its running status, and then inform the data processing unit to reclaim the first virtual machine's IP address.
[0167] This embodiment also provides a device for reclaiming virtual machine IP addresses, which is used to implement the above. Figure 2 The corresponding embodiments and preferred embodiments, which have already been described, will not be repeated hereafter. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0168] This embodiment provides a device for reclaiming virtual machine IP addresses, such as... Figure 5 The system includes: an acquisition module 501, a determination module 502, a sending module 503, a receiving module 504, and a processing module 505.
[0169] The acquisition module 501 is used to acquire the first IP address, MAC address and second IP address of the dynamic host configuration protocol server of the first virtual machine sent by the data processing unit, wherein the first virtual machine is any virtual machine configured in the cluster corresponding to the cloud platform;
[0170] The determination module 502 is used to determine the first identification information of the first virtual machine based on the MAC address;
[0171] The sending module 503 is used to send a first control instruction to the nodes in the cluster. The first control instruction carries first identification information and is used to instruct the nodes in the cluster to create a disappearance event and a generation event for the first virtual machine according to the first identification information.
[0172] The receiving module 504 receives the disappearance event corresponding to the first virtual machine from any node;
[0173] The processing module 505 is used to set a monitoring waiting time when the receiving module receives a disappearance event corresponding to the first virtual machine from any node; and when no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time, the first virtual machine is determined to be globally offline.
[0174] The sending module 503 is also used to send a second control instruction to the data processing unit, wherein the second control instruction carries a first IP address, a MAC address, and a second IP address, so that the data processing unit instructs the dynamic host configuration protocol server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
[0175] In an optional implementation, the processing module 505 is further configured to add the first identification information of the first virtual machine to the virtual machine monitoring queue.
[0176] In an optional implementation, the receiving module 504 is further configured to receive a generation event corresponding to the second virtual machine fed back by any node;
[0177] The processing module 505 is further configured to extract the second identification information of the second virtual machine from the generation event corresponding to the second virtual machine; match the second identification information with the identification information stored in the virtual machine monitoring queue; and delete the generation event corresponding to the second virtual machine when no match is found.
[0178] In this embodiment, the device for reclaiming virtual machine IP addresses is presented in the form of a functional module. Here, a module refers to an application-specific integrated circuit (ASIC), a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0179] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0180] This invention provides an apparatus for reclaiming virtual machine IP addresses. It acquires a first IP address, a MAC address, and a second IP address sent by a data processing unit. First identification information of the first virtual machine is obtained based on the MAC address. Then, a control command is sent to nodes in the cluster. This control command carries the first identification information and instructs each node in the cluster to create a disappearance event and a generation event for the first virtual machine. When a disappearance event corresponding to the first virtual machine is received from any node, it can only be determined that the first virtual machine has gone offline on that node. However, it cannot be determined that the first virtual machine is globally offline. Therefore, a monitoring waiting time needs to be set. If no generation event corresponding to the first virtual machine is received from other nodes within the monitoring waiting time, indicating that the first virtual machine has indeed gone globally offline, a second control command can be sent to the data processing unit. This second control command carries the first IP address, the MAC address, and the second IP address. The data processing unit then instructs the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address, ensuring that subsequent new virtual machines can obtain usable IP addresses from the DHCP address pool.
[0181] This embodiment provides a device for reclaiming virtual machine IP addresses, such as... Figure 6 The system includes: a receiving module 601, a sending module 602, an acquisition module 603, a parsing module 604, a monitoring module 605, and a processing module 606.
[0182] The receiving module 601 is used to receive flow table matching rules issued by the cloud platform. The flow table matching rules are used to match dynamic host configuration protocol response messages that meet preset conditions.
[0183] Sending module 602 is used to send flow table matching rules to the smart network card acceleration engine;
[0184] The acquisition module 603 is used to acquire the Dynamic Host Configuration Protocol response message sent by the smart network card acceleration engine;
[0185] The parsing module 604 is used to parse the Dynamic Host Configuration Protocol (DHCP) response message, obtain and save the first IP address and MAC address of the first virtual machine, and the second IP address of the DHCP server.
[0186] The monitoring module 605 is used to monitor whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period;
[0187] The sending module 602 is also used to send the first IP address, MAC address, and second IP address to the cloud platform when the listening application does not detect a message indicating a conflict with the first IP address within a preset time period.
[0188] The receiving module 601 is also used to receive control commands sent by the cloud platform;
[0189] The processing module 606 is used to generate a release message for the Dynamic Host Configuration Protocol server based on the first IP address, MAC address, and second IP address when it is determined that the control command includes a first IP address, a MAC address, and a second IP address.
[0190] The sending module 602 is also used to send a release message to the target dynamic host configuration protocol server so that the target dynamic host configuration protocol server can reclaim the first IP address.
[0191] In one optional implementation, the preset condition is that the Dynamic Host Configuration Protocol (DHCP) response message carries a first IP address, a MAC address, and a second IP address, and the field values of the first IP address, the MAC address, and the second IP address are all non-empty.
[0192] In an optional implementation, the device does not include a clearing module 607, which is used to clear the saved first IP address, MAC address, and second IP address when the monitoring module 605 detects a message indicating a first IP address conflict within a preset time period.
[0193] In this embodiment, the device for reclaiming virtual machine IP addresses is presented in the form of a functional module. Here, a module refers to an application-specific integrated circuit (ASIC), a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0194] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0195] This invention provides an apparatus for reclaiming virtual machine IP addresses. It sends flow table matching rules to a smart network interface card (NIC) acceleration engine, whereby the flow table matching rules are used to match Dynamic Host Configuration Protocol (DHCP) response messages that meet preset conditions. When a DHCP response message sent by the smart NIC acceleration engine is received, the DHCP response message is parsed to obtain and save a first IP address, a MAC address, and a second IP address. It detects whether the first virtual machine sends a message indicating a first IP address conflict within a preset time period. If no such message is received, it indicates that there is no IP address conflict, and the first IP address, MAC address, and second IP address can be sent to the cloud platform through a message channel for the cloud platform to monitor the first virtual machine. Upon receiving a control command from the cloud platform, a release message for the DHCP server is generated based on the first IP address, MAC address, and second IP address carried in the control command and sent to the DHCP server so that the DHCP server can reclaim the first IP address.
[0196] This embodiment provides a device for reclaiming virtual machine IP addresses, such as... Figure 7 The system includes: an acquisition module 701, a creation module 702, a monitoring module 703, and a sending module 704.
[0197] The acquisition module 701 is used to acquire control commands sent by the cloud platform. The control commands are used to instruct the creation of disappearance and generation events for the first virtual machine.
[0198] Module 702 is created to generate disappearance and generation events for the first virtual machine according to control instructions.
[0199] The monitoring module 703 is used to monitor the running status of the first virtual machine. The running status is used to determine whether the disappearance event of the first virtual machine is effective or whether the creation event of the first virtual machine is effective.
[0200] The sending module 704 is used to send the running status to the cloud platform.
[0201] In this embodiment, the device for reclaiming virtual machine IP addresses is presented in the form of a functional module. Here, a module refers to an application-specific integrated circuit (ASIC), a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0202] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0203] This invention provides an apparatus for reclaiming virtual machine IP addresses. It acquires control commands sent by a cloud platform and creates disappearance and creation events for a first virtual machine based on these commands. It also monitors the running status of the first virtual machine, which may include the disappearance event or the creation event of the first virtual machine being active. Regardless of the running status, the data needs to be sent to the cloud platform. This allows the cloud platform to determine when the first virtual machine should be globally taken offline based on its running status, and then inform the data processing unit to reclaim the first virtual machine's IP address.
[0204] This invention also provides a cloud platform having the above-described features. Figure 5 The apparatus shown is for reclaiming virtual machine IP addresses.
[0205] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a cloud platform provided by an optional embodiment of the present invention, such as... Figure 8 As shown, the cloud platform includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other using different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer devices, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 8 Take the 810 processor as an example.
[0206] The processor 810 may be a central processing unit, a network processor, or a combination thereof. The processor 810 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.
[0207] The memory 820 stores instructions executable by at least one processor 810 to cause the at least one processor 810 to perform the method shown in the above embodiments.
[0208] The memory 820 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device as shown by a landing page for an app. Furthermore, the memory 820 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 820 may optionally include memory remotely located relative to the processor 810, and these remote memories can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0209] The memory 820 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 820 may also include a combination of the above types of memory.
[0210] The computer device also includes an input device 830 and an output device 840. The processor 810, memory 820, input device 830, and output device 840 can be connected via a bus or other means. Figure 8 Taking the bus connection between China and Israel as an example.
[0211] Input device 830 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 840 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.
[0212] This invention also provides a computer device having the above-described features. Figure 6 or Figure 7 The apparatus shown is for reclaiming virtual machine IP addresses.
[0213] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 9As shown, the computer device includes one or more processors 910, memory 920, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 9 Take the 910 processor as an example.
[0214] The processor 910 may be a central processing unit, a network processor, or a combination thereof. The processor 910 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0215] The memory 920 stores instructions executable by at least one processor 910 to cause the at least one processor 910 to perform the method shown in the above embodiments.
[0216] The memory 920 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device as shown by a landing page for an app. Furthermore, the memory 920 may include high-speed random access memory and may also include non-transient memory, such as at least one disk storage device, flash memory device, or other non-transient solid-state storage device. In some alternative embodiments, the memory 920 may optionally include memory remotely located relative to the processor 910, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0217] The memory 920 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 920 may also include a combination of the above types of memory.
[0218] The computer device also includes an input device 930 and an output device 940. The processor 910, memory 920, input device 930, and output device 940 can be connected via a bus or other means. Figure 9 Taking the bus connection between China and Israel as an example.
[0219] Input device 930 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 940 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.
[0220] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0221] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for reclaiming virtual machine IP addresses, characterized in that, The method is executed by a cloud platform, and the method includes: The data processing unit obtains the first IP address and MAC address of the first virtual machine and the second IP address of the dynamic host configuration protocol server, wherein the first virtual machine is any virtual machine configured in the cluster corresponding to the cloud platform. Based on the MAC address, determine the first identification information of the first virtual machine; Send a first control instruction to the nodes in the cluster, wherein the first control instruction carries the first identification information, and the first control instruction is used to instruct the nodes in the cluster to create a disappearance event and a generation event for the first virtual machine according to the first identification information; When a disappearance event corresponding to the first virtual machine is received from any of the nodes, a monitoring wait time is set. If no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time, the first virtual machine is determined to be globally offline. A second control instruction is sent to the data processing unit, wherein the second control instruction carries the first IP address, the MAC address, and the second IP address, so that the data processing unit instructs the Dynamic Host Configuration Protocol (DHCP) server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
2. The method according to claim 1, characterized in that, After obtaining the first IP address and MAC address of the first virtual machine and the second IP address of the Dynamic Host Configuration Protocol (DHCP) server sent by the data processing unit, the method further includes: Add the first identifier information of the first virtual machine to the virtual machine monitoring queue.
3. The method according to claim 2, characterized in that, The method further includes: When a generation event corresponding to the second virtual machine is received from any of the nodes, the second identification information of the second virtual machine is extracted from the generation event corresponding to the second virtual machine; The second identification information is matched with the identification information stored in the virtual machine monitoring queue; If no match is found, the generation event corresponding to the second virtual machine will be deleted.
4. A method for reclaiming virtual machine IP addresses, characterized in that, The method includes: Receive flow table matching rules issued by the cloud platform, the flow table matching rules are used to match dynamic host configuration protocol response messages that meet preset conditions; Send the flow table matching rules to the smart network interface card acceleration engine; When the Dynamic Host Configuration Protocol (DHCP) response message sent by the smart network card acceleration engine is obtained, the DHCP response message is parsed to obtain and save the first IP address and MAC address of the first virtual machine, and the second IP address of the DHCP server. Monitor whether the first virtual machine sends a message indicating a conflict with the first IP address within a preset time period; If no message indicating a conflict with the first IP address is detected within the preset time period, the first IP address, the MAC address, and the second IP address are sent to the cloud platform. Obtain the first control command sent by the cloud platform; According to the first control instruction, a disappearance event and a generation event are created for the first virtual machine; Monitor the running status of the first virtual machine, the running status being used to determine whether the disappearance event of the first virtual machine is effective, or to determine whether the creation event of the first virtual machine is effective; The operational status is sent to the cloud platform; When a second control command is received from the cloud platform, and the control command includes the first IP address, the MAC address, and the second IP address, a release message for the Dynamic Host Configuration Protocol server is generated based on the first IP address, the MAC address, and the second IP address. The release message is sent to the target dynamic host configuration protocol server so that the target dynamic host configuration protocol server can reclaim the first IP address.
5. The method according to claim 4, characterized in that, The preset condition is that the Dynamic Host Configuration Protocol (DHCP) response message carries the first IP address, the MAC address, and the second IP address, and the field values of the first IP address, the MAC address, and the second IP address are all non-empty.
6. The method according to claim 4 or 5, characterized in that, The method further includes: When a message indicating a conflict with the first IP address is detected within the preset time period, the saved first IP address, the MAC address, and the second IP address are cleared.
7. An apparatus for reclaiming virtual machine IP addresses, characterized in that, The device includes: The acquisition module is used to acquire the first IP address, MAC address and second IP address of the dynamic host configuration protocol server of the first virtual machine sent by the data processing unit, wherein the first virtual machine is any virtual machine configured in the cluster corresponding to the cloud platform; The determining module is used to determine the first identification information of the first virtual machine based on the MAC address; The sending module is used to send a first control instruction to the nodes in the cluster, wherein the first control instruction carries the first identification information, and the first control instruction is used to instruct the nodes in the cluster to create a disappearance event and a generation event for the first virtual machine according to the first identification information; The receiving module is used to receive the disappearance event corresponding to the first virtual machine fed back by any of the nodes; The processing module is configured to set a monitoring waiting time when the receiving module receives a disappearance event corresponding to the first virtual machine from any of the nodes; and to determine that the first virtual machine is globally offline when no generation event corresponding to the first virtual machine is received from any node after the monitoring waiting time has elapsed. The sending module is further configured to send a second control instruction to the data processing unit, wherein the second control instruction carries the first IP address, the MAC address, and the second IP address, so that the data processing unit instructs the Dynamic Host Configuration Protocol server to reclaim the first IP address based on the first IP address, the MAC address, and the second IP address.
8. An apparatus for reclaiming virtual machine IP addresses, characterized in that, The device includes: The receiving module is used to receive flow table matching rules issued by the cloud platform. The flow table matching rules are used to match dynamic host configuration protocol response messages that meet preset conditions. The sending module is used to send the flow table matching rules to the smart network card acceleration engine; The acquisition module is used to acquire the Dynamic Host Configuration Protocol response message sent by the smart network card acceleration engine; The parsing module is used to parse the Dynamic Host Configuration Protocol (DHCP) response message, obtain and save the first IP address and MAC address of the first virtual machine, and the second IP address of the DHCP server; The monitoring module is used to monitor whether the first virtual machine sends a message indicating a conflict with the first IP address within a preset time period; The sending module is further configured to send the first IP address, the MAC address, and the second IP address to the cloud platform when no message indicating a conflict with the first IP address is detected within the preset time period. The acquisition module is also used to acquire the first control command sent by the cloud platform; A creation module is used to create disappearance and generation events for the first virtual machine according to the control instructions; The monitoring module is also used to monitor the running status of the first virtual machine, and the running status is used to determine whether the disappearance event of the first virtual machine is effective, or to determine whether the generation event of the first virtual machine is effective. The sending module is also used to send the running status to the cloud platform; The receiving module is also used to receive a second control command sent by the cloud platform; The processing module is configured to generate a release message for the Dynamic Host Configuration Protocol server based on the first IP address, the MAC address, and the second IP address when it is determined that the control command includes the first IP address, the MAC address, and the second IP address. The sending module is further configured to send the release message to the target dynamic host configuration protocol server so that the target dynamic host configuration protocol server can reclaim the first IP address.
9. A cloud platform, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method for reclaiming virtual machine IP addresses as described in any one of claims 1 to 3.
10. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method for reclaiming virtual machine IP addresses as described in any one of claims 4 to 6.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for instructing the cloud platform to perform the method for reclaiming virtual machine IP addresses as described in any one of claims 1 to 3.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer device to perform the method of reclaiming virtual machine IP addresses as described in any one of claims 4 to 6.
Citation Information
Patent Citations
IP (Internet Protocol) address leak preventing method in desktop cloud cluster running state
CN102685267A
Cloud computing system and backup method of dynamic host configuration protocol server
CN104506654A