Network port binding method, device, computer equipment and storage medium

By adjusting the network port binding policy in a virtualized environment, the problem of network port resource waste in the virtualized environment is solved, the maximum utilization of network port resources and the optimization of network traffic are achieved, and the risk of network interruption is reduced.

CN118984312BActive Publication Date: 2025-10-03INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410972455.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2025-10-03
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

In a virtualized environment, because physical switches do not support dynamic link aggregation, network ports can only be used in active/standby mode, resulting in a large number of idle network ports, wasting resources, and failing to fully utilize network port resources.

Method used

By determining in the network port configuration information that the primary network port of the target virtual switch is not the primary network port of other virtual switches, network port binding is performed, and the primary and backup relationships are updated when a network port fails, ensuring the normal operation of the virtual switch.

Benefits of technology

It achieves full utilization of idle network ports on the server in active-standby mode, maximizes the use of network port resources, reduces the risk of network interruption, and improves network traffic and the availability of the virtualization environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984312B_ABST
    Figure CN118984312B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of virtualization technology, and discloses a network port binding method, device, computer equipment, and storage medium. The method includes: when network port binding is required, obtaining network card information of multiple network cards in a virtualized environment; determining multiple network ports included in each network card based on the network card information; selecting two target network cards from the multiple network cards, and selecting a first network port from the multiple network ports of one of the target network cards, and selecting a second network port from the multiple network ports of the other target network card; determining network port configuration information of a target virtual switch based on the first network port and the second network port, such that the first network port is used as the primary network port of the target virtual switch and the second network port is used as the backup network port of the target virtual switch; and when the primary network port of the target virtual switch is not the primary network port of other virtual switches, performing network port binding on the target virtual switch based on the network port configuration information. The present invention maximizes the utilization of network port resources on a server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtualization technology, and in particular to a network port binding method, device, computer equipment and storage medium. Background Art

[0002] When purchasing servers in a virtualized environment, multiple network cards are typically configured and bound together to ensure business continuity. Furthermore, to prevent data traffic from different functions from interfering with each other, network ports on different network cards are bound and assigned to different functions, with each function corresponding to a virtual switch.

[0003] To enable simultaneous traffic transmission between the two network ports bound to the virtual switch, dynamic link aggregation must be configured on the physical switch and the virtualization platform. However, in many environments, the physical switch may not support dynamic link aggregation, resulting in the virtualization layer only being able to select active / standby mode when binding network ports. This means that only one of the two bound network ports in the virtual switch functions as the primary port, providing traffic, while the other functions as the backup port (transmitting traffic only if the primary port fails).

[0004] This active-standby mode leaves a large number of network ports in an idle state in the virtualized environment, resulting in a waste of network port resources and an inability to fully discover the functions of each network port. Summary of the Invention

[0005] In view of this, the present invention provides a network port binding method, apparatus, computer equipment and storage medium to solve the problem in related technologies that a large number of network ports are idle, resulting in waste of network port resources and inability to fully utilize network port resources.

[0006] In a first aspect, the present invention provides a network port binding method, the method comprising:

[0007] When any target virtual switch needs to bind network ports, obtain network card information of multiple network cards in the virtualization environment;

[0008] Determine a plurality of network ports included in each of the network cards based on the network card information;

[0009] Selecting two target network cards from the plurality of network cards, selecting a first network port from the plurality of network ports of one of the target network cards, and selecting a second network port from the plurality of network ports of the other target network card;

[0010] Based on the first network port and the second network port, determining the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch;

[0011] When the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch, network port binding is performed on the target virtual switch based on the network port configuration information.

[0012] The network port binding method provided in this embodiment performs network port binding on the target virtual switch based on the network port configuration information, when the primary network port of the target virtual switch in the network port configuration information is not the primary network port of another virtual switch other than the target virtual switch. This method enables any network port that is not the primary network port of another virtual switch in the master-slave mode to be used as the primary network port of the target virtual switch, responsible for carrying traffic corresponding to the target virtual switch's function. This method fully utilizes the idle network ports on the server, including the backup network ports bound to the virtual switches, to maximize the use of the server's network port resources.

[0013] In an optional embodiment, the method further includes:

[0014] If the primary network port of the target virtual switch in the network port configuration information is the primary network port of any virtual switch other than the target virtual switch, the process returns to executing the step of selecting two target network cards from the multiple network cards, or returns to executing the step of selecting the first network port from the multiple network ports of one of the target network cards and selecting the second network port from the multiple network ports of the other target network card, until the primary network port of the target virtual switch in the network port configuration information is not the primary network port of other virtual switches.

[0015] The network port binding method provided in this embodiment can maximize the utilization of network port resources on the server by making any network port that is not the primary network port of other virtual switches the primary network port of the target virtual switch in the master-slave mode.

[0016] In an optional embodiment, the method further includes:

[0017] In the event that any network port fails, the network port is determined to be the failed network port;

[0018] Determine whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port;

[0019] In the case that any virtual switch bound to the faulty network port uses the faulty network port as a primary network port, determining that the virtual switch using the faulty network port as the primary network port is the faulty virtual switch;

[0020] Using the backup network port of the failed virtual switch as the new primary network port of the failed virtual switch, and updating the network port binding of the failed virtual switch based on the new primary network port of the failed virtual switch;

[0021] Determine whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch for which the network port binding update has not been performed;

[0022] In a case where any virtual switch among the virtual switches for which the network port binding update has not been performed uses the new primary network port of the failed virtual switch as the primary network port, determining the virtual switch that uses the new primary network port of the failed virtual switch as the primary network port as the virtual switch to be updated;

[0023] Using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and performing network port binding update on the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated;

[0024] Determine whether the new primary network port of the virtual switch to be updated is used as the primary network port in the virtual switch for which the network port binding update has not been performed;

[0025] When any virtual switch among the virtual switches that have not performed network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, determine that the virtual switch that uses the new primary network port of the virtual switch to be updated as the primary network port is the new virtual switch to be updated, and return to the steps of using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and updating the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated, until there is no virtual switch that has not performed network port binding update or none of the virtual switches that have not performed network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port.

[0026] The network port binding method provided in this embodiment ensures the normal operation of the virtual switch and reduces the risk of network interruption caused by a single network port failure by updating the primary network port and the backup network port bound to the virtual switch when any network port fails.

[0027] In the event that any network port fails, the network port binding of the virtual switch that uses the network port as the primary network port is updated, and based on the updated primary network port of the failed virtual switch, it is determined whether the virtual switch that has not performed the network port binding update uses the updated primary network port as the primary network port, so as to update the network port binding of the virtual switch that uses the updated primary network port as the primary network port, so as to try to avoid or reduce the situation where a network port is the primary network port in different virtual switches at the same time, and to avoid the situation where the same network port bears the traffic of different virtual switches, causing the network port traffic to be too large and affecting the network response.

[0028] In an optional implementation, after binding the network port of the target virtual switch based on the network port configuration information, the method further includes:

[0029] Perform communication testing on the primary network port and backup network port bound to the target virtual switch;

[0030] If the communication test passes, it is determined that the network port binding of the target virtual switch is normal.

[0031] The network port binding method provided in this embodiment performs a communication test on the primary network port and the backup network port bound to the target virtual switch to ensure that the primary network port and the backup network port of the target virtual switch can communicate normally with each other, and that the primary network port and the backup network port can communicate normally with the outside world.

[0032] In an optional implementation, the performing a communication test on the primary network port and the backup network port bound to the target virtual switch includes:

[0033] Obtain the physical address of the primary network port and the physical address of the backup network port bound to the target virtual switch;

[0034] Using the physical address of the primary network port as the first physical address to be tested, and using the physical address of the backup network port as the first destination physical address;

[0035] Generate a first test data packet based on the first physical address to be tested and the first destination physical address;

[0036] Sending the first test data packet to the physical switch corresponding to the target virtual switch through the primary network port, so that the physical switch sends the first test data packet to the backup network port based on the first destination physical address in the first test data packet;

[0037] When the backup network port receives the first test data packet, determining that the communication test of the primary network port passes;

[0038] Using the physical address of the primary network port as the second destination physical address, and using the physical address of the backup network port as the second physical address to be tested;

[0039] generating a second test data packet based on the second physical address to be tested and the second destination physical address;

[0040] Sending the second test data packet to the physical switch corresponding to the target virtual switch through the backup network port, so that the physical switch sends the second test data packet to the primary network port based on the second destination physical address in the second test data packet;

[0041] When the primary network port receives the second test data packet, it is determined that the communication test of the backup network port passes.

[0042] The network port binding method provided in this embodiment performs a communication test on the primary network port and the backup network port bound to the target virtual switch to ensure that the primary network port and the backup network port of the target virtual switch can communicate normally with each other, and that the primary network port and the backup network port can communicate normally with the outside world.

[0043] In an optional embodiment, the method further includes:

[0044] If the communication test fails, the network port binding of the target virtual switch is determined to be abnormal, and the network port binding abnormality information is displayed, so that the user can confirm the abnormality of the primary network port and the backup network port bound to the target virtual switch based on the network port binding abnormality information.

[0045] The network port binding method provided in this embodiment can quickly determine that there is an abnormality in the network port binding of the target virtual switch when the communication test fails, which helps to promptly discover potential network problems and improve the efficiency of troubleshooting.

[0046] In an optional embodiment, the method further includes:

[0047] After the target virtual switch is bound to a network port based on the network port configuration information, the corresponding relationship between the target virtual switch and the network port bound to the target virtual switch is saved in a virtual switch and network port binding relationship table.

[0048] The network port binding method provided in this embodiment saves the correspondence between the target virtual switch and the bound network port in the virtual switch and network port binding relationship table, which facilitates the management and query of network configuration and can quickly obtain the network port binding status of each virtual switch.

[0049] In a second aspect, the present invention provides a network port binding device, the device comprising:

[0050] An acquisition module is used to obtain network card information of multiple network cards in a virtualized environment when any target virtual switch needs to bind network ports;

[0051] A first determining module, configured to determine a plurality of network ports included in each of the network cards based on the network card information;

[0052] a screening module, configured to screen out two target network cards from the plurality of network cards, and screen out a first network port from the plurality of network ports of one of the target network cards, and screen out a second network port from the plurality of network ports of the other target network card;

[0053] a second determining module, configured to determine, based on the first network port and the second network port, the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch;

[0054] The binding module is configured to bind the network port of the target virtual switch based on the network port configuration information when the primary network port of the target virtual switch in the network port configuration information is not the primary network port of other virtual switches except the target virtual switch.

[0055] In a third 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, computer instructions being stored in the memory, and the processor executing the network port binding method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0056] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the network port binding method of the first aspect or any corresponding embodiment thereof.

[0057] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the network port binding method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in related technologies, the following briefly introduces the drawings required for use in the specific embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0059] Figure 1 is a flow chart of a network port binding method according to an embodiment of the present invention;

[0060] Figure 2 is a flow chart of another network port binding method according to an embodiment of the present invention;

[0061] Figure 3 1 is a flow chart of updating a network port binding when a network port fails according to an embodiment of the present invention;

[0062] Figure 4 Schematic diagram of binding primary and backup network ports of a virtual switch according to an embodiment of the present invention;

[0063] Figure 5 is a structural block diagram of a network port binding device according to an embodiment of the present invention;

[0064] Figure 6 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0065] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0066] When selecting servers based on business needs in a virtualized environment, network card (NIC) or network port redundancy is often considered. This means multiple NICs are typically configured and bound together through the virtualization platform. This ensures business continuity even if a single NIC fails. Data traffic from different functions within a virtualized environment generates corresponding network traffic. Functions within a virtualized environment can include services, virtual machine migration, distributed storage, and more. To ensure that network traffic from each function does not affect each other, the network ports of different NICs are typically bound and assigned to each function. This allows different functions to transmit traffic using different bound network ports. Each function corresponds to a virtual switch.

[0067] It's important to note that virtualization, in computing, generally refers to computing components running on a virtual rather than real basis. Virtualization technology can expand hardware capacity and simplify software reconfiguration. CPU virtualization technology can simulate multiple CPUs in parallel on a single CPU, allowing a single platform to run multiple operating systems simultaneously. Applications can run in independent spaces without interfering with each other, significantly improving computer efficiency.

[0068] A virtual machine is a complete computer system emulated through software, with full hardware system functionality, running in a completely isolated environment. Any tasks that can be performed on a physical computer can also be performed on a virtual machine. When creating a virtual machine, a portion of the physical computer's hard drive and memory capacity is used as the virtual machine's hard drive and memory capacity. Each virtual machine has its own independent CMOS, hard drive, and operating system, allowing operations to be performed just like a physical machine.

[0069] A virtualization platform is a system that runs virtual machines, such as the Linux KVM system. This platform manages and runs several virtual machines, ensuring their proper operation. It allocates the host's physical memory to and manages the memory used by the virtual machines. When a virtual machine uses memory, it converts reads and writes to the virtual machine's memory into physical memory reads and writes. This platform is the foundation for virtual machine operation and management, serving as the host for the virtual machines and responsible for address translation between the virtual machine's virtual and physical memory.

[0070] A virtual switch refers to a vswitch virtual switch or virtual network switch, which works in a Layer 2 data network and implements the Layer 2 (and some Layer 3) network functions of a physical switch through software.

[0071] When binding network ports on a virtual switch, two ports are typically bound together. To ensure that both bound ports can transmit traffic simultaneously, dynamic link aggregation must be configured on both the physical switch and the virtualization platform. However, in many environments, the physical switch may not support dynamic link aggregation. This means that when binding network ports at the virtualization layer, only active / standby mode can be selected. Only one of the two bound ports in the virtual switch will function as the primary port, providing traffic. The other port, which has no traffic and serves as a backup port, will transmit traffic only if the primary port fails.

[0072] This active-standby mode leaves half of the network ports in the virtualized environment idle and not providing traffic, preventing the effective use of the idle backup network ports. This results in a waste of network port resources and an inability to fully discover the functions of each network port.

[0073] Moreover, when all network ports are allocated and network ports are to be allocated to virtual switches corresponding to new functions, this can only be achieved by adding new network cards, which results in additional hardware investment.

[0074] An embodiment of the present invention provides a network port binding method, which, when the primary network port of the target virtual switch in the network port configuration information is not the primary network port of other virtual switches other than the target virtual switch, binds the network port of the target virtual switch based on the network port configuration information to fully utilize the idle network ports on the server and achieve the effect of maximizing the utilization of the network port resources on the server.

[0075] According to an embodiment of the present invention, an embodiment of a network port binding method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0076] In this embodiment, a network port binding method is provided, which can be used for mobile terminals, such as servers, etc. Figure 1 Flowchart of the network port binding method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0077] Step S101 : When any target virtual switch needs to perform network port binding, obtain network card information of multiple network cards in a virtualized environment.

[0078] The target virtual switch requires network port binding, which can be the case when allocating network ports to a virtual switch corresponding to a new function. In other words, the target virtual switch is the virtual switch corresponding to the new function in the virtualization environment. Of course, the target virtual switch can also be any virtual switch in the virtualization environment that requires network port binding.

[0079] When the target virtual switch needs to perform network port binding, the server obtains the network card information of multiple network cards in the virtualization environment, which is actually obtaining the network port information of multiple network cards on the server.

[0080] It is understandable that multiple network cards can be configured on the server.

[0081] Step S102: determining a plurality of network ports included in each network card based on the network card information.

[0082] After obtaining the network card information of the multiple network cards in the virtualized environment, the multiple network ports included in each network card are determined according to the network card information of the multiple network cards.

[0083] It should be noted that each network card may include multiple network ports. Generally, each network card may include two network ports. There is no specific limit on the number of network ports included in each network card.

[0084] Step S103 , selecting two target network cards from the multiple network cards, selecting a first network port from the multiple network ports of one of the target network cards, and selecting a second network port from the multiple network ports of the other target network card.

[0085] Among them, when the multiple network ports included in each network card are determined, two target network cards are screened out from the multiple network cards in the virtualization environment, and the first network port is screened out from the multiple network ports of one of the target network cards, and the second network port is screened out from the multiple network ports of the other target network card.

[0086] It should be noted that the screening process can be a random screening.

[0087] Step S104 : Based on the first network port and the second network port, determine the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch.

[0088] The network port configuration information of the target virtual switch is determined according to the screened first network port and the second network port. The network port configuration information uses the screened first network port as the primary network port and the screened second network port as the backup network port.

[0089] Step S105 : When the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch, network port binding is performed on the target virtual switch based on the network port configuration information.

[0090] After determining the network port configuration information of the target virtual switch, it is necessary to determine the primary network port of the target virtual switch in the network port configuration information. Specifically, it is determined whether the primary network port of the target virtual switch in the network port configuration information is the primary network port of another virtual switch in the virtualization environment other than the target virtual switch. If the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any virtual switch other than the target virtual switch, network port binding is performed on the target virtual switch based on the network port configuration information. In other words, the primary network port of the target virtual switch can be a backup network port of another virtual switch.

[0091] It should be noted that, when any virtual switch has been bound to a network port, the correspondence between the virtual switch and the network port bound to the virtual switch needs to be saved in the virtual switch and network port binding relationship table in the virtualization system.

[0092] Among them, it is judged whether the main network port of the target virtual switch in the network port configuration information is the main network port of other virtual switches except the target virtual switch in the virtualization environment. Specifically, it is judged whether the main network port of the target virtual switch in the network port configuration information is the main network port of other virtual switches except the target virtual switch in the virtualization environment by traversing the correspondence between the virtual switches with network port binding and the network ports bound to the virtual switches with network port binding in the virtual switch and network port binding relationship table.

[0093] The network port binding method provided in this embodiment is as follows: in a virtualization environment where only active / standby mode can be selected for network port binding, if any target virtual switch needs to perform network port binding, the network card information of multiple network cards in the virtualization environment is obtained; based on the network card information, the multiple network ports included in each network card are determined; two target network cards are selected from the multiple network cards, and a first network port is selected from the multiple network ports of one of the target network cards, and a second network port is selected from the multiple network ports of the other target network card; based on the first network port and the second network port, the network port configuration information of the target virtual switch is determined to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch; if the primary network port of the target virtual switch in the network port configuration information is not the primary network port of another virtual switch except the target virtual switch, the network port binding is performed on the target virtual switch based on the network port configuration information. The method realizes rebinding of the backup network ports in different virtual switches to bear the traffic of other functions, fully utilizing the idle network ports on the server, effectively maximizing the utilization of the network port resources on the server, improving the network traffic of the server, and improving the availability and performance of the virtualization environment.

[0094] When all network ports are allocated and network ports are to be allocated to virtual switches corresponding to new functions, the backup network ports of other virtual switches can be used as the main network ports to allocate network ports to the virtual switches corresponding to the new functions, reducing additional hardware investment.

[0095] In this embodiment, a network port binding method is provided, which can be used for mobile terminals, such as servers, etc. Figure 2 Flowchart of the network port binding method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0096] Step S201: When any target virtual switch needs to perform network port binding, obtain network card information of multiple network cards in the virtualized environment. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0097] Step S202: Determine the multiple network ports included in each network card based on the network card information. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0098] Step S203: Select two target network cards from the multiple network cards, select a first network port from the multiple network ports of one target network card, and select a second network port from the multiple network ports of the other target network card. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0099] Step S204: Based on the first network port and the second network port, determine the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0100] Step S205: If the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch, network port binding is performed on the target virtual switch based on the network port configuration information. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0101] Step S206: When any network port fails, the network port is determined to be a failed network port.

[0102] If any network port among the multiple network cards on the server fails, the failed network port is determined to be a failed network port.

[0103] Step S207: Determine whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port.

[0104] in, Figure 3 FIG. 1 is a flow chart of updating a network port binding in the event of a network port failure according to an embodiment of the present invention. Figure 3 As shown, determining whether the faulty network port is the primary network port in a certain virtual switch means determining whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port.

[0105] The virtual switch bound to the faulty network port can be determined by traversing the virtual switch and network port binding relationship table, and then it can be determined whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port.

[0106] Step S208 : When any virtual switch bound to the faulty network port uses the faulty network port as the primary network port, the virtual switch using the faulty network port as the primary network port is determined to be the faulty virtual switch.

[0107] If there is a virtual switch that uses the faulty network port as the primary network port among the virtual switches bound to the faulty network port, the virtual switch that uses the faulty network port as the primary network port among the virtual switches bound to the faulty network port is determined as the faulty virtual switch.

[0108] Step S209: Use the backup network port of the failed virtual switch as the new primary network port of the failed virtual switch, and update the network port binding of the failed virtual switch based on the new primary network port of the failed virtual switch.

[0109] Among them, such as Figure 3As shown, if the faulty network port is the primary network port in a virtual switch, the backup network port corresponding to the faulty network port is set as the primary network port. That is, after the faulty virtual switch is determined, the network port binding of the faulty virtual switch is updated, that is, the backup network port bound to the faulty virtual switch is bound as the new primary network port.

[0110] It is understandable that the faulty network port bound to the faulty virtual switch is idle, and the fault information of the faulty network port is recorded in a log so that the user can handle the fault in a timely manner.

[0111] Step S210 , determining whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch that has not performed the network port binding update.

[0112] It is understandable that the new primary network port of the faulty virtual switch, that is, the new primary network port bound to the faulty virtual switch, may also be the primary network port in other virtual switches. Therefore, it is necessary to determine whether the virtual switches that have not updated the network port binding will use the new primary network port of the faulty virtual switch as the primary network port.

[0113] It should be noted that the virtual switch for which the network port binding is not updated is a virtual switch for which the network port binding is not updated in the process of resolving a network port failure when a network port failure occurs.

[0114] It is understandable that the table of virtual switch and network port binding relationships can be traversed to determine whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch that has not undergone network port binding update. Figure 3 The virtual switch and network port binding relationship table is traversed to determine whether the remaining network port paired with the failed network port is the primary network port in a virtual switch. The remaining network port configured with the failed network port is the new primary network port bound to the failed virtual switch.

[0115] Step S211 : When any virtual switch among the virtual switches that have not updated the network port binding uses the new primary network port of the failed virtual switch as the primary network port, the virtual switch that uses the new primary network port of the failed virtual switch as the primary network port is determined as the virtual switch to be updated.

[0116] Among them, any virtual switch in the virtual switches that have not updated the network port binding uses the new primary network port of the failed virtual switch as the primary network port, indicating that one network port serves as the primary network port in different virtual switches.

[0117] In step S212, the primary network port of the virtual switch to be updated is used as the new backup network port of the virtual switch to be updated, and the backup network port of the virtual switch to be updated is used as the new primary network port of the virtual switch to be updated. Based on the new primary network port and the new backup network port of the virtual switch to be updated, the network port binding of the virtual switch to be updated is updated.

[0118] In order to avoid or reduce the situation where a network port is the primary network port in different virtual switches at the same time, and to avoid the situation where the same network port bears the traffic of different virtual switches, causing too much network port traffic to affect network response, the primary network port and the backup network port of the virtual switch to be updated are swapped. The primary and backup network ports in other virtual switches with the new primary network port bound to the failed virtual switch as the primary network port are swapped. The primary network port of the virtual switch to be updated is used as the new backup network port of the virtual switch to be updated, and the backup network port of the virtual switch to be updated is used as the new primary network port of the virtual switch to be updated, so as to realize the network port binding update of the virtual switch to be updated.

[0119] Step S213 , determining whether the new primary network port of the virtual switch to be updated is used as the primary network port in the virtual switch for which the network port binding update has not been performed.

[0120] Among them, the new primary network port of the virtual switch whose primary and backup network port roles are newly adjusted, that is, the new primary network port in the virtual switch to be updated, may also be the primary network port of other virtual switches that have not performed network port binding updates. Therefore, it is necessary to continue to find whether the new primary network port of the virtual switch that has just been adjusted serves as the primary network port in other virtual switches that have not performed network port binding updates, that is, to determine whether the new primary network port of the virtual switch to be updated serves as the primary network port in the virtual switch that has not performed network port binding updates.

[0121] It is understandable that the table of virtual switch and network port binding relationships can be traversed to determine whether the new primary network port of the virtual switch to be updated is the primary network port in the virtual switch that has not undergone network port binding update. In other words, it can be determined whether the swapped primary network port is the primary network port of another virtual switch.

[0122] In step S214, when any virtual switch among the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, the virtual switch that uses the new primary network port of the virtual switch to be updated as the primary network port is determined to be the new virtual switch to be updated, and the process returns to executing the steps of using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and updating the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated, until there is no virtual switch that has not performed the network port binding update or none of the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port.

[0123] Among them, if any virtual switch among the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, then the virtual switch among the virtual switches that have not performed the network port binding update that uses the new primary network port of the virtual switch to be updated as the primary network port will be used as the new virtual switch to be updated, and the primary network port and the backup network port of the new virtual switch to be updated will be swapped, and the primary and backup network ports in other virtual switches that are about to use the swapped primary network port as the primary network port will be swapped, and the network port binding of the new virtual switch to be updated will be updated.

[0124] Continue executing the step of determining, based on the new primary network port of the new virtual switch to be updated, whether the new primary network port of the new virtual switch to be updated is used as the primary network port in any virtual switch that has not undergone a network port binding update, and subsequent steps. This continues until no virtual switches have undergone a network port binding update, or no virtual switches that have undergone a network port binding update have used the new primary network port of the virtual switch to be updated as the primary network port. In other words, until all network ports have been searched and adjusted, all primary and backup network ports of all virtual switches have been swapped, or no virtual switches that have not undergone a network port binding update have used the new primary network port of the virtual switch to be updated as the primary network port, then exit all swapping operations.

[0125] It is understandable that after the above steps S206-S214 are completed, it is still possible that some network ports serve as the primary network port in different virtual switches at the same time. However, if there are enough network ports, the above logic can ensure that the same primary network port does not appear repeatedly in each virtual switch.

[0126] In order to more clearly illustrate the process of updating the network port binding in the event of a network port failure, the following embodiments are described.

[0127] Figure 4 FIG. 1 is a schematic diagram of binding the primary and backup network ports of a virtual switch according to an embodiment of the present invention. Figure 4As shown in the figure, the server includes three network cards: NIC A, NIC B, and NIC C. NIC A includes ports A1 and A2; NIC B includes ports B1 and B2; and NIC C includes ports C1 and C2. Ports A1 and B1 are bound together as active / standby ports on the same virtual switch, with port A1 serving as the active port and port B1 as the standby port. Ports A2 and C1 are bound together as active / standby ports on the same virtual switch, with port A2 serving as the active port and port C1 as the standby port. Ports B2 and C2 are bound together as active / standby ports on the same virtual switch, with port B2 serving as the active port and port C2 as the standby port.

[0128] It is understood that if both the B1 and C2 network ports are backup network ports, the B1 and C2 network ports can be bound as the primary and backup network ports of the same virtual switch, with the B1 network port being the primary network port and the C2 network port being the backup network port. Alternatively, the C2 network port can be the primary network port and the B1 network port the backup network port. This embodiment describes the B1 network port as the primary network port and the C2 network port as the backup network port.

[0129] The binding relationship table corresponding to the binding performed according to the above binding method can be shown in Table 1.

[0130] Table 1

[0131] Main network port Backup network port A1 B1 B2 C2 A2 C1 B1 C2

[0132] The primary network port and backup network port corresponding to each row in Table 1 are the primary network port and backup network port bound to the same virtual switch.

[0133] Assuming that network port A1 fails, since it is the primary network port in the virtual switch, the backup network port B1 bound to it will be set as the new primary network port of the virtual switch. Since network port B1 is the primary network port in the binding relationship between B1 and C2, the primary and backup relationships in the binding relationship between B1 and C2 are swapped, that is, B1 is used as the new backup network port and C2 is used as the new primary network port to update the network port binding. If there is no binding relationship that uses C2 as the primary network port among the binding relationships that have not been updated, it is determined that the network port binding update in the case of network port failure is complete. The updated binding relationship table is shown in Table 2.

[0134] Table 2

[0135] Main network port Backup network port B1 B2 C2 A2 C1 C2 B1

[0136] The network port binding method provided in this embodiment ensures the normal operation of the virtual switch and reduces the risk of network interruption caused by a single network port failure by updating the primary network port and the backup network port bound to the virtual switch when any network port fails.

[0137] In the event that any network port fails, the network port binding of the virtual switch that uses the network port as the primary network port is updated, and based on the updated primary network port of the failed virtual switch, it is determined whether the virtual switch that has not performed the network port binding update uses the updated primary network port as the primary network port, so as to update the network port binding of the virtual switch that uses the updated primary network port as the primary network port, so as to try to avoid or reduce the situation where a network port is the primary network port in different virtual switches at the same time, and to avoid the situation where the same network port bears the traffic of different virtual switches, causing the network port traffic to be too large and affecting the network response.

[0138] In some optional implementations, the network port binding method further includes:

[0139] In step a1, if the primary network port of the target virtual switch in the network port configuration information is the primary network port of any virtual switch other than the target virtual switch, the process returns to executing the step of selecting two target network cards from a plurality of network cards, or returns to executing the step of selecting a first network port from a plurality of network ports of one of the target network cards and selecting a second network port from a plurality of network ports of another target network card, until the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch.

[0140] Among them, by traversing the correspondence between the virtual switches with network port binding and the network ports bound to the virtual switches with network port binding in the virtual switch and network port binding relationship table, it is determined that the main network port of the target virtual switch in the network port configuration information is the main network port of any virtual switch other than the target virtual switch. In this case, it is necessary to re-screen the two target network cards or re-screen the network ports in the target network card until the main network port in the network port configuration information is not the main network port of other virtual switches. Only then can the network port of the target virtual switch be bound based on the network port configuration information.

[0141] The network port binding method provided in this embodiment maximizes the utilization of network port resources on the server by enabling any network port in active / standby mode to serve as the primary network port of the target virtual switch if that network port is not the primary network port of another virtual switch. If the primary network port in the network configuration information is the primary network port of another virtual switch, the network ports are reselected for binding to the target virtual switch, preventing the same network port from serving as the primary network port in different virtual switches.

[0142] That is, when a virtual switch selects two network cards as its primary and backup network cards, other virtual switches can still use these two network cards as their primary and backup network cards, but the primary network ports designated by these two virtual switches are different (for example, virtual switch A has two network ports, E1 and E2, with E1 as the primary and E2 as the backup; another virtual switch, B, can also have two network ports, E2 and E1, but E2 is the primary and E1 is the backup). When the system selects the primary network port for a virtual switch, it only restricts it from being the primary network port of other virtual switches (to avoid the same network port being the primary network port in different virtual switches and bearing the traffic pressure brought by the same network port).

[0143] In some optional implementations, after binding the network port of the target virtual switch based on the network port configuration information, the network port binding method further includes:

[0144] Step b1: perform a communication test on the primary network port and the backup network port bound to the target virtual switch.

[0145] The physical switch sets the network port to trunk mode or access mode based on its purpose. If it is in trunk mode, the corresponding VLAN number will be set for the network port, which also serves to isolate the network. The network ports bound to the same virtual switch must have the same mode, that is, either all trunk ports use the same VLAN number, or all access ports. This ensures that any network port in the virtual switch can communicate with the outside world. If different network ports in the same virtual switch use different modes, or if all are in trunk mode but have different VLAN numbers, the network ports in the same virtual switch will be unable to communicate.

[0146] To avoid this situation, when the virtual switch is binding network ports or automatically binding network ports due to a network port failure, a communication test is performed on the network ports bound to the virtual switch to determine whether the bound network ports use the same mode, that is, whether the bound network ports can communicate normally.

[0147] Step b2: If the communication test passes, determine that the network port binding of the target virtual switch is normal.

[0148] If the communication test passes, it means that the network port binding of the target virtual switch is normal, and the primary network port and the backup network port bound to the target virtual switch can communicate normally.

[0149] The network port binding method provided in this embodiment performs a communication test on the primary network port and the backup network port bound to the target virtual switch to ensure that the primary network port and the backup network port of the target virtual switch can communicate normally with each other, and that the primary network port and the backup network port can communicate normally with the outside world.

[0150] In some optional implementations, the above step b1 includes:

[0151] Step b11: Obtain the physical address of the primary network port and the physical address of the backup network port bound to the target virtual switch.

[0152] Among them, a communication test is performed on the network port bound to the target virtual switch, including a communication test on the primary network port bound to the target virtual switch and a communication test on the backup network port bound to the target virtual switch. When the communication tests of the primary network port and the backup network port are passed, it is determined that the network port binding of the target virtual switch is normal.

[0153] The virtualization platform obtains the physical address (Media Access Control Address, abbreviated as: MAC address) of the primary network port and the physical address of the backup network port in the target virtual switch.

[0154] Step b12: Using the physical address of the primary network port as the first physical address to be tested, and using the physical address of the backup network port as the first destination physical address.

[0155] Among them, when performing communication test on the main network port, the physical address of the main network port is used as the first physical address to be tested, that is, the MAC address of the current network port, and the physical address of the backup network port is used as the first destination physical address, that is, the MAC address of the opposite network port.

[0156] Step b13: Generate a first test data packet based on the first physical address to be tested and the first destination physical address.

[0157] It should be noted that the first test data packet includes the test content, the first physical address to be tested, and the first destination physical address. The test content includes sending and receiving tests between each network port bound to the virtual switch to detect whether the data can be received. If the data can be received, it means that the network ports bound to the virtual switch are in the same mode.

[0158] Step b14: Send the first test data packet to the physical switch corresponding to the target virtual switch through the primary network port, so that the physical switch sends the first test data packet to the backup network port based on the first destination physical address in the first test data packet.

[0159] The physical switch corresponding to the target virtual switch is the physical switch to which the target virtual switch is connected.

[0160] Step b15: When the backup network port receives the first test data packet, it is determined that the communication test of the primary network port passes.

[0161] The virtualization platform receives the first test data packet through the backup network port. If the backup network port receives the first test data packet, it is determined that the communication test of the primary network port has passed. If the backup network port does not receive the first test data packet, it is determined that the primary network port bound to the virtual switch cannot communicate.

[0162] Step b16: Use the physical address of the primary network port as the second destination physical address, and use the physical address of the backup network port as the second physical address to be tested.

[0163] Among them, when performing communication test on the backup network port, the physical address of the backup network port is used as the second physical address to be tested, that is, the MAC address of the current network port, and the physical address of the primary network port is used as the second destination physical address, that is, the MAC address of the opposite network port.

[0164] Step b17: Generate a second test data packet based on the second physical address to be tested and the second destination physical address.

[0165] It should be noted that the second test data packet includes test content, a second physical address to be tested, and a second destination physical address.

[0166] Step b18: Send the second test data packet to the physical switch corresponding to the target virtual switch through the backup network port, so that the physical switch sends the second test data packet to the primary network port based on the second destination physical address in the second test data packet.

[0167] Step b19: When the primary network port receives the second test data packet, it is determined that the communication test of the backup network port passes.

[0168] If the primary network port does not receive the second test data packet, it is determined that the backup network port bound to the virtual switch cannot communicate.

[0169] The primary network port receives the second test data packet, and the backup network port receives the first test data packet, indicating that the primary network port and the backup network port bound to the target virtual switch use the same mode, and the primary network port and the backup network port can communicate normally, confirming that the network port binding of the target virtual switch is normal.

[0170] The network port binding method provided in this embodiment performs a communication test on the primary network port and the backup network port bound to the target virtual switch to ensure that the primary network port and the backup network port of the target virtual switch can communicate normally with each other, and that the primary network port and the backup network port can communicate normally with the outside world.

[0171] In some optional implementations, the network port binding method further includes:

[0172] In step c1, if the communication test fails, the network port binding of the target virtual switch is determined to be abnormal, and network port binding abnormality information is displayed, so that the user can confirm the abnormality of the primary network port and the backup network port bound to the target virtual switch based on the network port binding abnormality information.

[0173] The communication test failure may be that the primary network port communication test fails, the backup network port communication test fails, or both the primary network port and the backup network port communication tests fail.

[0174] The network port binding exception information can be information about whether the network port modes of the primary network port and the backup network port are consistent and whether the VLANs are the same, so that the user can review and confirm the network port binding exception information, that is, confirm the exception of the primary network port and the backup network port bound to the target virtual switch, and take corresponding measures to handle the exception.

[0175] The network port binding method provided in this embodiment can quickly determine that there is an abnormality in the network port binding of the target virtual switch when the communication test fails, which helps to promptly discover potential network problems and improve the efficiency of troubleshooting.

[0176] In some optional implementations, the network port binding method further includes:

[0177] Step d1: After binding the target virtual switch to the network port based on the network port configuration information, the corresponding relationship between the target virtual switch and the network port bound to the target virtual switch is saved in a virtual switch and network port binding relationship table.

[0178] It is understandable that after the target virtual switch is bound to the network port based on the network port configuration information, the correspondence between the target virtual switch and the network port bound to the target virtual switch is saved in the virtual switch and network port binding relationship table for subsequent query.

[0179] The network port binding method provided in this embodiment saves the correspondence between the target virtual switch and the bound network port in the virtual switch and network port binding relationship table, which facilitates the management and query of network configuration and can quickly obtain the network port binding status of each virtual switch.

[0180] In some optional implementations, selecting two target network cards from a plurality of network cards, selecting a first network port from a plurality of network ports of one of the target network cards, and selecting a second network port from a plurality of network ports of the other target network card include:

[0181] Determine whether there is any unbound network card among multiple network cards.

[0182] The unbound network card is a network card in which at least one network port among the multiple network ports is not bound to the virtual switch.

[0183] If there are unbound network cards, and the number of unbound network cards is at least two, two target network cards are randomly selected from the unbound network cards, and a first network port is randomly selected from the network ports of one of the target network cards that are not bound to the virtual switch, and a second network port is randomly selected from the network ports of the other target network card that are not bound to the virtual switch.

[0184] If there is an unbound network card, and the number of the unbound network cards is one, a first network port is randomly selected from the network ports of the unbound network card that are not bound to the virtual switch, and a second network port is randomly selected from the multiple network ports of any target network card that is bound to the multiple network cards.

[0185] The bound target network card is a network card whose multiple network ports are bound to the virtual switch.

[0186] Selecting the second network port from the multiple network ports in any bound target network card includes selecting any second network port as a backup network port from the multiple network ports in any bound target network card.

[0187] The backup network port is a network port that serves as a backup network port in other virtual switches.

[0188] If there is no unbound network card, two target network cards are randomly selected from the multiple network cards, any first network port is selected from the multiple network ports of one of the target network cards as the backup network port, and any second network port is selected from the multiple network ports of the other target network card as the backup network port.

[0189] That is to say, the target virtual switch selects two network ports in the backup role for binding, and designates these two network ports as the primary network port and the backup network port in the virtual switch in the master-slave mode. The network card including the primary network port will bear the traffic usage of the virtual switch.

[0190] The network port binding method provided in this embodiment solves the problem that network card resources are idle and cannot be fully utilized when only the master-slave mode can be used to bind the network card in the virtualized environment. When the virtual switch is configured to select the network card and the binding mode of the network card is configured to the master-slave mode, the newly configured virtual switch selects two network ports in the virtualized environment for binding, and the two network ports are respectively designated as the master network port and the backup network port in the virtual switch in the master-slave mode (as long as the designated master network port is not the master network port in other virtual switches), and the network card at the master port will bear the traffic usage on the new virtual switch. The newly configured virtual switch judges the binding status of the network card and reasonably screens the network ports in the unbound network card and the network ports in the bound network card, thereby improving the screening efficiency, thereby improving the network port binding efficiency of the virtual switch, making maximum use of the network port resources, and avoiding the waste of network port resources.

[0191] This embodiment provides a network port binding device, such as Figure 5 Shown, including:

[0192] The acquisition module 501 is configured to acquire network card information of multiple network cards in a virtualized environment when network port binding is required for any target virtual switch.

[0193] The first determining module 502 is configured to determine a plurality of network ports included in each network card based on the network card information.

[0194] The screening module 503 is configured to screen out two target network cards from the multiple network cards, screen out a first network port from the multiple network ports of one of the target network cards, and screen out a second network port from the multiple network ports of the other target network card.

[0195] The second determining module 504 is configured to determine, based on the first network port and the second network port, the network port configuration information of the target virtual switch, such that the first network port is used as the primary network port of the target virtual switch and the second network port is used as the backup network port of the target virtual switch.

[0196] The binding module 505 is configured to bind the target virtual switch to a network port based on the network port configuration information when the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch.

[0197] In some optional implementations, the network port binding device further includes:

[0198] The first return execution module is used to return to the step of filtering out two target network cards from multiple network cards, or return to the step of filtering out the first network port from the multiple network ports of one of the target network cards and filtering out the second network port from the multiple network ports of the other target network card, when the primary network port of the target virtual switch in the network port configuration information is the primary network port of any virtual switch other than the target virtual switch, until the primary network port of the target virtual switch in the network port configuration information is not the primary network port of the other virtual switches.

[0199] In some optional implementations, the network port binding device further includes:

[0200] The third determining module is configured to determine that any network port is a faulty network port when a fault occurs on the network port.

[0201] The first judgment module is used to judge whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port.

[0202] The fourth determining module is configured to determine that the virtual switch bound to the faulty network port uses the faulty network port as the primary network port as the faulty virtual switch when any virtual switch bound to the faulty network port uses the faulty network port as the primary network port.

[0203] The first updating module is configured to use the backup network port of the failed virtual switch as the new primary network port of the failed virtual switch, and update the network port binding of the failed virtual switch based on the new primary network port of the failed virtual switch.

[0204] The second judgment module is used to judge whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch that has not performed the network port binding update.

[0205] The fifth determining module is used to determine that the virtual switch using the new primary network port of the failed virtual switch as the primary network port is the virtual switch to be updated when any virtual switch among the virtual switches that have not updated the network port binding uses the new primary network port of the failed virtual switch as the primary network port.

[0206] The second update module is used to use the main network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, and use the backup network port of the virtual switch to be updated as the new main network port of the virtual switch to be updated, and based on the new main network port and the new backup network port of the virtual switch to be updated, perform network port binding update on the virtual switch to be updated.

[0207] The third judgment module is used to judge whether the new primary network port of the virtual switch to be updated is used as the primary network port in the virtual switch that has not performed the network port binding update.

[0208] The second return execution module is used to determine that the virtual switch that uses the new primary network port of the virtual switch to be updated as the primary network port is the new virtual switch to be updated when any virtual switch among the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, return to execute the steps of using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and updating the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated, until there is no virtual switch that has not performed the network port binding update or none of the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port.

[0209] In some optional implementations, the network port binding device further includes:

[0210] The test module is used to perform communication tests on the primary network port and the backup network port bound to the target virtual switch.

[0211] The sixth determination module is used to determine whether the network port binding of the target virtual switch is normal when the communication test passes.

[0212] In some optional embodiments, the test module includes:

[0213] The first acquiring unit is configured to acquire the physical address of the primary network port and the physical address of the backup network port bound to the target virtual switch.

[0214] The first address determining unit is configured to use the physical address of the primary network port as the first physical address to be tested, and use the physical address of the backup network port as the first destination physical address.

[0215] The first generating unit is configured to generate a first test data packet based on a first physical address to be tested and a first destination physical address.

[0216] The first sending unit is configured to send the first test data packet to the physical switch corresponding to the target virtual switch through the primary network port, so that the physical switch sends the first test data packet to the backup network port based on the first destination physical address in the first test data packet.

[0217] The first test determination unit is configured to determine that the communication test of the primary network port has passed when the backup network port receives the first test data packet.

[0218] The second address determining unit is configured to use the physical address of the primary network port as the second destination physical address and the physical address of the backup network port as the second physical address to be tested.

[0219] The second generating unit is configured to generate a second test data packet based on the second physical address to be tested and the second destination physical address.

[0220] The second sending unit is configured to send the second test data packet to the physical switch corresponding to the target virtual switch through the backup network port, so that the physical switch sends the second test data packet to the primary network port based on the second destination physical address in the second test data packet.

[0221] The second test determination unit is configured to determine that the communication test of the backup network port has passed when the primary network port receives the second test data packet.

[0222] In some optional implementations, the network port binding device further includes:

[0223] The seventh determination module is used to determine that the network port binding of the target virtual switch is abnormal when the communication test fails, and display the network port binding abnormality information so that the user can confirm the abnormality of the primary network port and the backup network port bound to the target virtual switch based on the network port binding abnormality information.

[0224] In some optional implementations, the network port binding device further includes:

[0225] The saving module is used to save the corresponding relationship between the target virtual switch and the network port bound to the target virtual switch into the virtual switch and network port binding relationship table after binding the network port of the target virtual switch based on the network port configuration information.

[0226] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0227] The network port binding device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0228] The embodiment of the present invention also provides a computer device having the above Figure 5 The network port binding device shown.

[0229] See also Figure 6 , Figure 6 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 601, memory 602, and the interface for connecting each component, including a high-speed interface and a low-speed interface. Each component utilizes different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instruction executed in the computer device, including being stored in the memory or on the memory to display the graphic information of the GUI on an external input / output device (such as, being coupled to the display device of the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides the necessary operation of part (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 601 is taken as an example.

[0230] Processor 601 may be a central processing unit, a network processor, or a combination thereof. Processor 601 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0231] The memory 602 stores instructions that can be executed by at least one processor 601, so as to enable the at least one processor 601 to execute the method shown in the above embodiment.

[0232] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 602 may optionally include a memory remotely located relative to the processor 601, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0233] The memory 602 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 602 may also include a combination of the above types of memory.

[0234] The computer device further includes a communication interface 603 for the computer device to communicate with other devices or a communication network.

[0235] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0236] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.

[0237] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A network port binding method, characterized in that: The method comprises: When any target virtual switch needs to bind network ports, obtain network card information of multiple network cards in the virtualization environment; Determine a plurality of network ports included in each of the network cards based on the network card information; Selecting two target network cards from the plurality of network cards, selecting a first network port from the plurality of network ports of one of the target network cards, and selecting a second network port from the plurality of network ports of the other target network card; Based on the first network port and the second network port, determining the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch; If the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch, performing network port binding on the target virtual switch based on the network port configuration information; The method further comprises: In the event that any network port fails, the network port is determined to be the failed network port; Determine whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port; In the case that any virtual switch bound to the faulty network port uses the faulty network port as a primary network port, determining that the virtual switch using the faulty network port as the primary network port is the faulty virtual switch; Using the backup network port of the failed virtual switch as the new primary network port of the failed virtual switch, and updating the network port binding of the failed virtual switch based on the new primary network port of the failed virtual switch; Determine whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch for which the network port binding update has not been performed; In a case where any virtual switch among the virtual switches for which the network port binding update has not been performed uses the new primary network port of the failed virtual switch as the primary network port, determining the virtual switch that uses the new primary network port of the failed virtual switch as the primary network port as the virtual switch to be updated; Using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and performing network port binding update on the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated; Determine whether the new primary network port of the virtual switch to be updated is used as the primary network port in the virtual switch for which the network port binding update has not been performed; When any virtual switch among the virtual switches that have not performed network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, determine that the virtual switch that uses the new primary network port of the virtual switch to be updated as the primary network port is the new virtual switch to be updated, and return to the steps of using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and updating the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated, until there is no virtual switch that has not performed network port binding update or none of the virtual switches that have not performed network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port.

2. The method according to claim 1, characterized in that The method further comprises: If the primary network port of the target virtual switch in the network port configuration information is the primary network port of any virtual switch other than the target virtual switch, the process returns to executing the step of selecting two target network cards from the multiple network cards, or returns to executing the step of selecting the first network port from the multiple network ports of one of the target network cards and selecting the second network port from the multiple network ports of the other target network card, until the primary network port of the target virtual switch in the network port configuration information is not the primary network port of other virtual switches.

3. The method according to claim 1, characterized in that After binding the network port of the target virtual switch based on the network port configuration information, the method further includes: Perform communication testing on the primary network port and backup network port bound to the target virtual switch; If the communication test passes, it is determined that the network port binding of the target virtual switch is normal.

4. The method according to claim 3, characterized in that The communication test of the primary network port and the backup network port bound to the target virtual switch includes: Obtain the physical address of the primary network port and the physical address of the backup network port bound to the target virtual switch; Using the physical address of the primary network port as the first physical address to be tested, and using the physical address of the backup network port as the first destination physical address; Generate a first test data packet based on the first physical address to be tested and the first destination physical address; Sending the first test data packet to the physical switch corresponding to the target virtual switch through the primary network port, so that the physical switch sends the first test data packet to the backup network port based on the first destination physical address in the first test data packet; When the backup network port receives the first test data packet, determining that the communication test of the primary network port passes; Using the physical address of the primary network port as the second destination physical address, and using the physical address of the backup network port as the second physical address to be tested; generating a second test data packet based on the second physical address to be tested and the second destination physical address; Sending the second test data packet to the physical switch corresponding to the target virtual switch through the backup network port, so that the physical switch sends the second test data packet to the primary network port based on the second destination physical address in the second test data packet; When the primary network port receives the second test data packet, it is determined that the communication test of the backup network port passes.

5. The method according to claim 3, characterized in that The method further comprises: If the communication test fails, the network port binding of the target virtual switch is determined to be abnormal, and the network port binding abnormality information is displayed, so that the user can confirm the abnormality of the primary network port and the backup network port bound to the target virtual switch based on the network port binding abnormality information.

6. The method according to claim 1, wherein The method further comprises: After the target virtual switch is bound to a network port based on the network port configuration information, the corresponding relationship between the target virtual switch and the network port bound to the target virtual switch is saved in a virtual switch and network port binding relationship table.

7. A network port binding device, characterized in that: The device comprises: An acquisition module is used to obtain network card information of multiple network cards in a virtualized environment when any target virtual switch needs to bind network ports; A first determining module, configured to determine a plurality of network ports included in each of the network cards based on the network card information; a screening module, configured to screen out two target network cards from the plurality of network cards, and screen out a first network port from the plurality of network ports of one of the target network cards, and screen out a second network port from the plurality of network ports of the other target network card; a second determining module, configured to determine, based on the first network port and the second network port, the network port configuration information of the target virtual switch to use the first network port as the primary network port of the target virtual switch and the second network port as the backup network port of the target virtual switch; a binding module, configured to bind the network port of the target virtual switch based on the network port configuration information when the primary network port of the target virtual switch in the network port configuration information is not the primary network port of any other virtual switch except the target virtual switch; The network port binding device also includes: A third determining module is used to determine that any network port is a faulty network port when a fault occurs to the network port; The first judgment module is used to judge whether the virtual switch bound to the faulty network port uses the faulty network port as the primary network port; a fourth determining module, configured to determine that the virtual switch that uses the faulty network port as the primary network port is a faulty virtual switch when any virtual switch bound to the faulty network port uses the faulty network port as the primary network port; A first update module is configured to use the backup network port of the failed virtual switch as the new primary network port of the failed virtual switch, and update the network port binding of the failed virtual switch based on the new primary network port of the failed virtual switch; The second judgment module is used to judge whether the new primary network port of the failed virtual switch is used as the primary network port in the virtual switch for which the network port binding update has not been performed; a fifth determining module, configured to, when any virtual switch among the virtual switches for which the network port binding update has not been performed uses the new primary network port of the failed virtual switch as the primary network port, determine that the virtual switch that uses the new primary network port of the failed virtual switch as the primary network port is the virtual switch to be updated; The second update module is used to use the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, use the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and update the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated; The third judgment module is used to judge whether the new primary network port of the virtual switch to be updated is used as the primary network port in the virtual switch for which the network port binding update has not been performed; The second return execution module is used to determine that the virtual switch that uses the new primary network port of the virtual switch to be updated as the primary network port is the new virtual switch to be updated when any virtual switch among the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port, return to execute the steps of using the primary network port of the virtual switch to be updated as the new backup network port of the virtual switch to be updated, using the backup network port of the virtual switch to be updated as the new primary network port of the virtual switch to be updated, and updating the network port binding of the virtual switch to be updated based on the new primary network port and the new backup network port of the virtual switch to be updated, until there is no virtual switch that has not performed the network port binding update or none of the virtual switches that have not performed the network port binding update uses the new primary network port of the virtual switch to be updated as the primary network port.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the network port binding method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the network port binding method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • System and method for virtual ethernet interface binding

    CN104521198A

  • System and method for implementing virtualization management platform high availability

    CN105302661A