Virtual switch upgrading method and device, equipment and medium
By dynamically linking the upgrade management component, download component, parsing component, and hot-swap component, the problems of resource waste and long downtime during OVS upgrades are solved, achieving efficient, stable, and smooth upgrades.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-17
AI Technical Summary
The existing OVS smooth upgrade solution suffers from severe resource waste, and the dual-process switching results in excessively long disconnection times, affecting system stability.
The upgrade management component, upgrade package download component, parsing component and hot replacement component are dynamically linked to replace the dual process replacement, reduce resource consumption, and upgrade through PMD idle mode to avoid virtual machine and OVS port renegotiation and PMD thread cut-off and restart.
Significantly saves resources, shortens downtime, enables smooth upgrades, and improves system stability and efficiency.
Smart Images

Figure CN121887635A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a method, apparatus, device and medium for upgrading a virtual switch. Background Technology
[0002] Currently, most OVS (Open vSwitch, a high-quality virtual switch supporting multi-layer data forwarding) smooth upgrade solutions use a dual-process replacement approach. Dual-process upgrades mean using twice the physical resources. For example, in a DPDK-based virtual switch (DPDK-OVS), the second process also requires large pages of memory for DPDK. Therefore, to ensure dual-process upgrades are always available, large pages are typically pre-allocated, leading to resource waste to some extent. In some special scenarios, due to limited physical resource allocation, dual-process upgrades may not even be feasible. Furthermore, the most crucial aspect of dual-process hot-swap upgrades is the switching of traffic between the two processes. To ensure uninterrupted traffic after the process switch, session synchronization is required, which involves a disconnection. Therefore, the success of session synchronization is a major factor determining the duration of the disconnection. Additionally, factors such as port negotiation between the virtual machine and OVS, and the enabling of physical network interface cards (NICs), can also lead to excessively long disconnection times.
[0003] Therefore, how to reduce the operational costs of the OVS hot upgrade process, save resources, and reduce downtime have become problems to be solved. Summary of the Invention
[0004] This application provides a virtual switch upgrade method, apparatus, device, and medium that can dynamically link upgrade management components, upgrade package download components, parsing components, and hot-swap components, replacing the original dual-process replacement upgrade method and significantly saving resources. Furthermore, it eliminates the need for port renegotiation between the virtual machine and OVS and the process of cutting off and restarting the PMD thread, instead using individual components for upgrade operations, further shortening the downtime during the upgrade release process and achieving a smooth upgrade.
[0005] In a first aspect, embodiments of this application provide a method for upgrading a virtual switch, the method comprising: The upgrade management component sends upgrade commands to the upgrade package download component; The upgrade package download component obtains the installation package to be upgraded based on the upgrade command and sends it to the parsing component; The parsing component receives the installation package to be upgraded, parses it, obtains the configuration information and loading order, and sends it to the hot-swap component; The hot-swap component receives and processes the configuration information and loading order to obtain the switch upgrade result.
[0006] Furthermore, the method also includes: The upgrade package download component obtains the installation package to be upgraded and backs up the current environment information.
[0007] Furthermore, the method also includes: The upgrade management component sends a rollback command to the upgrade package download component; The upgrade package download component obtains backup information based on the rollback command, gets the installation package to be rolled back, and sends it to the parsing component; The parsing component receives the installation package to be rolled back and parses it to obtain configuration information and loading order.
[0008] Furthermore, the method also includes: The hot-swap component receives and processes configuration information and loading order to determine whether the upgrade was successful. If so, the switch upgrade success result is obtained and sent to the upgrade management component; The upgrade management component receives and displays the successful upgrade result.
[0009] Furthermore, the method also includes: The hot-swap component receives and processes configuration information and loading order to determine whether the upgrade was successful. If not, the switch upgrade failed result is obtained and sent to the upgrade package download component; The upgrade package download component obtains a rollback instruction based on the switch upgrade failure result, retrieves backup information based on the rollback instruction, obtains the installation package to be rolled back, and sends it to the parsing component.
[0010] Furthermore, the parsing component receives and parses the installation package to be upgraded, obtains the configuration information and loading order, and sends them to the hot-swap component, including: The parsing component receives the installation package to be upgraded and parses it to obtain configuration information; The loading order is calculated based on the dependencies and configuration information of the dynamic library, and the configuration information and loading order are sent to the hot-swap component.
[0011] Furthermore, the hot-swap component receives and processes configuration information and loading order to obtain the switch upgrade result, including: The hot-swap component generates environment variables based on configuration information and loading order; The hot-swap component processes environment variables according to the pmd function to obtain the switch upgrade result.
[0012] Secondly, embodiments of this application provide a virtual switch upgrade device, the device comprising: The upgrade management component is used to send upgrade commands to the upgrade package download component; The upgrade package download component is used to obtain the installation package to be upgraded according to the upgrade command and send it to the parsing component; The parsing component receives the installation package to be upgraded, parses it, obtains the configuration information and loading order, and sends it to the hot-swap component. The hot-swap component is used to receive configuration information and loading order, process them, and obtain the switch upgrade result.
[0013] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the steps of a virtual switch upgrade method as described in any of the above embodiments.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of a virtual switch upgrade method as described in any of the above embodiments.
[0015] In summary, compared with the prior art, the beneficial effects of the technical solution provided in this application include at least the following: The virtual switch upgrade method provided in this application can dynamically link upgrade management components, upgrade package download components, parsing components, and hot-swap components, replacing the original dual-process replacement upgrade method, which greatly saves resources; and it eliminates the need for port renegotiation between the virtual machine and OVS and the disconnection and restart process of the PMD thread, instead using individual components to perform upgrade operations, further shortening the downtime during the upgrade release process and achieving a smooth upgrade. Attached Figure Description
[0016] Figure 1 A flowchart of a virtual switch upgrade method provided as an exemplary embodiment of this application.
[0017] Figure 2 This is a structural diagram of a virtual switch upgrade device provided as an exemplary embodiment of this application. Detailed Implementation
[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0019] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] Please see Figure 1This application provides a method for upgrading a virtual switch, which specifically includes the following steps: Step S1: The upgrade management component sends an upgrade command to the upgrade package download component.
[0021] The upgrade management component can be an externally interactive component used to control the execution of other components and return the execution results of each component.
[0022] Among them, the core interactive unit of the upgrade management component sends upgrade instructions to the upgrade package download component, which improves the execution efficiency and controllability of the upgrade process, increases the transparency of the system status, and optimizes the stability of the system.
[0023] In one feasible implementation, when the upgrade management component receives an upgrade request, it generates an upgrade instruction and sends it to the upgrade package download component for processing. The upgrade management component can continuously monitor the download progress and execution status, obtain the results after the process is completed, and provide feedback to the user, thus completing a reliable upgrade process.
[0024] In step S2, the upgrade package download component obtains the installation package to be upgraded according to the upgrade instruction and sends it to the parsing component.
[0025] The upgrade package download component is used to obtain and download the upgrade installation package, as well as parse the physical environment of the OVS to be upgraded. The upgrade package download component can select the corresponding installation branch in the installation package based on CPU type, network card type, and operating system, and then pass the file loading path information to the parsing component for processing.
[0026] The upgrade package download component can automatically match the corresponding installation branch according to the physical environment of the system to be upgraded, ensuring accurate adaptation of the installation package and avoiding upgrade failures caused by system reasons such as environment incompatibility.
[0027] In some embodiments, the method further includes: The upgrade package download component obtains the installation package to be upgraded and backs up the current environment information.
[0028] The upgrade package download component can perform a complete backup of the current environment information when obtaining the installation package to be upgraded, providing reliable protection for the upgrade process and improving the success rate of the entire upgrade operation.
[0029] In one feasible implementation, after receiving the upgrade command, the upgrade package download component first analyzes the CPU architecture, operating system type, and network card model of the OVS to be upgraded. Then, it retrieves the installation package to be upgraded from the repository and selects the corresponding installation branch file based on the identified environment parameters. At the same time, the upgrade package download component performs a local backup of the current environment information. Finally, it sends the selected installation branch file to the parsing component for further processing.
[0030] In some embodiments, the method further includes: The upgrade management component sends a rollback command to the upgrade package download component; The upgrade package download component obtains backup information based on the rollback command, gets the installation package to be rolled back, and sends it to the parsing component; The parsing component receives the installation package to be rolled back and parses it to obtain configuration information and loading order.
[0031] In some embodiments, the upgrade package download component can record the version information of each OVS module in the current environment. When an upgrade event is triggered (i.e., when the upgrade management component sends an upgrade command), the upgrade package download component downloads the installation package to be upgraded and backs up the information in the current environment. When the upgrade fails and rollback logic is automatically triggered, or when the upgrade management component issues a rollback command, a rollback operation can be performed quickly. After the rollback operation is triggered, the upgrade package download component can obtain the installation package to be rolled back through the backup information, re-parse the physical environment, and pass the configuration information and loading order to the next component.
[0032] Step S3: The parsing component receives the installation package to be upgraded, parses it, obtains the configuration information and loading order, and sends it to the hot-swap component.
[0033] In some embodiments, the parsing component receives and parses the installation package to be upgraded, obtains configuration information and loading order, and sends it to the hot-swap component, including: The parsing component receives the installation package to be upgraded and parses it to obtain configuration information; The loading order is calculated based on the dependencies and configuration information of the dynamic library, and the configuration information and loading order are sent to the hot-swap component.
[0034] The parsing component is used to parse the configuration information in the installation package, calculate the corresponding loading order based on the dynamic loading configuration information of each module in the information table and the dependency relationship of the dynamic library .so, and load the dynamic library .so according to the loading order from the loading path provided in the upgrade package download component; the parsing component can solve the mutual dependency problems that may exist between .so libraries.
[0035] In some embodiments, the configuration information table is implemented through a compiled and packaged project. During development, the module to which the current addition, fix, and feature optimization belong will be marked. The compiled and packaged project maintains an OVS dynamic library dependency graph (directed graph). The program information of each .so module is recorded in the vertex set of the graph. The program information includes: the module name, the module's physical environment dependencies (e.g., CPU architecture information), the module's MD5 hash, the module's size, and the relative path where the module is currently stored. The dependencies of the .so modules are recorded through the pointers in the dynamic library dependency graph.
[0036] After the compilation and packaging project begins, the differences between the marked modules during the development phase are first verified. The information recorded for the corresponding modules in the graph is compared. If the verification is correct, the information in the vertex set of the OVS dynamic library dependency graph is updated and marked "NEW". Next, the consistency between the unmarked modules and their corresponding information in the graph is verified. If correct, the mark "OLD" is added. Finally, during the packaging process of the compilation and packaging project, the modules marked "NEW" are selected for packaging, and the information of the "NEW" marked portion of the OVS dynamic library dependency graph is recorded as a configuration information table and included in the package.
[0037] In step S4, the hot-swap component receives the configuration information and loading order, processes them, and obtains the switch upgrade result.
[0038] In some embodiments, the hot-swap component receives and processes configuration information and loading order to obtain the switch upgrade result, including: The hot-swap component generates environment variables based on configuration information and loading order; The hot-swap component processes environment variables according to the pmd function to obtain the switch upgrade result.
[0039] The hot-replace component loads modules according to the loading order generated in the parsing component and the path of the corresponding dynamic library module. Afterwards, the replacement process is performed. To reduce thread start / stop overhead and time, this application uses a pmd idle-running method for replacement and upgrade. After the aforementioned .so file is successfully preloaded, an environment variable (ENV=hot_replace) is set to inform the pmd thread. Upon detecting the upgrade environment variable, the pmd function runs a spinlock, skipping the current round of execution. pmd continues to loop, idle-running until the upgrade environment variable disappears, thus resuming forwarding.
[0040] In some embodiments, during the pmd idling process, it is necessary to stop the resident threads in the old .so file and then activate the new .so file.
[0041] In some embodiments, after the pmd thread resumes, the old dynamic library is unloaded. The dynamic library upgrade is complete, and the interruption time is only the process of pmd idling. Since the pmd thread is not started or stopped, and the variables of the .so file exist in heap memory, the new .so file can be used directly, making the entire interruption time very short, achieving an upgrade in the single-digit millisecond range. In actual use, users can experience no interruption at all, achieving a smooth upgrade without interruption.
[0042] In some embodiments, the method further includes: The hot-swap component receives and processes configuration information and loading order to determine whether the upgrade was successful. If so, the switch upgrade success result is obtained and sent to the upgrade management component; The upgrade management component receives and displays the successful upgrade result.
[0043] The hot-swap component can perform upgrade processing based on the received configuration information and loading order, accurately determining the upgrade result and thus automating the upgrade process. When the upgrade is successful, the switch upgrade success result can be transmitted to the upgrade management component and displayed intuitively, greatly enhancing the visibility of the upgrade process, effectively avoiding the problem of unclear upgrade status, and significantly improving the efficiency of upgrade operations.
[0044] In some embodiments, the method further includes: The hot-swap component receives and processes configuration information and loading order to determine whether the upgrade was successful. If not, the switch upgrade failed result is obtained and sent to the upgrade package download component; The upgrade package download component obtains a rollback instruction based on the switch upgrade failure result, retrieves backup information based on the rollback instruction, obtains the installation package to be rolled back, and sends it to the parsing component.
[0045] When the hot-swap component determines that the upgrade has failed, it can trigger a complete rollback process. By transmitting the switch upgrade failure result to the upgrade package download component and driving it to generate a rollback instruction, the system can quickly obtain the installation package to be rolled back based on the pre-backed-up environment information and resubmit it to the parsing component. This enables rapid recovery after the upgrade failure, greatly reduces the risk of system unavailability caused by upgrade anomalies, and ensures the continuity and reliability of the system.
[0046] The virtual switch upgrade method provided in the above embodiments can dynamically link upgrade management components, upgrade package download components, parsing components, and hot-swap components, replacing the original dual-process replacement upgrade method, which greatly saves resources; and it eliminates the need for port renegotiation between the virtual machine and OVS and the disconnection and restart process of the PMD thread, instead using individual components to perform upgrade operations, further shortening the downtime during the upgrade release process and achieving a smooth upgrade.
[0047] Please see Figure 2 Another embodiment of this application provides a virtual switch upgrade apparatus, the apparatus comprising: The upgrade management component is used to send upgrade commands to the upgrade package download component.
[0048] The upgrade package download component is used to obtain the installation package to be upgraded according to the upgrade command and send it to the parsing component.
[0049] The parsing component receives the installation package to be upgraded, parses it, obtains the configuration information and loading order, and sends it to the hot-swap component.
[0050] The hot-swap component is used to receive configuration information and loading order, process them, and obtain the switch upgrade result.
[0051] The specific limitations of the virtual switch upgrade device provided in this embodiment can be found in the embodiment of the virtual switch upgrade method described above, and will not be repeated here. Each module in the above-described virtual switch upgrade device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0052] This application provides a computer device that may include a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it causes the processor to perform the steps of a virtual switch upgrade method as described in any of the above embodiments.
[0053] The working process, working details, and technical effects of the computer device provided in this embodiment can be found in the embodiment of a virtual switch upgrade method described above, and will not be repeated here.
[0054] This application provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the steps of a virtual switch upgrade method as described in any of the above embodiments. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or memory sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0055] The working process, working details, and technical effects of the computer-readable storage medium provided in this embodiment can be found in the embodiment of a virtual switch upgrade method described above, and will not be repeated here.
[0056] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0057] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0058] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for upgrading a virtual switch, characterized in that, The method includes: The upgrade management component sends upgrade commands to the upgrade package download component; The upgrade package download component obtains the installation package to be upgraded according to the upgrade instruction and sends it to the parsing component; The parsing component receives the installation package to be upgraded, parses it, obtains the configuration information and loading order, and sends it to the hot-swap component; The hot-swap component receives the configuration information and loading order, processes them, and obtains the switch upgrade result.
2. The virtual switch upgrade method according to claim 1, characterized in that, The method further includes: The upgrade package download component obtains the installation package to be upgraded and backs up the current environment information.
3. The virtual switch upgrade method according to claim 1, characterized in that, The method further includes: The upgrade management component sends a rollback command to the upgrade package download component; The upgrade package download component obtains backup information based on the rollback instruction, gets the installation package to be rolled back, and sends it to the parsing component; The parsing component receives the installation package to be rolled back and parses it to obtain configuration information and loading order.
4. The virtual switch upgrade method according to claim 3, characterized in that, The method further includes: The hot-swap component receives the configuration information and loading order, processes them, and determines whether the upgrade was successful. If so, the switch upgrade success result is obtained and sent to the upgrade management component; The upgrade management component receives and displays the upgrade success result.
5. The virtual switch upgrade method according to claim 4, characterized in that, The method further includes: The hot-swap component receives the configuration information and loading order, processes them, and determines whether the upgrade was successful. If not, the switch upgrade failed result is obtained and sent to the upgrade package download component; The upgrade package download component obtains a rollback instruction based on the switch upgrade failure result, acquires backup information based on the rollback instruction, obtains the installation package to be rolled back, and sends it to the parsing component.
6. The virtual switch upgrade method according to claim 1, characterized in that, The parsing component receives the installation package to be upgraded, parses it, obtains configuration information and loading order, and sends it to the hot-swap component, including: The parsing component receives the installation package to be upgraded and parses it to obtain configuration information; The loading order is calculated based on the dependencies of the dynamic library and the configuration information. The configuration information and loading order are then sent to the hot-swap component.
7. The virtual switch upgrade method according to claim 1, characterized in that, The hot-swap component receives the configuration information and loading order, processes them, and obtains the switch upgrade result, including: The hot-swap component generates environment variables based on the configuration information and loading order; The hot-swap component processes the environment variables according to the pmd function to obtain the switch upgrade result.
8. A virtual switch upgrade device, characterized in that, The device includes: The upgrade management component is used to send upgrade commands to the upgrade package download component; The upgrade package download component is used to obtain the installation package to be upgraded according to the upgrade instruction and send it to the parsing component; The parsing component is used to receive the installation package to be upgraded, parse it, obtain configuration information and loading order, and send it to the hot-swap component; The hot-swap component is used to receive the configuration information and loading order, process them, and obtain the switch upgrade result.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the virtual switch upgrade method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the virtual switch upgrade method as described in any one of claims 1 to 7.