Hot-plug processing method, device, storage medium and processor of virtual network card
By processing the virtual network card configuration information and kernel layer event queue management in the DPDK module, the problem of low hot-swap efficiency of virtual network cards in virtual machines is solved, and efficient network adjustment is achieved while the virtual machine is running.
Patent Information
- Application Number
- CN202111015923.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-08-31
AI Technical Summary
The hot-plugging efficiency of virtual network cards in existing standard Linux virtual machines is low, and it cannot effectively solve the need to dynamically add or delete virtual network cards when the network topology changes when the virtual machine is running.
By detecting the insertion action of the virtual network card, obtain its configuration information, process and create the network card interface in the DPDK module, use the event queues of the kernel layer and application layer to manage the insertion and removal events of the virtual network card, update the card board status information, and achieve efficient Hot-swappable handling.
It improves the hot-swappable efficiency of virtual network cards, ensures that network communication requirements are dynamically adjusted without interrupting existing business data flows, and improves the network flexibility of virtual machines.
Smart Images

Figure CN113778626B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network card driver technology, and in particular to a hot-plug processing method, device, storage medium and processor for a virtual network card. Background Art
[0002] In the Internet era, cloud computing is prevalent, and many businesses / devices run on cloud platforms and provide services in the form of virtual machines. The constant changes in the network environment will bring about changes in the network topology, so it is necessary to dynamically add or delete virtual network cards while the virtual machine is running, so as to ensure that new network communication needs are met without interrupting the existing business data flow. The existing standard Linux virtual machine uses kernel drivers, which can directly implement hot-swap of virtual network cards, but the efficiency of hot-swap is low.
[0003] With regard to the problem of low hot-plug efficiency of virtual network cards in related technologies, no effective solution has been proposed yet. Summary of the invention
[0004] The main purpose of the present application is to provide a hot-plug processing method, device, storage medium and processor for a virtual network card to solve the problem of low hot-plug efficiency of virtual network cards in related technologies.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a hot-swap processing method for a virtual network card is provided. The method comprises: detecting the insertion action of a target virtual network card; if it is detected that the target virtual network card is inserted into the kernel layer of a target virtual machine, obtaining the configuration information of the target virtual network card; processing the target virtual network card in a DPDK module according to the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
[0006] Furthermore, if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, obtaining the configuration information of the target virtual network card includes: if an increase in the number of virtual network cards is detected in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an addition event of the target virtual network card in the kernel layer; and obtaining the configuration information of the target virtual network card based on the addition event.
[0007] Furthermore, after determining the add event of the target virtual network card in the kernel layer, the method also includes: adding the add event to the event queue of the target virtual network card; acquiring the add event in the event queue according to a preset duration; storing the acquired add event in an information table, wherein the information table includes at least: configuration information of the target virtual network card and card board status information of the target virtual network card.
[0008] Furthermore, the target virtual network card is processed in the DPDK module through the configuration information, and the processed target virtual network card includes: if it is determined through the information table that the card board status information of the target virtual network card is in a non-empty state, the DPDK module is triggered to update the configuration information in the information table; the target virtual network card is processed based on the updated configuration information to obtain the processed target virtual network card.
[0009] Furthermore, the hierarchical structure of the target virtual machine includes at least: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display a network card interface.
[0010] Furthermore, after creating the processed network card interface of the target virtual network card, the method also includes: displaying the network card interface at the application layer; detecting whether the target virtual network card is removed; if it is detected that the target virtual network card is removed, determining the removal event of the target virtual network card; adding the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; deleting the configuration information of the target virtual network card through the target address of the target virtual network card, and setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0011] Furthermore, after the card board status information of the target virtual network card after the configuration information is deleted is set to an empty state, the method also includes: deleting the card board of the target virtual network card; when the card board of the target virtual network card is deleted, performing a deletion operation on the network card interface of the target virtual network card.
[0012] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a hot-swap processing device for a virtual network card is provided. The device comprises: a first detection unit, used to detect the insertion action of the target virtual network card; a first acquisition unit, used to acquire the configuration information of the target virtual network card if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine; a first processing unit, used to process the target virtual network card through the configuration information in the DPDK module to obtain the processed target virtual network card; and a first creation unit, used to create the network card interface of the processed target virtual network card.
[0013] Furthermore, the first acquisition unit includes: a first determination module, used to confirm that the target virtual network card is inserted into the kernel layer of the target virtual machine if an increase in the number of virtual network cards is detected in the kernel layer; a second determination module, used to determine the addition event of the target virtual network card in the kernel layer; and a first acquisition module, used to obtain the configuration information of the target virtual network card based on the addition event.
[0014] Furthermore, the device also includes: a first adding unit, used to add the added event to the event queue of the target virtual network card after determining the added event of the target virtual network card in the kernel layer; a second acquisition unit, used to acquire the added event in the event queue according to a preset time length; a first storage unit, used to store the acquired added event in an information table, wherein the information table includes at least: configuration information of the target virtual network card, and card board status information of the target virtual network card.
[0015] Furthermore, the first processing unit includes: a first trigger module, which is used to trigger the DPDK module to update the configuration information in the information table if it is determined through the information table that the card board status information of the target virtual network card is in a non-empty state; a first processing module, which is used to process the target virtual network card based on the updated configuration information to obtain a processed target virtual network card.
[0016] Furthermore, the hierarchical structure of the target virtual machine includes at least: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display a network card interface.
[0017] Furthermore, the device also includes: a first display unit, used to display the network card interface at the application layer after creating the processed target virtual network card interface; a second detection unit, used to detect whether the target virtual network card is removed; a first determination unit, used to determine the removal event of the target virtual network card if it is detected that the target virtual network card is removed; a second adding unit, used to add the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; a first deletion unit, used to delete the configuration information of the target virtual network card through the target address of the target virtual network card, and set the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0018] Furthermore, the device also includes: a second deletion unit, used to delete the card board of the target virtual network card after the card board status information of the target virtual network card is set to an empty state after the configuration information is deleted; a third deletion unit, used to perform a deletion operation on the network card interface of the target virtual network card when the card board of the target virtual network card is deleted.
[0019] According to another aspect of an embodiment of the present application, a processor is further provided, and the processor is used to run a program, wherein any one of the above methods is executed when the program is run.
[0020] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, any one of the above methods is performed.
[0021] Through this application, the following steps are adopted: detecting the insertion action of the target virtual network card; if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, obtaining the configuration information of the target virtual network card; processing the target virtual network card through the configuration information in the DPDK module to obtain the processed target virtual network card; creating the network card interface of the processed target virtual network card. The problem of low hot-plug efficiency of virtual network cards in related technologies is solved. By hot-plugging the target virtual network card based on the configuration information of the target virtual network card in the DPDK module, the effect of improving the hot-plug efficiency of the virtual network card is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0023] Figure 1 is a flow chart of a hot-plug processing method for a virtual network card provided in an embodiment of the present application;
[0024] Figure 2 It is a schematic diagram of inserting a virtual network card according to the hot-plug processing method of the virtual network card provided in an embodiment of the present application;
[0025] Figure 3 is a schematic diagram of removing a virtual network card according to a hot plug processing method of a virtual network card provided in an embodiment of the present application; and
[0026] Figure 4 It is a schematic diagram of a hot-swap processing device for a virtual network card provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0031] DPDK: Data Plane Development Kit, mainly runs on the Linux system. It is a collection of function libraries and drivers for fast data packet processing, which can greatly improve data processing performance and throughput, and improve the work efficiency of data plane applications.
[0032] According to an embodiment of the present application, a hot-plug processing method for a virtual network card is provided.
[0033] Figure 1 Flowchart of the hot-plug processing method of the virtual network card according to the embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0034] Step S101, detecting the insertion action of the target virtual network card.
[0035] For example, when the target virtual network card is inserted into the card slot, the insertion action of the target virtual network card is detected based on the Linux kernel layer in the target virtual machine hierarchy.
[0036] Step S102: If it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, the configuration information of the target virtual network card is obtained.
[0037] For example, before virtual network card A (corresponding to the target virtual network card in this application, the same below) is inserted into the kernel layer, there are already several virtual network cards in the kernel layer. The configuration information of virtual network card A is obtained, and virtual network card A is added to several virtual network card queues.
[0038] Optionally, in the hot-swap processing method for the virtual network card provided in an embodiment of the present application, if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, obtaining the configuration information of the target virtual network card includes: if an increase in the number of virtual network cards is detected in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an addition event of the target virtual network card in the kernel layer; and obtaining the configuration information of the target virtual network card based on the addition event.
[0039] For example, there are 3 virtual network cards in the kernel layer. When virtual network card A is inserted into the kernel layer, when the kernel layer detects an increase in the number of virtual network cards, it is confirmed that the virtual network card is inserted into the kernel layer of the target virtual machine, and the event of adding virtual network card A to the kernel layer is determined as the addition event of virtual network card A. The addition event of virtual network card A includes the PCI address of A, wherein the configuration information of the target virtual network card includes at least the PCI address. The present application dynamically adds virtual network cards during the operation of the virtual machine, thereby ensuring that new network communication needs are met without interrupting the existing business data flow, and improving the hot-swap efficiency of the virtual network card.
[0040] Optionally, in the hot-swap processing method for the virtual network card provided in an embodiment of the present application, after determining the add event of the target virtual network card in the kernel layer, the method also includes: adding the add event to the event queue of the target virtual network card; acquiring the add event in the event queue according to a preset duration; storing the acquired add event in an information table, wherein the information table includes at least: configuration information of the target virtual network card, and card board status information of the target virtual network card.
[0041] For example, the addition event of virtual network card A is added to the time queue, and the control module 1 detects the addition event of the event queue every 1s (corresponding to the preset duration in this application), obtains the PCI address of the virtual network card in the addition event of virtual network card A, stores the PCI address in the information table of the virtual network card, and sets the insertion status of the slot sub-card in the current virtual network card (corresponding to the card board status information of the target virtual network card in this application). By adding the addition event to the event queue of the target virtual network card, the control module 1 can obtain the insertion status of the target virtual network card in real time, thereby improving the hot plug efficiency of the virtual network card.
[0042] For example, based on the information table of the virtual network card obtained by the control module 1, the information table at the time of initialization is shown in the following table 1:
[0043] Table 1
[0044] Slot Portid Pci_addr Mac_addr Slot_status 1 0 0000:00:00.0 00:00:00:00:00:00 Empty 2 0 0000:00:00.0 00:00:00:00:00:00 Empty 3 0 0000:00:00.0 00:00:00:00:00:00 Empty 4 0 0000:00:00.0 00:00:00:00:00:00 Empty 5 0 0000:00:00.0 00:00:00:00:00:00 Empty 6 0 0000:00:00.0 00:00:00:00:00:00 Empty 7 0 0000:00:00.0 00:00:00:00:00:00 Empty 8 0 0000:00:00.0 00:00:00:00:00:00 Empty 9 0 0000:00:00.0 00:00:00:00:00:00 Empty 10 0 0000:00:00.0 00:00:00:00:00:00 Empty
[0045] As shown in Table 1 above, Slot represents the slot number, starting from 1, and 10 sub-cards are 1-10. Portid represents the id of the network card, starting from 0, and the specific id is assigned by the DPDK module. Pci_addr represents the pci address of the network card, Mac_addr represents the mac address of the network card, and Slot_status represents the insertion status of the sub-card in the current slot. Empty means not inserted, and Present means inserted.
[0046] When the information table contains three virtual network cards before virtual network card A is inserted into the kernel layer, the information table is as shown in Table 2 below:
[0047] Table 2
[0048] Slot Portid Pci_addr Mac_addr Slot_status 1 0 0000:00:03.0 52:54:00:01:8c:93 Present 2 1 0000:00:04.0 52:54:00:2b:2f:a7 Present 3 2 0000:00:05.0 52:54:00:2f:fd:a7 Present 4 0 0000:00:00.0 00:00:00:00:00:00 Empty 5 0 0000:00:00.0 00:00:00:00:00:00 Empty 6 0 0000:00:00.0 00:00:00:00:00:00 Empty 7 0 0000:00:00.0 00:00:00:00:00:00 Empty 8 0 0000:00:00.0 00:00:00:00:00:00 Empty 9 0 0000:00:00.0 00:00:00:00:00:00 Empty 10 0 0000:00:00.0 00:00:00:00:00:00 Empty
[0049] When the information table contains three virtual network cards after virtual network card A is inserted into the kernel layer, the information table is as shown in Table 3 below:
[0050] Table 3
[0051]
[0052]
[0053] Specifically, it can be seen from Table 3 above that the PCI address of virtual network card A is 0000:00:06.0, and the card board status information is not empty (there is a virtual network card inserted).
[0054] Step S103: Process the target virtual network card in the DPDK module according to the configuration information to obtain a processed target virtual network card.
[0055] For example, when the control module 1 detects that the card board status information in Table 3 above indicates that a virtual network card is inserted according to the hot-plug monitoring mechanism of the virtual network card, slot 4 (slot number 4) is initialized. After the initialization is completed, the virtual network card A corresponding to slot number 4 is processed based on the DPDK module.
[0056] Optionally, in the hot-swap processing method for the virtual network card provided in an embodiment of the present application, the target virtual network card is processed in the DPDK module through configuration information, and the processed target virtual network card includes: if it is determined through the information table that the card board status information of the target virtual network card is in a non-empty state, then the DPDK module is triggered to update the configuration information in the information table; the target virtual network card is processed based on the updated configuration information to obtain the processed target virtual network card.
[0057] For example, the DPDK module receives a notification from the control module that the target virtual network card has been inserted, obtains the PCI address of virtual network card A based on the virtual network card information table, initializes the virtual network card and configures information based on the PCI address, obtains the ID information of virtual network card A and the MAC address information of virtual network card A from the information of the configured virtual network card A, and updates the configured virtual network card A information to the information table. This application further improves the hot-plug efficiency of the virtual network card based on the DPDK module's driving of the virtual network card and the efficient update of the virtual network card configuration information.
[0058] The updated configuration information of virtual network card A is shown in Table 4 below:
[0059] Table 4
[0060]
[0061]
[0062] Step S104: creating a network card interface of the processed target virtual network card.
[0063] For example, after the configuration information of the virtual network card in the information table is updated, control module 2 receives the notification sent by control module 1 that virtual network card A has been inserted into the card slot, performs initialization processing on the logical interface of virtual network card A, and creates interface information of virtual network card A, for example, the interface information of the virtual network card is Interface Ethernet4 / 0.
[0064] Optionally, in the hot-plug processing method of the virtual network card provided in an embodiment of the present application, the hierarchical structure of the target virtual machine includes at least: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display the network card interface. The present application further improves the hot-plug efficiency of the virtual network card by coordinating between the layers of the target virtual machine.
[0065] Figure 2 Schematic diagram of virtual network card insertion according to the hot plug processing method of the virtual network card provided by the embodiment of the present application, such as Figure 2 As shown, the levels of virtual network card insertion implementation include three levels. After detecting the insertion information of the target virtual network card in the kernel layer, the control module 1 in the support layer first obtains the addition event from the event queue of the target virtual network card, obtains the configuration information of the target virtual network card in the addition event, and then processes the configuration information through the DPDK module, creates the interface information of the target virtual network card through the control module 2, and finally displays the network card interface of the created target virtual network card based on the application layer.
[0066] Optionally, in the hot-swap processing method of the virtual network card provided in an embodiment of the present application, after creating the network card interface of the processed target virtual network card, the method also includes: displaying the network card interface at the application layer; detecting whether the target virtual network card is removed; if it is detected that the target virtual network card is removed, determining the removal event of the target virtual network card; adding the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; deleting the configuration information of the target virtual network card through the target address of the target virtual network card, and setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0067] For example, after the window of the application layer displays the interface information of virtual network card A, the system does not need virtual network card A after a period of time, and executes the instruction to delete slot 4. The DPDK module responds to the instruction to obtain the id information of virtual network card A to remove virtual network card A. The kernel layer detects that virtual network card A is removed, generates a removal event and inserts it into the event queue, wherein the removal event includes the PCI address of virtual network card A, and the control module 1 detects the removal event every 1 second, confirms that virtual network card A is removed through the PCI address of virtual network card A, deletes the MAC address, PCI address, and id address of virtual network card A, and sets the card board status information of the target virtual network card after the configuration information is deleted to an empty state, wherein the update of the information table after virtual network card A is removed is shown in Table 4 below:
[0068] Table 4
[0069]
[0070]
[0071] This application dynamically removes the virtual network card during the operation of the virtual machine, thereby ensuring that new network communication needs are met without interrupting the existing business data flow, and improving the hot-swap efficiency of the virtual network card.
[0072] Optionally, in the hot-swap processing method for the virtual network card provided in an embodiment of the present application, after the card board status information of the target virtual network card is set to an empty state after the configuration information is deleted, the method also includes: deleting the card board of the target virtual network card; when the card board of the target virtual network card is deleted, performing a deletion operation on the network card interface of the target virtual network card.
[0073] Specifically, Figure 3 Schematic diagram of removing a virtual network card according to a hot plug processing method of a virtual network card provided in an embodiment of the present application, such as Figure 3As shown, the DPDK module responds to the application layer instruction to remove the virtual network card A, the hot-swap monitoring mechanism of the control module 1 obtains the removal event of the virtual network card A in the kernel layer, and detects that a board has been removed, and deletes the card board of the target virtual network card. After the processing is completed, the control module 2 is notified that the card board has been deleted, and the control module 2 performs the deletion processing of the logical interface, that is, deletes Interface Ethernet4 / 0. The application layer module in the application layer triggers a command not to display the logical interface Ethernet4 / 0 of the virtual network card A.
[0074] In summary, the hot-plug processing method of the virtual network card provided in the embodiment of the present application detects the insertion action of the target virtual network card; if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, the configuration information of the target virtual network card is obtained; the target virtual network card is processed by the configuration information in the DPDK module to obtain the processed target virtual network card; and the network card interface of the processed target virtual network card is created. The problem of low hot-plug efficiency of virtual network cards in the related art is solved, and the hot-plug processing of the target virtual network card based on the configuration information of the target virtual network card in the DPDK module is performed, thereby achieving the effect of improving the hot-plug efficiency of the virtual network card.
[0075] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0076] The embodiment of the present application also provides a hot-swap processing device for a virtual network card. It should be noted that the hot-swap processing device for a virtual network card in the embodiment of the present application can be used to execute the hot-swap processing method for a virtual network card provided in the embodiment of the present application. The hot-swap processing device for a virtual network card provided in the embodiment of the present application is introduced below.
[0077] Figure 4 Schematic diagram of a hot-swap processing device for a virtual network card according to an embodiment of the present application. Figure 4 As shown, the device includes: a first detection unit 401, a first acquisition unit 402, a first processing unit 403, and a first creation unit 404.
[0078] Specifically, the first detection unit 401 is used to detect the insertion action of the target virtual network card;
[0079] The first acquisition unit 402 is used to acquire the configuration information of the target virtual network card if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine; the first processing unit 403,
[0080] Used to process the target virtual network card through configuration information in the DPDK module to obtain the processed target virtual network card;
[0081] The first creating unit 404 is configured to create a network card interface of the processed target virtual network card.
[0082] In summary, the hot-swap processing device for a virtual network card provided in an embodiment of the present application detects the insertion action of the target virtual network card through the first detection unit 401; if the first acquisition unit 402 detects that the target virtual network card is inserted into the kernel layer of the target virtual machine, it obtains the configuration information of the target virtual network card; the first processing unit 403 processes the target virtual network card through the configuration information in the DPDK module to obtain the processed target virtual network card; the first creation unit 404 creates the network card interface of the processed target virtual network card, which solves the problem of low hot-swap efficiency of the virtual network card in the related art, and achieves the effect of improving the hot-swap efficiency of the virtual network card by hot-swap processing the target virtual network card based on the configuration information of the target virtual network card in the DPDK module.
[0083] Optionally, in the hot-swap processing device of the virtual network card provided in an embodiment of the present application, the first acquisition unit 402 includes: a first determination module, used to confirm that the target virtual network card is inserted into the kernel layer of the target virtual machine if an increase in the number of virtual network cards is detected in the kernel layer; a second determination module, used to determine the addition event of the target virtual network card in the kernel layer; and a first acquisition module, used to obtain configuration information of the target virtual network card based on the addition event.
[0084] Optionally, in the hot-swap processing device of the virtual network card provided in the embodiment of the present application, the device also includes: a first adding unit, used to add the adding event to the event queue of the target virtual network card after determining the adding event of the target virtual network card in the kernel layer; a second acquiring unit, used to acquire the adding event in the event queue according to a preset duration; a first storage unit, used to store the acquired adding event in an information table, wherein the information table includes at least: configuration information of the target virtual network card, and card board status information of the target virtual network card.
[0085] Optionally, in the hot-swap processing device of the virtual network card provided in the embodiment of the present application, the first processing unit 403 includes: a first trigger module, which is used to trigger the DPDK module to update the configuration information in the information table if it is determined through the information table that the card board status information of the target virtual network card is in a non-empty state; a first processing module, which is used to process the target virtual network card based on the updated configuration information to obtain a processed target virtual network card.
[0086] Optionally, in the hot-swap processing device for the virtual network card provided in the embodiment of the present application, the hierarchical structure of the target virtual machine includes at least: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display the network card interface.
[0087] Optionally, in the hot-swap processing device of the virtual network card provided in the embodiment of the present application, the device also includes: a first display unit, used to display the network card interface at the application layer after creating the processed network card interface of the target virtual network card; a second detection unit, used to detect whether the target virtual network card is removed; a first determination unit, used to determine the removal event of the target virtual network card if it is detected that the target virtual network card is removed; a second adding unit, used to add the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; a first deleting unit, used to delete the configuration information of the target virtual network card through the target address of the target virtual network card, and set the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0088] Optionally, in the hot-swap processing device of the virtual network card provided in an embodiment of the present application, the device also includes: a second deletion unit, used to delete the card board of the target virtual network card after the card board status information of the target virtual network card is set to an empty state after the configuration information is deleted; a third deletion unit, used to perform a deletion operation on the network card interface of the target virtual network card when the card board of the target virtual network card is deleted.
[0089] The hot-plug processing device of the virtual network card includes a processor and a memory. The above-mentioned first detection unit 401, first acquisition unit 402, first processing unit 403, first creation unit 404, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0090] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the hot plugging of the virtual network card can be performed by adjusting the kernel parameters.
[0091] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0092] An embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by a processor, a hot plug processing method for a virtual network card is implemented.
[0093] An embodiment of the present invention provides a processor, which is used to run a program, wherein a hot plug processing method for a virtual network card is executed when the program is running.
[0094] An embodiment of the present invention provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: detecting an insertion action of a target virtual network card; if it is detected that the target virtual network card is inserted into the kernel layer of a target virtual machine, obtaining configuration information of the target virtual network card; processing the target virtual network card in a DPDK module according to the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
[0095] When the processor executes the program, the following steps are also implemented: if an increase in the number of virtual network cards is detected in the kernel layer, confirm that the target virtual network card is inserted into the kernel layer of the target virtual machine; determine the addition event of the target virtual network card in the kernel layer; and obtain configuration information of the target virtual network card based on the addition event.
[0096] When the processor executes the program, the following steps are also implemented: after determining the add event of the target virtual network card in the kernel layer: adding the add event to the event queue of the target virtual network card; acquiring the add event in the event queue according to a preset duration; storing the acquired add event in an information table, wherein the information table includes at least: configuration information of the target virtual network card and card board status information of the target virtual network card.
[0097] When the processor executes the program, the following steps are also implemented: if the card board status information of the target virtual network card is determined to be non-empty through the information table, the DPDK module is triggered to update the configuration information in the information table; the target virtual network card is processed based on the updated configuration information to obtain the processed target virtual network card.
[0098] When executing the program, the processor also implements the following steps: the hierarchical structure of the target virtual machine at least includes: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display the network card interface.
[0099] When the processor executes the program, the following steps are also implemented: after creating the processed network card interface of the target virtual network card, displaying the network card interface at the application layer; detecting whether the target virtual network card is removed; if it is detected that the target virtual network card is removed, determining the removal event of the target virtual network card; adding the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; deleting the configuration information of the target virtual network card through the target address of the target virtual network card, and setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0100] When the processor executes the program, the following steps are also implemented: after the card board status information of the target virtual network card after the configuration information is deleted is set to an empty state, the card board of the target virtual network card is deleted; when the card board of the target virtual network card is deleted, a deletion operation is performed on the network card interface of the target virtual network card.
[0101] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0102] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: detecting the insertion action of a target virtual network card; if it is detected that the target virtual network card is inserted into the kernel layer of a target virtual machine, obtaining configuration information of the target virtual network card; processing the target virtual network card in a DPDK module according to the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
[0103] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: if an increase in the number of virtual network cards is detected in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an addition event of the target virtual network card in the kernel layer; and obtaining configuration information of the target virtual network card based on the addition event.
[0104] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: after determining the add event of the target virtual network card in the kernel layer: adding the add event to the event queue of the target virtual network card; acquiring the add event in the event queue according to a preset time; storing the acquired add event in an information table, wherein the information table includes at least: configuration information of the target virtual network card and card board status information of the target virtual network card.
[0105] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: if the card board status information of the target virtual network card is determined to be a non-empty state through the information table, the DPDK module is triggered to update the configuration information in the information table; the target virtual network card is processed based on the updated configuration information to obtain the processed target virtual network card.
[0106] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: the hierarchical structure of the target virtual machine at least includes: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display a network card interface.
[0107] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: after creating a processed network card interface of the target virtual network card, displaying the network card interface at the application layer; detecting whether the target virtual network card is removed; if it is detected that the target virtual network card is removed, determining the removal event of the target virtual network card; adding the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; deleting the configuration information of the target virtual network card through the target address of the target virtual network card, and setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state.
[0108] When executed on a data processing device, it is also suitable for executing an initialized program having the following method steps: after setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state, deleting the card board of the target virtual network card; when the card board of the target virtual network card is deleted, performing a deletion operation on the network card interface of the target virtual network card.
[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0110] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0111] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0113] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0114] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0115] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0116] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0117] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0118] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A hot-plug processing method for a virtual network card, characterized in that: include: Detect the insertion action of the target virtual network card; If it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, obtaining configuration information of the target virtual network card; The hierarchical structure of the target virtual machine at least includes: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display a network card interface; Processing the target virtual network card in the DPDK module in the support layer according to the configuration information to obtain a processed target virtual network card; Creating a network card interface of the processed target virtual network card; After creating the processed network card interface of the target virtual network card, the method further includes: Displaying the network card interface at the application layer; Check whether the target virtual network card has been removed; If it is detected that the target virtual network card is removed, determining a removal event of the target virtual network card through the DPDK module; Adding the removal event to the event queue of the target virtual network card, wherein the event queue includes the target address of the target virtual network card; The configuration information of the target virtual network card is deleted through the target address of the target virtual network card, and the card board status information of the target virtual network card after the configuration information is deleted is set to an empty state.
2. The method according to claim 1, characterized in that If it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, obtaining the configuration information of the target virtual network card includes: If an increase in the number of virtual network cards is detected in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; Determining, in the kernel layer, an event of adding the target virtual network card; The configuration information of the target virtual network card is obtained based on the adding event.
3. The method according to claim 2, characterized in that After determining the adding event of the target virtual network card in the kernel layer, the method further includes: Adding the added event to the event queue of the target virtual network card; Acquire the added events in the event queue according to a preset duration; The acquired adding event is stored in an information table, wherein the information table at least includes: configuration information of the target virtual network card and card board status information of the target virtual network card.
4. The method according to claim 3, characterized in that The target virtual network card is processed in the DPDK module according to the configuration information, and the processed target virtual network card includes: If it is determined through the information table that the card board status information of the target virtual network card is in a non-empty state, triggering the DPDK module to update the configuration information in the information table; The target virtual network card is processed based on the updated configuration information to obtain a processed target virtual network card.
5. The method according to claim 1, characterized in that After setting the card board status information of the target virtual network card after the configuration information is deleted to an empty state, the method further includes: Deleting the card board of the target virtual network card; When the card board of the target virtual network card is deleted, a deletion operation is performed on the network card interface of the target virtual network card.
6. A hot-plug processing device for a virtual network card, characterized in that: include: A first detection unit, used to detect an insertion action of a target virtual network card; A first acquisition unit is used to acquire configuration information of the target virtual network card if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine; The hierarchical structure of the target virtual machine at least includes: a kernel layer, a support layer, and an application layer, wherein the application layer is used to display a network card interface; A first processing unit, configured to process the target virtual network card according to the configuration information in the DPDK module in the support layer to obtain a processed target virtual network card; A first creating unit, used to create a network card interface of the processed target virtual network card; The device also includes: A first display unit, configured to display the network card interface at the application layer after creating the processed network card interface of the target virtual network card; A second detection unit, used to detect whether the target virtual network card is removed; A first determining unit, configured to determine a removal event of the target virtual network card through the DPDK module if it is detected that the target virtual network card is removed; A second adding unit, configured to add a removal event to an event queue of a target virtual network card, wherein the event queue includes a target address of the target virtual network card; The first deleting unit is used to delete the configuration information of the target virtual network card through the target address of the target virtual network card.
7. A processor, characterized in that: The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 5 when running.
8. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for realizing network card hot plug by linux virtual machine
CN105573791A
Configuration method of newly added network card of Linux virtual machine and related components
CN110798346A
