Switch upgrading method and system and server
By using persistent memory and reserving physical function ports during the switch upgrade process, the problems of long switch upgrade interruption time and high resource consumption are solved, achieving more efficient virtual switch upgrades and reducing interruption time and resource consumption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies suffer from long downtime and high resource consumption during switch upgrades, especially during hot upgrades of virtual switches, where existing solutions are complex and consume excessive resources.
By configuring persistent memory to save the switch's configuration parameters and status data, and utilizing reserved physical function ports (PF) and bonding mechanisms, the switch can quickly switch to new virtual switches and forward data, reducing downtime and resource consumption.
It enables more efficient hot upgrades of virtual switches, reduces downtime and resource consumption, improves upgrade efficiency, and avoids impacting front-end services.
Smart Images

Figure CN121644357A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular to a switch upgrading method, system and server. BACKGROUND
[0002] A network switch is a computer network device used to connect multiple devices in a computer network and forward messages between them. The switch can be deployed in hardware or software program in the device, and is more flexible in realizing communication functions. With system updates or function upgrades, the switch needs to be upgraded. However, the network may be interrupted during the update process.
[0003] In order to reduce the interruption time, hot upgrading of the switch needs to be implemented. For example, in one scheme, cold upgrading is implemented based on virtual machine hot migration. However, during the upgrading process, there are idle nodes in the existing network during the upgrading process. After the virtual machine is migrated to these idle nodes before upgrading, the operating system and the virtual switch can be upgraded. The whole upgrading process is complex, the upgrading period is long, and is limited by the vacancy rate. For example, in one scheme, hot upgrading of a single component of a virtual switch can be performed. During the upgrading process, the configuration of the new virtual switch needs to be exactly the same as that of the old virtual switch. However, this scheme occupies a lot of memory and has a complex state synchronization mechanism.
[0004] Therefore, how to implement more efficient and lower resource-occupying hot upgrading of the switch has become a problem to be solved. SUMMARY
[0005] Embodiments of the present application provide a switch upgrading method, system and server for implementing hot upgrading of a virtual switch with lower resource occupation and shorter interruption time.
[0006] Therefore, in a first aspect, embodiments of the present application provide a switch upgrading method applied to a switch upgrading system. The switch upgrading system is deployed with a first virtual switch and a virtual machine, but is not limited thereto. The first virtual switch is used to provide communication functions such as data forwarding for the virtual machine. The first virtual switch is connected to a persistent memory. The configuration parameters of the first virtual switch are saved in the persistent memory. The configuration parameters can be used to support the first virtual switch to implement communication functions.
[0007] The method comprises the following steps: in the case that a second virtual switch is deployed in the switch upgrading system, the second virtual switch synchronizes the configuration parameters from the persistent memory; in the case that the second virtual switch completes synchronization of the configuration parameters, the first virtual switch stops data forwarding, and the second virtual switch starts data forwarding.
[0008] In the embodiments of the present application, the persistent memory is configured to save the parameters of the old virtual machine, so that the new virtual switch can directly read the parameters of the old virtual machine from the persistent memory for configuration, that is, the persistent memory shared by the old virtual switch and the new virtual switch can be configured, additional memory allocation is reduced, and the upgrading efficiency is improved.
[0009] In a possible implementation, the foregoing method can further include: obtaining, by the second virtual switch, at least one reserved physical function (PF), the at least one reserved PF being a reserved PF corresponding to a port (or referred to as a network port) of the physical network card used by the first virtual switch, the at least one reserved PF being used by the second virtual switch to transmit and receive messages of the physical network card, for example, the second virtual switch can create a physical port based on the at least one PF, and the physical port is used by the second virtual switch to interact with the physical network card. Therefore, in the embodiments of the present application, the reserved PF is configured for the new virtual switch, so that the network port used by the old virtual switch is configured for the new virtual switch, to facilitate subsequent fast switching of the flow originally transmitted in the network port used by the old virtual switch, and to reduce the interruption time during the upgrading of the virtual switch.
[0010] In a possible implementation, the foregoing switch upgrading system further includes configuring the physical network card with a multi-PF capability, each port of the physical network card corresponding to at least two PFs, and one of the at least two PFs being a reserved PF. In the embodiments of the present application, the mechanism of the reserved PF is enabled, so that each network port is configured with at least one reserved PF, so that when the virtual switch is upgraded, the reserved PF can be used to realize fast flow switching, and the interruption time during the upgrading of the virtual switch is reduced.
[0011] In a possible implementation, the foregoing starting data forwarding by the second virtual switch can include: instructing, by the second virtual switch, the physical network card to send the data flow to the at least one reserved PF, for example, the second virtual switch can send a switching instruction to the physical network card, so as to control the physical network card to switch the data flow to the reserved PF for transmission.
[0012] In a possible implementation, when the number of the foregoing reserved PFs is a plurality, the second virtual switch can create a bonding based on the plurality of reserved PFs, and the bonding is used by the second virtual switch to transmit and receive messages of the physical network card. Therefore, in the embodiments of the present application, when there are a plurality of reserved PFs, the second virtual switch can create a bonding, so that the plurality of reserved PFs are used to forward the data transmitted in the plurality of network ports.
[0013] In a possible implementation, the persistent memory further includes state data, which includes parameters of a forwarding state of the first virtual switch when forwarding data, for example, the state data can include a connection tracking table, which can include a message triple or a message quintuple and the like of the first virtual switch when forwarding data; the method further includes: the second virtual switch reading the state data from the persistent memory; and the second virtual switch forwarding data according to the state data. In the implementation of the application, the dynamic state generated by the first virtual switch in the process of forwarding data can also be saved in the persistent memory, so that the second virtual switch can continue to forward the data in the process of forwarding data of the first virtual switch, thereby reducing the interruption time of data transmission.
[0014] In a possible implementation, the state data includes but is not limited to a connection tracking table or an address resolution protocol (ARP) table, and the connection tracking table includes but is not limited to a connection state, message source information and message destination information, wherein the connection state can include a state of a connection corresponding to a message, the message source information can include but is not limited to source address or source port information of a message, and the message destination information can include but is not limited to destination address, destination port or transmission protocol information of a message, and the ARP table can include one or more addresses, such as addresses of devices or apparatuses that can communicate with the virtual switch. Therefore, in the implementation of the application, the dynamic state of the first virtual switch in the process of data transmission can be saved in the persistent memory, so that the second virtual switch can continue to forward the data to be forwarded, thereby reducing the interruption time in the process of data transmission.
[0015] In a possible implementation, the virtual switch and the operating system can be updated cooperatively, when the operating system is updated, the QEMU in the operating system is updated, the updated QEMU can be used to manage the updated virtual machine, and the second virtual switch negotiates first communication information with the updated QEMU, wherein the first communication information includes configuration parameters used by the second virtual switch to communicate with the updated virtual machine. Therefore, in the implementation of the application, the virtual switch and the operating system can be updated cooperatively.
[0016] In a possible implementation, the second virtual switch can receive second communication information sent by the first virtual switch, wherein the second communication information includes configuration parameters used by the first virtual switch to communicate with the virtual machine, and the second communication information is used by the second virtual switch to communicate with the virtual machine. In the implementation of the application, in the process of updating the virtual switch, the front-end QEMU does not perceive the upgrade of the virtual switch, thereby avoiding affecting the front-end service.
[0017] In a possible implementation, the first communication information or the second communication information can include, but is not limited to, port information or memory mapping information, etc. The port information can include a virtual network card queue number or a queue depth, etc. The memory mapping information can include information of a shared memory region between the virtual switch and the virtual machine.
[0018] In a possible implementation, the first virtual switch is further connected to a first memory, the first memory including a memory temporarily applied for by the first virtual switch, and the first memory being used to store non-multiplexed data. The method further includes: the second virtual switch acquiring a second memory, the second memory being used to store non-multiplexed data of the second virtual switch. In the implementation, a general memory can also be configured for the virtual switch to store non-multiplexed data or retransmissible data, etc.
[0019] In a possible implementation, the configuration parameters of the first virtual switch include, but are not limited to, port information or a forwarding table of the first virtual switch, i.e., static configuration of the first virtual switch, to realize synchronization of the static configuration of the new virtual switch from the shared persistent memory.
[0020] In a second aspect, the application provides a switch upgrading system, which includes a first virtual switch and a virtual machine. The first virtual switch is used to provide a communication function for the virtual machine. The first virtual switch is connected to a persistent memory, and the persistent memory stores configuration parameters of the first virtual switch. In the case of deploying a second virtual switch in the switch upgrading system, the second virtual switch is used to synchronize the configuration parameters from the persistent memory. In the case that the second virtual switch completes the synchronization of the configuration parameters, the first virtual switch stops data forwarding, and the second virtual switch starts data forwarding.
[0021] The effects achieved by the second aspect or any optional implementation of the second aspect can be referred to the description of the first aspect or any optional implementation of the first aspect, which will not be repeated here.
[0022] In a possible implementation, the second virtual switch is further used to acquire at least one reserved physical function (PF). The at least one reserved PF is a reserved PF corresponding to a port of a physical network card used by the first virtual switch. The at least one reserved PF is used for the second virtual switch to perform message transceiving of the physical network card.
[0023] In a possible implementation, the switch upgrading system further includes a physical network card configured with a multi-PF capability. Each port of the physical network card corresponds to at least two PFs, and one of the at least two PFs is a reserved PF.
[0024] In a possible implementation, the second virtual switch is specifically configured to instruct the physical network card to send the data stream to the at least one reserved PF.
[0025] In a possible implementation, the persistent memory further includes state data, the state data including parameters of a forwarding state of the first virtual switch when forwarding data; the second virtual switch is further configured to read the state data from the persistent memory; and the second virtual switch is further configured to forward data according to the state data.
[0026] In a possible implementation, the state data includes, but is not limited to, a connection tracking table or an ARP table, and the connection tracking table includes, but is not limited to, a connection state, packet source information, and packet destination information, where the connection state can include a state of a connection corresponding to a packet, the packet source information can include, but is not limited to, source address or source port information of the packet, and the packet destination information can include, but is not limited to, destination address, destination port, or transmission protocol information of the packet; and the ARP table can include one or more addresses, such as addresses of devices or apparatuses that can communicate with the virtual switch.
[0027] In a possible implementation, the second virtual switch is further configured to negotiate, with the updated QEMU, first communication information, the first communication information including configuration parameters used by the second virtual switch to communicate with the updated virtual machine.
[0028] In a possible implementation, the second virtual switch is further configured to receive second communication information sent by the first virtual switch, the second communication information including configuration parameters used by the first virtual switch to communicate with the virtual machine, and the second communication information is used by the second virtual switch to communicate with the virtual machine.
[0029] In a possible implementation, the first virtual switch is further connected to a first memory, the first memory including temporarily applied memory of the first virtual switch, and the first memory is used to store non-multiplexed data; and the second virtual switch is further configured to obtain a second memory, the second memory being used to store non-multiplexed data of the second virtual switch.
[0030] In a possible implementation, the configuration parameters of the first virtual switch include port information or a forwarding table of the first virtual switch.
[0031] In a third aspect, an embodiment of the present application provides a computing device including a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device performs the method steps in the first aspect and any implementation manner thereof.
[0032] In a fourth aspect, an embodiment of the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the method steps in the first aspect and any implementation manner thereof.
[0033] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions which, when executed by a computing device cluster, cause the computing device cluster to perform the method in the first aspect or any implementation manner of the first aspect.
[0034] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium comprising computer program instructions, which, when executed by a computing device cluster, cause the computing device cluster to perform the method in the first aspect or any implementation manner of the first aspect.
[0035] In a seventh aspect, an embodiment of the present application provides a chip, comprising at least one processor and an interface; the at least one processor acquires program instructions or data through the interface; the at least one processor is configured to execute the program instructions to implement the method in the first aspect or any implementation manner of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 A system architecture schematic diagram is provided for an embodiment of the present application;
[0037] Figure 2 A flowchart of a switch upgrade method is provided for an embodiment of the present application;
[0038] Figure 3 Another system architecture schematic diagram is provided for an embodiment of the present application;
[0039] Figure 4 Another flowchart of a switch upgrade method is provided for an embodiment of the present application;
[0040] Figure 5 A memory management flowchart is provided for an embodiment of the present application;
[0041] Figure 6 A physical network card port schematic diagram is provided for an embodiment of the present application;
[0042] Figure 7 Another physical network card port schematic diagram is provided for an embodiment of the present application;
[0043] Figure 8 Another physical network card port schematic diagram is provided for an embodiment of the present application;
[0044] Figure 9Another physical network card port diagram provided in this application embodiment;
[0045] Figure 10 Another system architecture diagram provided in the application embodiment;
[0046] Figure 11 A flowchart illustrating another switch upgrade method provided in the application embodiment;
[0047] Figure 12 Another system architecture diagram provided in this application embodiment;
[0048] Figure 13 This application provides a schematic diagram of the structure of another computing device. Detailed Implementation
[0049] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0050] First, for ease of understanding, some concepts or terms involved in the embodiments of this application will be explained.
[0051] (1) Virtual machine (VM)
[0052] This refers to a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. In cloud environments, to fully utilize the computing, storage, and network resources of a physical host, one or more virtual machines (VMs) are created on that host, and these VMs are interconnected via virtual switches (vSwitch). As a software program, the virtual switch undergoes regular software updates, such as version upgrades and bug fixes.
[0053] (2) Virtual switch (vSwitch)
[0054] A virtual switch is a software program with more flexible network functions than a physical switch. It enables communication between virtual machines and between virtual machines and the physical network, and can also be deployed as a virtual gateway. It is a core component in a network virtualization environment. As software, virtual switches require version upgrades. Furthermore, as a component in a virtualization environment, there are scenarios where virtual switches need to be upgraded synchronously with other components, including the operating system. During upgrades, it is crucial to minimize network interruption time and avoid adverse effects on users.
[0055] (3) Memory
[0056] It is a crucial component of a computer, also known as internal memory or main memory. It temporarily stores data processed by the CPU, as well as data exchanged with external storage devices such as hard drives. It acts as a bridge between external storage and the CPU. All programs in a computer run within memory, and the performance of the memory directly impacts the overall performance of the computer. When the computer is running, the operating system retrieves the data requiring computation from memory to the CPU for processing. Once the computation is complete, the CPU sends the result back.
[0057] (4) Virtual persistent memory (VPMEM)
[0058] Virtual persistent memory is a novel memory management method provided by the operating system, enabling process memory data to remain persistent and unlost even during kernel restarts, thus supporting the system's hot-upgrade capabilities. The persistent memory mentioned in the following embodiments of this application refers to virtual persistent memory. This virtual persistent memory can be memory virtualized based on memory deployed in hardware devices. The memory in the hardware can specifically include ordinary memory or persistent memory; this application does not limit this specific inclusion.
[0059] (5) Physical function (PF)
[0060] It supports multiple PF capabilities for network cards, allowing multiple PFs to be created based on a single network port. Specific traffic can be forwarded to the corresponding PF by configuring the network card.
[0061] In this embodiment, a reserved PF mechanism is used when performing hot upgrades of virtual switches. The old virtual switch process uses a set of PFs, and the unused PFs in the corresponding network ports are reserved PFs. The new virtual switch process uses the reserved PFs to create physical ports. After the new process is ready, only the MAC table is replaced, which efficiently switches the network and reduces downtime.
[0062] (6) bonding
[0063] It is a network interface card (NIC) bonding scheme under Linux system, which can abstract (bond) n physical NICs on the server into a single logical NIC within the system to improve network fault tolerance, bandwidth expansion and load balancing capabilities.
[0064] (7) QEMU (Quick EMUlator)
[0065] QEMU is an open-source virtual machine manager and emulator—software that emulates processors and can simulate multiple hardware platforms. QEMU allows multiple virtual machines to run simultaneously on a single physical host and provides management and control capabilities for these virtual machines. QEMU supports various operating systems, including Linux, Windows, and many others. As an emulator, QEMU can execute binary code from different architectures on a single host, enabling cross-platform software development and testing.
[0066] The method provided in this application can be applied to software-based switch upgrade scenarios.
[0067] In existing solutions, a cold upgrade method based on virtual machine hot migration can be used to achieve low-interruption upgrades of virtual switches. This solution requires idle nodes in the existing network during the upgrade process. Before the upgrade, virtual machines must be migrated to these idle nodes before the operating system and virtual switch upgrade operations can be performed. After upgrading to the new version, the operating system needs to be restarted, and then the virtual machines need to be migrated back and the virtual machine load balancing operation performed on the nodes needs to be performed. Although this solution has the advantage of short network interruption time, the entire upgrade process is complex, the upgrade cycle is long, and it is limited by the idle rate.
[0068] Another common approach is a single-component hot upgrade scheme for virtual switches, typically employing a dual-process hot upgrade method. During the upgrade process, two processes exist simultaneously in the operating system: one for the old version of the virtual switch and the other for the new version. Initially, the old virtual switch continues receiving and processing network packets without interruption. Once the new virtual switch is ready, a smooth traffic switchover occurs. During the upgrade, the configuration of the new virtual switch must be exactly the same as the old process, and the dynamic state of the old virtual switch during forwarding must also be synchronized to the new virtual switch. While this approach offers the advantage of a short upgrade cycle, it still has several drawbacks: high memory resource consumption and a complex state synchronization mechanism. These drawbacks arise because the dual processes require double the memory resources, and the state of the old virtual switch continuously changes during the upgrade process, making it impossible to synchronize with the accurate real-time state.
[0069] For example, in one component upgrade scheme, a new module is loaded onto a virtual switch; the static configurations of the new and old modules are synchronized; as the dynamic information of the old module continuously changes, a bitmap is used to record the constantly changing dynamic information of the old module, and this dynamically changing information is copied to the new module; when network traffic is received on the virtual switch, it is sent to the new module after synchronizing the static configuration and dynamic information of the old module. However, problems still exist, such as high resource consumption, high time consumption for dynamic state synchronization, and the limitation to single-component upgrades within the same operating system.
[0070] For example, in another component upgrade scheme, the main daemon allocates a memory region from the large page memory for use by the virtual switch during operation, allowing the main and secondary daemons to store shared data. Shared data generated during virtual switch operation is stored in shared memory. Based on the virtual switch's hot restart command, the secondary daemon restarts the virtual switch using the shared data in shared memory. The secondary daemon obtains the shared memory structure table from the main daemon via a message communication mechanism and determines the logical memory address to access the shared memory based on the structure table. The secondary daemon can access the shared memory through its own logical memory address for data forwarding and processing between virtual machines. However, this approach still suffers from drawbacks such as not supporting full feature upgrades, not supporting co-upgrades with the operating system, and experiencing long network interruption times during the upgrade process.
[0071] Therefore, this application provides a switch upgrade method that reduces memory usage during the upgrade process by configuring persistent memory, and also reduces the interruption time during the switch upgrade process.
[0072] The system architecture and methods provided in the embodiments of this application will be described below.
[0073] For example, the method provided in this application embodiment can be applied to the virtual switch hot upgrade system provided in this application embodiment. For ease of understanding, it can be simply referred to as a switch upgrade system or system in the following embodiments. The switch upgrade system can be deployed in a physical machine, such as a server or server cluster or other computing device.
[0074] For example, the software and hardware system architecture of a virtual switch provided in this application can be as follows: Figure 1 As shown in the diagram. This system architecture can be divided into software and hardware components, with the hardware component supporting the operation of the software component.
[0075] The hardware components may include, but are not limited to, processors, physical network cards, and memory.
[0076] In the software component, an operating system can be deployed. Within the operating system, QEMU, upgrade framework modules, and virtual switches can be deployed. One or more virtual machines can be deployed within the operating system, each corresponding to a QEMU process. The following sections will describe each part of the switch upgrade system architecture.
[0077] The number of processors can be one or more. Each vCPU in a virtual machine can run on one physical core. Therefore, the higher the CPU frequency, the faster the virtual machine runs. The more vCPUs, the better the application's performance. If the virtual machine requires a lot of CPU time, you can consider allocating a second vCPU to it. However, allocating more than two vCPUs to a virtual machine does not necessarily make the application run faster, because only multi-threaded applications can effectively utilize multiple vCPUs.
[0078] A physical network interface card (NIC) provides bandwidth for communication between a virtual switch and the external network. Also known as a network adapter, a NIC typically has a unique physical address (MAC address) to uniquely identify it within a local area network (LAN). Network adapters generally do not store IP addresses; these are configured and managed by the operating system. A network adapter enables computers to connect to a LAN, WAN, or the Internet via a physical medium (such as Ethernet or WiFi). It is responsible for transmitting data packets between the computer and the network.
[0079] Memory is used to store data used or generated during the operation of virtual machines or virtual machine switches. Memory is typically allocated based on virtual machine requests. Memory can include persistent memory (VPMEM) and ordinary memory. If VPMEM is allocated to a process, the process can still use the originally allocated VPMEM after switching to a new operating system; that is, VPMEM can be accessed across operating systems. Ordinary memory is memory temporarily requested by software during runtime, used to cache data generated or received by the software, and typically cannot be accessed across operating systems. In this embodiment, VPMEM can be set on top of memory, such as... Figure 1 The VPMEM shown is a memory-based implementation. For example, at the software level, persistent memory can be pre-allocated, and when the software in the operating system runs, it can request the required persistent memory from the VPMEM according to actual needs.
[0080] When QEMU is used as a system emulator, it can simulate a virtual machine capable of running an independent operating system. Each virtual machine corresponds to a QEMU process on the host machine. System virtualization mainly involves virtualizing the CPU, memory, and I / O devices. The virtualized CPU is called a vCPU. To improve efficiency, QEMU uses a virtualization scheme to directly utilize hardware support for virtualization, allowing virtual machine code to run securely on the host machine.
[0081] Virtual switches can be used to enable communication between virtual machines and between virtual machines and physical networks. Within a virtual switch, a memory management framework, functional modules, virtual ports, and created physical ports (bondings) can be configured. The memory management framework provides unified management of VPMEM (Virtual Virtual Machine Memory). It initializes the VPMEM resource pool when a process starts, and requests VPMEM resources needed during process execution from this pool. This includes allocating or releasing memory for the virtual switch from persistent memory, such as allocating memory at process startup and releasing it upon process exit. Functional modules can deploy basic and advanced features. Basic features are the fundamental data forwarding functions of the virtual switch, while advanced features add functionality beyond the basics, such as security management or rate limiting for forwarded data. Virtual ports can be communication ports provided by QEMU. Created bondings are used to interface with physical network interface cards (NICs), enabling the virtual switch to communicate with external systems via physical NICs.
[0082] The upgrade framework module can be used to manage the upgrade process of the operating system and various components, such as controlling the switching between old and new modules within the operating system. Furthermore, this switch upgrade system may include more or fewer modules, depending on the actual application scenario. This application describes some modules related to this application embodiment, but this is not intended to limit the switch upgrade system provided in this application embodiment.
[0083] The method flow provided in this application will be described below in conjunction with the aforementioned system architecture.
[0084] See Figure 2 The following is a flowchart illustrating a switch upgrade method provided in this application embodiment.
[0085] 201. Configure the first virtual switch with virtual persistent memory and store the configuration parameters in the virtual persistent memory.
[0086] When the first virtual switch starts up, a virtual persistent memory can be configured for it, allowing the first virtual switch to store configuration parameters in the virtual persistent memory.
[0087] Specifically, the persistent memory can be virtual persistent memory (VPMEM), which is virtualized persistent memory, or simulated persistent memory, etc. Compared to ordinary memory, the data stored in this persistent memory can usually support cross-system access.
[0088] For the switch upgrade system architecture, please refer to the aforementioned... Figure 1 The introduction states that when the first virtual switch is deployed in the switch upgrade system, persistent memory can be configured for the first virtual switch when it starts up, so as to store the static configuration of the first virtual switch or the status data generated during data transmission.
[0089] In the switch upgrade system provided in this application embodiment, persistent memory can be configured for the virtual switch. When the virtual switch starts running, some of its static configuration is stored in the persistent memory, and the virtual switch can operate based on the configuration parameters stored in the persistent memory. The first virtual switch uses persistent memory, which can store the static configuration of the first virtual switch, or may also include status data during the operation of the first virtual switch. The static configuration includes parameters used to support the first virtual switch in implementing communication functions, and the status data can include dynamic information of the first virtual switch during operation. When upgrading the first virtual switch to a second virtual switch, the second virtual switch can directly read the static configuration and status data from the persistent memory.
[0090] Specifically, the configuration parameters stored in persistent memory may include, but are not limited to, port information or routing tables, which are used to support the virtual switch in implementing communication functions. Alternatively, these configuration parameters may also be considered the static configuration of the virtual switch. Port information includes port type, port number, queue count, VLANs, etc., while the routing table may include the routing paths used by the virtual switch to control packet forwarding. Both are used to support communication between virtual machines or between virtual machines and the physical network.
[0091] Optionally, during the operation of the virtual switch, the state data generated during operation can also be stored in persistent memory. For example, connection tracking and other state data generated during the operation of the virtual switch can be stored in persistent memory so that when the virtual switch is updated, the new virtual machine does not need to be regenerated, thus improving upgrade efficiency. Furthermore, the first virtual machine and the second virtual machine can use the same memory, avoiding the use of dual memory.
[0092] Optionally, the aforementioned status data includes, but is not limited to, a connection tracking table or an address resolution protocol (ARP) table. The connection tracking table includes, but is not limited to, connection status, packet source information, and packet destination information. The connection status may include the status of the connection corresponding to the packet. The packet source information may include, but is not limited to, the packet's source address or source port. The packet destination information may include, but is not limited to, the packet's destination address, destination port, or transport protocol. The ARP table may include one or more addresses, such as the addresses of devices or apparatuses that the virtual switch can communicate with. Therefore, in this embodiment, the dynamic status of the first virtual switch during data transmission can be stored in persistent memory, allowing the second virtual switch to continue forwarding data to be forwarded, thereby reducing the interruption time during data transmission.
[0093] In addition, after startup or during operation, virtual switches can request regular memory to store data that does not need to be reused or data that can be redistributed. Normally, regular memory can be read and written by the virtual switch that requested it, while other virtual switches cannot directly read it or read / write it across systems. Therefore, during virtual switch upgrades, some data that does not need to be reused or temporary data can be stored in regular memory, and persistent memory can only be used when necessary to avoid impacting the upgrade efficiency of the virtual switch.
[0094] For example, in conjunction with the aforementioned Figure 1 The architecture shown categorizes the virtual switch's functionality into basic functions and advanced features. Static configurations for basic functions are stored in persistent memory. To further improve the upgrade efficiency of the virtual switch and reduce the additional memory required for upgrades, configuration parameters and status data corresponding to advanced features can also be stored in persistent memory. The specific storage location can be determined based on the actual application scenario, and this embodiment does not impose any limitations on this. For example, security policy configurations or other advanced feature configurations can also be stored in persistent memory. Security configuration policies may include access control lists (ACLs) to control the virtual switch's filtering of allowed data. This allows the new virtual switch to synchronize the status of advanced features stored in persistent memory during updates or upgrades.
[0095] 202. Deploy a second virtual switch in the switch upgrade system.
[0096] When the switch upgrade system needs to patch vulnerabilities or upgrade the version of the first virtual switch, a second virtual switch can be deployed within the switch upgrade system. For ease of understanding, the first virtual switch can also be referred to as the old virtual switch, and the second virtual switch can also be referred to as the new virtual switch.
[0097] Specifically, the second virtual switch can be deployed by the upgrade framework module in the aforementioned switch upgrade system according to the actual scenario, or it can be deployed by other control modules in the switch upgrade system after downloading, etc., depending on the actual application scenario.
[0098] 203. The second virtual switch reads the virtual persistent memory synchronization configuration parameters.
[0099] The second virtual switch reads and synchronizes configuration parameters from persistent memory, enabling it to operate directly based on the configuration parameters stored in persistent memory.
[0100] Specifically, the configuration parameters of the second virtual switch can be completely or partially the same as those of the first virtual switch. For example, if the configuration parameters for the basic functions of the first virtual switch exist in persistent memory, the second virtual switch can synchronize the parameters for the basic functions from persistent memory. Furthermore, if the configuration parameters for the advanced features of the first virtual switch exist in persistent memory, and the second virtual switch also supports the advanced features, the second virtual switch can directly synchronize the configuration parameters for the advanced features.
[0101] In one possible implementation, if the state data of the first virtual switch, i.e., the parameters of the forwarding state when the first virtual switch forwards data, is stored in persistent memory, the second virtual switch can also synchronize the state data from persistent memory, thereby reducing the impact on services during hot upgrades and reducing memory usage.
[0102] 204. The first virtual switch stops data forwarding, and the second virtual switch starts data forwarding.
[0103] After the second virtual switch is configured, the first virtual switch can stop data forwarding, and the second virtual machine can start data forwarding to achieve hot upgrade of the virtual switch.
[0104] The first virtual switch no longer receives packets from virtual ports or physical ports, nor does it forward packets. The second virtual switch begins receiving packets from each port and forwarding them.
[0105] In this embodiment, persistent memory is configured for the virtual switch to store configuration parameters, such as static configuration or status data. Therefore, during the upgrade process of the virtual switch, the new virtual switch can directly synchronize the configuration parameters or status data of the old virtual switch from the persistent memory, which can achieve more efficient virtual switch upgrades and reduce the interruption time during virtual switch upgrades; and it does not need to occupy dual memory, reducing memory usage during the virtual switch upgrade process.
[0106] In one possible implementation, virtual switches typically require physical ports to transmit data during operation; therefore, one or more PFs can be used to create physical ports on the virtual switch. The multi-PF capability of a network interface card (NIC) allows the creation of multiple PFs based on a single network port.
[0107] In one possible implementation, the switch upgrade system provided in this application embodiment further includes multiple PFs configured for at least one port preset in the physical network interface card (NIC). Each port corresponds to at least two PFs, and one of the at least two PFs is a reserved PF. This is equivalent to configuring at least two PFs for each port, with at least one reserved PF among these at least two PFs. In some scenarios, the reserved PF can also be referred to as a redundant PF.
[0108] Optionally, in this embodiment, the first virtual switch uses one PF (Power Processor) from at least one network port to create a physical port, or it can use one PF from each of multiple network ports to create a physical port. The physical port is the port through which the virtual switch interacts with the physical network interface card (NIC). Before the second virtual switch starts data forwarding, the second virtual switch uses at least one reserved PF from the network port that is not used by the first virtual switch to create a physical port. Using a reserved PF to create a physical port for the second virtual switch avoids the impact on the first virtual switch when creating the port, and allows the second virtual switch to directly use the physical port for packet transmission and reception.
[0109] In one possible implementation, the aforementioned second virtual switch initiates data forwarding, which specifically includes: the second virtual switch controlling the physical network interface card (NIC) to switch the corresponding traffic to the reserved power field (PF) used by the physical port of the second virtual switch. Therefore, after configuring the corresponding reserved PF for the network port used by the first virtual switch for the second virtual switch, once the second virtual switch completes configuration synchronization, the traffic originally transmitted in the network port of the first virtual switch can be switched, and the packets received by the physical NIC are sent to the second virtual switch for processing, thus enabling hot upgrades of the virtual switch.
[0110] In one possible scenario, the virtual switch and operating system can be updated simultaneously. When updating the operating system, QEMU is typically updated concurrently. The second virtual switch negotiates with the updated QEMU to determine the configuration parameters for communication between the second virtual switch and the virtual machines—the initial communication information. This pre-negotiation between the second virtual switch and QEMU is completed before enabling forwarding on the second virtual switch, allowing the front-end virtual machines to transmit data via the second virtual switch.
[0111] In one possible scenario, the second virtual switch can obtain second communication information sent by the first virtual switch. This information may include configuration parameters used by the first virtual switch to communicate with the virtual machine. The second virtual switch can then communicate with QEMU based on this second communication information, such as the number of virtual port queues or information about shared areas. For example, without updating the operating system, the first virtual switch can send the data negotiated with QEMU to the second virtual switch. The first virtual switch and the second virtual machine switch can interact via sockets, thereby sending the negotiated communication information between the first virtual switch and the virtual machine to the second virtual switch. Therefore, QEMU is unaware of virtual switch upgrades or updates, which can reduce virtual machine downtime.
[0112] Optionally, the aforementioned first or second communication information may include, but is not limited to, port information or memory mapping information. Port information may include the number or depth of virtual network interface card queues, and memory mapping information may include information about the shared memory region between the virtual switch and the virtual machine.
[0113] In one possible implementation, the second virtual switch can also request ordinary memory. For ease of distinction, the ordinary memory requested by the first virtual switch is referred to as the first memory, and the ordinary memory requested by the second virtual switch is referred to as the second memory. The data of the second virtual switch can be stored in the second memory.
[0114] The foregoing has described the method flow provided in the embodiments of this application. The method flow provided in the embodiments of this application will be further described below in conjunction with a specific system architecture.
[0115] The methods provided in this application can be divided into several cases, such as simultaneous upgrades of the operating system and virtual switches, or separate upgrades of the virtual switch. The following describes the different cases in conjunction with the switch upgrade system architecture provided in this application.
[0116] I. Simultaneously upgrade the operating system and virtual switch
[0117] See Figure 3The following is a schematic diagram of a process for synchronously upgrading the operating system and virtual switch, provided in an embodiment of this application.
[0118] The architecture of the old operating system can be found in the aforementioned document. Figure 1 The description states that in the old QEMU, a virtio-netdevice frontend was deployed, and a corresponding vhost-user backend was deployed in the old virtual switch. The virtio-netdevice frontend in the old QEMU communicated with the vhost-user backend in the old virtual switch. The old virtual switch also deployed a memory management framework, functional modules, virtual ports, and created bonding, etc.
[0119] It should be noted that, in Figure 3 In the system architecture shown, Figure 3 The connection line between the bonding and VPMEM shown is not a limitation for creating a bonding; that is, when creating a bonding based on the physical network card's PF, it is not necessary to go through VPMEM.
[0120] During a hot upgrade, a new operating system is booted into the server. Typically, the new and old operating systems are of the same type; for example, if the old operating system is Linux, the updated operating system will also be Linux, with the difference possibly being updates to certain capabilities. Accordingly, during the upgrade process, the new operating system can directly use the VPMEM from the old operating system, or in other words, the new and old operating systems can use the same VPMEM across systems.
[0121] The following section combines the system architecture and... Figure 4 The method flow shown is used to introduce the process provided in this application.
[0122] 301. Deploy a new virtual machine switch.
[0123] The new virtual switch can be deployed by upgrading the framework or by downloading other control modules from the switch upgrade system. The specific deployment method can be determined based on the actual application scenario.
[0124] Updating the old virtual switch (i.e., the first virtual switch mentioned above) can include adjusting or adding functions to the virtual switch, or making adaptive updates to keep up with operating system updates, in order to upgrade it to a new virtual switch (i.e., the second virtual switch mentioned above). The specific update scenario can be determined according to the actual application scenario.
[0125] 302. The new virtual switch synchronizes static configuration and status data from persistent memory.
[0126] After deploying a new virtual switch, the new virtual machine can directly synchronize its configuration from persistent memory, which may include static configuration or state data.
[0127] Static configuration refers to the parameters that enable the virtual switch to function. These include information such as the virtual switch's subnet IP address, subnet mask, gateway IP address, and VLAN ID.
[0128] State data refers to the state generated by the legacy virtual switch during data forwarding, such as connection tracking tables or other dynamic parameters. Specifically, a connection tracking table can be stored in persistent memory during data forwarding by the legacy virtual switch. This table may include, but is not limited to, connection states and packet triples or quintuples. For example, it can include elements such as the packet's source address, source port, destination address, destination port, or transport protocol to form the packet's triple or quintuple. Connection states can include the status of the connection corresponding to the packet, such as established, new, or associated with an existing established connection.
[0129] For example, when deploying a new virtual switch, the new virtual switch can synchronize static configuration or dynamic data from persistent memory after startup. If static configuration is stored in persistent memory, the new virtual switch synchronizes it from there. Therefore, the new virtual switch can directly synchronize static configuration from the persistent memory used in real-time by the old virtual switch during operation, without allocating additional memory to store static configuration, reducing memory resource usage during virtual switch upgrades. If status data is also stored in persistent memory, the new virtual switch also synchronizes dynamic data from there. This allows the new virtual switch to directly forward data that originally needed to be forwarded by the old virtual switch based on this dynamic data, reducing data forwarding interruption time during virtual switch upgrades.
[0130] For example, the process of an old virtual switch requesting persistent memory can be as follows: Figure 5As shown, persistent memory resources are typically allocated and released by the memory management framework during the execution of the virtual switch process. For example, the memory management framework in older virtual switches can pre-allocate persistent memory as shared memory and initialize the allocated persistent memory at runtime. During the operation of the virtual switch, persistent memory can be allocated or reclaimed based on the virtual switch's operating status. The memory allocated during the execution of the virtual switch process can be divided into persistent memory and ordinary memory. Static configurations such as port information and forwarding tables, as well as status data such as connection tracking generated during operation, can be stored in persistent memory; memory temporarily allocated during operation, and other data that does not need to be reused, can be stored in ordinary memory.
[0131] 303. New virtual switch bonding is created.
[0132] Traditionally, older virtual switches communicate with the physical network by using physical ports created by PFs. The physical ports on a virtual switch are usually single PF ports or bonding consisting of multiple PFs. When a virtual switch uses only one physical network card port for communication, that is, only one PF, bonding may not be necessary. This is only an example, and whether to create a bonding depends on the actual application scenario. This application does not impose any restrictions on this.
[0133] Specifically, in the scenario of updating virtual switches, in order to improve update efficiency and reduce downtime, the new virtual switch can obtain the reserved PF corresponding to each network port used by the old virtual switch, and create bonding based on the reserved PF to complete the virtualization of the network interface card used by the new virtual switch, thereby improving the efficiency of switching the old virtual switch to the new virtual switch for transmission.
[0134] For example, a physical network interface card (NIC) may include one or more network ports, such as Figure 6 As shown, taking four network ports as an example, namely P0, P1, P2, and P3, each port can be configured with two PFs. P1 corresponds to PF1 and PF3, P2 corresponds to PF5 and PF7, and P3 corresponds to PF6 and PF8. When a network port is used by a virtual switch, the port uses one of the PFs in each port to create a physical port, and each port can reserve at least one PF for use during hot upgrades of the virtual switch.
[0135] Furthermore, such as Figure 7As shown, taking two network ports used by an old virtual switch as P0 and P1 as an example, each network port has multiple PFs created in the switch upgrade system. For example, network port P1 corresponds to PF1 and PF3, and network port P0 corresponds to PF2 and PF4. The old virtual switch uses PF1 and PF2 to create a bonding, and reserves PF3 and PF4 for P0 and P1 respectively. The new virtual switch can create a bonding based on PF3 and PF4 for communication through the physical network port. Therefore, in this embodiment, each network port corresponds to multiple PFs. When the virtual switch uses the PF of a network port, the port also reserves a PF for the new virtual switch to create physical ports. This reduces the interruption time during data forwarding when switching traffic between network ports, enabling hot upgrades of the virtual switch. This is equivalent to enabling the PF reservation mechanism for virtual switch upgrades, allowing the virtual switch to switch traffic between network ports during the upgrade process, more efficiently switching the flow to the new virtual switch for forwarding, thereby reducing the interruption time during the virtual switch upgrade process.
[0136] 304. New virtual switch pre-negotiation with QEMU.
[0137] In scenarios involving simultaneous operating system upgrades, the new virtual switch also negotiates with the updated QEMU to determine basic communication information between them, such as port information or memory mapping information for communication between the new virtual switch and the virtual machine. Typically, when upgrading a virtual switch, the new virtual switch needs to perform virtio-net front-end and back-end negotiations with the new QEMU. This embodiment completes these time-consuming operations before the switchover between the old and new virtual switches, thereby reducing the amount of negotiation required during the hot upgrade phase of the virtual switch and improving the upgrade efficiency.
[0138] The front-end and back-end negotiation process before switching from an old virtual switch to a new one can be called the pre-negotiation phase. During the pre-negotiation phase, QEMU establishes a connection with the back-end vhost-user to negotiate information such as vring information and shared memory regions; this is the negotiation of the aforementioned first communication information. For example, QEMU can send a VHOST_USER_SET_MEM_TABLE message to the new virtual switch to transmit the memory address information in the virtual machine. After receiving the message, the new virtual switch performs memory mapping based on the memory address information carried in the message to configure the shared memory region with the virtual machine. Typically, memory mapping time accounts for a significant portion of the front-end and back-end negotiation time; therefore, in this embodiment, sending this message in advance can reduce the hot upgrade interruption time.
[0139] 305. The new virtual switch controls the flow switching of physical network cards.
[0140] After the new virtual switch synchronizes and persists the configuration in memory, completes bonding creation, and the pre-negotiation phase, it can control the physical network interface card (NIC) for traffic switching. Packets received by the physical NIC are forwarded to the reserved power PF (PF), which corresponds to the physical port used by the new virtual switch. Specifically, the aforementioned upgrade framework module can control the physical NIC traffic switching, or, if the new virtual switch has the capability to control physical ports, it can directly control the physical NIC traffic switching.
[0141] Typically, the upgrade process of a virtual switch can be divided into a pre-loading phase and an execution phase. In the pre-loading phase, the new virtual switch performs state synchronization but does not forward packets; packet forwarding remains the responsibility of the old virtual switch. In the execution phase of a hot upgrade, packet forwarding switches from the old virtual switch to the new virtual switch. That is, during the execution phase of a hot upgrade, physical network interface card (NIC) flow switching can be controlled, transferring flows to the PF (Power Processor) of the new virtual switch. Furthermore, if step 304 is also executed, the pre-negotiation phase steps are also performed during the execution phase of the hot upgrade.
[0142] For example, the streams transmitted by the old virtual switch before the switchover could be like... Figure 8 As shown, the flow transmitted through the physical network interface cards' ports P0 and P1 is forwarded via the bonding between PF1 and PF2 through the old virtual switch.
[0143] During the hot upgrade execution phase, the old virtual switch process stops forwarding. After the new virtual switch refreshes the consistency information of vhost-user, it controls the physical network to perform PF traffic switching. For example, the new virtual switch can issue commands to the physical network interface card (NIC). Figure 9 As shown, to control the physical network card to forward received packets to the reserved PF, the new virtual switch process starts packet forwarding. Figure 9 This diagram illustrates the PF traffic switching of a physical network interface card (NIC). After the switch, the traffic flowing through ports P0 and P1 of the physical NIC can be switched to the bonding bound to PF3 and PF4, thus allowing the traffic to be forwarded through the new virtual switch.
[0144] In this embodiment, the operating system and virtual switches can be upgraded simultaneously. During the pre-loading phase, the new virtual switch can synchronize static configuration parameters and status data from persistent memory, create bonding using the reserved PF of the network port, and pre-negotiate with QEMU before entering the hot upgrade execution phase, i.e., switching the traffic to the new virtual switch for transmission. During the synchronous upgrade of the virtual switch and operating system, the virtual switch can directly synchronize static configuration and status data from persistent memory without needing to use dual memory to run the new and old virtual switches, thus improving the upgrade efficiency and reducing memory usage during the upgrade process. Furthermore, it enables synchronous upgrades of the operating system and virtual switches to adapt to scenarios requiring coordinated upgrades with the operating system. Compared to the dual-process upgrades of the operating system and virtual switches in existing solutions, the method provided in this embodiment enables coordinated upgrades of the virtual switch and operating system with short interruption times. Additionally, by sharing persistent memory between the new and old virtual switches, this embodiment significantly reduces memory usage during the upgrade process.
[0145] II. Upgrade the virtual machine switch
[0146] You can upgrade only the virtual switch without upgrading the operating system. See also Figure 10 The present application provides a schematic flowchart of the switch upgrade method.
[0147] In the absence of an operating system upgrade, QEMU typically remains unchanged during virtual switch upgrades. QEMU is unaware of these changes, and therefore, virtio-net information is synchronized from the old virtual switch to the new one. This means the aforementioned second communication information can be sent from the old virtual switch to the new virtual switch. The following section discusses this in conjunction with... Figure 11 The detailed steps are described below.
[0148] 901. Deploy a new virtual machine switch.
[0149] 902. The new virtual switch is configured synchronously from persistent memory.
[0150] 903. New virtual switch bonding is created.
[0151] Steps 901 to 903 are similar to steps 301 to 303 mentioned above. For details, please refer to the description of steps 301 to 303 mentioned above. They will not be repeated here.
[0152] 904. The old virtual switch will synchronize the front-end and back-end negotiation information to the new virtual switch.
[0153] The difference from step 304 above is that, in this embodiment, QEMU is unaware of changes to the virtual switch. The old virtual switch synchronizes front-end and back-end negotiation information with the new virtual switch, such as front-end vring information and shared memory region information. To maintain consistency of the virtio-net network card information between the new and old virtual switches, the old virtual switch freezes message processing for virtual machines during the hot upgrade process.
[0154] 905. The new virtual switch controls the physical network interface card (NIC) to switch traffic, while the old virtual switch stops forwarding, and the new virtual switch refreshes the consistency information of the virtual machine's virtio-net port.
[0155] Step 905 is similar to step 305 above. For details, please refer to the description of step 305 above. It will not be repeated here.
[0156] In this embodiment, QEMU is unaware of virtual switch updates. The old virtual switch synchronizes the front-end and back-end negotiation information to the new virtual switch, thereby reducing the downtime during the virtual switch upgrade process.
[0157] The system architecture provided in the embodiments of this application will be summarized below in conjunction with the aforementioned method and process.
[0158] See Figure 12 This application provides an embodiment of another switch upgrade system architecture diagram.
[0159] Before upgrading the virtual switch, the upgrade system includes a first virtual switch 1201 and a virtual machine 1202. The first virtual switch is used to provide communication functions for the virtual machine. The first virtual switch is connected to persistent memory 1203, and the configuration parameters of the first virtual switch are stored in the persistent memory.
[0160] During the upgrade process, if a second virtual switch is deployed in the switch upgrade system, the second virtual switch 1204 is used to synchronize configuration parameters from persistent memory 1204. Once the second virtual switch 1204 has completed the synchronization of configuration parameters, the first virtual switch 1201 stops data forwarding, and the second virtual switch 1204 starts data forwarding.
[0161] In one possible implementation, the second virtual switch is further configured to acquire at least one reserved physical function (PF), wherein the at least one reserved PF is a reserved PF corresponding to the port of the physical network card used by the first virtual switch, and the at least one reserved PF is used by the second virtual switch to send and receive packets for the physical network card.
[0162] In one possible implementation, the switch upgrade system also includes configuring multiple PF capabilities for physical network interface cards (NICs), where each port of the physical NIC corresponds to at least two PFs, and one of the at least two PFs is a reserved PF.
[0163] In one possible implementation, a second virtual switch is used to instruct the physical network interface card to send data streams to at least one reserved PF.
[0164] In one possible implementation, the persistent memory also includes state data, which includes parameters of the forwarding state when the first virtual switch forwards data; the second virtual switch is further used to read the state data from the persistent memory; and the second virtual switch is further used to forward data based on the state data.
[0165] In one possible implementation, the status data includes, but is not limited to, a connection tracking table or an ARP table. The connection tracking table includes, but is not limited to, connection status, message source information, and message destination information. The connection status may include the status of the connection corresponding to the message, such as established, new, or related to an existing established connection. The message source information may include, but is not limited to, the source address, destination port, or transport protocol of the message. The message destination information may include, but is not limited to, the destination address or destination port of the message. The ARP table may include one or more addresses, such as the addresses of devices or apparatuses that the virtual switch can communicate with.
[0166] In one possible implementation, the second virtual switch is also used to negotiate first communication information with the updated QEMU, the first communication information including configuration parameters used by the second virtual switch to communicate with the updated virtual machine.
[0167] In one possible implementation, the second virtual switch is further configured to receive second communication information sent by the first virtual switch. The second communication information includes configuration parameters for communication between the first virtual switch and the virtual machine. The second communication information is used for communication between the second virtual switch and the virtual machine.
[0168] In one possible implementation, the first virtual switch is also connected to a first memory, which includes memory temporarily requested by the first virtual switch for storing non-reusable data; the second virtual switch is also used to access a second memory, which is used to store non-reusable data of the second virtual switch.
[0169] In one possible implementation, the configuration parameters of the first virtual switch include the port information or forwarding table of the first virtual switch.
[0170] like Figure 13 The diagram shown is a hardware structure schematic of a computing device 130 provided in an embodiment of this application. This computing device 130 can be used to implement the aforementioned... Figures 2 to 11 The steps of the method in the text.
[0171] Figure 13 The computing device 130 shown may include a processor 1301, a memory 1302, a communication interface 1303, and a bus 1304. The processor 1301, the memory 1302, and the communication interface 1303 can be connected to each other via the bus 1304.
[0172] The processor 1301 is the control center of the computing device 130. It can be a general-purpose central processing unit (CPU) or other general-purpose processors. The general-purpose processor can be a microprocessor or any conventional processor, such as a GPU or NPU, and can be adapted to the actual application scenario.
[0173] As an example, processor 1301 may include one or more CPUs, and may also include other processors, such as... Figure 13 The CPU, NPU, or GPU shown are examples of such devices.
[0174] The memory 1302 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0175] In one possible implementation, the memory 1302 may exist independently of the processor 1301. The memory 1302 can be connected to the processor 1301 via a bus 1304 and is used to store data, instructions, or program code. When the processor 1301 calls and executes the instructions or program code stored in the memory 1302, it can implement the methods provided in the embodiments of this application, for example, Figures 2 to 11 The method shown.
[0176] In another possible implementation, the memory 1302 can also be integrated with the processor 1301.
[0177] The communication interface 1303 is used for connecting the computing device 130 to other devices via a communication network, which may be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The communication interface 1303 may include a receiving unit for receiving data and a transmitting unit for sending data.
[0178] The 1304 bus can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. This bus can be divided into address bus, data bus, and control bus, etc. For ease of representation, Figure 13 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0179] It should be pointed out that, Figure 13 The structure shown does not constitute a limitation on the computing device 130, except Figure 13 In addition to the components shown, the computing device 130 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0180] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., including several instructions to cause a device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0181] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0182] This application also provides a computer-readable storage medium storing a program for training a model or performing inference tasks, which, when run on a computer, causes the computer to perform the aforementioned... Figures 2 to 11 All or part of the steps in the method described in the embodiments shown.
[0183] This application also provides a digital processing chip. This digital processing chip integrates circuitry for implementing the aforementioned processor or processor functions, and one or more interfaces. When the digital processing chip integrates a memory, it can perform the method steps of any one or more of the foregoing embodiments. When the digital processing chip does not integrate a memory, it can be connected to an external memory via a communication interface. The digital processing chip implements the method steps of any one or more of the foregoing embodiments based on the program code stored in the external memory.
[0184] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).
[0185] The data comparison device provided in this application embodiment can be a chip, which includes a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip in the server to perform the above-mentioned operations. Figures 2 to 11 The method described in the illustrated embodiment. Optionally, the storage unit is a storage unit within the chip, such as a register, cache, etc. The storage unit can also be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM), etc.
[0186] Specifically, the aforementioned processing unit or processor can be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0187] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0188] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0189] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0190] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0191] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. The term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Additionally, the character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps in this application does not imply that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effect can be achieved. The division of modules in this application is a logical division. In actual applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the modules shown or discussed may be through some ports, and the indirect coupling or communication connection between modules may be electrical or other similar forms, which are not limited in this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules. Some or all of the modules can be selected to achieve the purpose of the solution in this application according to actual needs.
Claims
1. A method of upgrading a switch, the method comprising: The application is applied to a switch upgrading system, the switch upgrading system comprises a first virtual switch and a virtual machine, the first virtual switch is used to provide communication function for the virtual machine, the first virtual switch is connected with a persistent memory, and configuration parameters of the first virtual switch are stored in the persistent memory. The method comprises: In the case that a second virtual switch is deployed in the switch upgrading system, the second virtual switch synchronizes the configuration parameters from the persistent memory; In the case that the second virtual switch completes synchronization of the configuration parameters, the first virtual switch stops data forwarding, and the second virtual switch starts data forwarding.
2. The method of claim 1, wherein, The method further comprises: The second virtual switch acquires at least one reserved physical function (PF), the at least one reserved PF is a reserved PF corresponding to a port of a physical network card used by the first virtual switch, and the at least one reserved PF is used for the second virtual switch to transmit and receive messages of the physical network card.
3. The method of claim 2, wherein, The switch upgrading system further comprises a physical network card configured with a multi-PF capability, each port of the physical network card corresponds to at least two PFs, and one of the at least two PFs is a reserved PF.
4. The method according to claim 2 or 3, characterized in that, The second virtual switch starting data forwarding comprises: The second virtual switch instructs the physical network card to send a data stream to the at least one reserved PF.
5. The method according to any one of claims 1-4, characterized in that, The persistent memory further comprises state data, the state data comprises parameters of a forwarding state of the first virtual switch when the first virtual switch forwards data; The method further comprises: The second virtual switch reads the state data from the persistent memory; The second virtual switch forwards data according to the state data.
6. The method of claim 5, wherein, The state data comprises a connection tracking table or an address resolution protocol (ARP) table, the connection tracking table comprises connection states, message source information and message destination information, and the ARP table comprises at least one address.
7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: The second virtual switch negotiates first communication information with the updated QEMU, the first communication information comprises configuration parameters used by the second virtual switch to communicate with the updated virtual machine.
8. The method according to any one of claims 1-6, characterized in that, The method further comprises: The second virtual switch receives second communication information sent by the first virtual switch, the second communication information comprises configuration parameters used by the first virtual switch to communicate with the virtual machine, and the second communication information is used for the second virtual switch to communicate with the virtual machine.
9. The method according to any one of claims 1-8, characterized in that, The first virtual switch is further connected with a first memory, the first memory comprises temporarily applied memory of the first virtual switch, and the first memory is used to store non-multiplexed data; the method further comprises: The second virtual switch acquires a second memory, and the second memory is used to store non-multiplexed data of the second virtual switch.
10. The method according to any one of claims 1-9, characterized in that, The configuration parameters of the first virtual switch comprise port information or a forwarding table of the first virtual switch.
11. A switch upgrade system, comprising: The switch upgrading system comprises a first virtual switch and a virtual machine, the first virtual switch is configured to provide communication function for the virtual machine, and the first virtual switch is connected to a persistent memory, and the persistent memory stores configuration parameters of the first virtual switch; In the case that a second virtual switch is deployed in the switch upgrading system, the second virtual switch is configured to synchronize the configuration parameters from the persistent memory; In the case that the second virtual switch completes the synchronization of the configuration parameters, the first virtual switch stops data forwarding, and the second virtual switch starts data forwarding.
12. The system of claim 11, wherein The second virtual switch is further configured to obtain at least one reserved physical function (PF), the at least one reserved PF is a reserved PF corresponding to a port of a physical network card used by the first virtual switch, and the at least one reserved PF is used for the second virtual switch to transmit and receive messages of the physical network card.
13. The system of claim 12, wherein, The switch upgrading system further comprises a physical network card configured with a multi-PF capability, each port of the physical network card corresponds to at least two PFs, and one of the at least two PFs is a reserved PF.
14. The system of claim 12 or 13, wherein The second virtual switch is specifically configured to instruct the physical network card to send a data stream to the at least one reserved PF.
15. The system of any of claims 11-14, wherein, The persistent memory further comprises state data, and the state data comprises parameters of a forwarding state of the first virtual switch when the first virtual switch forwards data. The second virtual switch is further configured to read the state data from the persistent memory. The second virtual switch is further configured to forward data according to the state data.
16. The system of claim 15, wherein, The state data comprises a connection tracking table or an address resolution protocol (ARP) table, the connection tracking table comprises connection states, message source information, and message destination information, and the ARP table comprises at least one address.
17. The system of any one of claims 11-16, wherein The second virtual switch is further configured to negotiate first communication information with the updated QEMU, and the first communication information comprises configuration parameters used by the second virtual switch to communicate with the updated virtual machine.
18. The system of any one of claims 11-16, wherein The second virtual switch is further configured to receive second communication information sent by the first virtual switch, the second communication information comprises configuration parameters used by the first virtual switch to communicate with the virtual machine, and the second communication information is used by the second virtual switch to communicate with the virtual machine.
19. The system of any of claims 11-18, wherein, The first virtual switch is further connected to a first memory, the first memory comprises temporarily applied memory of the first virtual switch, and the first memory is used to store non-multiplexed data. The second virtual switch is further configured to obtain a second memory, and the second memory is used to store non-multiplexed data of the second virtual switch.
20. The system of any of claims 11-19, wherein, The configuration parameters of the first virtual switch comprise port information or a forwarding table of the first virtual switch.
21. A computing device, comprising: The computing device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the computing device to perform the operational steps of the method of any of claims 1 to 10.
22. A computer program product comprising instructions, characterized in that, The instructions, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the operational steps of the method of any of claims 1 to 10.
23. A computer-readable storage medium, characterized in that, The instructions, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the operational steps of the method of any of claims 1 to 10.