A method, system, device, and storage medium for creating a Virtual Machine (VF).

By monitoring the throughput and network utilization of the virtual machine network interface card (NIC) resource pool, the physical NIC with the largest product of network utilization and the number of virtual virtual machines (VFs) that can be created is selected, thus solving the problem of choosing a suitable NIC adapter and improving resource scheduling efficiency and balance.

CN115756728BActive Publication Date: 2026-06-30JINAN INSPUR DATA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2022-11-04
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

When choosing to create an SR-IOV network adapter (VF) on a server, users may find it difficult to determine the appropriate network adapter, leading to inappropriate selection and uneven resource utilization.

Method used

By monitoring the throughput data of the virtual machine network interface resource pool, the network utilization and the number of virtual virtual machines (VFs) that can be created are calculated. The physical network interface with the largest product of network utilization and the number of VFs that can be created is selected to create the VF.

Benefits of technology

Automatically selects the appropriate network card adapter to improve resource scheduling efficiency and reduce the problem of uneven resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756728B_ABST
    Figure CN115756728B_ABST
Patent Text Reader

Abstract

This invention relates to a method, system, device, and storage medium for creating Virtual Machines (VFs). It monitors the throughput data of physical network interface cards (NICs) in a network interface card (NIC) resource pool. The throughput data includes the number of bytes received, bytes sent, and cumulative time. The network utilization of each physical NIC in the resource pool is calculated using the throughput data and the physical NIC interface speed. The number of VFs that can currently be created for each physical NIC in the resource pool is determined. The physical NIC with the largest product of its network utilization and the number of VFs it can currently create is selected to create the VF. This method automatically selects the physical NICs for VF creation based on both network utilization and the number of VFs that can be created, eliminating the need for manual intervention and balancing the number of VFs configured across different physical NICs, thus facilitating the balancing of traffic load across physical NICs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of creating Virtual Machines (VFs), and more particularly to a method, system, device, and storage medium for creating Virtual Machines (VFs). Background Technology

[0002] Currently, as applications become increasingly complex, the performance requirements for virtual machines are also increasing. Most public or private cloud server virtualization products on the market offer SR-IOV functionality to improve the network performance of virtual machines.

[0003] SR-IOV (Single-Root I / O Virtualization) is an input / output virtualization technology that can virtualize multiple virtual PCIe adapters on a single physical PCIe adapter. These are called virtual functions (VFs). Taking a network adapter that supports SR-IOV as an example, a physical network adapter configured with a PF can virtualize multiple virtual network adapters (VFs). Each VF in a virtual machine corresponds to one virtual network adapter. Each SR-IOV-enabled network interface card (NIC) adapter can create a fixed number of Virtual Functions (VFs). Most server virtualization products require users to manually select the SR-IOV-enabled NIC adapter for each VF to be used by the virtual machine. If the server has only one SR-IOV-enabled NIC adapter, only that adapter can be selected to create the VF. However, when the server has multiple SR-IOV-enabled NIC adapters, users often don't know which adapter is suitable for creating the VF. They need to manually check the number of VFs each SR-IOV-enabled NIC adapter can create and its current load status. This process is cumbersome and prone to errors, often resulting in the selection of an unsuitable SR-IOV-enabled NIC adapter. Summary of the Invention

[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, the present invention provides a method, system, device and storage medium for creating a virtual machine (VF).

[0005] In a first aspect, the present invention provides a method for creating a Virtual Machine (VF), comprising:

[0006] Monitor the throughput data of physical network cards in the network card resource pool of virtual machines;

[0007] Calculate the network utilization of the physical network interface card;

[0008] Determine the number of Virtual Functions (VFs) that the physical network interface card (NIC) can currently create;

[0009] The physical network interface card (NIC) that produces the largest product of the network utilization rate and the number of VFs that can be created is selected to create a VF.

[0010] Furthermore, the throughput data includes: the number of bytes received, the number of bytes sent, and the cumulative time.

[0011] Furthermore, the step of calculating the network utilization of the physical network card includes:

[0012] Obtain the interface speed of the physical network card;

[0013] Calculate the receiving network utilization of the physical network card:

[0014] The network utilization rate is calculated as follows: (Number of bytes received by the network card × 8) / (Physical network card interface speed × Cumulative time of data reception).

[0015] Calculate the transmission network utilization of the physical network card:

[0016] The network utilization rate is calculated as follows: (Number of bytes sent by the network card × 8) / (Physical network card interface speed × Cumulative time of data transmission).

[0017] The larger of the receiving network utilization rate and the transmitting network utilization rate is taken as the network utilization rate.

[0018] Furthermore, the step of calculating the network utilization of the physical network card includes:

[0019] The transmit network utilization and receive network utilization of the physical network card are calculated multiple times according to a set number of times, and the average value is taken. The larger of the average value of the receive network utilization and the transmit network utilization is taken as the network utilization.

[0020] Furthermore, the step of determining the number of VFs that the physical network interface card can currently create includes:

[0021] Get the maximum number of Virtual Functions (VFs) supported by each physical network interface card (NIC) in the NIC resource pool. Query the number of VFs currently available for each physical NIC in the NIC resource pool. Subtract the number of currently available VFs from the maximum number of VFs supported by the physical NIC to get the number of VFs that can be created by the physical NIC at present.

[0022] Furthermore, the configuration data of the Virtual Machine (VF) required by the virtual machine is pre-configured, and the physical network cards in the network card resource pool are traversed and checked to see if they can meet the configuration data of the VF. If not, the corresponding physical network card is kicked out of the network card resource pool.

[0023] Furthermore, after creating the Virtual Machine (VF), configure the VF according to its configuration data before enabling it, and then enable the VF for functional verification after configuration.

[0024] Secondly, the present invention provides a system for creating a Virtual Machine (VF), comprising: a throughput monitoring module, wherein the throughput monitoring module is used to monitor the throughput data of physical network cards in the network card resource pool;

[0025] The network utilization calculation module obtains the physical network interface speed of each physical network card in the network card resource pool, and calculates the network utilization of the physical network card using the physical network interface speed and the throughput data of the physical network card.

[0026] The analysis of currently available VF modules determines the number of VFs that can be created for each physical network interface card (NIC) in the NIC resource pool.

[0027] The selection module multiplies the number of VFs that can be created by each physical network card with the network utilization rate, sorts them according to the product, and selects the physical network card with the largest product to create the VF.

[0028] Thirdly, the present invention provides an electronic device for creating a Virtual Machine (VF), comprising: at least one processing unit, a physical network interface card (NIC), a bus unit, and a storage unit, wherein the bus unit connects the storage unit, the processing unit, and the physical NIC, and the storage unit stores a computer program, which, when executed by the processing unit, implements the method for creating a Virtual Machine (VF).

[0029] Fourthly, the present invention provides a storage medium for implementing a method for creating a virtual machine (VF), the storage medium storing a computer program that, when executed by a processor, implements the method for creating a virtual machine (VF).

[0030] The technical solutions provided in the embodiments of the present invention have the following advantages compared with the prior art:

[0031] This invention monitors the throughput data of physical network interface cards (NICs) in a NIC resource pool. It calculates the network utilization of each NIC in the pool using the throughput data and the NIC interface speed. It then determines the number of Virtual Functions (VFs) that can be created on each NIC in the pool. Finally, it selects the NIC with the highest product of its network utilization and the number of VFs it can create to create a VF. By combining the network utilization of each NIC with the number of VFs it can create, the invention automatically and comprehensively determines the target NIC for VF creation, eliminating the need for manual configuration, improving scheduling efficiency, and reducing resource imbalances across the NICs after resource scheduling. Attached Figure Description

[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 A flowchart illustrating a method for creating a Virtual Machine (VF) according to an embodiment of the present invention;

[0035] Figure 2 A flowchart for calculating the network utilization of each physical network card in the network card resource pool using throughput data and physical network card interface speed, provided in an embodiment of the present invention;

[0036] Figure 3 This is a flowchart for determining the number of VFs that can be created for each physical network interface card (NIC) in the NIC resource pool, as provided in an embodiment of the present invention.

[0037] Figure 4 A schematic diagram of a system for creating a Virtual Machine (VF) provided in an embodiment of the present invention;

[0038] Figure 5 This is a schematic diagram of an electronic device for implementing the creation of a virtual machine (VF) according to an embodiment of the invention. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0040] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0041] Example 1

[0042] See Figure 1 As shown, the present invention provides a method for creating a Virtual Machine (VF), comprising:

[0043] S100 monitors the throughput data of physical network cards in the network card resource pool. The throughput data includes: number of bytes received, number of bytes sent, and cumulative time.

[0044] In a preferred embodiment, for each virtual machine, its usable physical network interface cards (NICs) are included in the NIC resource pool. If the server contains multiple NICs with varying performance and different Virtual Functions (VFs) supported by those NICs, the configuration data for the required VFs is pre-configured. The NIC resource pool is then iterated to check whether the physical NICs can meet the VF configuration data. If not, the corresponding physical NIC is removed from the NIC resource pool.

[0045] In one feasible implementation, the number of bytes received and the number of bytes sent are monitored synchronously, and the cumulative time for receiving and sending is calculated uniformly. In another feasible implementation, the number of bytes received and the number of bytes sent are monitored separately, and the cumulative time for receiving and sending is calculated separately.

[0046] In a preferred embodiment, the number of received bytes, the number of transmitted bytes, and the cumulative time of each monitoring are monitored multiple times according to a set number of times. The collected number of received bytes, the number of transmitted bytes, and the corresponding cumulative time are used to calculate the physical network card's receiving network utilization and the physical network card's transmitting network utilization, and then to calculate the physical network card's network utilization.

[0047] S200 calculates the network utilization of each physical network card in the network card resource pool using throughput data and physical network card interface speed; specifically, it calculates the physical network card receiving network utilization and the physical network card transmitting network utilization using throughput data and network card interface speed respectively, and takes the larger value between the physical network card receiving network utilization and the physical network card transmitting network utilization as the network utilization.

[0048] In the specific implementation process, please refer to Figure 2 As shown, the network utilization of each physical network interface card (NIC) in the NIC resource pool is calculated using throughput data and physical NIC interface speed, including:

[0049] S201, Obtain the throughput data and physical network interface speed of each physical network card in the network card resource pool; the throughput data includes: number of bytes received, number of bytes sent, and cumulative time.

[0050] S202, calculate the physical network card's receiving network utilization and physical network card's transmitting network utilization using the throughput data and physical network card interface speed respectively according to the following formulas:

[0051] Physical network card reception network utilization = (Number of bytes received by the network card × 8) / (Physical network card interface speed × Cumulative time of data reception)

[0052] Physical network card transmission network utilization = (number of bytes transmitted by the network card × 8) / (physical network card interface speed × cumulative time of data transmission).

[0053] S203, compare the physical network card receive network utilization rate and / or physical network card transmit network utilization rate of each physical network card, and take the larger value between the physical network card receive network utilization rate and the physical network card transmit network utilization rate as the network utilization rate.

[0054] In a preferred embodiment, using the throughput data monitored a set number of times in step S100, the transmit network utilization and receive network utilization of the physical network card are calculated cumulatively for a set number of times; then, the average values ​​are calculated as the transmit network utilization and receive network utilization of the physical network card. The receive network utilization and transmit network utilization of each physical network card are compared, and the larger of the receive network utilization and transmit network utilization is taken as the network utilization of the corresponding physical network card.

[0055] S300 determines the number of Virtual Functions (VFs) that can be created for each physical network interface card (NIC) in the NIC resource pool; see also Figure 3 As shown, step S300 includes:

[0056] S301 retrieves the maximum number of Virtual Functions (VFs) supported by each physical network interface card (NIC) in the NIC resource pool. Specifically, the SR-IOV specification defines a read-only field, TotalVFS, which specifies the maximum number of VFs that can be associated with a PF. The maximum number of VFs supported by each physical NIC is obtained by iterating through the contents of the TotalVFS read-only field of the PF for each physical NIC in the NIC resource pool.

[0057] S302, query the number of VFs currently available for each physical network interface card (NIC). Specifically, the SR-IOV specification defines a read-only field NumVFS that specifies the current number of available VFs on a physical NIC. The maximum number of VFs supported by each physical NIC is obtained by iterating through the contents of the NumVFS read-only field of each PF in the NIC resource pool.

[0058] S303: The number of VFs that a physical network card can currently create is obtained by subtracting the number of currently available VFs from the maximum number of VFs that the physical network card can support.

[0059] S400: The physical network interface card (NIC) with the highest product of network utilization and the number of VFs it can currently create is selected from all physical NICs in the NIC resource pool to create a VF. In a preferred implementation, all physical NICs in the NIC resource pool are sorted from largest to smallest based on the product of network utilization and the number of VFs they can currently create. The sorting results are retained, and the physical NIC with the largest product is selected to create the VF.

[0060] In a preferred embodiment, after creating the Virtual Functions (VFs) required for the virtual machine, the VF is configured according to its configuration data before being enabled, and then enabled for functional verification after configuration. Specifically, after starting the VF and allocating it to the virtual machine, the virtual machine transmits test data through the VF to verify its availability. Simultaneously, the throughput data of the physical network interface cards (NICs) associated with the VF is monitored, the network utilization of the NICs is recalculated, the number of VFs that can currently be created on the NICs is re-acquired, and the product of the NIC's network utilization and the number of VFs that can be created is updated. This updated product is then compared with other sorted NICs in the retained sorting results to re-sort the NICs.

[0061] Example 2

[0062] See Figure 4 As shown, this embodiment of the invention provides a system for creating a Virtual Machine (VF), comprising:

[0063] The network interface card (NIC) resource pool filtering module determines whether a physical NIC supports the creation of the required VF based on pre-configured VF configuration data. If not, the corresponding physical NIC is removed from the NIC resource pool to obtain a NIC resource pool that can meet the required VF.

[0064] The throughput monitoring module is used to monitor the throughput data of physical network cards in the network card resource pool; the throughput data includes: number of bytes received, number of bytes sent, and cumulative time.

[0065] The network utilization calculation module obtains the physical network interface speed of each physical network interface card (NIC) in the NIC resource pool and calculates the network utilization of the physical NIC using the NIC interface speed and the throughput data. The physical NIC receive network utilization is calculated as follows: (Number of bytes received × 8) / (Physical NIC interface speed × Cumulative time for receiving data); the physical NIC transmit network utilization is calculated as follows: (Number of bytes transmitted × 8) / (Physical NIC interface speed × Cumulative time for transmitting data). The physical NIC receive network utilization and / or transmit network utilization are compared, and the larger value between the two is taken as the network utilization.

[0066] The analysis of currently available VF modules determines the number of VFs that can be created for each physical network interface card (NIC) in the NIC resource pool. Specifically, the analysis of currently available VF modules obtains the maximum number of VFs supported by each physical NIC in the NIC resource pool; queries the number of currently available VFs for each physical NIC; and subtracts the number of currently available VFs from the maximum number of VFs supported by the physical NIC to obtain the number of VFs that can be created for the physical NIC.

[0067] The selection module multiplies the number of VFs that can be created by each physical network card with the network utilization rate, sorts them according to the product, and selects the physical network card with the largest product to create the VF.

[0068] Example 3

[0069] See Figure 5 As shown, this embodiment of the invention provides an electronic device for creating a Virtual Machine (VF), comprising: at least one processing unit, a physical network interface card (NIC), a bus unit, and a storage unit, wherein the bus unit connects the storage unit, the processing unit, and the physical NIC, and the storage unit stores a computer program, which, when executed by the processing unit, implements the method for creating a Virtual Machine (VF).

[0070] Example 4

[0071] This invention provides a storage medium for implementing a method for creating a virtual machine (VF). The storage medium stores a computer program, which, when executed by a processor, implements the method for creating a virtual machine (VF).

[0072] This invention monitors the throughput data of physical network interface cards (NICs) in a NIC resource pool. The NIC resource pool for a virtual machine can consist of at least two physical NICs from a single server, or at least two physical NICs from multiple servers on a cloud platform. It calculates the network utilization of each physical NIC in the resource pool using throughput data and physical NIC interface speeds; determines the number of Virtual Functions (VFs) that can currently be created from each physical NIC in the resource pool; and selects the physical NIC with the largest product of its network utilization and the number of VFs it can currently create from all physical NICs in the resource pool to create the VF. By combining the network utilization of each physical NIC in the virtual machine's NIC resource pool with the number of VFs that can be created, the invention automatically and comprehensively determines the target physical NIC for VF creation, eliminating the need for manual configuration, improving scheduling efficiency, and reducing the problem of uneven resource utilization across the entire physical NIC after resource scheduling.

[0073] In the embodiments provided by this invention, it should be understood that the disclosed structures and methods can be implemented in other ways. For example, the structural embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, structures, or units, and may be electrical, mechanical, or other forms.

[0074] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0075] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0076] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for creating a Virtual Machine (VF), characterized in that, include: Monitor the throughput data of physical network cards in the network card resource pool of virtual machines; The throughput data includes: number of bytes received, number of bytes sent, and cumulative time; Calculate the network utilization of the physical network interface card; including: Obtain the interface speed of the physical network card; calculate the receiving network utilization of the physical network card: receiving network utilization = (number of bytes received by the network card × 8) / (physical network card interface speed × cumulative time of receiving data); calculate the transmitting network utilization of the physical network card: transmitting network utilization = (number of bytes transmitted by the network card × 8) / (physical network card interface speed × cumulative time of transmitting data); take the larger of the receiving network utilization and the transmitting network utilization as the network utilization; or, calculate the transmitting network utilization and the receiving network utilization of the physical network card multiple times according to a set number of times, and take the average value of each, and take the larger of the average value of the receiving network utilization and the transmitting network utilization as the network utilization. Determine the number of Virtual Functions (VFs) that the physical network interface card (NIC) can currently create; The physical network interface card (NIC) that produces the largest product of the network utilization rate and the number of VFs that can be created is selected to create a VF.

2. The method for creating a Virtual Machine (VF) according to claim 1, characterized in that, The steps for determining the number of Virtual Functions (VFs) that the physical network interface card can currently create include: Get the maximum number of Virtual Functions (VFs) supported by each physical network interface card (NIC) in the NIC resource pool. Query the number of VFs currently available for each physical NIC in the NIC resource pool. Subtract the number of currently available VFs from the maximum number of VFs supported by the physical NIC to get the number of VFs that can be created by the physical NIC at present.

3. The method for creating a Virtual Machine (VF) according to claim 1, characterized in that, The configuration data of the Virtual Machine (VF) required by the virtual machine is pre-configured. The physical network cards in the network card resource pool are traversed and checked to see if they can meet the configuration data of the VF. If not, the corresponding physical network card is kicked out of the network card resource pool.

4. The method for creating a Virtual Machine (VF) according to claim 1, characterized in that, After creating the Virtual Functions (VFs) required for the virtual machine, configure the VFs according to their configuration data before enabling them, and then enable the VFs for functional verification after configuration.

5. A system for creating a Virtual Machine (VF), characterized in that, include: A throughput monitoring module, which is used to monitor the throughput data of physical network cards in the network card resource pool; The throughput data includes: number of bytes received, number of bytes sent, and cumulative time; A network utilization calculation module acquires the physical network interface speed of each physical network interface card (NIC) in the NIC resource pool, and calculates the network utilization of the NIC using the NIC interface speed and the NIC throughput data. The calculation of the network utilization of the NIC includes: acquiring the interface speed of the NIC; calculating the receiving network utilization of the NIC: receiving network utilization = (number of bytes received by the NIC × 8) / (physical NIC interface speed × cumulative time of receiving data); calculating the transmitting network utilization of the NIC: transmitting network utilization = (number of bytes transmitted by the NIC × 8) / (physical NIC interface speed × cumulative time of transmitting data); taking the larger of the receiving network utilization and the transmitting network utilization as the network utilization; or, calculating the transmitting network utilization and the receiving network utilization of the NIC multiple times according to a set number of times, taking the average value of each, and taking the larger of the average value of the receiving network utilization and the transmitting network utilization as the network utilization. The analysis of currently available VF modules determines the number of VFs that can be created for each physical network interface card (NIC) in the NIC resource pool. The selection module multiplies the number of VFs that can be created at present for each physical network card by the network utilization rate, sorts them according to the product, and selects the physical network card with the largest product to create the VF.

6. An electronic device for creating a Virtual Machine (VF), characterized in that, include: The system includes at least one processing unit, a physical network interface card (NIC), a bus unit, and a storage unit, wherein the bus unit connects the storage unit, the processing unit, and the physical NIC, and the storage unit stores a computer program that, when executed by the processing unit, implements the method for creating a virtual machine (VF) as described in any one of claims 1-4.

7. A storage medium for implementing a method for creating a virtual machine (VF), the storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method for creating a virtual machine (VF) as described in any one of claims 1-4.