WO2020114292A1 - 一种虚拟交换机切换方法、装置、宿主机及存储介质 - Google Patents
一种虚拟交换机切换方法、装置、宿主机及存储介质 Download PDFInfo
- Publication number
- WO2020114292A1 WO2020114292A1 PCT/CN2019/121308 CN2019121308W WO2020114292A1 WO 2020114292 A1 WO2020114292 A1 WO 2020114292A1 CN 2019121308 W CN2019121308 W CN 2019121308W WO 2020114292 A1 WO2020114292 A1 WO 2020114292A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- virtual
- switch
- virtual switch
- machine
- network card
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/70—Virtual switches
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
- H04L41/082—Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0823—Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
- H04L41/0836—Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability to enhance reliability, e.g. reduce downtime
Definitions
- the present application relates to the field of communication technologies, and in particular, to a virtual switch switching method, device, host machine, and storage medium.
- the virtual switch works in the layer 2 data network, and realizes the layer 2 network function or part of the layer 3 network function of the physical switch through software.
- the virtual switch runs in the host machine and is used to process messages. To enable virtual switches to process messages more efficiently, developers will continue to develop new versions of virtual switches. After receiving the trigger instruction for switching the virtual switch, the host switches the old version of the virtual switch to the new version of the virtual switch.
- the host switches the old version of the virtual switch to the new version of the virtual switch through the following four steps: the first step is to close the old version of the virtual switch; the second step is to start the new version of the virtual switch; the third step To load the configuration file of the new version of the virtual switch; the fourth step is to establish a connection between the new version of the virtual switch and at least one virtual machine in the host machine.
- the new version of the virtual switch can process packets.
- the longer time for the virtual switch to be unavailable in the host machine will eventually cause the user to wait longer and affect the user experience.
- the purpose of the embodiments of the present application is to provide a virtual switch switching method, device, host and storage medium, so that when switching between virtual switches, the time when no virtual switch is available in the host is shortened, thereby reducing user waiting time, Improve user experience.
- the specific technical solutions are as follows:
- an embodiment of the present application provides a virtual switch switching method, which is applied to a host machine, where a physical network card and at least one virtual machine are provided in the host machine, and at least two sets of virtual interfaces are provided in the physical network card
- the method includes: receiving a switching instruction of a virtual switch, wherein the switching instruction is used to instruct to switch the currently running first virtual switch to a second virtual switch; while keeping the first virtual switch running, Start the second virtual switch and load the configuration file of the second virtual switch; establish a connection between the at least one virtual machine and the second virtual switch; notify the physical network card to receive virtual traffic from the virtual machine
- the interface is switched from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, so that the physical network card sends traffic to be sent to the at least one virtual machine to the
- the virtual interface group corresponding to the second virtual switch receives the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the method also includes shutting down or uninstalling the first virtual switch.
- the step of informing the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch includes: after determining that the at least one virtual machine has established a connection with the second virtual switch, sending a notification message to the physical network card in the host machine; wherein the notification message is used to indicate that the physical network card will The virtual interface receiving the virtual machine traffic is switched from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch.
- the step of establishing a connection between the at least one virtual machine and the second virtual switch includes: sending a connection establishment instruction to the at least one virtual machine, so that the at least one A virtual machine sends queue address information to the second virtual switch; wherein the connection establishment instruction is used to instruct the at least one virtual machine to establish a connection with the second virtual switch.
- the step of sending a connection establishment instruction to the at least one virtual machine includes: sending a connection establishment instruction to a Qemu management platform corresponding to the at least one virtual machine, so that the Qemu management The platform sends queue address information to the second virtual switch.
- an embodiment of the present application provides a virtual switch switching device, which is applied to a host machine, where a physical network card and at least one virtual machine are provided in the host machine, and at least two sets of virtual interfaces are provided in the physical network card
- the device includes an instruction receiving module configured to receive a switching instruction of a virtual switch, wherein the switching instruction is used to instruct to switch the currently running first virtual switch to a second virtual switch; the switch startup module is set to While keeping the first virtual switch running, start the second virtual switch and load the configuration file of the second virtual switch; a connection establishment module is set to establish the at least one virtual machine and the first virtual switch Connection of two virtual switches; an interface switching module configured to notify the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch , So that the physical network card sends the traffic to be sent to the at least one virtual machine to the virtual interface group corresponding to the second virtual switch, and the first interface is received through the virtual interface
- the apparatus further includes a switch shutdown module configured to notify the physical network card that the virtual interface that receives virtual machine traffic will be replaced by the virtual interface group corresponding to the first virtual switch in the interface switching module After switching to the virtual interface group corresponding to the second virtual switch, the first virtual switch is shut down or uninstalled.
- a switch shutdown module configured to notify the physical network card that the virtual interface that receives virtual machine traffic will be replaced by the virtual interface group corresponding to the first virtual switch in the interface switching module After switching to the virtual interface group corresponding to the second virtual switch, the first virtual switch is shut down or uninstalled.
- the interface switching module is configured to: after determining that the at least one virtual machine has established a connection with the second virtual switch, send a notification message to the physical network card in the host machine;
- the notification message is used to instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch.
- the connection establishment module includes: a connection establishment unit configured to send a connection establishment instruction to the at least one virtual machine, so that the at least one virtual machine sends the second virtual switch Sending queue address information; wherein the connection establishment instruction is used to instruct the at least one virtual machine to establish a connection with the second virtual switch.
- connection establishment unit is configured to send a connection establishment instruction to the Qemu management platform corresponding to the at least one virtual machine, so that the Qemu management platform sends a queue to the second virtual switch Address information.
- an embodiment of the present application provides a host including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is configured to store The computer program; the processor is configured to implement the virtual switch switching method described in the first aspect when the program stored in the memory is executed.
- an embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the virtual switch according to the first aspect is implemented method.
- an embodiment of the present application provides a computer program that, when run on a computer, causes the computer to execute the virtual switch switching method described in the first aspect.
- an embodiment of the present application provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the virtual switch switching method described in the first aspect.
- the host after receiving the switching instruction of the virtual switch, the host starts the second virtual switch, keeps the first virtual switch running, loads the configuration file of the second virtual switch, and establishes at least one The connection between a virtual machine and the second virtual switch; notify the physical NIC to switch the virtual interface, and switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, thereby physically
- the network card sends the traffic to be sent to at least one virtual machine to the virtual interface group corresponding to the second virtual switch, and receives the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded. Pause the exchange of traffic through the virtual switch for a short period of time, thereby shortening the time when the virtual switch is not available in the host, reducing the user's waiting time and improving the user experience.
- FIG. 1 is a flowchart of a virtual switch switching method provided by an embodiment of this application
- FIG. 2 is a flowchart of another virtual switch switching method provided by an embodiment of the present application.
- FIG. 3 is a schematic diagram of a virtual switch switching device provided by an embodiment of the present application.
- FIG. 4 is a schematic structural diagram of a host machine provided by an embodiment of the present application.
- embodiments of the present application provide a virtual switch switching method, device, host machine, and storage medium.
- the following first introduces a virtual switch switching method provided by an embodiment of the present application.
- the virtual switch switching method provided in the embodiments of the present application is applied to a host machine.
- the virtual switch runs on the host machine.
- the original virtual switch for example, the old version of the virtual switch may be called the first virtual switch;
- the new virtual switch for example, the new version of the virtual switch is called the second virtual switch. switch.
- the virtual switch switching method provided in the embodiment of the present application is used to switch the first virtual switch to the second virtual switch.
- the virtual switch switching method provided in the embodiment of the present invention is also applicable.
- the first virtual switch is the new version of the virtual switch
- the first The second virtual switch is an old version of the virtual switch.
- a physical network card and at least one virtual machine are provided in the host machine, and at least two sets of virtual interfaces are provided in the physical network card, and each group of virtual interfaces includes at least one virtual interface.
- the virtual interface is a port for the physical network card to communicate with other devices and is not visible.
- the two groups of virtual interfaces may be described as: a first group of virtual interfaces and a second group of virtual interfaces.
- the first group of virtual interfaces is an active virtual interface, that is, the physical NIC receives traffic or forwards traffic through the group of virtual interfaces;
- the second group of virtual interfaces is an idle virtual interface, that is, the physical NIC does not pass the group of virtual interfaces The interface receives traffic or forwards traffic.
- the so-called traffic may refer to a message flow or a message received or forwarded by the virtual machine, and correspondingly, the virtual machine traffic may be a message flow or a message sent by the virtual machine.
- the physical network card may receive or forward traffic through the first group of virtual interfaces.
- the physical network card can switch the virtual interface, that is, switch the first group of virtual interfaces to the second group of virtual interfaces. In this way, the second group of virtual interfaces is switched from the idle state to the active state, and the first group of virtual interfaces is switched from the active state to the idle state.
- the second group of virtual interfaces can also be switched to the first group of virtual interfaces, that is, the first group of virtual interfaces can be switched from the idle state to the active state, and the second The group virtual interface switches from the active state to the idle state. It can be known from the above description that the state of the first group of virtual interfaces and the state of the second group of virtual interfaces can be switched between the active state and the idle state.
- the purpose of setting two sets of virtual interfaces is to realize the switching of the virtual switch and reduce the time for the traffic to stop forwarding.
- the first group of virtual interfaces continues to work continuously, that is, to maintain traffic interaction with the first virtual switch, and when the virtual interface switches, only the first group of virtual interfaces is shut down to the second group of virtual interfaces.
- the time between startup stops the flow interaction between the virtual interface and the virtual switch.
- the second set of virtual interfaces starts, the flow interaction returns to normal. Therefore, the setting of these two sets of virtual interfaces shortens the stop of the flow interaction. Time, effectively guarantee the normal operation of the host machine.
- a virtual switch switching method provided by an embodiment of the present application may include the following steps:
- S110 Receive a switching instruction of a virtual switch.
- the above switching instruction is used to instruct to switch the currently running first virtual switch to the second virtual switch.
- the operation and maintenance personnel managing the host machine can issue an instruction to switch the virtual switch, so that the host machine receives the switching instruction of the virtual switch.
- the operation and maintenance personnel who manage the host can also issue a command to switch the virtual switch, so that the host receives the switch command of the virtual switch to achieve
- the first virtual switch running in the host machine is switched to the second virtual switch.
- the first virtual switch is a new version of the virtual switch
- the second virtual switch is the old version of the virtual switch, that is, the new version of the virtual switch running in the host is switched to the old version of the virtual switch.
- the first virtual switch In order to shorten the time when the host machine has no available virtual switch, during the process of starting the second virtual switch and loading the configuration file of the second virtual switch, the first virtual switch is still kept in a running state. That is, during this process, the first virtual switch can still receive traffic or forward traffic.
- the manner in which the host machine starts the second virtual switch may be: the host machine sends a start instruction to the second virtual switch, and the second virtual switch can start after receiving the start instruction.
- the embodiment of the present application does not specifically limit the manner in which the host starts the second virtual switch.
- the host machine can load the configuration file of the second virtual switch, and the configuration file includes configuration information such as the virtual machine IP address and virtual network routing information. .
- the embodiment of the present application does not specifically limit the configuration information included in the configuration file.
- the virtual switch In order to enable the virtual switch to forward the traffic that needs to be sent to the at least one virtual machine to the at least one virtual machine through the second virtual switch, or to transfer the traffic from the at least one virtual machine to the second virtual switch When the machine forwards the traffic to the target virtual machine, it is necessary to establish a connection between the at least one virtual machine and the second virtual switch.
- a virtual machine or multiple virtual machines may be set in the host machine, so that when the second virtual switch is running, it can send traffic to any virtual machine and can receive traffic sent by any virtual machine, Any virtual machine set in the host machine may be connected to the second virtual switch.
- the step of establishing a connection between at least one virtual machine and the second virtual switch may include:
- connection establishment instruction is used to instruct at least one virtual machine to establish a connection with the second virtual switch.
- the host machine may send a connection establishment instruction to at least one virtual machine, and after receiving the connection establishment instruction, the at least one virtual machine may send the queue address of the at least one virtual machine to the second virtual switch information.
- the queue address information of the virtual machine may be the address information of the queue of the traffic cache of the virtual machine. After the second virtual switch obtains the queue address information of the at least one virtual machine, the traffic may be stored in the flow buffer queue of the at least one virtual machine, therefore, the at least one virtual machine is obtained from the second virtual switch After the queue address information, you can complete the connection with the at least one virtual machine.
- the step of the host sending a connection establishment instruction to at least one virtual machine may include:
- the Qemu management platform is a virtualization management platform, which is a virtualization simulator implemented by software, and can emulate any hardware device.
- the Qemu management platform can obtain the The queue address information of at least one virtual machine. Therefore, the host machine can send a connection establishment instruction to the Qemu management platform corresponding to the at least one virtual machine. After receiving the connection establishment instruction, the Qemu management platform can send the at least one to the second virtual switch. Queue address information of a virtual machine.
- S140 Instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, so that the physical network card will need to be sent to the at least one virtual machine.
- the traffic is sent to the virtual interface group corresponding to the second virtual switch, and the traffic forwarded by the second virtual switch is received through the virtual interface group corresponding to the second virtual switch.
- At least two sets of virtual interfaces are provided in the physical network card, and the first virtual switch and the second virtual switch correspond to different virtual interface groups. Therefore, when the host switches the first virtual switch to the second virtual switch, it can notify the physical NIC to switch the virtual interface, that is, the virtual interface that receives the virtual machine traffic is switched from the virtual interface group corresponding to the first virtual switch to the second virtual switch Corresponding virtual interface group.
- the so-called traffic may refer to the packet flow or the message received or forwarded by the virtual machine, and correspondingly, the virtual machine traffic may be the packet flow or the message sent by the virtual machine.
- the physical network card can send the traffic that needs to be sent to the at least one virtual switch to the virtual interface group corresponding to the second virtual switch, and can receive the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the host switches the first virtual switch to the second virtual switch.
- the first virtual switch is still in normal operation. After the physical network card is notified to switch the virtual interface group at step S140, the operation of the first virtual switch may be stopped. Therefore, the virtual interface group corresponding to the first virtual switch and the virtual interface group corresponding to the second virtual switch may only be switched on the physical network card During this period of time, the interaction of the virtual machine traffic is stopped. After the virtual interface group corresponding to the second virtual switch is enabled, the virtual machine traffic starts to be normally forwarded immediately. Of course, the operation of the first virtual switch can also be stopped before step S140.
- the step of the host notifying the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch may include:
- the notification message is used to instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch.
- the host machine can monitor in real time whether at least one virtual switch has established a connection with the second virtual switch, and after determining that at least one virtual machine has established a connection with the second virtual switch, it can send a notification message to the physical network card in the host machine .
- the notification message is used to instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch. Therefore, the physical network card in the host receives the After the notification message, an operation of switching virtual interfaces may be performed to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded, thereby shortening and reducing the time when no virtual switch is available in the host This improves user waiting time and improves user experience.
- another virtual switch switching method provided by an embodiment of the present application may include the following steps:
- S240 Instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, so that the physical network card will need to send traffic to at least one virtual machine Send to the virtual interface group corresponding to the second virtual switch, and receive the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- S210 to S240 of the embodiment shown in FIG. 2 are the same as S110 to 140 of the embodiment shown in FIG. 1, S210 to S240 will not be repeated here.
- the host switches the first virtual switch to the second virtual switch, that is, the second virtual switch is in the running state, and the first virtual switch is in the non-running state. Therefore, in order to improve the resource utilization of the host, The host machine may shut down the first virtual switch, or uninstall the first virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded, thereby shortening and reducing the time when no virtual switch is available in the host
- the waiting time of the user is improved, and the user experience is improved; and after the first virtual switch is switched to the second virtual switch, the first virtual switch can be turned off or uninstalled, which improves the resource utilization rate of the host machine.
- an embodiment of the present application further provides a virtual switch switching device, which is applied to a host machine.
- the host machine is provided with a physical network card and at least one virtual machine, and the physical network card is provided with at least two sets of virtual interfaces, as shown in the figure As shown in 3, the device may include:
- the instruction receiving module 310 is configured to receive a switching instruction of the virtual switch, wherein the switching instruction is used to instruct to switch the currently running first virtual switch to the second virtual switch;
- the switch startup module 320 is configured to start the second virtual switch and load the configuration file of the second virtual switch while keeping the first virtual switch running;
- connection establishment module 330 is configured to establish a connection between at least one virtual machine and the second virtual switch;
- the interface switching module 340 is configured to notify the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, so that the physical network card will need to be sent to at least one
- the traffic of the virtual machines is sent to the virtual interface group corresponding to the second virtual switch, and the traffic forwarded by the second virtual switch is received through the virtual interface group corresponding to the second virtual switch.
- the host after receiving the switching instruction of the virtual switch, the host starts the second virtual switch, loads the configuration file of the second virtual switch while keeping the first virtual switch running, and establishes at least one The connection between a virtual machine and the second virtual switch; notify the physical NIC to switch the virtual interface, and switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, thereby physically
- the network card sends the traffic to be sent to at least one virtual machine to the virtual interface group corresponding to the second virtual switch, and receives the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded, thereby shortening and reducing the time when no virtual switch is available in the host This improves user waiting time and improves user experience.
- the device may further include:
- the switch shutdown module is configured to shut down or uninstall the first after the interface switching module 340 notifies the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch Virtual switch.
- the interface switching module 340 is set to:
- the notification message is used to instruct the physical network card to switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch.
- connection establishment module 330 includes:
- a connection establishment unit configured to send a connection establishment instruction to at least one virtual machine, so that at least one virtual machine sends queue address information to the second virtual switch;
- connection establishment instruction is used to instruct at least one virtual machine to establish a connection with the second virtual switch.
- connection establishment unit is set to:
- an embodiment of the present application further provides a host machine, as shown in FIG. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 Complete communication with each other through the communication bus 404,
- the memory 403 is set to store a computer program
- the processor 401 is configured to implement the virtual switch switching method of the first aspect when executing the program stored in the memory 403.
- the communication bus mentioned by the above host machine may be a peripheral component interconnection standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard structure (Extended Industry Standard Architecture, EISA) bus, etc.
- PCI peripheral component interconnection standard
- EISA Extended Industry Standard Architecture
- the communication bus can be divided into an address bus, a data bus, and a control bus. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
- the communication interface is used for communication between the above host and other devices.
- the memory may include random access memory (Random Access Memory, RAM), or non-volatile memory (Non-Volatile Memory, NVM), for example, at least one disk memory.
- RAM Random Access Memory
- NVM Non-Volatile Memory
- the memory may also be at least one storage device located away from the aforementioned processor.
- the aforementioned processor may be a general-purpose processor, including a central processor (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processing, DSP), dedicated integration Circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
- a central processor Central Processing Unit, CPU
- NP Network Processor
- DSP Digital Signal Processing
- ASIC Application Specific Integrated Circuit
- FPGA Field-Programmable Gate Array
- the host after receiving the switching instruction of the virtual switch, the host starts the second virtual switch, keeps the first virtual switch running, loads the configuration file of the second virtual switch, and establishes at least one
- the connection between the virtual machine and the second virtual switch notifies the physical NIC to switch the virtual interface, and switches the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, thereby physically
- the network card sends the traffic to be sent to at least one virtual machine to the virtual interface group corresponding to the second virtual switch, and receives the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded, thereby shortening and reducing the time when no virtual switch is available in the host This improves user waiting time and improves user experience.
- an embodiment of the present application further provides a computer-readable storage medium.
- a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the virtual switch switching method of the first aspect is implemented.
- an embodiment of the present application further provides a computer program that, when run on a computer, causes the computer to execute the virtual switch switching method of the first aspect.
- an embodiment of the present application further provides a computer program product containing instructions, which when executed on a computer, causes the computer to execute the virtual switch switching method of the first aspect.
- the host after receiving the switching instruction of the virtual switch, the host starts the second virtual switch, loads the configuration file of the second virtual switch while keeping the first virtual switch running, and establishes at least one The connection between a virtual machine and the second virtual switch; notify the physical NIC to switch the virtual interface, and switch the virtual interface receiving the virtual machine traffic from the virtual interface group corresponding to the first virtual switch to the virtual interface group corresponding to the second virtual switch, thereby physically
- the network card sends the traffic to be sent to at least one virtual machine to the virtual interface group corresponding to the second virtual switch, and receives the traffic forwarded by the second virtual switch through the virtual interface group corresponding to the second virtual switch.
- the second virtual switch is started and the configuration file of the second virtual switch is loaded, thereby shortening and reducing the time when no virtual switch is available in the host This improves user waiting time and improves user experience.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
本申请实施例提供了一种虚拟交换机切换方法,应用于宿主机,宿主机中设置有物理网卡和至少一台虚拟机,物理网卡中设置有至少两组虚拟接口,该方法包括:接收虚拟交换机的切换指令;在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,并加载第二虚拟交换机的配置文件;建立至少一台虚拟机与第二虚拟交换机的连接;通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组。通过本申请实施例提供的技术方案,可以缩短宿主机中无可用虚拟交换机的时间,降低了用户的等待时间,提高了用户体验。
Description
本申请要求于2018年12月7日提交中国专利局、申请号为201811495309.7发明名称为“一种虚拟交换机切换方法、装置、宿主机及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及通信技术领域,特别是涉及一种虚拟交换机切换方法、装置、宿主机及存储介质。
虚拟交换机工作在二层数据网络中,通过软件方式实现物理交换机的二层网络功能或者部分三层网络功能。
虚拟交换机运行于宿主机中,用于实现报文的处理。为了使得虚拟交换机能够更加高效地处理报文,开发人员会不断开发新版本的虚拟交换机。在接收到切换虚拟交换机的触发指令后,宿主机将旧版本的虚拟交换机切换为新版本的虚拟交换机。
相关技术中,宿主机通过如下四个步骤将旧版本的虚拟交换机切换为新版本的虚拟交换机:第一步,关闭旧版本的虚拟交换机;第二步,启动新版本的虚拟交换机;第三步,加载新版本的虚拟交换机的配置文件;第四步,将新版本的虚拟交换机与宿主机中的至少一个虚拟机建立连接。通过上述四个步骤,新版本的虚拟交换机可以进行报文的处理。但是由于上述四个步骤均需要消耗时间,因此,宿主机中无可用虚拟交换机的时间较长,最终导致用户等待时间较长,影响用户体验。
发明内容
本申请实施例的目的在于提供一种虚拟交换机切换方法、装置、宿主机及存储介质,以使在进行虚拟交换机的切换时,宿主机中无可用虚拟交换机的时间缩短,从而减少用户等待时间,提高用户体验。具体技术方案如下:
第一方面,本申请实施例提供了一种虚拟交换机切换方法,应用于宿主机,所述宿主机中设置有物理网卡和至少一台虚拟机,所述物理网卡中设置 有至少两组虚拟接口,所述方法包括:接收虚拟交换机的切换指令,其中,所述切换指令用于指示将当前运行的第一虚拟交换机切换为第二虚拟交换机;在保持所述第一虚拟交换机运行的情况下,启动所述第二虚拟交换机,并加载所述第二虚拟交换机的配置文件;建立所述至少一台虚拟机与所述第二虚拟交换机的连接;通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组,以使所述物理网卡将需发送至所述至少一台虚拟机的流量发送至所述第二虚拟交换机对应的虚拟接口组,通过所述第二虚拟交换机对应的虚拟接口组接收所述第二虚拟交换机转发的流量。
在一种实施方式中,在所述通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组之后,所述方法还包括:关闭或卸载所述第一虚拟交换机。
在一种实施方式中,所述通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组的步骤,包括:在确定所述至少一台虚拟机与所述第二虚拟交换机已建立连接后,向所述宿主机中的物理网卡发送通知消息;其中,所述通知消息用于指示所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组。
在一种实施方式中,所述建立所述至少一台虚拟机与所述第二虚拟交换机的连接的步骤,包括:向所述至少一台虚拟机发送建立连接指令,以使所述至少一台虚拟机向所述第二虚拟交换机发送队列地址信息;其中,所述建立连接指令用于指示所述至少一台虚拟机与所述第二虚拟交换机建立连接。
在一种实施方式中,所述向所述至少一台虚拟机发送建立连接指令的步骤,包括:向所述至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使所述Qemu管理平台向所述第二虚拟交换机发送队列地址信息。
第二方面,本申请实施例提供了一种虚拟交换机切换装置,应用于宿主机,所述宿主机中设置有物理网卡和至少一台虚拟机,所述物理网卡中设置有至少两组虚拟接口,所述装置包括:指令接收模块,设置为接收虚拟交换机的切换指令,其中,所述切换指令用于指示将当前运行的第一虚拟交换机 切换为第二虚拟交换机;交换机启动模块,设置为在保持所述第一虚拟交换机运行的情况下,启动所述第二虚拟交换机,并加载所述第二虚拟交换机的配置文件;连接建立模块,设置为建立所述至少一台虚拟机与所述第二虚拟交换机的连接;接口切换模块,设置为通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组,以使所述物理网卡将需发送至所述至少一台虚拟机的流量发送至所述第二虚拟交换机对应的虚拟接口组,通过所述第二虚拟交换机对应的虚拟接口组接收所述第二虚拟交换机转发的流量。
在一种实施方式中,所述装置还包括:交换机关闭模块,设置为在所述接口切换模块通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组之后,关闭或卸载所述第一虚拟交换机。
在一种实施方式中,所述接口切换模块,设置为:在确定所述至少一台虚拟机与所述第二虚拟交换机已建立连接后,向所述宿主机中的物理网卡发送通知消息;其中,所述通知消息用于指示所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组。
在一种实施方式中,所述连接建立模块,包括:连接建立单元,设置为向所述至少一台虚拟机发送建立连接指令,以使所述至少一台虚拟机向所述第二虚拟交换机发送队列地址信息;其中,所述建立连接指令用于指示所述至少一台虚拟机与所述第二虚拟交换机建立连接。
在一种实施方式中,所述连接建立单元,设置为:向所述至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使所述Qemu管理平台向所述第二虚拟交换机发送队列地址信息。
第三方面,本申请实施例提供了一种宿主机,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,设置为存放计算机程序;处理器,设置为执行存储器上所存放的程序时,实现第一方面所述的虚拟交换机切换方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现第一方面所述的虚拟交换机切换方法。
第五方面,本申请实施例提供了一种计算机程序,当其在计算机上运行时,使得计算机执行第一方面所述的虚拟交换机切换方法。
第六方面,本申请实施例提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行第一方面所述的虚拟交换机切换方法。
本申请实施例提供的技术方案,宿主机接收到虚拟交换机的切换指令后,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,加载第二虚拟交换机的配置文件,并建立至少一台虚拟机与第二虚拟交换机的连接;通知物理网卡切换虚拟接口,将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,从而物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动第二虚拟交换机并加载第二虚拟交换机的配置文件,实质上可以在进行物理网卡的虚拟接口组切换时的很短时间暂停通过虚拟交换机交换流量,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验。
为了更清楚地说明本申请实施例和现有技术的技术方案,下面对实施例和现有技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例所提供的一种虚拟交换机切换方法的流程图;
图2为本申请实施例所提供的另一种虚拟交换机切换方法的流程图;
图3为本申请实施例所提供的一种虚拟交换机切换装置的示意图;
图4为本申请实施例所提供的一种宿主机的结构示意图。
为使本申请的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本申请进一步详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为了使得切换虚拟交换机所消耗的时间缩短,保证宿主机的正常稳定运行,提升用户的体验,本申请实施例提供了一种虚拟交换机切换方法、装置、宿主机及存储介质。
第一方面,下面首先对本申请实施例所提供的一种虚拟交换机切换方法进行介绍。
本申请实施例所提供的一种虚拟交换机切换方法,应用于宿主机。虚拟交换机运行于宿主机中,在本申请实施例中,可以将原虚拟交换机,例如旧版本的虚拟交换机称为第一虚拟交换机;将新虚拟交换机,例如新版本的虚拟交换机称为第二虚拟交换机。这样,本申请实施例所提供的虚拟交换机切换方法用于将第一虚拟交换机切换为第二虚拟交换机。
当然,对于从新版本的虚拟交换机切换至旧版本的虚拟交换机的场景而言,本发明实施例所提供的虚拟交换机切换方法也适用,此时,第一虚拟交换机为新版本的虚拟交换机,而第二虚拟交换机为旧版本的虚拟交换机。
需要说明的是,本申请实施例中,宿主机中设置有物理网卡和至少一台虚拟机,且该物理网卡中设置有至少两组虚拟接口,每组虚拟接口包括至少一个虚拟接口。其中,虚拟接口是物理网卡与其他装置进行通信的端口,是不可见的。
为了方案描述清楚,下面将以物理网卡中设置有两组虚拟接口为例进行说明。并且,为了方便描述,可以将这两组虚拟接口描述为:第一组虚拟接口和第二组虚拟接口。其中,第一组虚拟接口为处于活跃状态的虚拟接口,即物理网卡通过该组虚拟接口接收流量或者转发流量;第二组虚拟接口为处于空闲状态的虚拟接口,即物理网卡不通过该组虚拟接口接收流量或者转发 流量。
其中,所谓流量可以是指虚拟机接收或者转发的报文流或者报文,相应的,虚拟机流量可以为虚拟机发送的报文流或者报文。
在实际应用中,在第一虚拟交换机处于运行的情况下,物理网卡可以通过第一组虚拟接口接收流量或者转发流量。当宿主机需要将第一虚拟交换机切换至第二虚拟交换机时,物理网卡可以切换虚拟接口,即将第一组虚拟接口切换至第二组虚拟接口。这样,第二组虚拟接口由空闲状态切换至活跃状态,第一组虚拟接口由活跃状态切换至空闲状态。可以理解的是,当宿主机需要再次切换虚拟交换机时,还可以将第二组虚拟接口切换为第一组虚拟接口,即,使得第一组虚拟接口由空闲状态切换为活跃状态,而第二组虚拟接口由活跃状态切换为空闲状态。由上述描述可知,第一组虚拟接口的状态和第二组虚拟接口的状态均可以在活跃状态与空闲状态之间切换。
基于上述描述可知,本申请实施例中,设置两组虚拟接口的目的在于,实现虚拟交换机的切换并减少流量停止转发的时间。在虚拟交换机切换过程中,第一组虚拟接口一直可持续工作,即与第一虚拟交换机保持进行流量交互,而在虚拟接口切换时,仅在第一组虚拟接口关停至第二组虚拟接口启动之间的时间停止了虚拟接口与虚拟交换机之间的流量交互,第二组虚拟接口启动后流量交互即恢复正常,因此,这种两组虚拟接口的设置较好的缩短了流量交互的停止时间,有效保证宿主机的正常运行。
如图1所示,本申请实施例提供的一种虚拟交换机切换方法可以包括如下步骤:
S110,接收虚拟交换机的切换指令。
其中,上述切换指令用于指示将当前运行的第一虚拟交换机切换为第二虚拟交换机。
在实际应用中,在开发人员开发出新版本的虚拟交换机后,即开发人员开发出第二虚拟交换机后,可以将运行在宿主机中的第一虚拟交换机切换为第二虚拟交换机。此时,通常来讲,管理宿主机的运维人员,可以发出切换虚拟交换机的指令,从而宿主机接收到虚拟交换机的切换指令。
当然,对于从新版本的虚拟交换机切换至旧版本的虚拟交换机的场景而言,管理宿主机的运维人员也可以发出切换虚拟交换机的指令,从而宿主机接收到虚拟交换机的切换指令,以实现将运行在宿主机中的第一虚拟交换机切换为第二虚拟交换机。此时,第一虚拟交换机为新版本的虚拟交换机,而第二虚拟交换机为旧版本的虚拟交换机,即实现将将运行在宿主机中的新版本的虚拟交换机切换为旧版本的虚拟交换机。
S120,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,并加载第二虚拟交换机的配置文件。
为了缩短宿主机无可用虚拟交换机的时间,在启动第二虚拟交换机,以及加载第二虚拟交换机的配置文件的过程中,仍保持第一虚拟交换机处于运行的状态。即该过程中,第一虚拟交换机仍可以接收流量或者转发流量。
其中,宿主机启动第二虚拟交换机的方式可以为:宿主机向第二虚拟交换机发送启动指令,第二虚拟交换机接收到启动指令后即可启动。当然,本申请实施例对宿主机启动第二虚拟交换机的方式不做具体限定。
并且,宿主机在启动第二虚拟交换机后,为了使得第二虚拟交换机能够正常运行,宿主机可以加载第二虚拟交换机的配置文件,该配置文件包括虚拟机IP地址、虚拟网络路由信息等配置信息。本申请实施例对该配置文件所包含的配置信息不做具体限定。
S130,建立至少一台虚拟机与第二虚拟交换机的连接。
为了使得虚拟交换机切换后,能够通过第二虚拟交换机将需要发送至该至少一台虚拟机的流量转发至该至少一台虚拟机,或者,能够通过第二虚拟交换机将流量从该至少一台虚拟机转发至流量的目标虚拟机,需要将该至少一台虚拟机与第二虚拟交换机建立连接。
其中,宿主机中可以设置有一台虚拟机或者多台虚拟机,为了使得在第二虚拟交换机运行时,能够向任一台虚拟机发送流量,并能够接收任一台虚拟机所发送的流量,可以将宿主机中设置的任一台虚拟机与第二虚拟交换机建立连接。
在一种实施方式中,建立至少一台虚拟机与第二虚拟交换机的连接的步 骤,可以包括:
向至少一台虚拟机发送建立连接指令,以使至少一台虚拟机向第二虚拟交换机发送队列地址信息,从而实现至少一台虚拟机与第二虚拟交换机的连接。
其中,上述建立连接指令用于指示至少一台虚拟机与第二虚拟交换机建立连接。
在该实施方式中,宿主机可以向至少一台虚拟机发送建立连接指令,该至少一台虚拟机接收到该建立连接指令后,可以向第二虚拟交换机发送该至少一台虚拟机的队列地址信息。
需要说明的是,虚拟机的队列地址信息可以为虚拟机的流量缓存队列的地址信息。在第二虚拟交换机得到该至少一台虚拟机的队列地址信息后,可以将流量存储至该至少一台虚拟机的流量缓存队列中,因此,在第二虚拟交换机获取到该至少一台虚拟机的队列地址信息后,可以完成与该至少一台虚拟机的连接。
作为本申请实施例的一种实现形式,宿主机向至少一台虚拟机发送建立连接指令的步骤,可以包括:
向至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使Qemu管理平台向第二虚拟交换机发送队列地址信息。
其中,本领域技术人员可以理解的是,Qemu管理平台是一种虚拟化管理平台,其是通过软件实现的虚拟化模拟器,可以模拟任何硬件设备,具体可以参见相关技术,这里不在赘述。在一些具体实施中,宿主机中的至少一台虚拟机对应同一个Qemu管理平台,即,宿主机中设置有该Qemu管理平台,用于创建和管理虚拟机,该Qemu管理平台可以获取到该至少一台虚拟机的队列地址信息,因此,宿主机可以向至少一台虚拟机对应的Qemu管理平台发送建立连接指令,Qemu管理平台接收到建立连接指令后,可以向第二虚拟交换机发送该至少一台虚拟机的队列地址信息。
S140,通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,以使物理网卡将 需发送至该至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。
由上述描述可知,物理网卡中设置有至少两组虚拟接口,第一虚拟交换机与第二虚拟交换机对应不同的虚拟接口组。因此,宿主机在将第一虚拟交换机切换为第二虚拟交换机时,可以通知物理网卡切换虚拟接口,即将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组。
其中,所谓流量可以指虚拟机接收或者转发的报文流或者报文,相应的,虚拟机流量可以为虚拟机发送的报文流或者报文。
这样,物理网卡可以将需要发送至该至少一台虚拟交换机的流量发送至第二虚拟交换机对应的虚拟接口组,并可以通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。至此,宿主机将第一虚拟交换机切换至第二虚拟交换机。
需要说明的是,上述步骤S120至S130的执行期间,基于第一虚拟交换机对应的虚拟接口组,第一虚拟交换机仍在正常工作中。可在S140步骤通知物理网卡切换虚拟接口组之后,停止第一虚拟交换机的工作,因此,可以使得仅在物理网卡进行第一虚拟交换机对应的虚拟接口组和第二虚拟交换机对应的虚拟接口组切换的这段时间里,停止了虚拟机流量的交互,在第二虚拟交换机对应的虚拟接口组启用后,虚拟机流量立即开始正常的转发。当然,亦可在S140步骤之前,停止第一虚拟交换机的工作。
在一种实施方式中,宿主机通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组的步骤,可以包括:
在确定至少一台虚拟机与第二虚拟交换机已建立连接后,向宿主机中的物理网卡发送通知消息;
其中,通知消息用于指示物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组。
宿主机可以实时监控至少一台虚拟交换机与第二虚拟交换机是否建立好 连接,并且在确定至少一台虚拟机与第二虚拟交换机已经建立好连接后,可以向宿主机中的物理网卡发送通知消息。
由于该通知消息用于指示物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,因此,宿主机中的物理网卡在接收到该通知消息后,可以执行切换虚拟接口的操作,将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组。
可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动第二虚拟交换机并加载第二虚拟交换机的配置文件,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验。
如图2所示,本申请实施例所提供的另一种虚拟交换机切换方法,可以包括如下步骤:
S210,接收虚拟交换机的切换指令。
S220,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,并加载第二虚拟交换机的配置文件。
S230,建立至少一台虚拟机与第二虚拟交换机的连接。
S240,通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,以使物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。
由于图2所示实施例的S210至S240与图1所示实施例的S110至140相同,因此,在此不再对S210至S240进行赘述。
S250,关闭或卸载第一虚拟交换机。
通过步骤S210至S240,宿主机将第一虚拟交换机切换至第二虚拟交换机,即第二虚拟交换机处于运行状态,而第一虚拟交换机处于未运行状态,因此,为了提高宿主机的资源利用率,宿主机可以关闭第一虚拟交换机,或者卸载 第一虚拟交换机。
可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动第二虚拟交换机并加载第二虚拟交换机的配置文件,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验;并且,在将第一虚拟交换机切换至第二虚拟交换机后,可以关闭或卸载第一虚拟交换机,提高了宿主机的资源利用率。
第二方面,本申请实施例还提供了一种虚拟交换机切换装置,应用于宿主机,宿主机中设置有物理网卡和至少一台虚拟机,物理网卡中设置有至少两组虚拟接口,如图3所示,装置可以包括:
指令接收模块310,设置为接收虚拟交换机的切换指令,其中,切换指令用于指示将当前运行的第一虚拟交换机切换为第二虚拟交换机;
交换机启动模块320,设置为在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,并加载第二虚拟交换机的配置文件;
连接建立模块330,设置为建立至少一台虚拟机与第二虚拟交换机的连接;
接口切换模块340,设置为通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,以使物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。
本申请实施例提供的技术方案,宿主机接收到虚拟交换机的切换指令后,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,加载第二虚拟交换机的配置文件;并建立至少一台虚拟机与第二虚拟交换机的连接;通知物理网卡切换虚拟接口,将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,从而物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动 第二虚拟交换机并加载第二虚拟交换机的配置文件,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验。
在一种实施方式中,装置还可以包括:
交换机关闭模块,设置为在接口切换模块340通知物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组之后,关闭或卸载第一虚拟交换机。
在一种实施方式中,接口切换模块340,设置为:
在确定至少一台虚拟机与第二虚拟交换机已建立连接后,向宿主机中的物理网卡发送通知消息;
其中,通知消息用于指示物理网卡将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组。
在一种实施方式中,连接建立模块330,包括:
连接建立单元,设置为向至少一台虚拟机发送建立连接指令,以使至少一台虚拟机向第二虚拟交换机发送队列地址信息;
其中,建立连接指令用于指示至少一台虚拟机与第二虚拟交换机建立连接。
在一种实施方式中,连接建立单元,设置为:
向至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使Qemu管理平台向第二虚拟交换机发送队列地址信息。
第三方面,本申请实施例还提供了一种宿主机,如图4所示,包括处理器401、通信接口402、存储器403和通信总线404,其中,处理器401,通信接口402,存储器403通过通信总线404完成相互间的通信,
存储器403,设置为存放计算机程序;
处理器401,设置为执行存储器403上所存放的程序时,实现第一方面的虚拟交换机切换方法。
上述宿主机提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口用于上述宿主机与其他设备之间的通信。
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。在一种实施方式中,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本申请实施例提供的技术方案,宿主机接收到虚拟交换机的切换指令后,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,加载第二虚拟交换机的配置文件,并建立至少一台虚拟机与第二虚拟交换机的连接,通知物理网卡切换虚拟接口,将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,从而物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动第二虚拟交换机并加载第二虚拟交换机的配置文件,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验。
第四方面,本申请实施例还提供了一种计算机可读存储介质,计算机可 读存储介质内存储有计算机程序,计算机程序被处理器执行时实现实现第一方面的虚拟交换机切换方法。
第五方面,本申请实施例还提供了一种计算机程序,当其在计算机上运行时,使得计算机执行第一方面的虚拟交换机切换方法。
第六方面,本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行第一方面的虚拟交换机切换方法。
本申请实施例提供的技术方案,宿主机接收到虚拟交换机的切换指令后,在保持第一虚拟交换机运行的情况下,启动第二虚拟交换机,加载第二虚拟交换机的配置文件;并建立至少一台虚拟机与第二虚拟交换机的连接;通知物理网卡切换虚拟接口,将接收虚拟机流量的虚拟接口由第一虚拟交换机对应的虚拟接口组切换为第二虚拟交换机对应的虚拟接口组,从而物理网卡将需发送至至少一台虚拟机的流量发送至第二虚拟交换机对应的虚拟接口组,通过第二虚拟交换机对应的虚拟接口组接收第二虚拟交换机转发的流量。可见,本申请实施例提供的技术方案,在第一虚拟交换机运行的过程中,启动第二虚拟交换机并加载第二虚拟交换机的配置文件,从而使得宿主机中无可用虚拟交换机的时间缩短,降低了用户的等待时间,提高了用户体验。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、宿主机、存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。
Claims (13)
- 一种虚拟交换机切换方法,应用于宿主机,其中,所述宿主机中设置有物理网卡和至少一台虚拟机,所述物理网卡中设置有至少两组虚拟接口,所述方法包括:接收虚拟交换机的切换指令,其中,所述切换指令用于指示将当前运行的第一虚拟交换机切换为第二虚拟交换机;在保持所述第一虚拟交换机运行的情况下,启动所述第二虚拟交换机,并加载所述第二虚拟交换机的配置文件;建立所述至少一台虚拟机与所述第二虚拟交换机的连接;通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组,以使所述物理网卡将需发送至所述至少一台虚拟机的流量发送至所述第二虚拟交换机对应的虚拟接口组,通过所述第二虚拟交换机对应的虚拟接口组接收所述第二虚拟交换机转发的流量。
- 根据权利要求1所述的方法,其中,在所述通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组之后,所述方法还包括:关闭或卸载所述第一虚拟交换机。
- 根据权利要求1或2所述的方法,其中,所述通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组的步骤,包括:在确定所述至少一台虚拟机与所述第二虚拟交换机已建立连接后,向所述宿主机中的物理网卡发送通知消息;其中,所述通知消息用于指示所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组。
- 根据权利要求1或2所述的方法,其中,所述建立所述至少一台虚拟机 与所述第二虚拟交换机的连接的步骤,包括:向所述至少一台虚拟机发送建立连接指令,以使所述至少一台虚拟机向所述第二虚拟交换机发送队列地址信息;其中,所述建立连接指令用于指示所述至少一台虚拟机与所述第二虚拟交换机建立连接。
- 根据权利要求4所述的方法,其中,所述向所述至少一台虚拟机发送建立连接指令的步骤,包括:向所述至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使所述Qemu管理平台向所述第二虚拟交换机发送队列地址信息。
- 一种虚拟交换机切换装置,应用于宿主机,其中,所述宿主机中设置有物理网卡和至少一台虚拟机,所述物理网卡中设置有至少两组虚拟接口,所述装置包括:指令接收模块,设置为接收虚拟交换机的切换指令,其中,所述切换指令用于指示将当前运行的第一虚拟交换机切换为第二虚拟交换机;交换机启动模块,设置为在保持所述第一虚拟交换机运行的情况下,启动所述第二虚拟交换机,并加载所述第二虚拟交换机的配置文件;连接建立模块,设置为建立所述至少一台虚拟机与所述第二虚拟交换机的连接;接口切换模块,设置为通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组,以使所述物理网卡将需发送至所述至少一台虚拟机的流量发送至所述第二虚拟交换机对应的虚拟接口组,通过所述第二虚拟交换机对应的虚拟接口组接收所述第二虚拟交换机转发的流量。
- 根据权利要求6所述的装置,其中,所述装置还包括:交换机关闭模块,设置为在所述接口切换模块通知所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组之后,关闭或卸载所述第一虚拟交换机。
- 根据权利要求6或7所述的装置,其中,所述接口切换模块,设置为:在确定所述至少一台虚拟机与所述第二虚拟交换机已建立连接后,向所述宿主机中的物理网卡发送通知消息;其中,所述通知消息用于指示所述物理网卡将接收虚拟机流量的虚拟接口由所述第一虚拟交换机对应的虚拟接口组切换为所述第二虚拟交换机对应的虚拟接口组。
- 根据权利要求6或7所述的装置,其中,所述连接建立模块,包括:连接建立单元,设置为向所述至少一台虚拟机发送建立连接指令,以使所述至少一台虚拟机向所述第二虚拟交换机发送队列地址信息;其中,所述建立连接指令用于指示所述至少一台虚拟机与所述第二虚拟交换机建立连接。
- 根据权利要求9所述的装置,其中,所述连接建立单元,设置为:向所述至少一台虚拟机对应的Qemu管理平台发送建立连接指令,以使所述Qemu管理平台向所述第二虚拟交换机发送队列地址信息。
- 一种宿主机,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的程序时,实现权利要求1-5任一所述的方法步骤。
- 一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-5任一所述的方法步骤。
- 一种计算机程序,当其在计算机上运行时,使得计算机执行权利要求1-5任一项所述的方法步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811495309.7A CN109450701B (zh) | 2018-12-07 | 2018-12-07 | 一种虚拟交换机切换方法、装置、宿主机及计算机可读存储介质 |
CN201811495309.7 | 2018-12-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020114292A1 true WO2020114292A1 (zh) | 2020-06-11 |
Family
ID=65557871
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/121308 WO2020114292A1 (zh) | 2018-12-07 | 2019-11-27 | 一种虚拟交换机切换方法、装置、宿主机及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109450701B (zh) |
WO (1) | WO2020114292A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023103741A1 (zh) * | 2021-12-07 | 2023-06-15 | 中兴通讯股份有限公司 | 一种虚拟交换机升级方法、设备、电子设备和存储介质 |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113285873B (zh) * | 2021-05-18 | 2022-03-11 | 广州锦行网络科技有限公司 | 支持虚拟化构建真实路由的虚实混合的网络系统 |
CN114710408A (zh) * | 2022-03-18 | 2022-07-05 | 阿里云计算有限公司 | 实现虚拟交换机热升级的方法及装置 |
CN115086219B (zh) * | 2022-05-31 | 2024-04-09 | 深信服科技股份有限公司 | 一种虚拟路由器确定方法、设备及计算机可读存储介质 |
CN116455746A (zh) * | 2023-04-06 | 2023-07-18 | 中科驭数(北京)科技有限公司 | 一种dpu中虚拟交换机的带流量升级方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103324532A (zh) * | 2013-06-28 | 2013-09-25 | 东软集团股份有限公司 | 虚拟机的动态迁移方法及系统 |
CN107493180A (zh) * | 2016-06-13 | 2017-12-19 | 阿里巴巴集团控股有限公司 | 一种虚拟交换机的升级方法以及装置 |
CN108023756A (zh) * | 2016-10-28 | 2018-05-11 | 阿里巴巴集团控股有限公司 | 一种虚拟交换机的升级方法和装置 |
WO2018131547A1 (ja) * | 2017-01-16 | 2018-07-19 | 富士通株式会社 | ポート切替プログラム、ポート切替方法、および情報処理装置 |
CN108768895A (zh) * | 2018-05-18 | 2018-11-06 | 华为技术有限公司 | 一种虚拟机迁移的方法及数据中心 |
CN108900441A (zh) * | 2018-07-04 | 2018-11-27 | 联想(北京)有限公司 | 网络切换方法、第一电子设备及可读存储介质 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103516802B (zh) * | 2013-09-30 | 2017-02-08 | 中国科学院计算技术研究所 | 一种实现跨异构虚拟交换机无缝迁移的方法和装置 |
WO2015146355A1 (ja) * | 2014-03-28 | 2015-10-01 | 株式会社Nttドコモ | 更新管理システムおよび更新管理方法 |
CN104780071B (zh) * | 2015-04-21 | 2018-12-25 | 新华三技术有限公司 | 虚拟交换机的升级方法及装置 |
US10469374B2 (en) * | 2016-03-30 | 2019-11-05 | Futurewei Technologies, Inc. | Multiple provider framework for virtual switch data planes and data plane migration |
JP6855906B2 (ja) * | 2017-04-25 | 2021-04-07 | 富士通株式会社 | スイッチプログラム、スイッチング方法及び情報処理装置 |
CN107995129B (zh) * | 2017-11-30 | 2021-12-17 | 锐捷网络股份有限公司 | 一种nfv报文转发方法和装置 |
-
2018
- 2018-12-07 CN CN201811495309.7A patent/CN109450701B/zh active Active
-
2019
- 2019-11-27 WO PCT/CN2019/121308 patent/WO2020114292A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103324532A (zh) * | 2013-06-28 | 2013-09-25 | 东软集团股份有限公司 | 虚拟机的动态迁移方法及系统 |
CN107493180A (zh) * | 2016-06-13 | 2017-12-19 | 阿里巴巴集团控股有限公司 | 一种虚拟交换机的升级方法以及装置 |
CN108023756A (zh) * | 2016-10-28 | 2018-05-11 | 阿里巴巴集团控股有限公司 | 一种虚拟交换机的升级方法和装置 |
WO2018131547A1 (ja) * | 2017-01-16 | 2018-07-19 | 富士通株式会社 | ポート切替プログラム、ポート切替方法、および情報処理装置 |
CN108768895A (zh) * | 2018-05-18 | 2018-11-06 | 华为技术有限公司 | 一种虚拟机迁移的方法及数据中心 |
CN108900441A (zh) * | 2018-07-04 | 2018-11-27 | 联想(北京)有限公司 | 网络切换方法、第一电子设备及可读存储介质 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023103741A1 (zh) * | 2021-12-07 | 2023-06-15 | 中兴通讯股份有限公司 | 一种虚拟交换机升级方法、设备、电子设备和存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN109450701A (zh) | 2019-03-08 |
CN109450701B (zh) | 2020-04-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020114292A1 (zh) | 一种虚拟交换机切换方法、装置、宿主机及存储介质 | |
US10171567B2 (en) | Load balancing computer device, system, and method | |
US9672057B2 (en) | Notification of target before all guest data is copied to target in live migration | |
KR102059251B1 (ko) | 노드 시스템, 서버 장치, 스케일링 제어 방법 및 프로그램 | |
CN113452830B (zh) | 安卓云手机的批量控制方法、计算机可读介质及电子设备 | |
EP3518465B1 (en) | Method and device for initiating software modification | |
US20100077063A1 (en) | System and method for emulating a computing device | |
US20110125949A1 (en) | Routing packet from first virtual machine to second virtual machine of a computing device | |
US11036543B1 (en) | Integrated reliability, availability, and serviceability state machine for central processing units | |
US10127072B2 (en) | Enhanced virtual function capabilities in a virtualized network environment | |
JP2012215987A (ja) | コンピュータシステム、及びi/oスイッチ | |
US11588909B1 (en) | System and method for subscription based solution data compatibility | |
US20230222470A1 (en) | System and method for subscription based solution modification implementation | |
US20230221784A1 (en) | System and method for power state enforced subscription management | |
CN103888491A (zh) | 无盘工作站启动系统及方法 | |
JP2011060225A (ja) | オペレーティングシステム起動方法 | |
TWI668634B (zh) | 基於軟體容器提供雲端服務之系統及方法 | |
US20240022629A1 (en) | Kubernetes cluster load balance handling method and apparatus, and storage mediun | |
CN103678163A (zh) | 数据流的切换方法、装置及系统 | |
US20230273801A1 (en) | Method for configuring compute mode, apparatus, and computing device | |
JP2019028673A (ja) | 管理装置および管理方法 | |
WO2019169582A1 (zh) | 处理中断的方法和装置 | |
US10469374B2 (en) | Multiple provider framework for virtual switch data planes and data plane migration | |
US10180844B2 (en) | Boot path and production path accessible storage system | |
WO2015109708A1 (zh) | 数据包的处理方法、装置及服务器 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19892418 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28/09/2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19892418 Country of ref document: EP Kind code of ref document: A1 |