Method and device for implementing hot upgrade of virtual switch
By establishing traffic channels between virtual switches, it solves the problem of insufficient physical network card capacity to copy traffic during hot upgrade of virtual switches, realizes uninterrupted virtual switch upgrades, gets rid of physical network card hardware limitations, and ensures user experience.
Patent Information
- Application Number
- CN202210273026.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-03-18
AI Technical Summary
In the existing technology, hot upgrade of a virtual switch requires the physical network card to have the ability to copy traffic. When the physical network card has hardware limitations, uninterrupted services cannot be achieved.
By establishing a traffic channel between the old version of the virtual switch and the new version of the virtual switch, the new version of the virtual switch can realize traffic interaction with the physical network card through the old version of the virtual switch, avoiding the need for the physical network card to copy traffic, and controlling the virtual machine and the old version of the virtual switch. The switch is disconnected and a connection is established to the new version of the virtual switch.
The hot upgrade of the virtual switch is not restricted by the physical network card hardware, ensuring uninterrupted services and protecting the user experience to the greatest extent, with almost no user awareness.
Smart Images

Figure CN114710408B
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of Internet technology, and in particular, to a method and device for implementing hot upgrade of a virtual switch. Background Art
[0002] With the continuous development of information technology, virtualized networks are gradually showing great development potential. The streamlining of physical servers has led to the virtualization of computer room networks. Physical switches and other network devices that were originally seen everywhere in the computer room have also been integrated into the virtual platform. Through software simulation, virtual switches and other components are formed to provide network services for virtual machines. The essence of a virtual switch is to logically integrate physically connected switches through software. However, when a new version of a virtual switch is launched or a vulnerability in an existing version of a virtual switch is repaired, the virtual switch needs to be upgraded.
[0003] In the related art, hot upgrade of virtual switches can be achieved through a dual-process approach. The dual-process approach means that an independent new-version virtual switch process is created on the basis of the old-version virtual switch process. At this time, the physical network card connected to the old-version virtual switch replicates the traffic and sends it to the new-version virtual switch process and the old-version virtual switch process at the same time. After completing the required settings, the old-version virtual switch process is terminated, and the new-version virtual switch process provides the corresponding service, thereby achieving hot upgrade of virtual switches without service interruption.
[0004] However, this dual-process hot upgrade method of duplicating traffic of the physical network card requires the physical network card to have the ability to duplicate traffic. When the physical network card has hardware limitations and does not have the ability to duplicate traffic, the above-mentioned hot upgrade of the virtual switch without interrupting service cannot be achieved. Summary of the invention
[0005] In view of this, one or more embodiments of the present specification provide a method and apparatus for implementing hot upgrade of a virtual switch.
[0006] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0007] According to a first aspect of one or more embodiments of this specification, a method for implementing a hot upgrade of a virtual switch is proposed, the method comprising:
[0008] Deploy a corresponding new version virtual switch for the old version virtual switch, and load the configuration information to be upgraded by the new version virtual switch; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is used to implement traffic forwarding between the physical network card and the at least one virtual machine;
[0009] Establishing a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch;
[0010] Control the at least one virtual machine to disconnect from the old version virtual switch, and establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
[0011] According to a second aspect of one or more embodiments of this specification, a device for implementing hot upgrade of a virtual switch is provided, the device comprising:
[0012] A deployment unit, configured to deploy a corresponding new version virtual switch for an old version virtual switch, and load configuration information to be upgraded by the new version virtual switch; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is configured to implement traffic forwarding between the physical network card and the at least one virtual machine;
[0013] An establishing unit, configured to establish a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch;
[0014] The control unit is used to control the disconnection between the at least one virtual machine and the old version virtual switch, and to establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
[0015] According to a third aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0016] According to a fourth aspect of one or more embodiments of this specification, an electronic device is proposed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification, and for ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0018] Figure 1It is a schematic diagram of the architecture of a virtual switch hot upgrade system provided by an exemplary embodiment of this specification;
[0019] Figure 2 is a flow chart of a method for implementing hot upgrade of a virtual switch provided by an exemplary embodiment of this specification;
[0020] Figure 3 It is a schematic diagram of hot upgrading a virtual switch provided by an exemplary embodiment of this specification;
[0021] Figure 4 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of this specification;
[0022] Figure 5 It is a block diagram of a device for implementing hot upgrade of a virtual switch provided by an exemplary embodiment of this specification. DETAILED DESCRIPTION
[0023] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0024] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0025] Figure 1 FIG. 1 is a schematic diagram of the architecture of a virtual switch hot upgrade system provided by an exemplary embodiment of this specification. Figure 1 As shown, the system architecture may include a control end 10 and a service end 11 .
[0026] The control terminal 10 can be deployed on a physical server including an independent host, or the control terminal 10 can be deployed on a virtual server (such as a cloud server) carried by a host cluster, and this specification does not limit this. The control terminal 10 can be configured with the control logic for implementing the hot upgrade of the virtual switch described in this specification, so that the virtual switch 15 can be hot upgraded without the need for the physical network card 16 to have the ability to replicate traffic, thereby avoiding service interruption of the virtual switch 15 during the upgrade process.
[0027] The server 11 may be a physical server including an independent host, or the server 11 may be a host cluster. Figure 1 In the embodiment shown, the control end 10 and the server end 11 are independent of each other, but in some embodiments, the control end 10 can also be deployed at the server end 11, and this specification does not limit this. The server end 11 is configured with a physical network card 16, and the server end 11 can virtualize processing resources to logically integrate at least one virtual machine (such as virtual machine 12, virtual machine 13 and virtual machine 14, etc.), and a virtual switch 15. Furthermore, the virtual switch 15 can be configured with two virtual interfaces: an uplink port and a downlink port. The uplink port can be used to connect to the physical network card 16, and the downlink port can be used to connect to the virtual machines 12-14. The virtual switch 15 establishes logical connections with the virtual machines 12-14 and the physical network card 16 through the above-mentioned virtual interfaces, so that the virtual switch 15 can forward the traffic on the virtual machines 12-14 through the physical network card 16 based on the above-mentioned connection, and can also forward the traffic of the physical network card 16 to the corresponding virtual machine 12 based on the above-mentioned connection. At the same time, multiple virtual machines, such as virtual machine 12, virtual machine 13 and virtual machine 14, can also be interconnected through the virtual switch 15.
[0028] This specification can implement dual-process hot upgrade for the virtual switch 15 in the above system architecture, and can successfully complete the hot upgrade regardless of whether the physical network card 16 has the ability to replicate traffic, thereby freeing the hot upgrade of the virtual switch 15 from the hardware limitations of the physical network card 16.
[0029] Figure 2 The present invention is a flowchart of a method for implementing a hot upgrade of a virtual switch provided by an exemplary embodiment, the method comprising the following steps:
[0030] Step 201: deploy a corresponding new version virtual switch for the old version virtual switch, and load the configuration information to be upgraded by the new version virtual switch; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is used to realize traffic forwarding between the physical network card and the at least one virtual machine.
[0031] In the embodiments of this specification, a virtual switch may refer to a virtual switch process that is logically integrated by virtualizing processing resources on the server side. An old version of a virtual switch may refer to a virtual switch process that exists before the hot upgrade of the virtual switch begins. Correspondingly, a new version of a virtual switch may refer to another virtual switch process that replaces the old version of the virtual switch process during the hot upgrade. In other words, the new version of the virtual switch and the old version of the virtual switch described in this specification are used to characterize the front-to-back replacement relationship of the virtual switch during the hot upgrade process, rather than a specific version. The hot upgrade of the virtual switch can be triggered according to functional requirements, that is, the current version of the virtual switch can no longer meet the functional requirements, and the current version of the virtual switch needs to be hot upgraded to achieve functional expansion. Of course, the hot upgrade of the virtual switch can also be upgraded due to version vulnerabilities. At this time, the hot upgrade of the virtual switch can be implemented in two ways: one, launching a new version of the virtual switch after the vulnerability is patched. Second, version rollback. It is not difficult to understand that when method one is adopted, the new version of the virtual switch is a virtual switch after the vulnerability is patched, and the old version of the virtual switch is a virtual switch that still has the vulnerability. When method 2 is adopted, that is, version rollback, the new version virtual switch refers to the virtual switch that does not have vulnerabilities in the previous version, and correspondingly, the old version virtual switch refers to the virtual switch that still has vulnerabilities in the current version.
[0032] It should be noted that the new version virtual switch process and the old version virtual switch process are different processes independent of each other. For how to deploy the new version virtual switch, please refer to the relevant content in the relevant technology, and this manual will not go into details here.
[0033] The old version of the virtual switch is connected to the physical network card and at least one virtual machine respectively, and is used to implement traffic forwarding between the physical network card and the at least one virtual machine. Figure 1 In the illustrated embodiment, the virtual switch 15 may be an old version virtual switch, the virtual machines 12-14 may be virtual machines connected to the old version virtual switch, the physical network card 16 may be a physical network card connected to the old version virtual switch, and the virtual switch 15 is used to implement traffic forwarding between the physical network card 16 and the virtual machine 12, such as forwarding the traffic generated by the virtual machine 12-14 outward through the physical network card 16, or forwarding the traffic received by the physical network card 16 to the virtual machine 12-14, etc. For another example, the virtual machine 12-14 is configured with a corresponding virtual network card, and at this time, the connection between the old version virtual switch and at least one virtual machine can be regarded as the connection between the old version virtual switch 15 and the corresponding virtual network card configured for the virtual machine 12-14, so that the old version virtual switch can implement traffic forwarding according to the virtual network card configured for the virtual machine 12-14.
[0034] In one embodiment, the new version of the virtual switch loads the configuration information to be upgraded, and the configuration information to be upgraded can be the configuration information added and / or deleted according to the functional requirements, or the corresponding configuration information required to patch the vulnerability of the old version of the virtual switch. It is not difficult to understand that when the virtual switch is hot upgraded to version rollback, the configuration information to be upgraded at this time can be the configuration information corresponding to the previous version. In other words, the configuration information to be upgraded described in this specification can be flexibly adapted according to actual needs.
[0035] Step 202: Establish a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch.
[0036] Through this traffic channel, the old version virtual switch can forward traffic between the new version virtual switch and the physical network card, such as forwarding the traffic sent by the physical network card to the old version virtual switch to the new version virtual switch, and forwarding the traffic generated by the new version virtual switch to the physical network card. Then, since the physical network card only needs to forward the traffic normally to the old version virtual switch, and the old version virtual switch forwards it to the new version virtual switch, the physical network card does not need to have the ability to replicate traffic in hardware, which can ensure that the new version virtual switch can obtain the traffic sent by the physical network card, so that the hot upgrade of the virtual switch can be independent of the hardware capabilities of the physical network card.
[0037] In one embodiment, the control end can configure a first virtual network card on the old version virtual switch, and configure a second virtual network card on the new version virtual switch, so that a virtual network card pair is formed between the first virtual network card and the second virtual network card, thereby forming the above-mentioned traffic channel. The traffic channel described in this specification can realize traffic sharing between the new and old versions of virtual switches, without the need for a physical network card to copy traffic and send it to the new version of the virtual switch, thereby avoiding the inability to implement hot upgrades of virtual switches due to hardware limitations. It should be noted that the traffic channel described in this specification is not only achievable through a virtual network card pair, and this specification does not limit this.
[0038] In one embodiment, the old version virtual switch can copy the traffic from the physical network card and send it to the second virtual network card configured by the new version virtual switch through the first virtual network card, thereby realizing traffic sharing. It should be noted that the old version virtual switch described in this specification can also send the traffic from the physical network card to the second virtual network card directly without copying, because regardless of whether the traffic is copied or not, the new version virtual switch can obtain the corresponding traffic through the traffic channel. The above copy operation can be selected according to actual needs, and this specification does not limit this.
[0039] In one embodiment, after the old version virtual switch configures the first virtual network card, it can continuously send traffic from the physical network card to the second virtual network card; and after the new version virtual switch configures the second virtual network card, it can poll the second virtual network card to receive traffic forwarded by the first virtual network card. For example, after the old version virtual switch continuously sends traffic from the physical network card to the second virtual network card, the new version virtual switch can query the second virtual network card every 300 milliseconds whether it has received traffic forwarded by the first virtual network card.
[0040] Through the steps of continuous sending by the old version virtual switch and polling by the new version virtual switch, it can be ensured that the new version virtual switch receives the traffic forwarded by the first virtual network card as soon as possible and avoids missing the traffic forwarded by the first virtual network card. At the same time, the polling operation can also reduce the performance consumption caused by continuous query.
[0041] Step 203: Control the disconnection between the at least one virtual machine and the old version virtual switch, and establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
[0042] By disconnecting the virtual machine from the old version of the virtual switch and establishing a connection with the new version of the virtual switch, the virtual machine can be reconnected from the old version of the virtual switch to the new version of the virtual switch, and the new version of the virtual switch can at least achieve indirect connectivity with the physical network card through the aforementioned traffic channel, thereby replacing the old version of the virtual switch with the new version to achieve traffic forwarding between the virtual machine and the physical network card.
[0043] In one embodiment, the control end can control all virtual machines on the old version virtual switch to disconnect at the same time, and simultaneously establish connections with the new version virtual switch. It is not difficult to see that when the number of virtual machines is at a relatively low scale, the above-mentioned simultaneous disconnection of all connections and simultaneous establishment of all connections will not cause an interruption or will not cause an excessively long interruption.
[0044] In one embodiment, the at least one virtual machine can be divided into a plurality of groups, and at this time, the following operations can be performed on each group in turn: disconnecting the connection between the virtual machine of the corresponding group and the old version virtual switch, and establishing a connection between the disconnected virtual machine and the upgraded new version virtual switch. Wherein, each group includes one or more virtual machines. By dividing all virtual machines connected to the old version virtual switch into a plurality of groups, and disconnecting the connection with the old version virtual switch and establishing the connection with the new version virtual switch in turn according to the groups, wherein: the virtual machine that has completed the switch is provided with services by the new version virtual switch, and the virtual machine that has not completed the switch (i.e., is still connected to the old version virtual switch) is provided with services by the old version virtual switch, thereby avoiding the long interruption time caused by the simultaneous switching when the number of virtual machines reaches a certain scale, so that no matter how many virtual machines there are, it can be ensured that the hot upgrade of the virtual switch is completed without the user's perception. It should be noted that the control end can control the number of virtual machines in each group. By controlling the number, the pressure caused by the number of virtual machines will not be increased to exceed the system's tolerance range, avoid service interruption or cause excessive service interruption, and relatively improve the migration efficiency. Moreover, the number of virtual machines contained in each group can be the same or different, and can even be dynamically adjusted according to the system operation status to ensure a dynamic balance between system pressure and migration efficiency. For example, the virtual machines connected to the old version of the virtual switch can be divided into three groups: A, B, and C, where groups A, B, and C each contain 100 virtual switches. At this time, the above steps can be performed on groups A, B, and C in turn, that is, disconnect the connection between the virtual machines in group A and the old version of the virtual switch, and establish a connection between the virtual machines in group A and the new version of the virtual switch that has been upgraded. At this time, the virtual machines in group A have completed the switch, while the virtual machines in groups B and C have not completed the switch. In this case, the virtual machines in group A are served by the new version of the virtual switch, thereby completing the corresponding traffic interaction, while the virtual machines in groups B and C are served by the old version of the virtual switch, thereby completing the corresponding traffic interaction. After the virtual machines in group A have completed the switch, the above steps are performed on groups B and C in turn, that is, the virtual machines in group B are disconnected from the old version of the virtual switch, and a connection is established with the upgraded new version of the virtual switch. At this time, the virtual machines in groups A and B are served by the new version of the virtual switch, and the corresponding traffic interaction is completed, while the virtual machines in group C are still served by the old version of the virtual switch, and the corresponding traffic switching is completed. Finally, the above steps are performed on the virtual machines in group C, that is, the virtual machines in group C are disconnected from the old version of the virtual switch, and a connection is established with the upgraded new version of the virtual switch. At this time, the virtual machines in groups A, B, and C are all served by the new version of the virtual switch, and the corresponding traffic interaction is completed.
[0045] In one embodiment, after the traffic channel is established, the control end can send a first switching request to the old version virtual switch and a second switching request to the new version virtual switch respectively; wherein the first switching request is used to instruct the old version virtual switch to disconnect from the at least one virtual machine, and the second switching request is used to instruct the new version virtual switch to establish a connection with the at least one virtual machine. Under the effect of the above-mentioned first and second switching requests, the new and old version virtual switches can be guaranteed to perform the switching operation of the virtual machines in an orderly manner.
[0046] In one embodiment, when at least one virtual machine has been connected to the new version of the virtual switch, the physical network card is controlled to be disconnected from the old version of the virtual switch and connected to the new version of the virtual switch, so that traffic forwarding can be achieved between the new version of the virtual switch and the physical network card. After all virtual machines have completed the switch, that is, all virtual machines are disconnected from the old version of the virtual switch and connected to the new version of the virtual switch, the control end can control the physical network card to be disconnected from the old version of the virtual switch and connected to the new version of the virtual switch. At this time, the old version of the virtual switch no longer needs to send traffic from the physical network card to the second virtual network card configured on the new version of the virtual switch, but the physical network card directly sends traffic to the new version of the virtual switch. After the physical network card is connected to the new version of the virtual switch, the control end can deactivate and end the old version of the virtual switch, and the new version of the virtual switch will take over the network service. In fact, after all virtual machines have completed the switch, that is, after all virtual machines are connected to the new version of the virtual switch, the old version of the virtual switch can no longer receive the traffic sent by the virtual machine, and its network service has been fully taken over by the new version of the virtual switch. At this time, timely deactivation and termination of the old version of the virtual switch can release the resources occupied by the old version of the virtual switch and reduce system pressure. However, it should be noted that the new version of the virtual switch does not start to take over the network service after the physical network card is switched. The new version of the virtual switch can provide network services when the virtual machine is switched to the new version of the virtual switch. That is, in the process of switching virtual machines between the old version of the virtual switch and the new version of the virtual switch, both the new and old versions of the virtual switch provide corresponding network services, and after the physical network card is switched, the new version of the virtual switch takes over the network service and deactivates the old version of the virtual switch.
[0047] In one embodiment, the control end determines the number of connections of virtual machines connected to the old version virtual switch that has been counted in advance; when the number of virtual machines that have been disconnected from the old version virtual switch and established a connection with the new version virtual switch has reached the determined number of connections, it is determined that at least one virtual machine has been connected to the new version virtual switch. For example, the control end determines that there are 200 virtual machines on the old version virtual switch that has been counted in advance, then after the 200 virtual machines are switched to the new version virtual switch in turn, the control end can traverse and detect whether the above 200 virtual machines have completed the switching. When the control end determines that the above 200 virtual machines have been connected to the new version virtual switch, the control end can automatically switch the physical network card to the new version virtual switch, and deactivate and end the old version virtual switch, so that the new version virtual switch can take over the network service in full, and realize the hot upgrade of the virtual switch without interrupting the service.
[0048] The method for implementing hot upgrade of a virtual switch described in this specification can implement hot upgrade of the virtual switch without interrupting services. It does not require the physical network card to have the ability to copy traffic, so that the hot upgrade of the virtual switch is free from the limitation of the physical network card hardware. In addition, when switching virtual machines, the old version of the virtual switch and the new version of the virtual switch can provide corresponding network services at the same time without affecting the normal use of users, thus protecting the user experience to the greatest extent and implementing the hot upgrade of the virtual switch without the user's perception.
[0049] For ease of understanding, the following Figure 1 and Figure 3 This manual describes how to implement hot upgrade of virtual switches. Figure 3 It is a schematic diagram of hot upgrading a virtual switch provided by an exemplary embodiment of this specification.
[0050] Assume that you need to Figure 1 The virtual switch 15 shown in the figure is hot-upgraded. Figure 1 The virtual switch 15 shown is an old version virtual switch. Figure 3The above-mentioned virtual switch 15 is marked as an old version virtual switch 15. The uplink port of the old version virtual switch 15 forms a logical connection with the physical network card 16, and the downlink port of the old version virtual switch 15 forms a logical connection with the virtual machines 12, 13 and 14. The old version virtual switch 15 can realize the traffic interaction between the virtual machines 12, 13, 14 and the physical network card 16 through the above two virtual interfaces. The control end 10 can deploy the new version virtual switch 17, and the new version virtual switch 17 loads the configuration information to be upgraded. For example, if the old version virtual switch 15 needs to be upgraded due to the existence of a system vulnerability, then the configuration information to be upgraded can be the configuration information corresponding to the patch of the above system vulnerability to ensure that the new version virtual switch 17 no longer contains the above system vulnerability.
[0051] After completing the deployment of the new version virtual switch 17, the control end 10 can configure the first virtual network card 301 on the old version virtual switch, and at the same time, the control end 10 configures the second virtual network card 302 on the new version virtual switch 17, so that the first virtual network card 301 and the second virtual network card 302 form a virtual network card pair, and then establish a traffic channel based on the virtual network card pair. The old version virtual switch 15 continuously sends the traffic from the physical network card 16 to the second virtual network card 302 configured on the new version virtual switch 17 through the first virtual network card 301, and the new version virtual switch 17 polls the second virtual network card 302 every 300 milliseconds, so that the new version virtual switch 17 receives the traffic sent by the old version virtual switch 15 through the first virtual network card 301. It should be noted that at this time, the old version virtual switch 15 may not copy the traffic sent by the physical network card 16, but directly send the traffic to the second virtual network card 302 configured by the new version virtual switch 17. Of course, the old version virtual switch 15 can also copy the traffic and then send it to the second virtual network card 302 configured by the new version virtual switch 17. This manual does not limit this.
[0052] After the new version virtual switch 17 receives the traffic sent by the old version virtual switch 15, the control end 10 sends a first switching request to the old version virtual switch 15, and the control end 10 sends a second switching request to the new version virtual switch 17, so that the old version virtual switch 15 is ready to disconnect the virtual machine connected to it, and the new version virtual switch 17 is ready to establish a connection with the virtual machine. The control end 10 determines that the number of virtual machines connected to the old version virtual switch is 3, that is, there are 3 virtual machines connected to the old version virtual switch 15, namely virtual machine 12, virtual machine 13 and virtual machine 14. Because the number of virtual machines connected to the old version virtual switch 15 is 3, the virtual machines can be divided into three groups A, B and C. Group A includes virtual machine 12, group B includes virtual machine 13, and group C includes virtual machine 14. Of course, as mentioned above, the interruption time caused by simultaneous switching and group switching of the number of virtual machines within a certain range will not be perceived by the user, so virtual machine 12, virtual machine 13 and virtual machine 14 can also be switched at the same time at this time.
[0053] Based on the first switching request, the old version virtual switch 15 disconnects from the virtual machine 12 of group A; based on the second switching request, the new version virtual switch 17 establishes a connection with the virtual machine 12, and the switching of the virtual machine 12 is completed. At this time, the virtual machine 12 is provided with corresponding network services by the new version virtual switch 17, that is, the message forwarding work of the virtual machine 12 is realized by the new version virtual switch 17, and at this time, the virtual machines 13 and 14 are still provided with corresponding network services by the old version virtual switch 15. After completing the switching of the virtual machine 12, the switching of the virtual machine 13 of group B is started, and the old version virtual switch 15 disconnects from the virtual machine 13; the new version virtual switch 17 establishes a connection with the virtual machine 13. After completing the switching of the virtual machine 13, the switching of the virtual machine 14 of group C is started, and the old version virtual switch 15 disconnects from the virtual machine 14, and the new version virtual switch 17 establishes a connection with the virtual machine 14. At this point, the three virtual machines of the three groups A, B and C, namely virtual machine 12, virtual machine 13 and virtual machine 14, have completed the switching, and the corresponding network services are provided by the new version virtual switch 17. The control end 10 determines that virtual machines 12, 13, and 14 are all connected to the new version virtual switch 17 based on the number of virtual machines connected to the old version virtual switch 15 that has been counted in advance, namely, 3 virtual machines. The control end 10 automatically disconnects the physical network card 16 from the old version virtual switch 15, and establishes a connection between the physical network card 16 and the new version virtual switch 17. At this point, the new version virtual switch 17 takes full control of the network service and no longer needs a traffic channel to receive traffic. After the physical network card 16 switches to the new version virtual switch 17, the control end 10 deactivates and ends the old version virtual switch 15, and then completes the hot upgrade of the virtual switch.
[0054] It can be seen from the above embodiments that regardless of whether the physical network card 16 has the ability to replicate traffic, the virtual switch 15 can be hot-upgraded by the method for implementing hot upgrade of the virtual switch provided in this specification, so that the hot upgrade of the virtual switch is free from the limitation of the physical network card hardware, and the old version of the virtual switch 15 and the new version of the virtual switch 17 provide corresponding network services at the same time during the process of switching virtual machines (virtual machine 12, virtual machine 13 and virtual machine 14) in groups, so that the hot upgrade of the virtual switch can be achieved with almost no perception by the user.
[0055] Corresponding to the above method embodiments, this specification also provides device embodiments.
[0056] Figure 4 This is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Please refer to Figure 4 At the hardware level, the electronic device includes a processor 401, a network interface 402, a memory 403, a non-volatile memory 404, and an internal bus 405, and may also include hardware required for other functions. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it. Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0057] Figure 5 is a block diagram of a device for implementing hot upgrade of a virtual switch provided by an exemplary embodiment. Figure 5 As shown, the device comprises:
[0058] The deployment unit 501 is used to deploy a corresponding new version virtual switch for the old version virtual switch, and the new version virtual switch loads the configuration information to be upgraded; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is used to implement traffic forwarding between the physical network card and the at least one virtual machine;
[0059] An establishing unit 502 is used to establish a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch;
[0060] The control unit 503 is used to control the disconnection between the at least one virtual machine and the old version virtual switch, and to establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
[0061] Optionally, the establishing unit 502 is specifically configured to:
[0062] A first virtual network card is configured on the old version virtual switch, and a second virtual network card is configured on the new version virtual switch; wherein the traffic channel is established between the first virtual network card and the second virtual network card.
[0063] Optionally, the old version virtual switch is used to continuously forward traffic from the physical network card to the second virtual network card through the first virtual network card; the new version virtual switch is used to poll the second virtual network card to receive traffic forwarded by the first virtual network card.
[0064] Optionally, the control unit 503 is specifically configured to:
[0065] In the case where the at least one virtual machine is divided into multiple groups, the following steps are performed on each group in turn: disconnecting the virtual machines of the corresponding group from the old version of the virtual switch, and establishing a connection between the disconnected virtual machines and the upgraded new version of the virtual switch; wherein each group includes one or more virtual machines.
[0066] Optionally, the control unit 503 is specifically configured to:
[0067] After the traffic channel is established, a first switching request is sent to the old version virtual switch and a second switching request is sent to the new version virtual switch; wherein the first switching request is used to instruct the old version virtual switch to disconnect from the at least one virtual machine, and the second switching request is used to instruct the new version virtual switch to establish a connection with the at least one virtual machine.
[0068] Optionally, the device further comprises:
[0069] The physical network card control unit 504 is used to control the physical network card to be disconnected from the old version virtual switch and connected to the new version virtual switch when at least one virtual machine is connected to the new version virtual switch, so as to realize traffic forwarding between the new version virtual switch and the physical network card.
[0070] Optionally, the device further comprises:
[0071] The determination unit 505 is used to determine the number of virtual machines connected to the old version virtual switch that has been counted in advance; when the number of virtual machines that are disconnected from the old version virtual switch and connected to the new version virtual switch reaches a determined number, determine that at least one virtual machine has been connected to the new version virtual switch.
[0072] Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the relevant method, and will not be elaborated here.
[0073] It can be seen from the technical solution provided in the above specification that the method for implementing hot upgrade of a virtual switch described in the specification can realize hot upgrade of a virtual switch without interrupting services, and does not require the physical network card to have the ability to copy traffic, thereby freeing the hot upgrade of the virtual switch from the limitation of the physical network card hardware, and realizing a universal hot upgrade method of a virtual switch. Moreover, when the old version virtual switch and the new version virtual switch are in the process of switching the virtual machine, the old version virtual switch and the new version virtual switch provide corresponding network services at the same time, and the hot upgrade of the virtual switch can be realized with almost no perception by the user.
[0074] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0075] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0076] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0077] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0078] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0079] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A method for implementing hot upgrade of a virtual switch, characterized in that: The method comprises: Deploy a corresponding new version virtual switch for the old version virtual switch, and load the configuration information to be upgraded by the new version virtual switch; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is used to implement traffic forwarding between the physical network card and the at least one virtual machine; Establishing a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch; Control the at least one virtual machine to disconnect from the old version virtual switch, and establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
2. The method according to claim 1, characterized in that The establishing of a traffic channel between the old version virtual switch and the new version virtual switch includes: Configuring a first virtual network card on the old version virtual switch, and configuring a second virtual network card on the new version virtual switch; The traffic channel is established between the first virtual network card and the second virtual network card.
3. The method according to claim 2, characterized in that The old version virtual switch is used to continuously forward traffic from the physical network card to the second virtual network card through the first virtual network card; The new version virtual switch is used to poll the second virtual network card to receive the traffic forwarded by the first virtual network card.
4. The method according to claim 1, characterized in that: The controlling the disconnection between the at least one virtual machine and the old version virtual switch and establishing a connection between the at least one virtual machine and the upgraded new version virtual switch includes: In the case where the at least one virtual machine is divided into a plurality of groups, the following steps are performed on each group in turn: disconnecting the virtual machines of the corresponding group from the old version virtual switch, and establishing a connection between the disconnected virtual machines and the upgraded new version virtual switch; Each group includes one or more virtual machines.
5. The method according to claim 1, characterized in that The controlling the disconnection between the at least one virtual machine and the old version virtual switch and establishing a connection between the at least one virtual machine and the upgraded new version virtual switch includes: After the traffic channel is established, a first switching request is sent to the old version virtual switch and a second switching request is sent to the new version virtual switch; The first switching request is used to instruct the old version virtual switch to disconnect from the at least one virtual machine, and the second switching request is used to instruct the new version virtual switch to establish a connection with the at least one virtual machine.
6. The method according to claim 1, characterized in that The method further comprises: When the at least one virtual machine is connected to the new version virtual switch, the physical network card is controlled to be disconnected from the old version virtual switch and connected to the new version virtual switch, so as to realize traffic forwarding between the new version virtual switch and the physical network card.
7. The method according to claim 6, characterized in that The method further comprises: Determine the number of connections of virtual machines connected to the old version virtual switch that is counted in advance; When the number of virtual machines disconnected from the old version virtual switch and connected to the new version virtual switch reaches the determined number of connections, it is determined that the at least one virtual machine is connected to the new version virtual switch.
8. A device for implementing hot upgrade of a virtual switch, characterized in that: The device comprises: A deployment unit, configured to deploy a corresponding new version virtual switch for an old version virtual switch, and load configuration information to be upgraded by the new version virtual switch; wherein the old version virtual switch is respectively connected to a physical network card and at least one virtual machine, and is configured to implement traffic forwarding between the physical network card and the at least one virtual machine; An establishing unit, configured to establish a traffic channel between the old version virtual switch and the new version virtual switch, so that the new version virtual switch can achieve traffic interaction with the physical network card through the old version virtual switch; The control unit is used to control the disconnection between the at least one virtual machine and the old version virtual switch, and to establish a connection between the at least one virtual machine and the upgraded new version virtual switch.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.
