CN113778626A - Hot plug processing method and device for virtual network card, storage medium and processor - Google Patents

Hot plug processing method and device for virtual network card, storage medium and processor Download PDF

Info

Publication number
CN113778626A
CN113778626A CN202111015923.0A CN202111015923A CN113778626A CN 113778626 A CN113778626 A CN 113778626A CN 202111015923 A CN202111015923 A CN 202111015923A CN 113778626 A CN113778626 A CN 113778626A
Authority
CN
China
Prior art keywords
network card
virtual network
target virtual
configuration information
card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111015923.0A
Other languages
Chinese (zh)
Inventor
高雪琴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hillstone Networks Co Ltd
Original Assignee
Hillstone Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hillstone Networks Co Ltd filed Critical Hillstone Networks Co Ltd
Priority to CN202111015923.0A priority Critical patent/CN113778626A/en
Publication of CN113778626A publication Critical patent/CN113778626A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a hot plug processing method and device of a virtual network card, a storage medium and a processor. The method comprises the following steps: detecting the insertion action of a target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card. Through the application, the problem that the hot plug efficiency of the virtual network card is low in the related technology is solved.

Description

Hot plug processing method and device for virtual network card, storage medium and processor
Technical Field
The present application relates to the field of network card drivers, and in particular, to a method and an apparatus for hot plug processing of a virtual network card, a storage medium, and a processor.
Background
In the internet era, cloud computing is prevalent, and a lot of services/devices run on a cloud platform and provide services in a virtual machine mode. The continuous change of the network environment can bring about the change of the network topology, so that the virtual network card can be dynamically added or deleted in the running state of the virtual machine, thereby ensuring that the new network communication requirement is realized under the condition that the existing service data flow is not interrupted.
Aiming at the problem of low hot plug efficiency of the virtual network card in the related technology, no effective solution is provided at present.
Disclosure of Invention
The present application mainly aims to provide a method, an apparatus, a storage medium, and a processor for hot plug processing of a virtual network card, so as to solve the problem of low hot plug efficiency of the virtual network card in the related art.
In order to achieve the above object, according to an aspect of the present application, a method for hot-plug processing of a virtual network card is provided. The method comprises the following steps: detecting the insertion action of a target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
Further, if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card includes: if the number of the virtual network cards is detected to increase in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an adding event of a target virtual network card in a kernel layer; and acquiring the configuration information of the target virtual network card based on the adding event.
Further, after determining an adding event of the target virtual network card in the kernel layer, the method further includes: adding the adding event into an event queue of the target virtual network card; acquiring an added event in the event queue according to a preset time length; storing the acquired adding event into an information table, wherein the information table at least comprises: configuration information of the target virtual network card and card board state information of the target virtual network card.
Further, processing the target virtual network card in the DPDK module through the configuration information, and obtaining the processed target virtual network card includes: if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table, triggering the DPDK module to update the configuration information in the information table; and processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
Further, the hierarchy of the target virtual machine includes at least: the network interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface.
Further, after creating a network card interface of the processed target virtual network card, the method further includes: displaying a network card interface on an application layer; detecting whether the target virtual network card is moved out; if the target virtual network card is detected to be moved out, determining a moving-out event of the target virtual network card; adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
Further, after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state, the method further includes: deleting the clamping plate of the target virtual network card; and under the condition that the card board of the target virtual network card is deleted, executing deletion operation on the network card interface of the target virtual network card.
In order to achieve the above object, according to another aspect of the present application, a hot plug processing apparatus for a virtual network card is provided. The device includes: the first detection unit is used for detecting the insertion action of the target virtual network card; the first acquisition unit is used for acquiring the configuration information of the target virtual network card if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine; the first processing unit is used for processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and the first creating unit is used for creating the network card interface of the processed target virtual network card.
Further, the first acquisition unit includes: the first determining module is used for determining that the target virtual network card is inserted into the kernel layer of the target virtual machine if the number of the virtual network cards is increased when the kernel layer is detected; the second determining module is used for determining an adding event of the target virtual network card in the kernel layer; and the first acquisition module is used for acquiring the configuration information of the target virtual network card based on the adding event.
Further, the apparatus further comprises: the first adding unit is used for adding an adding event of the target virtual network card into an event queue of the target virtual network card after the adding event of the target virtual network card is determined in the kernel layer; the second acquisition unit is used for acquiring the adding event in the event queue according to the preset duration; a first storing unit, configured to store the obtained addition event in an information table, where the information table at least includes: configuration information of the target virtual network card and card board state information of the target virtual network card.
Further, the first processing unit includes: the first triggering module is used for triggering the DPDK module to update the configuration information in the information table if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table; and the first processing module is used for processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
Further, the hierarchy of the target virtual machine includes at least: the network interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface.
Further, the apparatus further comprises: the first display unit is used for displaying the network card interface on the application layer after the network card interface of the processed target virtual network card is established; the second detection unit is used for detecting whether the target virtual network card is moved out; the first determining unit is used for determining a removal event of the target virtual network card if the target virtual network card is detected to be removed; the second adding unit is used for adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a target address of the target virtual network card; and the first deleting unit is used for 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
Further, the apparatus further comprises: the second deleting unit is used for deleting the card board of the target virtual network card after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state; and the third deleting unit is used for executing deleting operation on the network card interface of the target virtual network card under the condition that the card board of the target virtual network card is deleted.
According to another aspect of the embodiments of the present application, there is also provided a processor configured to execute a program, where the program executes to perform the method of any one of the above.
According to another aspect of embodiments of the present application, there is also provided a computer-readable storage medium having stored thereon a computer program/instructions which, when executed by a processor, perform the method of any one of the above.
Through the application, the following steps are adopted: detecting the insertion action of a target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card. The problem of low hot plug efficiency to the virtual network card in the correlation technique is solved, and hot plug processing is carried out to the target virtual network card based on the configuration information of the target virtual network card in the DPDK module, so that the effect of improving the hot plug efficiency of the virtual network card is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
fig. 1 is a flowchart of a hot plug processing method of a virtual network card according to an embodiment of the present application;
fig. 2 is a schematic diagram illustrating virtual network card insertion according to the hot plug processing method for a virtual network card provided in the embodiment of the present application;
fig. 3 is a schematic diagram of virtual network card removal according to the hot plug processing method of the virtual network card provided in the embodiment of the present application; and
fig. 4 is a schematic diagram of a hot plug processing device of a virtual network card according to an embodiment of the present application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, some terms or expressions referred to in the embodiments of the present application are explained below:
DPDK: the Data Plane Development Kit (Data Plane Development Kit) mainly operates based on a Linux system, is used for a function library and a drive set for rapidly processing Data packets, and can greatly improve the Data processing performance and throughput and improve the working efficiency of a Data Plane application program.
According to the embodiment of the application, a hot plug processing method of a virtual network card is provided.
Fig. 1 is a flowchart of a hot plug processing method of a virtual network card according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, detecting the insertion action of the target virtual network card.
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.
Step S102, if it is detected that the target virtual network card is inserted into the kernel layer of the target virtual machine, configuration information of the target virtual network card is obtained.
For example, before the virtual network card a (corresponding to the target virtual network card in this application, the same applies below) is inserted into the kernel layer, the kernel layer already has a plurality of virtual network cards, obtains configuration information of the virtual network card a, and adds the virtual network card a to a plurality of virtual network card queues.
Optionally, in the hot plug processing method for a virtual network card provided in the embodiment of the present application, if it is detected that a target virtual network card is inserted into a kernel layer of a target virtual machine, acquiring configuration information of the target virtual network card includes: if the number of the virtual network cards is detected to increase in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an adding event of a target virtual network card in a kernel layer; and acquiring the configuration information of the target virtual network card based on the adding event.
For example, the number of the virtual network cards in the kernel layer is 3, when the virtual network card a is inserted into the kernel layer, and when the increase of the number of the virtual network cards is detected in the kernel layer, it is determined that the virtual network card is inserted into the kernel layer of the target virtual machine, an event that the virtual network card a is added into the kernel layer is determined as an addition event of the virtual network card a, and the addition event of the virtual network card a includes a PCI address of a, where the configuration information of the target virtual network card at least includes the PCI address.
Optionally, in the hot plug processing method for a virtual network card provided in this embodiment of the present application, after determining an addition event of a target virtual network card in the kernel layer, the method further includes: adding the adding event into an event queue of the target virtual network card; acquiring an added event in the event queue according to a preset time length; storing the acquired adding event into an information table, wherein the information table at least comprises: configuration information of the target virtual network card and card board state information of the target virtual network card.
For example, adding an adding event of the virtual network card a into a time queue, detecting the adding event of the event queue every 1s (corresponding to a preset duration in the present application) by the control module 1, obtaining a PCI address of the virtual network card in the adding event of the virtual network card a, storing the PCI address into an information table of the virtual network card, setting an insertion state of a slot position daughter card in the current virtual network card (corresponding to card board state information of a target virtual network card in the present application), and adding the adding event into the event queue of the target virtual network card, so that the control module 1 can obtain the insertion state of the target virtual network card in real time, thereby improving the hot plug efficiency of the virtual network card.
For example, based on the information table of the virtual network card obtained by the control module 1, the information table at initialization is shown in the following table one:
watch 1
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
As shown in the first table, Slot represents a Slot number, starting from 1, 10 daughter cards are 1-10, port represents an id of a network card, starting from 0, a specific id is allocated by a DPDK module, Pci _ addr represents a Pci address of the network card, Mac _ addr represents a Mac address of the network card, Slot _ status represents an insertion state of the current Slot daughter card, Empty represents not inserted, and Present represents inserted.
When the information table already contains 3 virtual network cards before the virtual network card a is inserted into the kernel layer, the information table is as shown in the following table two:
watch two
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
When the information table already contains 3 virtual network cards after the virtual network card a is inserted into the kernel layer, the information table is as shown in table three below:
watch III
Figure BDA0003239777350000061
Figure BDA0003239777350000071
Specifically, as can be seen from the above table three, the PCI address of the virtual network card a is 0000:00:06.0, and the card board status information is in a non-null state (there is a virtual network card insertion).
Step S103, the target virtual network card is processed in the DPDK module through the configuration information, and the processed target virtual network card is obtained.
For example, when monitoring that the card board state information in the table three is a virtual network card inserted according to a hot plug monitoring mechanism of the virtual network card, the control module 1 initializes slot4 (slot number 4), and after the initialization is completed, processes the virtual network card a corresponding to slot number 4 based on the DPDK module.
Optionally, in the hot plug processing method for a virtual network card provided in the embodiment of the present application, processing a target virtual network card in a DPDK module through configuration information, and obtaining the processed target virtual network card includes: if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table, triggering the DPDK module to update the configuration information in the information table; and processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
For example, the DPDK module receives a notification that the target virtual network card sent by the control module has been inserted, acquires the PCI address of the virtual network card a based on the virtual network card information table, initializes the virtual network card based on the PCI address and configures the information, acquires the ID information of the virtual network card a and the MAC address information of the virtual network card a from the configured information of the virtual network card a, and updates the configured information of the virtual network card a into the information table.
The updated configuration information of the virtual network card a is shown in the following table four:
watch four
Figure BDA0003239777350000072
Figure BDA0003239777350000081
And step S104, creating a network card interface of the processed target virtual network card.
For example, after the configuration information of the virtual network card in the information table is updated, the control module 2 receives a notification that the virtual network card a is inserted into the card slot, which is sent by the control module 1, executes initialization processing of the logical Interface on the virtual network card a, and creates Interface information of the virtual network card a, for example, the Interface information of the virtual network card is Interface Ethernet 4/0.
Optionally, in the hot plug processing method for a virtual network card provided in the embodiment of the present application, the hierarchical structure of the target virtual machine at least includes: the virtual network card hot plug system comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface, and the hot plug efficiency of the virtual network card is further improved by mutually matching the levels of a target virtual machine.
Fig. 2 is a schematic diagram of virtual network card insertion according to the hot plug processing method for a virtual network card provided in the embodiment of the present application, and as shown in fig. 2, the implementation hierarchy of virtual network card insertion includes three hierarchies, after the insertion information of a target virtual network card is detected in the kernel layer, the control module 1 in the support layer first obtains an addition event from the event queue of the target virtual network card, obtains configuration information of the target virtual network card in the addition event, then processes the configuration information through the DPDK module, creates interface information of the target virtual network card through the control module 2, and finally displays the created network card interface of the target virtual network card based on the application layer.
Optionally, in the hot plug processing method for a virtual network card provided in the embodiment of the present application, after a network card interface of a processed target virtual network card is created, the method further includes: displaying a network card interface on an application layer; detecting whether the target virtual network card is moved out; if the target virtual network card is detected to be moved out, determining a moving-out event of the target virtual network card; adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
For example, after the window of the application layer displays the interface information of the virtual network card a, the system does not need the virtual network card a after a period of time, and executes an instruction of deleting the slot position 4, the DPDK module responds to the instruction to obtain id information of the virtual network card a, so as to implement removal of the virtual network card a, the kernel layer detects that the virtual network card a is removed, generates a removal event and inserts the removal event into the event queue, wherein the removal event includes a PCI address of the virtual network card a, the control module 1 detects the removal event every 1 second, confirms that the virtual network card a is removed through the PCI address of the virtual network card a, deletes the MAC address, the PCI address and the id address of the virtual network card a, and sets the card board state information of the target virtual network card with the configuration information deleted to be in an empty state, wherein the information table is updated after the virtual network card a is removed as shown in the following four tables:
watch four
Figure BDA0003239777350000082
Figure BDA0003239777350000091
According to the method and the device, the virtual network card is dynamically moved out in the running process of the virtual machine, so that the new network communication requirement is met under the condition that the existing service data flow is not interrupted, and the hot plug efficiency of the virtual network card is improved.
Optionally, in the hot plug processing method for a virtual network card provided in this embodiment of the present application, after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state, the method further includes: deleting the clamping plate of the target virtual network card; and under the condition that the card board of the target virtual network card is deleted, executing deletion operation on the network card interface of the target virtual network card.
Specifically, fig. 3 is a schematic diagram of virtual network card removal according to the hot plug processing method for a virtual network card provided in the embodiment of the present application, as shown in fig. 3, a DPDK module responds to an application layer instruction to remove the virtual network card a, a hot plug monitoring mechanism of a control module 1 obtains a removal event of the virtual network card a in a kernel layer, detects that a board removal occurs, deletes a board of a target virtual network card, and after the processing is completed, notifies the control module 2 that the board has been deleted, and notifies the control module 2 that a logical Interface has been deleted, that is, the Interface Ethernet4/0 is deleted, and an application layer module in an application layer triggers an instruction to not display a logical Interface Ethernet4/0 of the virtual network card a.
In summary, the hot plug processing method for the virtual network card provided in the embodiment of the present application detects the insertion motion of the target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card. The problem of low hot plug efficiency to the virtual network card in the correlation technique is solved, and hot plug processing is carried out to the target virtual network card based on the configuration information of the target virtual network card in the DPDK module, so that the effect of improving the hot plug efficiency of the virtual network card is achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the present application further provides a hot plug processing device for a virtual network card, which needs to be described. The hot plug processing device of the virtual network card provided by the embodiment of the present application is described below.
Fig. 4 is a schematic diagram of a hot plug processing device of a virtual network card according to an embodiment of the present application. As shown in fig. 4, the apparatus includes: a first detection unit 401, a first acquisition unit 402, a first processing unit 403, a first creation unit 404.
Specifically, the first detecting unit 401 is configured to detect an insertion action of a target virtual network card;
a first obtaining unit 402, configured to obtain configuration information of a target virtual network card if it is detected that the target virtual network card is inserted into a kernel layer of a target virtual machine; the first processing unit 403 is used for processing the image,
the DPDK module is used for processing the target virtual network card through the configuration information to obtain a processed target virtual network card;
a first creating unit 404, configured to create a network card interface of the processed target virtual network card.
To sum up, the hot plug processing apparatus for a virtual network card provided in the embodiment of the present application detects an insertion motion of a target virtual network card through the first detection unit 401; if detecting that the target virtual network card is inserted into the kernel layer of the target virtual machine, the first obtaining unit 402 obtains configuration information of the target virtual network card; the first processing unit 403 processes the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; the first creating unit 404 creates the network card interface of the processed target virtual network card, so as to solve the problem of low hot plug efficiency of the virtual network card in the related art, and the hot plug processing is performed on the target virtual network card based on the configuration information of the target virtual network card in the DPDK module, so that the effect of improving the hot plug efficiency of the virtual network card is achieved.
Optionally, in the hot plug processing apparatus for a virtual network card provided in this embodiment of the application, the first obtaining unit 402 includes: the first determining module is used for determining that the target virtual network card is inserted into the kernel layer of the target virtual machine if the number of the virtual network cards is increased when the kernel layer is detected; the second determining module is used for determining an adding event of the target virtual network card in the kernel layer; and the first acquisition module is used for acquiring the configuration information of the target virtual network card based on the adding event.
Optionally, in the hot plug processing apparatus for a virtual network card provided in this embodiment of the present application, the apparatus further includes: the first adding unit is used for adding an adding event of the target virtual network card into an event queue of the target virtual network card after the adding event of the target virtual network card is determined in the kernel layer; the second acquisition unit is used for acquiring the adding event in the event queue according to the preset duration; a first storing unit, configured to store the obtained addition event in an information table, where the information table at least includes: configuration information of the target virtual network card and card board state information of the target virtual network card.
Optionally, in the hot plug processing device of a virtual network card provided in this embodiment of the present application, the first processing unit 403 includes: the first triggering module is used for triggering the DPDK module to update the configuration information in the information table if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table; and the first processing module is used for processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
Optionally, in the hot plug processing apparatus for a virtual network card provided in the embodiment of the present application, the hierarchical structure of the target virtual machine at least includes: the network interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface.
Optionally, in the hot plug processing apparatus for a virtual network card provided in this embodiment of the present application, the apparatus further includes: the first display unit is used for displaying the network card interface on the application layer after the network card interface of the processed target virtual network card is established; the second detection unit is used for detecting whether the target virtual network card is moved out; the first determining unit is used for determining a removal event of the target virtual network card if the target virtual network card is detected to be removed; the second adding unit is used for adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a target address of the target virtual network card; and the first deleting unit is used for 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
Optionally, in the hot plug processing apparatus for a virtual network card provided in this embodiment of the present application, the apparatus further includes: the second deleting unit is used for deleting the card board of the target virtual network card after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state; and the third deleting unit is used for executing deleting operation on the network card interface of the target virtual network card under the condition that the card board of the target virtual network card is deleted.
The hot plug processing device of the virtual network card comprises a processor and a memory, the first detection unit 401, the first obtaining unit 402, the first processing unit 403, the first creating unit 404, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and hot plug processing of the virtual network card is carried out by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the invention provides a storage medium, wherein a program is stored on the storage medium, and the program realizes the hot plug processing method of a virtual network card when being executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein a hot plug processing method of a virtual network card is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps: detecting the insertion action of a target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
The processor executes the program and further realizes the following steps: if the number of the virtual network cards is detected to increase in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an adding event of a target virtual network card in a kernel layer; and acquiring the configuration information of the target virtual network card based on the adding event.
The processor executes the program and further realizes the following steps: after determining the adding event of the target virtual network card in the kernel layer: adding the adding event into an event queue of the target virtual network card; acquiring an added event in the event queue according to a preset time length; storing the acquired adding event into an information table, wherein the information table at least comprises: configuration information of the target virtual network card and card board state information of the target virtual network card.
The processor executes the program and further realizes the following steps: if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table, triggering the DPDK module to update the configuration information in the information table; and processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
The processor executes the program and further realizes the following steps: the hierarchy of the target virtual machine includes at least: the network interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface.
The processor executes the program and further realizes the following steps: after a network card interface of the processed target virtual network card is established, displaying the network card interface on an application layer; detecting whether the target virtual network card is moved out; if the target virtual network card is detected to be moved out, determining a moving-out event of the target virtual network card; adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
The processor executes the program and further realizes the following steps: deleting the card board of the target virtual network card after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state; and under the condition that the card board of the target virtual network card is deleted, executing deletion operation on the network card interface of the target virtual network card.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: detecting the insertion action of a target virtual network card; if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card; processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card; and creating a network card interface of the processed target virtual network card.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: if the number of the virtual network cards is detected to increase in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine; determining an adding event of a target virtual network card in a kernel layer; and acquiring the configuration information of the target virtual network card based on the adding event.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: after determining the adding event of the target virtual network card in the kernel layer: adding the adding event into an event queue of the target virtual network card; acquiring an added event in the event queue according to a preset time length; storing the acquired adding event into an information table, wherein the information table at least comprises: configuration information of the target virtual network card and card board state information of the target virtual network card.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table, triggering the DPDK module to update the configuration information in the information table; and processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: the hierarchy of the target virtual machine includes at least: the network interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying a network card interface.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: after a network card interface of the processed target virtual network card is established, displaying the network card interface on an application layer; detecting whether the target virtual network card is moved out; if the target virtual network card is detected to be moved out, determining a moving-out event of the target virtual network card; adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: deleting the card board of the target virtual network card after the card board state information of the target virtual network card after the configuration information is deleted is set to be in an empty state; and under the condition that the card board of the target virtual network card is deleted, executing deletion operation on the network card interface of the target virtual network card.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A hot plug processing method of a virtual network card is characterized by comprising the following steps:
detecting the insertion action of a target virtual network card;
if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine, acquiring configuration information of the target virtual network card;
processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card;
and creating a network card interface of the processed target virtual network card.
2. The method of claim 1, wherein if it is detected that the target virtual network card is inserted into a kernel layer of a target virtual machine, acquiring configuration information of the target virtual network card comprises:
if the number of the virtual network cards is detected to increase in the kernel layer, confirming that the target virtual network card is inserted into the kernel layer of the target virtual machine;
determining an adding event of the target virtual network card in the kernel layer;
and acquiring the configuration information of the target virtual network card based on the adding event.
3. The method of claim 2, wherein after determining the add event for the target virtual network card in the kernel layer, the method further comprises:
adding the adding event into an event queue of the target virtual network card;
acquiring the added events in the event queue according to a preset time length;
storing the acquired adding event into an information table, wherein the information table at least comprises: the configuration information of the target virtual network card and the card board state information of the target virtual network card.
4. The method of claim 3, wherein processing the target virtual network card through the configuration information in the DPDK module to obtain the processed target virtual network card comprises:
if the card board state information of the target virtual network card is determined to be in a non-empty state through the information table, triggering the DPDK module to update the configuration information in the information table;
and processing the target virtual network card based on the updated configuration information to obtain the processed target virtual network card.
5. The method of claim 1, wherein the hierarchy of target virtual machines comprises at least: the network card interface comprises a kernel layer, a supporting layer and an application layer, wherein the application layer is used for displaying the network card interface.
6. The method of claim 5, wherein after creating the network card interface of the processed target virtual network card, the method further comprises:
displaying the network card interface on the application layer;
detecting whether the target virtual network card is moved out;
if the target virtual network card is detected to be moved out, determining a moving-out event of the target virtual network card;
adding the removal event into an event queue of the target virtual network card, wherein the event queue comprises a 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 state information of the target virtual network card after the configuration information is deleted to be in an empty state.
7. The method according to claim 6, wherein after setting the card board status information of the target virtual network card after the configuration information is deleted to be in an empty status, the method further comprises:
deleting the clamping plate of the target virtual network card;
and under the condition that the card board of the target virtual network card is deleted, executing deletion operation on the network card interface of the target virtual network card.
8. A hot plug processing device of a virtual network card is characterized by comprising:
the first detection unit is used for detecting the insertion action of the target virtual network card;
the first acquisition unit is used for acquiring the configuration information of the target virtual network card if the target virtual network card is detected to be inserted into the kernel layer of the target virtual machine;
the first processing unit is used for processing the target virtual network card in the DPDK module through the configuration information to obtain a processed target virtual network card;
and the first creating unit is used for creating the network card interface of the processed target virtual network card.
9. A processor, characterized in that the processor is configured to run a program, wherein the program when running performs the method of any of claims 1 to 7.
10. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program performs the method of any one of claims 1 to 7.
CN202111015923.0A 2021-08-31 2021-08-31 Hot plug processing method and device for virtual network card, storage medium and processor Pending CN113778626A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111015923.0A CN113778626A (en) 2021-08-31 2021-08-31 Hot plug processing method and device for virtual network card, storage medium and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111015923.0A CN113778626A (en) 2021-08-31 2021-08-31 Hot plug processing method and device for virtual network card, storage medium and processor

Publications (1)

Publication Number Publication Date
CN113778626A true CN113778626A (en) 2021-12-10

Family

ID=78840341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111015923.0A Pending CN113778626A (en) 2021-08-31 2021-08-31 Hot plug processing method and device for virtual network card, storage medium and processor

Country Status (1)

Country Link
CN (1) CN113778626A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050138620A1 (en) * 2003-12-18 2005-06-23 Saul Lewites Virtual network interface
US20140181810A1 (en) * 2012-12-21 2014-06-26 Red Hat Israel, Ltd. Automatic discovery of externally added devices
CN105573791A (en) * 2015-12-15 2016-05-11 国云科技股份有限公司 Method for realizing network card hot plug by linux virtual machine
CN106301859A (en) * 2015-06-09 2017-01-04 华为技术有限公司 A kind of manage the method for network interface card, Apparatus and system
WO2017152633A1 (en) * 2016-03-09 2017-09-14 中兴通讯股份有限公司 Port binding implementation method and device
WO2020019950A1 (en) * 2018-07-23 2020-01-30 南京中兴软件有限责任公司 Physical function multiplexing method and apparatus and computer storage medium
CN110798346A (en) * 2019-10-25 2020-02-14 北京浪潮数据技术有限公司 Configuration method of newly added network card of Linux virtual machine and related components
CN112615781A (en) * 2020-12-09 2021-04-06 网宿科技股份有限公司 Method and server for realizing BGP message interaction in DPDK
CN112787903A (en) * 2020-12-24 2021-05-11 郑州信大捷安信息技术股份有限公司 Multi-protocol VPN gateway fusion system and method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050138620A1 (en) * 2003-12-18 2005-06-23 Saul Lewites Virtual network interface
US20140181810A1 (en) * 2012-12-21 2014-06-26 Red Hat Israel, Ltd. Automatic discovery of externally added devices
CN106301859A (en) * 2015-06-09 2017-01-04 华为技术有限公司 A kind of manage the method for network interface card, Apparatus and system
CN105573791A (en) * 2015-12-15 2016-05-11 国云科技股份有限公司 Method for realizing network card hot plug by linux virtual machine
WO2017152633A1 (en) * 2016-03-09 2017-09-14 中兴通讯股份有限公司 Port binding implementation method and device
WO2020019950A1 (en) * 2018-07-23 2020-01-30 南京中兴软件有限责任公司 Physical function multiplexing method and apparatus and computer storage medium
CN110798346A (en) * 2019-10-25 2020-02-14 北京浪潮数据技术有限公司 Configuration method of newly added network card of Linux virtual machine and related components
CN112615781A (en) * 2020-12-09 2021-04-06 网宿科技股份有限公司 Method and server for realizing BGP message interaction in DPDK
CN112787903A (en) * 2020-12-24 2021-05-11 郑州信大捷安信息技术股份有限公司 Multi-protocol VPN gateway fusion system and method

Similar Documents

Publication Publication Date Title
CN102419803B (en) Method, system and device for searching and killing computer virus
CN110247984B (en) Service processing method, device and storage medium
US20170140315A1 (en) Managing incident tickets in a cloud managed service environment
CN113037794B (en) Method, device and system for computing resource allocation scheduling
US11036535B2 (en) Data storage method and apparatus
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
US10282120B2 (en) Method, apparatus and system for inserting disk
CN107908957B (en) Safe operation management method and system of intelligent terminal
CN112087401A (en) Method and device for realizing service quality in distributed storage
CN115599300A (en) Task allocation method, device, equipment and medium
US20220206836A1 (en) Method and Apparatus for Processing Virtual Machine Migration, Method and Apparatus for Generating Virtual Machine Migration Strategy, Device and Storage Medium
CN113641446A (en) Memory snapshot creating method, device and equipment and readable storage medium
CN112596669A (en) Data processing method and device based on distributed storage
CN111367609A (en) Desktop switching method based on intelligent desktop virtualization IDV framework
CN113778626A (en) Hot plug processing method and device for virtual network card, storage medium and processor
CN109840094B (en) Database deployment method and device and storage equipment
CN109995571B (en) Method and device for matching server configuration and VNF application
CN111475424A (en) Method, apparatus and computer program product for managing a storage system
US11262932B2 (en) Host-aware discovery and backup configuration for storage assets within a data protection environment
CN110300068B (en) ARP resource management method and device and electronic equipment
CN113114571A (en) Data packet processing method and device, electronic equipment and storage medium
CN109144740B (en) Distributed lock implementation method and device
CN113342270A (en) Volume unloading method and device and electronic equipment
CN113126912A (en) Personal disk mounting method and device
CN109426559B (en) Command issuing method and device, storage medium and processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination