Virtual network card binding and unbinding method and device, computing node and storage medium
By implementing dynamic binding and unbinding management of virtual network cards on the OpenStack cloud computing platform, the problem of the inability to adjust the number of SR-IOV virtual network cards during the virtual machine operation stage is solved, and the efficiency of VF equipment and user experience is improved.
Patent Information
- Application Number
- CN202010632622.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-01
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2040-07-01
AI Technical Summary
The existing OpenStack cloud computing platform does not support dynamic adjustment of the number of SR-IOV virtual network cards during the virtual machine operation stage, resulting in low efficiency of VF equipment and limited network scalability, affecting business continuity and user experience.
By implementing dynamic management of virtual network card binding and unbinding on the computing nodes of the cloud computing platform, the database is used to record the mapping relationship between the virtual machine and VF resources, and dynamically binding and unbinding VF network card resources in the running state of the virtual machine, avoiding Added API to reuse native interfaces to implement functions.
It realizes dynamic SR-IOV VF network card resource management of virtual machines in operation, improves resource usage efficiency, ensures business continuity, and optimizes customer usage experience.
Smart Images

Figure CN113961301B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to a virtual network card creation technology in a cloud computing platform network, and more particularly to a virtual network card binding method and device, a virtual network card unbinding device, a computing node, and a storage medium. Background Art
[0002] According to the definition of the National Institute of Standards and Technology of the United States, cloud computing is a pay-per-use model that provides available, convenient, on-demand network access, and users can use computing, network, storage and other resources on demand. OpenStack is an open source cloud computing management platform project, and is the de facto open source cloud computing infrastructure as a service (IAAS) layer standard. It defines and provides a set of services required by various IAAS layers, including network, virtualization, operating system, and server, which can help service providers and enterprises realize their own cloud infrastructure services.
[0003] Single Root I / O Virtualization (SR-IOV) is a network input / output (I / O) virtualization technology that allows virtual hosts to directly use physical network card PCI devices to achieve virtual machine network acceleration. Compared with network card pass-through technology, this technology not only inherits the high performance advantage of network card pass-through, but also supports cross-virtual machine sharing of physical I / O devices, and has good application prospects. SR-IOV technology introduces two types of network functions: physical function (PF) and virtual function (VF). Among them, PF is a peripheral component interconnect standard (PCI) function supported by the physical network card. A PF can extend several VFs according to the network card indicators; VF is a virtual network card virtualized by PF, presented as an independent network card. Each VF has an independent PCI configuration and shares a physical network card resource with other VFs. Virtual machines can directly access physical network card devices by binding VFs to achieve network acceleration.
[0004] Network I / O virtualization is an important part of cloud computing server virtualization. Compared with computing virtualization, network I / O virtualization technology is currently lagging behind. The current mainstream network virtualization technologies are roughly divided into three types: full virtualization, network card passthrough, and SR-IOV. Among them, full virtualization technology refers to the virtual machine management layer simulating the virtual network card, and the virtual machine can directly drive the virtual network card. This technology has the best scalability and flexibility, but its disadvantage is that the virtual machine network I / O performance is poor; SR-IOV is a hardware-level technical solution proposed by Intel to solve the virtualization network I / O performance. This solution has the high-performance advantage of network card passthrough and virtualization characteristics. It supports virtual machines to share physical network devices. Therefore, it has broad application prospects in cloud computing scenarios.
[0005] The OpenStack computing management service currently supports virtual machines using SR-IOV network card devices, but the supported business scenarios are limited to the stage of creating virtual machines, that is, users are supported to specify the use of SR-IOV VF network cards during the stage of creating virtual machines. If the user's virtual machine has been established and running normally, the user is not supported to dynamically adjust the number of SR-IOV network cards bound to the virtual machine. Therefore, not allowing user virtual machines to dynamically use VF devices will reduce the efficiency of SR-IOV VF device use and also limit the network scalability of user virtual machines. If the user wants to expand the number of VFs used by the virtual machine, the user must first shut down the virtual machine and manually configure the use of VF. This operation will affect the user's business continuity and have an adverse impact on customer business, user experience and the quality of service of cloud computing providers. Summary of the invention
[0006] In view of this, embodiments of the present application provide a virtual network card binding method and device, a virtual network card unbinding device, a computing node, and a storage medium.
[0007] The present application provides a method for binding a virtual network card, including:
[0008] A computing node in a cloud computing platform network receives a binding request for a virtual machine to bind a virtual network card sent by a virtual machine management application, and in response to the binding request, queries a database for available virtual function VF resources of the computing node;
[0009] Constructing a peripheral component interconnect standard request PCI_request based on available VF resources, establishing a mapping relationship between a virtual logical port created by a virtual machine, an identifier of the PCI_request and a peripheral component interconnect standard PCI number index corresponding to the available VF resources, and recording the mapping relationship in the database;
[0010] A network card configuration file of the virtual machine is generated based on the mapping relationship, and the network card configuration file is sent to the virtual machine to trigger the virtual machine to load the virtual network card resources.
[0011] As an implementation manner, after constructing the PCI_request based on the available VF resources, the method further includes:
[0012] The queried available VF resources are marked as allocated.
[0013] As an implementation mode, the method further includes:
[0014] If the available VF resource allocation fails, the mapping relationship between the virtual logical port, the identifier of the PCI_request and the PCI number index corresponding to the available VF resource in the database is cleared, and the available VF resource is marked as an available state.
[0015] As an implementation mode, the method further includes:
[0016] Before the virtual machine initiates a request to bind a virtual network card, a virtual logical port of a single root input and output virtualization SR-IOV type is created, and the virtual machine is bound to the virtual logical port.
[0017] As an implementation mode, the method further includes:
[0018] The computing node receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship including the virtual logical port identifier based on the virtual logical port identifier in the unbinding request;
[0019] The available VF resources corresponding to the identifier of the PCI_request in the logical relationship are released, and the released available VF resources are marked as being in an available state.
[0020] The embodiment of the present application also provides a method for unbinding a virtual network card, comprising:
[0021] A computing node in a cloud computing platform network receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship including the virtual logical port identifier based on the virtual logical port identifier in the unbinding request; the mapping relationship at least includes an association relationship between the virtual logical port created by the virtual machine, an identifier of a peripheral component interconnect standard request PCI_request, and a peripheral component interconnect standard PCI number index corresponding to an available VF resource of the computing node;
[0022] The available VF resources corresponding to the identifier of the PCI_request in the logical relationship are released, and the released available VF resources are marked as being in an available state.
[0023] As an implementation mode, the method further includes:
[0024] The computing node sends the information of unbinding the virtual machine and the virtual network card to the virtual machine through the virtual machine management application.
[0025] The embodiment of the present application also provides a virtual network card binding device, including:
[0026] A receiving unit, configured to receive a binding request for binding a virtual machine to a virtual network card sent by a virtual machine management application;
[0027] A query unit, configured to query available virtual function VF resources of a computing node in a database in response to the binding request;
[0028] An establishing unit, configured to construct a peripheral component interconnect standard request PCI_request based on available VF resources, and establish a mapping relationship between a virtual logical port created by a virtual machine, an identifier of the PCI_request, and a peripheral component interconnect standard PCI number index corresponding to the available VF resources;
[0029] A recording unit, used for recording the mapping relationship in the database;
[0030] A generating unit, configured to generate a network card configuration file of the virtual machine based on the mapping relationship;
[0031] The sending unit is used to send the network card configuration file to the virtual machine to trigger the virtual machine to load the virtual network card resources.
[0032] As an implementation method, the device further includes:
[0033] The clearing unit is used to clear the mapping relationship between the virtual logical port, the identifier of the PCI_request and the PCI number index corresponding to the available VF resource in the database when the allocation of the available VF resource fails, and mark the available VF resource as an available state.
[0034] As an implementation method, the receiving unit is further used to receive an unbinding request for unbinding the virtual machine and the virtual network card sent by the virtual machine management application; the device also includes:
[0035] A searching unit, configured to search a database for a mapping relationship including the virtual logical port identifier in response to the unbinding request and based on the virtual logical port identifier in the unbinding request;
[0036] The releasing unit is used to release the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and mark the released available VF resources as available.
[0037] The embodiment of the present application also provides a virtual network card unbinding device, including:
[0038] A receiving unit, configured to receive an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application;
[0039] A search unit, configured to search, in response to the unbinding request, a mapping relationship including the virtual logical port identifier in the database based on the virtual logical port identifier in the unbinding request; the mapping relationship at least includes an association relationship between the virtual logical port created by the virtual machine, the identifier of the peripheral component interconnect standard request PCI_request, and the peripheral component interconnect standard PCI number index corresponding to the available VF resources of the computing node;
[0040] The releasing unit is used to release the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and mark the released available VF resources as available.
[0041] An embodiment of the present application also provides a computing node in a cloud computing platform network, comprising: a processor and a memory for storing processor executable instructions, wherein the processor is configured to execute the aforementioned virtual network card binding method when calling the executable instructions in the memory.
[0042] An embodiment of the present application also provides a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the aforementioned virtual network card binding method is implemented.
[0043] The present application implements a method for dynamically binding an SR-IOV virtual network card to an OpenStack virtual machine, by associating the logical virtual network card number of the SR-IOV type created by the user with the PCI number of the SR-IOV VF network card of the computing node, and recording it in the OpenStack computing management service database, while updating the network card PCI address to the virtual machine configuration file, triggering the virtual machine to dynamically load the PCI device through the virtual machine management program, and realizing the dynamic binding of the SR-IOV VF network card device to the virtual machine when it is running. The present application establishes a mapping relationship between the logical virtual network card and the VF PCI_device resource, supports dynamic binding and unbinding of VF network card resources during the virtual machine running phase, ensures the continuity of the customer's virtual machine business, and greatly improves the efficiency of the use of SR-IOV VF network card resources. The present application avoids the addition of a new application programming interface (API, Application Programming Interface), implements functions by reusing the native interface method, optimizes the business logic, and improves the customer experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flowchart of a virtual network card binding method provided in an embodiment of the present application;
[0045] Figure 2 A flowchart of a method for unbinding a virtual network card provided in an embodiment of the present application;
[0046] Figure 3 A flowchart of a virtual network card binding method provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of the correspondence between the virtual machine network card, PF, and VF in the embodiment of the present application;
[0048] Figure 5 A flowchart of a method for unbinding a virtual network card provided in an embodiment of the present application;
[0049] Figure 6 This is a schematic diagram of the relationship between the virtual machine network card and the VF resources after unbinding in the embodiment of the present application;
[0050] Figure 7 A schematic diagram of the composition structure of a virtual network card binding device provided in an embodiment of the present application;
[0051] Figure 8 A schematic diagram of the structure of a virtual network card unbinding device provided in an embodiment of the present application;
[0052] Fig. 9 A schematic diagram of the composition structure of computing nodes in a cloud computing platform network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The essence of the technical solution of the embodiment of the present application is explained in detail below in conjunction with the accompanying drawings.
[0054] The technical solution of the embodiment of the present application is to associate the logical virtual network card number of the SR-IOV type created by the user with the PCI number of the SR-IOV VF network card of the computing node, and record it in the OpenStack computing management service database, and at the same time update the network card PCI address to the virtual machine configuration file, trigger the virtual machine to dynamically load the PCI device through the virtual machine management program, and realize the dynamic binding of the SR-IOV VF network card device to the virtual machine in the running state. The business network card of the computing node where the virtual machine is located must support the SR-IOV feature, and the business network card SR-IOV function has been enabled in the deployment phase, and the network card PF is correctly virtualized into multiple VFs. In the environment deployment stage, the SR-IOV network card must be configured in the computing service configuration file with reference to the relevant configuration documents, that is, the computing service can correctly manage the SR-IOV VFs resources. The virtual machine needs to be created in advance on the computing node that turns on the SR-IOV network card feature and correctly configures the computing service.
[0055] Figure 1 A flow chart of a virtual network card binding method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the virtual network card binding method of the embodiment of the present application includes the following steps:
[0056] Step 101: A computing node in a cloud computing platform network receives a binding request for binding a virtual machine to a virtual network card sent by a virtual machine management application, and in response to the binding request, queries a database for available VF resources of the computing node.
[0057] In the embodiment of the present application, the user creates a logical virtual network card of the SR-IOV type in advance. The logical network card exists in the network service of the cloud computing platform. When creating it, it is necessary to specify the network card type as "direct". The user initiates the operation of binding the virtual machine to the SR-IOV virtual VF network card. The interface reuses the virtual machine binding network card interface in the OpenStack computing management service to bind the created logical virtual network card to the user's virtual machine. The user sends it to the virtual machine hypervisor of the OpenStack computing management service.
[0058] The virtual machine management program of the OpenStack computing management service receives the request initiated by the user to bind the virtual machine to the network card, and sends the virtual machine binding VF network card operation to the computing node where the virtual machine is located through the remote procedure call (RPC) method, thereby starting the virtual machine binding VF network card process.
[0059] Step 102, the computing node constructs a peripheral component interconnect standard request PCI_request based on the available VF resources, establishes a mapping relationship between the virtual logical port created by the virtual machine, the identifier of the PCI_request and the peripheral component interconnect standard PCI number index corresponding to the available VF resources, and records it in the database.
[0060] The computing node accesses the Nova database, queries the VF resources of the computing node, and determines whether there are available free VFs. If there is a VF, a pci_request request is constructed to pre-allocate the VF to the virtual machine; otherwise, an error message indicating that there are not enough VF resources is directly fed back to the user, terminating the user's virtual network card binding operation. After the computing node pre-allocates the VF resources, it will first mark the VF resources as allocated "allocated"; secondly, the computing node will establish a [port_id, pci_request_id, pci_device_id] mapping relationship. Among them, port_id refers to the number id of the virtual logical port of the SR-IOV type created by the user, pci_request_id refers to the pci_request request number id constructed when pre-allocating the VF, and pci_device_id refers to the pci number index corresponding to the pre-allocated VF. The computing node will record the mapping relationship in the Nova database.
[0061] Step 103: The computing node generates a network card configuration file of the virtual machine based on the mapping relationship, sends the network card configuration file to the virtual machine, and triggers the virtual machine to load virtual network card resources.
[0062] If the computing node Nova service successfully allocates VF resources and correctly records the correspondence between the logical network card and the VF resource, a configuration file for the virtual machine network card will be generated. The file format is an XML file, which is the standard configuration file format for KVM virtual machines. In the configuration file, define the type of the newly added network card of the virtual machine as "hostdev", and record the network card address type as "pci" and the specific pci number.
[0063] If the computing node Nova service successfully allocates VF resources and correctly records the correspondence between the logical network card and the VF resource, a configuration file for the virtual machine network card will be generated. The file format is an XML file, which is the standard configuration file format for KVM virtual machines. In the configuration file, define the type of the newly added network card of the virtual machine as "hostdev", and record the network card address type as "pci" and the specific pci number. The computing node Nova service updates the virtual machine XML configuration file based on the generated network card XML file format, and triggers the virtual machine to reload the network card resources, thereby realizing the function of dynamically loading and binding VF resources for the virtual machine.
[0064] The above method also includes: if the available VF resource allocation fails, the computing node clears the mapping relationship between the virtual logical port, the PCI_request identifier and the PCI number index corresponding to the available VF resource in the database, and marks the available VF resource as an available state.
[0065] If the VF network card pre-allocation fails, the resource rollback process will be entered. This process will clear the [port_id, pci_request_id, pci_device_id] mapping relationship recorded in the Nova database and mark the pre-allocated VF status as idle "available". Finally, the user virtual machine will be fed back the failure information of binding the VF network card.
[0066] The method further comprises:
[0067] The computing node receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship containing the virtual logical port identifier based on the virtual logical port identifier in the unbinding request; releases the available VF resources corresponding to the PCI_request identifier in the logical relationship, and marks the released available VF resources as available.
[0068] The user initiates the operation of unbinding a virtual machine's SR-IOV network card, which is implemented by reusing the unbinding network card interface of the OpenStack computing management service. The user needs to specify the virtual machine id and the logical port id to be unbound. The virtual machine management program of the OpenStack computing management service receives the request initiated by the user to unbind the virtual machine network card, and notifies the Nova service of the computing node where the virtual machine is located through a remote RPC call to start the process of unbinding the virtual machine's SR-IOV VF network card. The computing node queries the Nova database based on the logical network card port id in the request, finds the [port_id, pci_request_id, pci_device_id] mapping relationship record saved in the binding stage, finds the pci_device data corresponding to the VF based on the pci_device_id in the record, and finds the pci_request in the binding stage based on the pci_request_id. Based on the aforementioned query information, the computing node releases the VF resources corresponding to the logical port of the virtual machine. Specifically, the computing node clears the [port_id, pci_request_id, pci_device_id] mapping relationship record; and marks the pci_device data corresponding to the VF as idle "availabile" state. According to the queried VF pci_device data and pci_request data, the configuration corresponding to the VF in the virtual machine configuration file is deleted, and the virtual machine is triggered to reload the xml configuration file to implement the unbinding operation between the virtual machine and the VF network card.
[0069] This application establishes a mapping relationship between the logical virtual network card and the VF PCI_device resource, supports dynamic binding and unbinding of VF network card resources during the virtual machine operation phase, ensures the customer's virtual machine business continuity, and greatly improves the efficiency of SR-IOV VF network card resources. This application avoids adding new API methods, implements functions by reusing native interfaces, optimizes usage logic, and improves customer experience.
[0070] Figure 2 A flow chart of a method for unbinding a virtual network card provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method for unbinding a virtual network card in an embodiment of the present application includes the following steps:
[0071] Step 201, the computing node receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship including the virtual logical port identifier based on the virtual logical port identifier in the unbinding request;
[0072] The mapping relationship at least includes an association relationship between a virtual logical port created by a virtual machine, an identifier of a peripheral component interconnect standard request PCI_request, and a peripheral component interconnect standard PCI number index corresponding to an available VF resource of a computing node.
[0073] The user initiates the operation of unbinding a virtual machine's SR-IOV network card, which is implemented by reusing the unbinding network card interface of the OpenStack computing management service. The user needs to specify the virtual machine id and the logical port id to be unbound. The virtual machine management program of the OpenStack computing management service receives the request initiated by the user to unbind the virtual machine network card, and notifies the Nova service of the computing node where the virtual machine is located through a remote RPC call to start the process of unbinding the virtual machine's SR-IOV VF network card. The computing node queries the Nova database based on the logical network card port id in the request, finds the [port_id, pci_request_id, pci_device_id] mapping relationship record saved in the binding stage, finds the pci_device data corresponding to the VF based on the pci_device_id in the record, and finds the pci_request in the binding stage based on the pci_request_id.
[0074] Step 202: The computing node releases the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and marks the released available VF resources as being in the available state.
[0075] The computing node releases the VF resources corresponding to the virtual machine logical port according to the aforementioned query information. Specifically, the computing node clears the [port_id, pci_request_id, pci_device_id] mapping relationship record; and marks the pci_device data corresponding to the VF as idle "availabile" state. According to the queried VF pci_device data and pci_request data, the configuration corresponding to the VF in the virtual machine configuration file is deleted, and the virtual machine is triggered to reload the xml configuration file to implement the unbinding operation between the virtual machine and the VF network card.
[0076] The essence of the technical solution of the embodiment of the present application is further explained below through specific examples.
[0077] Figure 3 A flow chart of a virtual network card binding method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the virtual network card binding method of the embodiment of the present application includes the following processing steps:
[0078] In the embodiment of the present application, the basic requirements for dynamically binding the SR-IOV VF network card to the virtual machine are: the business network card of the computing node where the virtual machine is located must support the SR-IOV feature, and the business network card SR-IOV function has been enabled during the deployment phase, and the network card PF is correctly virtualized into multiple VFs. During the environment deployment phase, the SR-IOV network card must be configured in the computing service configuration file with reference to the relevant configuration documents, so that the computing service can correctly manage the SR-IOV VFs resources. The virtual machine must be created in advance on the computing node that has enabled the SR-IOV network card feature and correctly configured the computing service.
[0079] Step 1: Create an SR-IOV type logical port (neutron port).
[0080] Users need to create a logical virtual network card of the SR-IOV type in advance. This logical network card exists in the network service of the cloud computing platform. When creating it, you need to specify the network card type as "direct".
[0081] Step 2: The user initiates a virtual machine binding to an SR-IOV type virtual port.
[0082] The user initiates the operation of binding the SR-IOV virtual VF network card to the virtual machine. The interface reuses the virtual machine binding network card interface in the OpenStack computing management service to bind the logical virtual network card created in step 1 to the user's virtual machine.
[0083] Step 3: The OpenStack Compute Management Service receives the request and notifies the Nova service on the compute node to start binding the SR-IOV VF network card to the VM.
[0084] The OpenStack computing management service receives the user's request to bind the virtual machine to the network card, and sends the virtual machine binding VF network card operation to the Nova service of the computing node where the virtual machine is located through a remote RPC call, officially starting the virtual machine binding VF network card process.
[0085] Step 4: Determine whether there is an available VF.
[0086] The computing node Nova service accesses the Nova database to query the computing node VFs resources to determine whether there are available free VFs. If there are VFs, a pci_request request is constructed to pre-allocate the VF to the virtual machine; otherwise, an error message indicating that there are not enough VF resources is directly fed back to the user, terminating the user operation.
[0087] Step 5: Allocate a VF, record the VF PCI and port association, and save it to the Nova database.
[0088] After the compute node Nova service pre-allocates the VF resource, it will first mark the VF resource as allocated; secondly, the Nova service will establish a [port_id, pci_request_id, pci_device_id] mapping relationship. Port_id refers to the ID of the SR-IOV type virtual logical port created by the user in step 1, pci_request_id refers to the pci_request request ID constructed when pre-allocating the VF in step 4, and pci_device_id refers to the pci number index corresponding to the pre-allocated VF. The compute node Nova service will record the mapping relationship in the Nova database.
[0089] Figure 4 Schematic diagram of the correspondence between the virtual machine network card, PF, and VF in the embodiment of the present application, as shown in Figure 4 As shown, the network card 2 in the virtual machine 1 is the VF network card newly bound by the user.
[0090] Step 6: Generate the virtual machine network card configuration and update the virtual machine xml configuration file.
[0091] In step 5, if the computing node Nova service successfully allocates VF resources and correctly records the correspondence between the logical network card and the VF resource, a configuration file for the virtual machine network card will be generated. The file format is an XML file, which is the standard configuration file format for KVM virtual machines. In the configuration file, define the type of the newly added network card of the virtual machine as "hostdev", and record the network card address type as "pci" and the specific pci number. The specific example is as follows:
[0092]
[0093] Step 7: Trigger the virtual machine to load the configuration file and bind the VF network card.
[0094] The Nova service on the computing node updates the virtual machine xml configuration file according to the network card xml file format generated in step 6, and triggers the virtual machine to reload the network card resources, thereby implementing the virtual machine dynamic loading and binding VF resource function.
[0095] Step 8: If VF allocation fails, the allocated VF is released.
[0096] If the VF network card pre-allocation fails in step 5, the resource rollback process will be entered. This process needs to clear the [port_id, pci_request_id, pci_device_id] mapping relationship recorded in step 5 in the Nova database, and mark the pre-allocated VF state as idle "available". Finally, the user virtual machine is fed back the failure information of binding the VF network card.
[0097] Figure 5 A flow chart of a method for unbinding a virtual network card provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the virtual network card unbinding method provided in the embodiment of the present application includes the following processing steps:
[0098] Step 1: The user initiates the operation of unbinding a virtual port of a virtual machine;
[0099] The user initiates the operation of unbinding a SR-IOV network card of a virtual machine by reusing the unbinding network card interface of the OpenStack computing management service. The user needs to specify the virtual machine ID and the logical port ID to be unbound.
[0100] Step 2: The OpenStack computing management service receives the request and notifies the computing node Nova service to start binding the SR-IOV VF network card to the virtual machine;
[0101] The OpenStack computing management service receives the request initiated by the user to unbind the virtual machine network card, and notifies the Nova service of the computing node where the virtual machine is located through a remote RPC call to start the process of unbinding the virtual machine SR-IOV VF network card.
[0102] Step 3: The Nova service on the computing node queries the association record with the VF based on the logical port port ID, and then finds the pci_request and VF pci_device resources;
[0103] The Nova service of the computing node queries the Nova database according to the logical network card port id in the request, finds the [port_id, pci_request_id, pci_device_id] mapping relationship record saved in the binding phase, finds the pci_device data corresponding to the VF according to the pci_device_id in the record, and finds the pci_request in the binding phase according to the pci_request_id.
[0104] Step 4: Release VF resources and update database records.
[0105] The computing node Nova service releases the VF resources corresponding to the virtual machine logical port according to the query information in step 3. First, the computing node Nova service clears the [port_id, pci_request_id, pci_device_id] mapping relationship record; secondly, the pci_device data corresponding to the VF is marked as idle "availabile" state.
[0106] Step 5: Clear the logical network card configuration file of the virtual machine to trigger the reloading of the network card resources.
[0107] According to the VF pci_device data and pci_request data queried in step 3, the configuration corresponding to the VF in the virtual machine configuration file is deleted, and the virtual machine is triggered to reload the xml configuration file to implement the unbinding operation between the virtual machine and the VF network card.
[0108] This application establishes a mapping relationship between the logical virtual port and the pci_request and pci_device resources corresponding to the VF. The VF resources bound to the virtual machine can be queried according to the virtual port ID, so that the virtual machine can dynamically bind and unbind SR-IOV VF network card resources through the logical virtual port, greatly improving the utilization efficiency of SR-IOV network card resources.
[0109] This application reuses the virtual machine binding and unbinding network card interface provided by the OpenStack computing management service. According to the binding and unbinding logic of the native interface virtual machine network card, a binding and unbinding process compatible with the SR-IOV VF network card is designed, which improves the customer experience at the API level and simplifies the business logic.
[0110] Figure 6 This is a schematic diagram of the relationship between the virtual machine network card and the VF resources after unbinding in the embodiment of the present application, combined with Figure 4 As shown, the network card 2 in the virtual machine 1 is unbound from the VF network card.
[0111] Figure 7 A schematic diagram of the composition structure of the virtual network card binding device provided in the embodiment of the present application is as follows: Figure 7 As shown, the virtual network card binding device of the embodiment of the present application includes:
[0112] The receiving unit 70 is used to receive a binding request for binding a virtual machine to a virtual network card sent by a virtual machine management application;
[0113] A query unit 71, configured to query available virtual function VF resources of a computing node in a database in response to the binding request;
[0114] An establishing unit 72 is used to construct a peripheral component interconnect standard request PCI_request based on available VF resources, and establish a mapping relationship between the virtual logical port created by the virtual machine, the identifier of the PCI_request, and the peripheral component interconnect standard PCI number index corresponding to the available VF resources;
[0115] A recording unit 73, used for recording the mapping relationship in the database;
[0116] A generating unit 74, configured to generate a network card configuration file of the virtual machine based on the mapping relationship;
[0117] The sending unit 75 is used to send the network card configuration file to the virtual machine to trigger the virtual machine to load the virtual network card resources.
[0118] In some embodiments, before the virtual machine initiates a request to bind a virtual network card, a virtual logical port of a single root input and output virtualization SR-IOV type is created, and the virtual machine binds the virtual logical port.
[0119] After constructing PCI_request based on available VF resources, the queried available VF resources are marked as allocated.
[0120] In some embodiments, the apparatus further comprises:
[0121] Clearing unit ( Figure 7 ), which is used to clear the mapping relationship between the virtual logical port, the PCI_request identifier and the PCI number index corresponding to the available VF resource in the database when the available VF resource allocation fails, and mark the available VF resource as an idle available state.
[0122] In some embodiments, the receiving unit 70 is further configured to receive an unbinding request sent by a virtual machine management application to unbind the virtual machine and the virtual network card; the device further comprises:
[0123] Find Unit( Figure 7 (not shown), for responding to the unbinding request, based on the virtual logical port identifier in the unbinding request, searching the database for a mapping relationship containing the virtual logical port identifier;
[0124] Release unit ( Figure 7 (not shown) for releasing the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and marking the released available VF resources as available state.
[0125] Those skilled in the art should understand that the relevant description of the above-mentioned virtual network card binding device in the embodiment of the present application can be understood by referring to the relevant description of the virtual network card binding method in the embodiment of the present application.
[0126] Figure 8 The schematic diagram of the composition structure of the virtual network card unbinding device provided in the embodiment of the present application, the virtual network card unbinding device recorded in the embodiment of the present application includes:
[0127] The receiving unit 80 is used to receive an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application;
[0128] A search unit 81 is used to search for a mapping relationship including the virtual logical port identifier in a database in response to the unbinding request, based on the virtual logical port identifier in the unbinding request; the mapping relationship at least includes an association relationship between the virtual logical port created by the virtual machine, the identifier of the peripheral component interconnect standard request PCI_request, and the peripheral component interconnect standard PCI number index corresponding to the available VF resources of the computing node;
[0129] The releasing unit 82 is used to release the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and mark the released available VF resources as being in the available state.
[0130] Those skilled in the art should understand that the relevant description of the above-mentioned virtual network card unbinding device in the embodiment of the present application can be understood by referring to the relevant description of the virtual network card unbinding method in the embodiment of the present application.
[0131] Fig. 9 A schematic diagram of the composition structure of computing nodes in a cloud computing platform network provided in an embodiment of the present application, such as Fig. 9 As shown, the computing node in the cloud computing platform network of the embodiment of the present application includes: a processor 910 and a memory 920 for storing executable instructions of the processor 910, and the processor 910 and the memory 920 are connected via a data bus. The processor 910 is configured to execute the virtual network card binding method of the aforementioned embodiment when calling the executable instructions in the memory.
[0132] An embodiment of the present application also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the virtual network card binding method of the aforementioned embodiment is implemented.
[0133] In the present embodiment, at least one processor may constitute any physical device having a circuit for performing a logical operation on one or more inputs. For example, at least one processor may include one or more integrated circuits (ICs), including application specific integrated circuits (ASICs), microchips, microcontrollers, microprocessors, all or part of a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a field programmable gate array (FPGA), or other circuits suitable for executing instructions or performing logical operations. The instructions executed by at least one processor may be preloaded, for example, into a memory integrated with or embedded in a controller, or may be stored in a separate memory. The memory may include a random access memory (RAM), a read-only memory (ROM), a hard disk, an optical disk, a magnetic medium, a flash memory, other permanent, fixed or volatile memory, or any other mechanism capable of storing instructions. In some embodiments, at least one processor may include more than one processor. Each processor may have a similar structure, or the processor may have different configurations that are electrically connected or disconnected from each other. For example, the processor may be a separate circuit or integrated in a single circuit. When more than one processor is used, the processor may be configured to operate independently or collaboratively. The processors may be coupled electrically, magnetically, optically, acoustically, mechanically, or by other means that allow them to interact.
[0134] In this embodiment, the non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0135] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present invention, the size of the serial number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. The serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.
[0136] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0137] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0138] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0139] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0140] The above is only an embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A virtual network card binding method, characterized in that: The method comprises: A computing node in a cloud computing platform network receives a binding request for a virtual machine to bind a virtual network card sent by a virtual machine management application, and in response to the binding request, queries a database for available virtual function VF resources of the computing node; Constructing a peripheral component interconnect standard request PCI_request based on available VF resources, establishing a mapping relationship between a virtual logical port created by a virtual machine, an identifier of the PCI_request and a peripheral component interconnect standard PCI number index corresponding to the available VF resources, and recording the mapping relationship in the database; A network card configuration file of the virtual machine is generated based on the mapping relationship, and the network card configuration file is sent to the virtual machine to trigger the virtual machine to load the virtual network card resources.
2. The method according to claim 1, characterized in that After constructing the PCI_request based on the available VF resources, the method further includes: The queried available VF resources are marked as allocated.
3. The method according to claim 2, characterized in that The method further comprises: If the available VF resource allocation fails, the mapping relationship between the virtual logical port, the identifier of the PCI_request and the PCI number index corresponding to the available VF resource in the database is cleared, and the available VF resource is marked as an available state.
4. The method according to claim 1, characterized in that: The method further comprises: Before the virtual machine initiates a request to bind a virtual network card, a virtual logical port of a single root input and output virtualization SR-IOV type is created, and the virtual machine is bound to the virtual logical port.
5. The method according to claim 1, characterized in that The method further comprises: The computing node receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship including the virtual logical port identifier based on the virtual logical port identifier in the unbinding request; The available VF resources corresponding to the identifier of the PCI_request in the logical relationship are released, and the released available VF resources are marked as being in an available state.
6. A method for unbinding a virtual network card, characterized in that: The method comprises: A computing node in a cloud computing platform network receives an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application, and in response to the unbinding request, searches a database for a mapping relationship including the virtual logical port identifier based on the virtual logical port identifier in the unbinding request; the mapping relationship at least includes an association relationship between the virtual logical port created by the virtual machine, an identifier of a peripheral component interconnect standard request PCI_request, and a peripheral component interconnect standard PCI number index corresponding to an available VF resource of the computing node; The available VF resources corresponding to the identifier of the PCI_request in the logical relationship are released, and the released available VF resources are marked as being in an available state.
7. The method according to claim 6, characterized in that The method further comprises: The computing node sends the information of unbinding the virtual machine and the virtual network card to the virtual machine through the virtual machine management application.
8. A virtual network card binding device, characterized in that: The device comprises: A receiving unit, configured to receive a binding request for binding a virtual machine to a virtual network card sent by a virtual machine management application; A query unit, configured to query available virtual function VF resources of a computing node in a database in response to the binding request; An establishing unit, configured to construct a peripheral component interconnect standard request PCI_request based on available VF resources, and establish a mapping relationship between a virtual logical port created by a virtual machine, an identifier of the PCI_request, and a peripheral component interconnect standard PCI number index corresponding to the available VF resources; A recording unit, used for recording the mapping relationship in the database; A generating unit, configured to generate a network card configuration file of the virtual machine based on the mapping relationship; The sending unit is used to send the network card configuration file to the virtual machine to trigger the virtual machine to load the virtual network card resources.
9. The device according to claim 8, characterized in that The device also includes: The clearing unit is used to clear the mapping relationship between the virtual logical port, the identifier of the PCI_request and the PCI number index corresponding to the available VF resource in the database when the allocation of the available VF resource fails, and mark the available VF resource as an available state.
10. The device according to claim 8, characterized in that The receiving unit is further configured to receive an unbinding request sent by the virtual machine management application to unbind the virtual machine and the virtual network card; the device further comprises: A searching unit, configured to search a database for a mapping relationship including the virtual logical port identifier in response to the unbinding request and based on the virtual logical port identifier in the unbinding request; The releasing unit is used to release the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and mark the released available VF resources as available.
11. A virtual network card unbinding device, characterized in that: The device comprises: A receiving unit, configured to receive an unbinding request for unbinding a virtual machine and a virtual network card sent by a virtual machine management application; A search unit, configured to search, in response to the unbinding request, a mapping relationship including the virtual logical port identifier in the database based on the virtual logical port identifier in the unbinding request; the mapping relationship at least includes an association relationship between the virtual logical port created by the virtual machine, the identifier of the peripheral component interconnect standard request PCI_request, and the peripheral component interconnect standard PCI number index corresponding to the available VF resources of the computing node; The releasing unit is used to release the available VF resources corresponding to the identifier of the PCI_request in the logical relationship, and mark the released available VF resources as available.
12. A computing node in a cloud computing platform network, characterized in that: include: A processor and a memory for storing processor executable instructions, wherein the processor is configured to execute the virtual network card binding method according to any one of claims 1 to 5 when calling the executable instructions in the memory.
13. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed by the processor, the virtual network card binding method according to any one of claims 1 to 5 is implemented.
