WO2018233252A1 - 一种配置虚拟网卡速率的方法及装置 - Google Patents

一种配置虚拟网卡速率的方法及装置 Download PDF

Info

Publication number
WO2018233252A1
WO2018233252A1 PCT/CN2017/117514 CN2017117514W WO2018233252A1 WO 2018233252 A1 WO2018233252 A1 WO 2018233252A1 CN 2017117514 W CN2017117514 W CN 2017117514W WO 2018233252 A1 WO2018233252 A1 WO 2018233252A1
Authority
WO
WIPO (PCT)
Prior art keywords
transmission rate
network card
virtual network
virtual
rate
Prior art date
Application number
PCT/CN2017/117514
Other languages
English (en)
French (fr)
Inventor
邱剑
Original Assignee
北京三快在线科技有限公司
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 北京三快在线科技有限公司 filed Critical 北京三快在线科技有限公司
Priority to CA3063781A priority Critical patent/CA3063781C/en
Publication of WO2018233252A1 publication Critical patent/WO2018233252A1/zh
Priority to US16/685,515 priority patent/US20200089522A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0806Configuration setting for initial configuration or provisioning, e.g. plug-and-play
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4604LAN interconnection over a backbone network, e.g. Internet, Frame Relay
    • H04L12/462LAN interconnection over a bridge based backbone
    • H04L12/4625Single bridge functionality, e.g. connection of two networks over a single bridge
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/083Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability for increasing network speed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0896Bandwidth or capacity management, i.e. automatically increasing or decreasing capacities
    • 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/4557Distribution of virtual machine instances; Migration and load balancing
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0882Utilisation of link capacity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2416Real-time traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds

Definitions

  • the present disclosure relates to the field of network transmission technologies, and in particular, to a method for configuring a virtual machine network card rate, and an apparatus for configuring a virtual machine network card rate.
  • the server administrator or application software can use a specific tool software to obtain the maximum transmission rate of the physical network card (network card speed limit), for example, by querying and setting the NIC parameter ethtool under the Linux system, or by reading sys/class/ Fields such as net/ethX/speed to get the transmission rate of the installed network card.
  • network card speed limit for example, by querying and setting the NIC parameter ethtool under the Linux system, or by reading sys/class/ Fields such as net/ethX/speed to get the transmission rate of the installed network card.
  • the actual maximum transmission rate of the virtual network card cannot be obtained by using the above method. This is because in the virtualized environment, the rate index of the virtual network card in the virtual machine is different from the rate index of the physical network card. Without the actual reference value, the virtual machine cannot obtain the maximum bandwidth through the rate indicator of the virtual NIC.
  • embodiments of the present disclosure have been made in order to provide a method of configuring a virtual network card rate that overcomes the above problems or at least partially solves the above problems, and an apparatus for configuring a virtual network card rate.
  • a method for configuring a virtual network card rate including:
  • the external interface is invoked to obtain a target transmission rate, and the transmission rate of the virtual network card is reconfigured to the Target transfer rate.
  • the internal interface is generated as follows:
  • the system file with the specified field is added as the internal interface.
  • saving the initial transmission rate in the virtual network card includes:
  • the initial transmission rate is saved in the virtual network card.
  • reconfiguring a transmission rate of the virtual network card to the target transmission rate via the internal interface includes:
  • the virtual machine communicates based on a target transmission rate of the virtual network card.
  • the target transmission rate includes a real-time rate of an external network, or a preset rate-limiting rate.
  • the internal interface also allows communication with an application running in the virtual machine to cause the application to obtain a transmission rate of the virtual network card via the internal interface.
  • determining whether the transmission rate of the virtual network card needs to be modified includes:
  • determining whether the transmission rate of the virtual network card needs to be modified includes:
  • an apparatus for configuring a virtual network card rate including:
  • An initial transmission rate configuration module configured to configure, after the virtual machine is started, an initial transmission rate of the virtual network card of the virtual machine by using an internal interface set in the virtual machine, and save the initial transmission rate in the virtual network card
  • the internal interface is configured to configure a transmission rate of the virtual network card and allow communication with an external interface in the physical machine;
  • a target transmission rate configuration module configured to: when the virtual network card transmission rate needs to be modified, invoke the external interface to obtain a target transmission rate, and send the virtual network card through the internal interface The transmission rate is reconfigured to the target transmission rate.
  • the virtual machine includes an internal interface generation module
  • the internal interface generation module includes:
  • a system file obtaining submodule configured to acquire a system file of the virtual network card
  • the specified field adds a sub-module for adding a specified field to the system file
  • the internal interface determines the submodule for using the system file with the specified field as the internal interface.
  • the initial transmission rate configuration module includes:
  • An initial transmission rate reading submodule for reading the initial transmission rate from a specified field of the internal interface
  • An initial transmission rate saving submodule is configured to save the initial transmission rate in the virtual network card.
  • the target transmission rate configuration module includes:
  • a rate replacement submodule configured to replace an initial transmission rate in a specified field of the internal interface with the target transmission rate
  • a target transmission rate saving submodule is configured to save the target transmission rate to the virtual network card.
  • the virtual machine communicates based on a target transmission rate of the virtual network card.
  • the target transmission rate includes a real-time rate of an external network, or a preset rate-limiting rate.
  • the internal interface also allows communication with an application running in the virtual machine to cause the application to obtain a transmission rate of the virtual network card via the internal interface.
  • the virtual machine in the embodiment of the present disclosure provides an interface for setting a virtual network card rate, which can be used to read the rate of the virtual network card, and can also be used to set the rate of the virtual network card.
  • the virtual network card driver of the operating system in the virtual machine in the embodiment of the present disclosure can be used by the physical machine to obtain the virtual network card rate from the intermediate software layer hypervisor between the physical machine system and the virtual machine system, and can be used by the application to obtain the virtual network card. Interface for NIC speed.
  • the virtual network card driver of the operating system in the virtual machine can synchronize the modification.
  • the virtual machine provides an interface for setting the virtual network card rate to be compatible with the existing interface for acquiring the network card rate, and the target transmission rate of the virtual network card can be read without modifying the application software.
  • the virtual machine can obtain the actual rate of the physical machine through the virtual machine providing an interface for setting the virtual network card rate, thereby dynamically adjusting the bandwidth that the virtual machine application can use, and better utilizing the network bandwidth. Resources, to achieve the purpose of making full use of network bandwidth resources.
  • FIG. 1 is a flow chart of steps of a method for configuring a virtual machine network card rate according to an embodiment of the present disclosure
  • FIG. 2 is a flow chart of steps of an embodiment of a method for obtaining a virtual machine network card rate according to an embodiment of the present disclosure
  • FIG. 3 is a flow chart of steps of a method for determining a rate of a virtual machine network card according to an embodiment of the present disclosure
  • FIG. 4 is a flow chart showing the steps of a method for setting a virtual machine network card rate according to an embodiment of the present disclosure
  • FIG. 5 is a structural block diagram of an apparatus for configuring a virtual machine network card rate according to an embodiment of the present disclosure.
  • FIG. 6 is a structural block diagram of an apparatus for configuring a virtual machine network card rate according to an embodiment of the present disclosure.
  • the virtual machine software may be modified to increase command line parameters for setting an initial transmission rate of the virtual network card, so that after the virtual machine is started, each virtual network card has a speed limit value of an initial transmission rate, and the virtual machine is modified.
  • the virtual network card driver of the running operating system allows the virtual machine operating system to provide the above initial transmission rate to the application via the internal interface; the virtual machine software can be modified to allow the virtual network card to be dynamically modified through the external interface while the virtual machine is running.
  • the speed value, and the virtual machine operating system can provide the modified speed limit value to the application through the internal interface in real time.
  • FIG. 1 a flow chart of a method for configuring a virtual network card rate according to an embodiment of the present disclosure is shown. Specifically, the method may include the following steps:
  • Step 101 After the virtual machine is started, configure an initial transmission rate of the virtual network card by using an internal interface of the virtual machine, and save the initial transmission rate in the virtual network card.
  • the embodiments of the present disclosure may be applied to a virtual environment of a computer.
  • Each virtual environment is equivalent to an independent operating system, and the user may install an application in the virtual environment, and save data and the like.
  • the internal interface of the virtual machine is generated by acquiring a system file of the virtual network card, adding a specified field to the system file, and adding a system file after the specified field as an internal interface of the virtual machine.
  • the embodiment of the present disclosure may add an internal interface for setting a virtual network card rate in the virtual machine, and the internal network may be configured to allocate an initial transmission rate to the virtual network card when the virtual machine is started.
  • the system file is a sysfs virtual file consisting of /sys/class/net/ethX/ multiple fields.
  • the specified field speed field After obtaining the sysfs virtual file, add the specified field speed field to make it become
  • the initial transmission rate may be saved in the virtual network card by reading the initial transmission rate from the specified field of the internal interface, and saving the initial transmission rate in the virtual network card.
  • embodiments of the present disclosure may read an initial transmission rate after generating a virtual hardware configuration of a virtual machine using command line parameters.
  • the command line field for the initial transfer rate of the incoming virtual NIC. The value in this field will be saved in the virtual machine's virtual NIC after the virtual machine is started.
  • Step 102 If the virtual network card transmission rate needs to be modified during the running of the virtual machine, the external interface is invoked to obtain a target transmission rate, and the virtual network card transmission rate is reconfigured to the Target transfer rate.
  • the embodiment of the present disclosure may preset an external interface for acquiring a target transmission rate, and an external program in the user or the physical machine may transmit the value of the target transmission rate to the virtual machine through the external interface.
  • the target transmission rate may include the real-time rate of the external network, or, Set the rate limit.
  • an API Application Programming Interface
  • the external interface can obtain the obtained external network after acquiring the real-time rate of the external network.
  • the real-time rate is used as the target transmission rate.
  • the user sets a rate limit rate for the external interface to read. When the external interface obtains the rate limit rate, the rate limit is used as the target transmission rate of the virtual machine.
  • the transmission rate of the virtual network card may be reconfigured to the target transmission rate via the internal interface by replacing the initial transmission rate in the specified field of the internal interface with the target transmission rate, and saving the target transmission rate to the virtual Network card.
  • the embodiment may write the value of the target transmission rate to the specified field of the internal interface through the external interface, and replace the initial transmission rate in the specified field of the internal interface, and The value of the target transmission rate is stored in the virtual network card.
  • an application running in the virtual machine may also acquire an initial transmission rate of the virtual network card, or a target transmission rate, via an internal interface.
  • the embodiment of the present disclosure may implement the code by modifying the virtual machine software, and configured in the virtual network card to allow the external interface to obtain the virtual network card target transmission rate from the intermediate software layer hypervisor between the physical machine system and the virtual machine system.
  • the virtual NIC driver when the virtual machine is started, the virtual NIC driver can obtain the initial transmission rate of the internal interface, and allows the application running in the virtual machine to obtain the initial transmission rate of the virtual NIC by reading the internal interface.
  • the virtual network card driver can obtain the value of the target transmission rate, synchronize the value of the target transmission rate to the internal interface, and allow the application running in the virtual machine to obtain the internal interface by reading the internal interface.
  • the target transmission rate of the virtual NIC can be obtained.
  • the maximum transfer rate is 1000 mbps.
  • the initial transfer rate of the application running in the virtual machine is 1000 mbps. If the target transfer rate of the external interface is 500 mbps, the virtual machine will send a configuration change interrupt to the virtual NIC driver.
  • the target transmission rate obtained from the external interface is synchronized to the internal interface of the virtual network card, and is stored in the vi->speed field of the virtual network card, when the application accesses the internal interface /sys/ When class/net/ethX/speed is read, the value of the updated vi->speed is read.
  • the initial transmission rate of the virtual network card can be configured through the internal interface, and after the initial transmission rate is configured, the target transmission rate of the virtual network card can be obtained through the external interface, and After the target transmission rate is obtained, the transmission rate of the virtual network card is reconfigured to the target transmission rate through the internal interface, so that the available bandwidth of the virtual network card can be dynamically adjusted during the running of the virtual machine, thereby realizing the user's use of the virtual machine.
  • the network bandwidth resources can be more fully utilized in the process.
  • FIG. 2 a flow chart of a method for obtaining a virtual network card rate according to an embodiment of the present disclosure is shown.
  • the present embodiment is described based on an application side in a virtual machine, and specifically includes the following steps:
  • Step 201 If an application running inside the virtual machine needs to read a target transmission rate of the virtual network card of the virtual machine, invoke the external interface to obtain a target transmission rate of the virtual network card.
  • the embodiment of the present disclosure may acquire a target transmission rate through an external interface when an application running inside the virtual machine needs to read a target transmission rate of the virtual network card of the virtual machine.
  • whether the application running inside the virtual machine needs to read the target transmission rate of the virtual network card may be determined by determining whether to invoke the external interface of the virtual machine to obtain the target transmission rate of the virtual network card:
  • the user can set a reasonable alarm threshold for network bandwidth usage.
  • the external interface is called to obtain the target transmission rate of the virtual network card to set a speed limit for the virtual network card, thereby avoiding excessive use of physical machine bandwidth resources. Or use inefficiently.
  • whether the application running inside the virtual machine needs to read the target transmission rate of the virtual network adapter of the virtual machine may be determined by determining whether to invoke the interface of the virtual machine to obtain the target of the virtual network card.
  • the external interface of the virtual machine is called to obtain the target transmission rate to reconfigure the transmission rate of the virtual network card, so that the virtual network card can reconfigure the speed limit according to the bandwidth rate of the physical machine, thereby controlling the operation in the virtual network.
  • the transfer rate of the application within the machine is called to obtain the target transmission rate to reconfigure the transmission rate of the virtual network card, so that the virtual network card can reconfigure the speed limit according to the bandwidth rate of the physical machine, thereby controlling the operation in the virtual network.
  • Step 202 Read a target transmission rate of the virtual network card of the virtual machine via the internal interface.
  • the target transmission rate is achieved by controlling the transmission rate of the application running on the virtual machine by acquiring the target transmission rate.
  • FIG. 3 a flowchart of a method for determining a virtual network card rate according to an embodiment of the present disclosure is shown.
  • the present embodiment is described based on a virtual machine side, and specifically includes the following steps:
  • Step 301 When the virtual machine is started, an initial transmission rate of the virtual network card may be generated.
  • the initial transmission rate of the virtual network card may also be generated by:
  • a command line parameter is added to the virtual network card to generate an internal interface for setting an initial transmission rate of the virtual network card, and an internal interface is used to generate an initial transmission rate of the virtual network card.
  • Manner 2 Add a configuration item to the virtual NIC to generate an internal interface for setting the initial transmission rate of the virtual NIC, and use an internal interface to generate an initial transmission rate of the virtual NIC.
  • Step 302 When the virtual machine is running, the external interface may be invoked to obtain a target transmission rate.
  • the virtual machine in the embodiment of the present disclosure is configured with an external interface for acquiring an external network rate, and the external interface may configure the obtained external network rate as a target transmission rate to the virtual network card.
  • the external control program or administrator can update the transmission rate of the virtual network card in real time through the programming interface.
  • the virtual network card may be configured by using a target transmission rate.
  • the virtual network card driver of the virtual machine can obtain the value of the target transmission rate, and overwrite the value of the target transmission rate with the initial transmission rate. Value, and then save the updated value in the virtual network card.
  • the rate parameter passed in by the API will be saved in the local variable and a signal will be sent to the virtual machine operating system to inform the network card that the rate has changed.
  • the NIC driver reads the latest rate from the virtual machine and saves it locally.
  • the application in the virtual machine reads /sys/class/net/ethX/speed and will read the latest rate.
  • Step 304 if it is detected that the application in the virtual machine reads the target transmission rate of the virtual network card via the external interface, after the external interface completes the configuration of the virtual network card, the application is invoked via the application.
  • the internal interface reads the target transmission rate.
  • an application running in a virtual machine can read a value of a target transmission rate in a virtual network card through an internal interface.
  • the system's virtio-net NIC driver enables the virtual NIC to be notified of the modified speed settings and can simultaneously modify the sysfs /sys/class/net/ethX/speed field. After modification, you can use ethtool and other tools to get the modified rate.
  • the initial transmission rate of the virtual network card is configured through the internal interface when the virtual machine is started.
  • the target transmission rate of the virtual network card is obtained through the external interface, and then The virtual network card driver reads the value of the target transmission rate, and overwrites the value of the target transmission rate with the value of the initial transmission rate. If it detects that the application reads the target transmission rate of the virtual network card through the external interface, the virtual interface is completed on the external interface.
  • the calling application reads the target transmission rate via the internal interface, thereby dynamically adjusting the transmission rate of the virtual network card to the application, making better use of the network bandwidth resources, and achieving the purpose of fully utilizing the network bandwidth resources.
  • FIG. 4 a flow chart of a method for setting a virtual network card rate according to the present disclosure is shown.
  • the present embodiment is described based on the physical machine side, and specifically includes the following steps:
  • Step 401 Obtain a real-time rate of the current network environment.
  • Step 402 The real-time rate is transmitted to the virtual machine as the target transmission rate of the virtual network card via the external interface.
  • the virtual network card driver of the operating system in the virtual machine in the embodiment of the disclosure can obtain the virtual network card rate from the intermediate software layer hypervisor between the physical machine system and the virtual machine system, and the virtual network card can be set by the virtual machine. External interface.
  • the present disclosure may enable an operator to transfer the real-time rate to a virtual machine via a physical interface via an external interface.
  • the initial value of the /sys/class/net/ethX/speed field of the sysfs system file in the virtual machine is: the value of the speed field passed in the command line when the virtual machine is created.
  • the initial The value is the target transmission rate of the virtual network card.
  • the speed value of the virtual NIC of the virtual machine is changed to 500 by calling the set_link_speed command of the virtual machine. This change will trigger the virtual machine.
  • the virtual NIC driver updates the value of vi->speed and reads the latest speed value of 500 from the virtual NIC.
  • the application in the virtual machine reads /sys/class/net/ethX/speed, it can get the updated rate of 500mbps.
  • S1 modify the qemu virtualization software, increase the speed field of the virtio-net virtual NIC, and allow the rate of incoming virtual NICs through the command line.
  • command line configuration for a virtual NIC is:
  • the driver needs to implement the ethtool_ops.get_settings interface, which is called when the application reads /sys/class/net/ethX/speed in the virtual machine.
  • the specific steps of the interface include:
  • ethtool_cmd_speed_set method to set the value of the speed field of the incoming ethtool_cmd structure, which is finally obtained by the application accessing the /sys/class/net/ethX/speed field of sysfs.
  • vi->speed is the speed value obtained from the virtual network card of the virtual machine.
  • S3 modify the qemu virtualization software, increase the set_link_speed control command, allow the dynamic setting of the virtio-net-pci virtual network card to be dynamically modified during the running of the qemu virtual machine, and modify the virtio-net NIC driver of the operating system in the virtual machine.
  • tools such as ethtool get the modified rate.
  • set_link_speed is an interface added by the user to the virtual machine.
  • the interface is provided to the external system to modify the speed setting of the virtual network card of the virtual machine during the running of the virtual machine.
  • the value of the speed field of the virtual machine's virtual NIC is modified. After the modification, the virtual machine will send a configuration change interrupt to the virtual NIC driver in the virtual machine. After the virtual network card driver in the virtual machine receives the interrupt notification, the value of the speed field is read from the I/O port of the virtual network card and stored in the vi->speed field of the virtual network card. Later, when the application accesses /sys/class/net/ethX/speed, what is read is the value of the updated vi->speed field.
  • the virtnet_config_changed method of the driver needs to be modified. This method is called after the virtual NIC obtains the configuration change interrupt. In the virtnet_config_changed method, increase the speed value stored in the virtual NIC from the I/O port of the virtio-net virtual NIC.
  • the speed incoming parameter of the virtual NIC is 1000. After the VM starts running, the speed of the virtual NIC is 1000.
  • the value read by the in-virtual application from /sys/class/net/ethX/speed is also 1000.
  • the driver of the virtual NIC in the virtual machine will update its maintained vi->speed field synchronously, and read the latest value from the virtual NIC. save. Later, when the application in the virtual machine accesses /sys/class/net/ethX/speed again, the updated value 500 is read.
  • FIG. 5 a structural block diagram of an apparatus embodiment for configuring a virtual machine network card rate of the present disclosure is shown. Specifically, the following modules may be included:
  • the initial transmission rate configuration module 501 is configured to configure, after the virtual machine is started, an initial transmission rate of the virtual network card of the virtual machine by using an internal interface set in the virtual machine, and save the initial transmission rate in the virtual In the network card, wherein the internal interface is configured to configure a transmission rate of the virtual network card, and allows communication with an external interface in the physical machine;
  • the target transmission rate configuration module 502 is configured to: if the transmission rate of the virtual network card needs to be modified during the running of the virtual machine, invoke the external interface to obtain a target transmission rate, and use the virtual network card by using the internal interface. The transmission rate is reconfigured to the target transmission rate.
  • the virtual machine may include an internal interface generation module, and the internal interface generation module may include the following sub-modules:
  • a system file obtaining submodule configured to acquire a system file of the virtual network card
  • the specified field adds a sub-module for adding a specified field to the system file
  • the internal interface determines a submodule for using the system file after the specified field is added as an internal interface.
  • the initial transmission rate configuration module 501 may include the following sub-modules:
  • An initial transmission rate reading submodule for reading the initial transmission rate from a specified field of the internal interface
  • An initial transmission rate saving submodule is configured to save the initial transmission rate in the virtual network card.
  • the target transmission rate configuration module 502 may include the following sub-modules:
  • a rate replacement submodule configured to replace an initial transmission rate in a specified field of the internal interface with the target transmission rate
  • a target transmission rate saving submodule is configured to save the target transmission rate to the virtual network card.
  • the virtual machine communicates based on a target transmission rate of the virtual network card.
  • the target transmission rate includes a real-time rate of the external network, or a preset rate-limiting rate.
  • the internal interface further allows communication with an application running in the virtual machine to cause the application to acquire a transmission rate of the virtual network card via the internal interface.
  • the initial transmission rate of the virtual network card is configured through the internal interface after the virtual machine is started.
  • the target transmission rate of the virtual network card is obtained through the external interface, and obtained.
  • the transmission rate of the virtual network card is reconfigured to the target transmission rate through the internal interface, so that the bandwidth that the virtual network card can use can be dynamically adjusted, and the network bandwidth resource can be better utilized to fully utilize the network bandwidth resource.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • a machine device and a machine readable storage medium provided by an embodiment of the present disclosure are described in detail.
  • an embodiment of the present disclosure provides a machine device, including a storage medium 601, a processor 602, a network interface 603, and a system bus 604.
  • the storage medium 601 stores a machine executable by the processor 602.
  • An instruction wherein the processor 602 executes the machine executable instructions to implement the following steps:
  • the internal interface is generated by:
  • saving the initial transmission rate in the virtual network card including:
  • the initial transmission rate is saved in the virtual network card.
  • reconfiguring the transmission rate of the virtual network card to the target transmission rate via the internal interface including:
  • the virtual machine communicates based on a target transmission rate of the virtual network card.
  • the target transmission rate includes a real-time rate of the external network, or a preset rate-limiting rate.
  • the internal interface further allows communication with an application running in the virtual machine to cause the application to acquire a transmission rate of the virtual network card via the internal interface.
  • the processor when determining whether the transmission rate of the virtual network card needs to be modified, is further caused by the machine executable instructions:
  • the processor when determining whether the transmission rate of the virtual network card needs to be modified, is further caused by the machine executable instructions:
  • Embodiments of the present disclosure also provide a machine readable storage medium having stored thereon machine executable instructions, wherein the machine executable instructions are executed by a processor to implement the following steps:
  • the machine executable instructions cause the processor to:
  • the machine executable instructions cause the processor to:
  • the initial transmission rate is saved in the virtual network card.
  • the machine executable instructions cause the processor to:
  • the virtual machine communicates based on a target transmission rate of the virtual network card.
  • the target transmission rate includes a real-time rate of the external network, or a preset rate-limiting rate.
  • the internal interface further allows communication with an application running in the virtual machine to cause the application to acquire a transmission rate of the virtual network card via the internal interface.
  • the machine executable instructions cause the processor to: when determining whether the transmission rate of the virtual network card needs to be modified:
  • the machine executable instructions cause the processor to: when determining whether the transmission rate of the virtual network card needs to be modified:
  • embodiments of the disclosed embodiments can be provided as a method, apparatus, or computer program product.
  • embodiments of the present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware aspects.
  • embodiments of the present disclosure 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, etc.) including computer usable program code.
  • Embodiments of the present disclosure are described with reference to flowchart illustrations and/or block diagrams of a method, a terminal device (system), and a computer program product according to an embodiment of the present disclosure. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine such that instructions are executed by a processor of a computer or other programmable data processing terminal device
  • Means are provided for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the instruction device implements the functions specified in one or more blocks of the flow or in a flow or block diagram of the flowchart.
  • the method for configuring a virtual machine network card rate, a method for obtaining a virtual machine network card rate, a method for determining a virtual machine network card rate, a method for setting a virtual machine network card rate, and a configuration virtual The device of the network card rate is described in detail.
  • the specific examples are used herein to explain the principles and implementations of the present disclosure.
  • the description of the above embodiments is only used to help understand the method of the present disclosure and its core ideas; For those skilled in the art, the details of the present invention and the scope of the application are subject to change without departing from the scope of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Communication Control (AREA)
  • Computer And Data Communications (AREA)

Abstract

本公开提供了一种配置虚拟网卡速率的方法及装置,所述方法包括:在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则调用所述外部接口获取目标传输速率,经由所述内部接口将所述虚拟网卡的传输速率重新配置为目标传输速率。

Description

一种配置虚拟网卡速率的方法及装置
相关申请的交叉引用
本专利申请要求于2017年6月23日提交的、申请号为201710487161.1、发明名称为“一种配置虚拟机网卡速率的方法及装置”的中国专利申请的优先权,该申请的全文以引用的方式并入本文中。
技术领域
本公开涉及网络传输技术领域,特别是涉及一种配置虚拟机网卡速率的方法,和一种配置虚拟机网卡速率的装置。
背景技术
随着计算机技术的不断发展,越来越多的用户会通过软件模拟具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统,这样便使得用户可以将一台物理服务器虚拟化为多个虚拟机,以提高服务器资源利用率,降低使用成本。
服务器管理员或应用软件可使用特定工具软件来获取物理网卡的最大传输速率(网卡限速),例如,通过在Linux系统下查询及设置网卡参数的命令ethtool,或,通过读取sys/class/net/ethX/speed等字段来获取所安装网卡的传输速率。
然而,在虚拟机内,采用上述方法一般无法获取到虚拟网卡的实际最大传输速率,这是因为在虚拟化的环境下,虚拟机内的虚拟网卡的速率指标与物理网卡的速率指标不同,一般不具备实际参考价值,所以无法通过虚拟网卡的速率指标使虚拟机获得最大带宽。
发明内容
鉴于上述问题,提出了本公开实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种配置虚拟网卡速率的方法,和一种配置虚拟网卡速率的装置。
依据本公开的一个方面,提供了一种配置虚拟网卡速率的方法,包括:
在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所 述虚拟网卡的传输速率并且允许与物理机中的外部接口进行通信;
在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则调用所述外部接口获取目标传输速率,以及经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
在一个示例中,所述内部接口通过如下方式生成:
获取所述虚拟网卡的系统文件;
在所述系统文件中增添指定字段;
将增添了指定字段的系统文件作为内部接口。
在一个示例中,将所述初始传输速率保存在所述虚拟网卡中,包括:
从所述内部接口的指定字段中读取所述初始传输速率;
将所述初始传输速率保存在所述虚拟网卡中。
在一个示例中,经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率,包括:
用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
将所述目标传输速率保存至所述虚拟网卡。
在一个示例中,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
在一个示例中,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
在一个示例中,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
在一个示例中,判断是否需要修改所述虚拟网卡的传输速率,包括:
判断运行在所述虚拟机内部的应用程序的网络带宽使用率是否达到预设阈值;
若达到所述预设阈值,则确定需要修改所述虚拟网卡的传输速率。
在一个示例中,判断是否需要修改所述虚拟网卡的传输速率,包括:
判断用户是否变更了网络带宽;
若用户变更了网络带宽,则确定需要修改所述虚拟网卡的传输速率。
根据本公开的另一方面,提供了一种配置虚拟网卡速率的装置,包括:
初始传输速率配置模块,用于在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;
目标传输速率配置模块,用于在所述虚拟机运行过程中,若需要修改所述虚拟网卡传输速率,则调用所述外部接口获取目标传输速率,以及经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
在一个示例中,所述虚拟机包括内部接口生成模块,所述内部接口生成模块包括:
系统文件获取子模块,用于获取所述虚拟网卡的系统文件;
指定字段增添子模块,用于在所述系统文件中增添指定字段;
内部接口确定子模块,用于将增添了指定字段的系统文件作为内部接口。
在一个示例中,所述初始传输速率配置模块包括:
初始传输速率读取子模块,用于从所述内部接口的指定字段中读取所述初始传输速率;
初始传输速率保存子模块,用于将所述初始传输速率保存在所述虚拟网卡中。
在一个示例中,所述目标传输速率配置模块包括:
速率替换子模块,用于用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
目标传输速率保存子模块,用于将所述目标传输速率保存至所述虚拟网卡。
在一个示例中,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
在一个示例中,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
在一个示例中,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
本公开实施例包括以下优点:
1、本公开实施例中的虚拟机提供用于设置虚拟网卡速率的接口,可用于读取虚拟网卡的速率,还可以用于设置虚拟网卡的速率。
2、本公开实施例中的虚拟机内操作系统的虚拟网卡驱动可供物理机从物理机系统和虚拟机系统之间的中间软件层Hypervisor中获取虚拟网卡速率,以及,可供应用程序获取虚拟网 卡速率的接口。
3、在本公开实施例中,通过虚拟网卡速率的接口对虚拟网卡目标传输速率进行修改时,虚拟机内操作系统的虚拟网卡驱动能够同步该修改。
4、在本公开实施例中,虚拟机提供用于设置虚拟网卡速率的接口兼容现有的获取网卡速率的接口,无需再对应用软件进行修改即可读取到虚拟网卡的目标传输速率。
5、运用本公开实施例,虚拟机可以通过虚拟机提供用于设置虚拟网卡速率的接口获得物理机的实际速率,从而能够动态调整虚拟机应用程序能够使用的带宽,更好地利用好网络带宽资源,达到充分利用网络带宽资源的目的。
附图说明
图1是本公开实施例的一种配置虚拟机网卡速率的方法实施例的步骤流程图;
图2是本公开实施例的一种获取虚拟机网卡速率的方法实施例的步骤流程图;
图3是本公开实施例的一种确定虚拟机网卡速率的方法实施例的步骤流程图;
图4是本公开实施例的一种设置虚拟机网卡速率的方法实施例的步骤流程图;
图5是本公开实施例的一种配置虚拟机网卡速率的装置实施例的结构框图。
图6是本公开实施例的一种配置虚拟机网卡速率的装置实施例的结构框图。
具体实施方式
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
为使本公开的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本公开作进一步详细的说明。
根据本公开的实施例,可修改虚拟机软件,增加设置虚拟网卡初始传输速率的命令行参数,这样虚拟机启动之后,每块虚拟网卡就有一个初始传输速率的限速值,修改虚拟机内运行的操作系统的虚拟网卡驱动,允许虚拟机操作系统把上述初始传输速率经由内部接口提供给应用程序;可修改虚拟机软件,允许在虚拟机运行状态下通过外部接口动态地修改虚拟网 卡的限速值,并且虚拟机操作系统能够实时地把修改后的限速值通过内部接口提供给应用程序。
实施例一
参考图1,示出了本公开的一种配置虚拟网卡速率的方法实施例的步骤流程图,具体可以包括如下步骤:
步骤101,在虚拟机启动后,通过虚拟机的内部接口配置虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中;
在具体实现中,本公开实施例可以应用在计算机的虚拟环境中,每一个虚拟环境都相当于一个独立的操作系统,用户可以在虚拟环境中安装应用程序,以及,保存资料等等。
在本公开实施例中,虚拟机的内部接口通过如下方式生成:获取虚拟网卡的系统文件;在系统文件中增添指定字段;将增添了指定字段后的系统文件作为虚拟机的内部接口。
在实际应用中,本公开实施例可以在虚拟机中增加用于设置虚拟网卡速率的内部接口,可以通过该内部接口在虚拟机启动的时候给虚拟网卡配置一个初始传输速率。
例如,在Linux操作系统中,系统文件是一个由/sys/class/net/ethX/多个字段组成的sysfs虚拟文件,在获取sysfs虚拟文件后,对其增添指定字段speed字段,使其变成由/sys/class/net/ethX/speed多个字段组成的sysfs虚拟文件,修改后的sysfs虚拟文件即为内部接口,通过读取这个文件的内容获得对应网卡的速率值。
在本公开实施例中,可以通过如下方式将初始传输速率保存在虚拟网卡中:从内部接口的指定字段中读取初始传输速率,将初始传输速率保存在虚拟网卡中。
在具体实现中,本公开实施例可以在使用命令行参数生成虚拟机的虚拟硬件配置后读取初始传输速率。
为使本领域技术人员更好的理解本公开,下面是本公开实施例提供一个具体的参考示例:
例如,在模拟处理器qemu中,对其命令行参数增添指定字段speed字段后,在一个虚拟网卡的命令行配置为:--netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000说明虚拟机设置有一个虚拟网卡,型号为virtio-net,mac地址为00:22:4a:df:cc:d2,最大传输速率为1000mbps,其中,speed就是增添的用于传入虚拟网卡的初始传输速率的命令行字段,该字段中的值在虚拟机启动运行后将被保存在虚拟机的虚拟网卡中。
当然,上述示例只作为一个参考示例,本领域技术人员采用其他方式单独生成内部接口 也是可行的,本公开对此不作限制。
步骤102,在所述虚拟机运行过程中,若需要修改所述虚拟网卡传输速率,则调用所述外部接口获取目标传输速率,经由所述内部接口将所述虚拟网卡传输速率重新配置为所述目标传输速率。
在实际应用中,本公开实施例可以预设一个用于获取目标传输速率的外部接口,用户或者物理机中的外部程序可以通过外部接口将目标传输速率的值传输给虚拟机。
在本公开的一个实施例中,为了使得虚拟机既能获取外部网络环境的真实速率,又能使得用户可以针对虚拟机的速率进行限制,目标传输速率可以包括外部网络的实时速率,或,预设的限速速率。
例如,在qemu的控制端monitor中设置一个设置链接速度set_link_speed的API(Application Programming Interface,应用程序编程接口)作为外部接口,外部接口在获取到外部网络的实时速率后,可将获取到的外部网络的实时速率作为目标传输速率,或者,用户预先设置一个限速速率供外部接口读取,当外部接口获取到该限速速率时,将该限速速率作为虚拟机的目标传输速率。
在本公开实施例中,可以通过如下方式经由内部接口将虚拟网卡的传输速率重新配置为目标传输速率:采用目标传输速率替换内部接口的指定字段中的初始传输速率,将目标传输速率保存至虚拟网卡。
在具体实现中,本公开实施例可以在获取到目标传输速率后,通过外部接口将目标传输速率的值写入内部接口的指定字段中,替换内部接口的指定字段中的初始传输速率,并将目标传输速率的值储存于虚拟网卡中。
例如,在虚拟机运行中,一个虚拟网卡的命令行配置为:--netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000说明该虚拟机目前最大传输速率为1000mbps,如果外部接口获取到的目标传输速率为500mbps,则通过调用虚拟机的设置链接速度set_link_speed命令,将内部接口的speed字段上的值改为500,该字段上的值将被保存在虚拟机的虚拟网卡中,作为虚拟网卡的最大传输速率。
在本公开另一个实施例中,还可以使运行在虚拟机中的应用程序经由内部接口获取虚拟网卡的初始传输速率,或,目标传输速率。
在实际应用中,本公开实施例可以通过修改虚拟机软件实现代码,在虚拟网卡中配置用于允许外部接口从物理机系统和虚拟机系统之间的中间软件层Hypervisor中获取虚拟网卡目 标传输速率的虚拟网卡驱动,当虚拟机启动时,虚拟网卡驱动能够获取内部接口的初始传输速率,并允许运行在虚拟机内的应用程序通过读取内部接口获得虚拟网卡的初始传输速率。
当外部接口获取目标传输速率后,虚拟网卡驱动可以获取到目标传输速率的值,并将目标传输速率的值同步到内部接口中,并允许运行在虚拟机内的应用程序通过读取内部接口获得虚拟网卡的目标传输速率。
例如,在虚拟机运行中,一个虚拟网卡的命令行配置为:--netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000说明该虚拟机目前最大传输速率为1000mbps,这时,运行在虚拟机内的应用程序的初始传输速率为1000mbps,如果外部接口获取到的目标传输速率为500mbps,虚拟机将会给虚拟网卡驱动发送一个配置更改的中断,虚拟网卡驱动获得中断通知后,将从外部接口获取到的目标传输速率同步到虚拟网卡的内部接口中,并存储在虚拟网卡的vi->speed字段中,当应用程序访问内部接口/sys/class/net/ethX/speed时,读取到的就是更新后的vi->speed的值。
在实际应用中运用本公开实施例,可以在虚拟机启动后,通过内部接口配置虚拟网卡的初始传输速率,在完成初始传输速率的配置后,可经由外部接口获取虚拟网卡的目标传输速率,并获取目标传输速率后,经由内部接口将虚拟网卡的传输速率重新配置为该目标传输速率,从而能在虚拟机运行过程中动态调整虚拟网卡的可使用带宽大小,进而实现了用户在使用虚拟机的过程中能够更为充分的利用网络带宽资源。
实施例二
参照图2,示出了本公开的一种获取虚拟网卡速率的方法实施例的步骤流程图,本实施例基于虚拟机中的应用程序侧进行描述,具体可以包括如下步骤:
步骤201,如果运行在虚拟机内部的应用程序需要读取所述虚拟机的虚拟网卡的目标传输速率,则调用所述外部接口获取所述虚拟网卡的目标传输速率;
在实际应用中,本公开实施例可以在运行在虚拟机内部的应用程序需要读取虚拟机的虚拟网卡的目标传输速率时,通过外部接口获取目标传输速率。
在本公开的一个实施例中,可以通过如下方法判断运行在虚拟机内部的应用程序是否需要读取虚拟网卡的目标传输速率,从而判定是否调用虚拟机的外部接口获取虚拟网卡的目标传输速率:
判断运行在虚拟机内部的应用程序的网络带宽使用率是否达到预设速率阈值,若是,则可调用虚拟机的接口获取虚拟网卡的目标传输速率;
例如,用户可以设置合理的网络带宽使用率的报警阈值,当应用程序占用过多带宽时,调用外部接口获取虚拟网卡的目标传输速率对虚拟网卡设置限速,从而避免物理机带宽资源被过度使用或者低效使用。
在本公开的另一个实施例中,可以通过如下方法判断运行在虚拟机内部的应用程序是否需要读取虚拟机的虚拟网卡的目标传输速率,从而判定是否调用虚拟机的接口获取虚拟网卡的目标传输速率:
判断用户是否重新配置带宽大小;若是,则调用虚拟机的外部接口。
例如,用户变更带宽速率时,调用虚拟机的外部接口获取目标传输速率从而对虚拟网卡的传输速率重新进行配置,从而使得虚拟网卡得以根据物理机的带宽速率重新配置限速,进而控制运行在虚拟机内的应用程序的传输速率。
当然,本领域技术人员可以通过上述任意一种或多种方法调用虚拟机的接口,本公开对此不做限制。
步骤202,经由所述内部接口读取所述虚拟机的虚拟网卡的目标传输速率。
在实际应用中运用本公开实施例,可以在运行在虚拟机内部的应用程序需要读取虚拟机的虚拟网卡的目标传输速率时,调用外部接口,再经由内部接口读取虚拟机的虚拟网卡的目标传输速率,实现了通过获取目标传输速率控制运行在虚拟机的应用软件的传输速率。
实施例三
参照图3,示出了本公开的一种确定虚拟网卡速率的方法实施例的步骤流程图,本实施例基于虚拟机侧进行描述,具体可以包括如下步骤:
步骤301,在虚拟机启动时,可生成所述虚拟网卡的初始传输速率;
在本公开的一个实施例中,还可以通过如下方式生成虚拟网卡的初始传输速率:
方式一,在虚拟网卡中增添命令行参数,生成用于设置虚拟网卡初始传输速率的内部接口,采用内部接口,生成虚拟网卡的初始传输速率。
方式二,在虚拟网卡中增添配置项,生成用于设置虚拟网卡初始传输速率的内部接口,采用内部接口,生成虚拟网卡的初始传输速率。
当然,本领域技术人员可以根据实际需要采用上述任意一种或多种方式生成虚拟网卡的初始传输速率都是可行的,对此本公开不作限制。
例如,1.修改qemu,允许虚拟网卡的启动参数增加一个speed的字段,以前的启动参数为-netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,现改为:-netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000,即增加speed=1000,用来制定虚拟机的虚拟网卡的初始传输速率为1000Mbps。2.修改qemu,使得在虚拟机启动之后,从命令行参数的speed=XXX中解析得到网卡速率,并保存在本地变量中。3.修改虚拟机的virtio_net网卡驱动,在初始化的时候,从虚拟机读取到该网卡的初始传输速率,并保存在一个本地变量中。
步骤302,在所述虚拟机运行时,可调用所述外部接口获取目标传输速率;
在具体实现中,本公开实施例的虚拟机配置有用于获取外部网络速率的外部接口,该外部接口可以将获取到的外部网络速率作为目标传输速率配置给虚拟网卡。
例如,修改qemu的monitor实现代码,在虚拟机管理程序Hypervisor中增添set_link_speed的API,用于在虚拟机程序运行时,外部控制程序或管理员通过编程接口实时更新虚拟网卡的传输速率。
步骤303,可采用目标传输速率配置所述虚拟网卡;
在本公开实施例中,当虚拟机运行时,外部接口在获取到目标传输速率后,虚拟机的虚拟网卡驱动可以获得目标传输速率的值,并将目标传输速率的值覆盖于初始传输速率的值,再将更新后的值保存于虚拟网卡中。
例如,当该set_link_speed这个API被调用后,API传入的速率参数将被保存在本地的变量,并且向虚拟机操作系统发出信号,通知网卡的速率有变化。同时,需要修改虚拟机内的网卡驱动,让该驱动监听网卡速率变化的事件。当速率变化事件发生时,网卡驱动将从虚拟机读取获得最新的速率,并保存到本地。虚拟机内的应用读/sys/class/net/ethX/speed,将读到最新的速率。
步骤304,如果检测到虚拟机内应用程序经由所述外部接口读取所述虚拟网卡的目标传输速率,则在所述外部接口完成对所述虚拟网卡的配置后,调用所述应用程序经由所述内部接口读取所述目标传输速率。
在本公开实施例中,运行在虚拟机内应用程序可以通过内部接口读取虚拟网卡中的目标传输速率的值。
例如,可以通过对虚拟机内的qemu虚拟化软件增加set_link_speed的控制命令,允许qemu虚拟化软件在虚拟机运行过程中,动态修改virtio-net-pci虚拟网卡的speed设置;再修改虚拟 机内操作系统的virtio-net网卡驱动,使虚拟网卡能够获得修改speed设置的通知,并能同步修改sysfs的/sys/class/net/ethX/speed字段。修改后,可以用ethtool等工具获得修改后的速率。
为使本领域技术人员更好的理解本公开,下面是本公开实施例提供一个具体的参考示例:
S1,修改qemu,允许虚拟网卡的启动参数增加一个speed的字段,以前的启动参数为-netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,现改为:-netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000,即增加speed=1000,用来制定虚拟机的虚拟网卡的初始传输速率为1000Mbps。
S2,修改qemu,使得在虚拟机启动之后,从命令行参数的speed=XXX中解析得到网卡速率,并保存在本地变量中。
S3,修改虚拟机的virtio_net网卡驱动,在初始化的时候,从虚拟机读取到该网卡的初始传输速率,并保存在一个本地变量中。
当然,上述示例只作为一个参考示例,本领域技术人员通过其他方式采用虚拟网卡驱动提取目标传输速率,并将其写入外部接口中也是可行的,本公开对此不作限制。
在实际应用中运用本公开实施例,可以在虚拟机启动时,通过内部接口配置虚拟网卡的初始传输速率,在完成初始传输速率的配置后,经由外部接口获取虚拟网卡的目标传输速率,再由虚拟网卡驱动读取目标传输速率的值,并将目标传输速率的值覆盖于初始传输速率的值,如果检测到应用程序经由外部接口读取虚拟网卡的目标传输速率,则在外部接口完成对虚拟网卡的配置后,调用应用程序经由内部接口读取目标传输速率,从而能够动态调整虚拟网卡对应用程序的传输速率,更好地利用好网络带宽资源,达到充分利用网络带宽资源的目的。
实施例四
参照图4,示出了本公开的一种设置虚拟网卡速率的方法实施例的步骤流程图,本实施例基于物理机侧进行描述,具体可以包括如下步骤:
步骤401,可获取当前网络环境的实时速率;
步骤402,可经由所述外部接口,将所述实时速率作为所述虚拟网卡的目标传输速率传送至虚拟机中。
本公开实施例中的虚拟机内操作系统的虚拟网卡驱动可供物理机从物理机系统和虚拟机系统之间的中间软件层Hypervisor中获取虚拟网卡速率,以及,可供虚拟机设置虚拟网卡的外部接口。
在本公开实施例中,本公开可以实现操作人员通过物理机经由外部接口将所述实时速率传送至虚拟机中。
在实际应用中,虚拟机中sysfs系统文件的/sys/class/net/ethX/speed字段的初始值就是:创建虚拟机时通过命令行传入speed字段的值,在虚拟机运行中,该初始值作为所述虚拟网卡的目标传输速率。
例如,用户在虚拟机运行中,将虚拟机的目标传输速率降低为500mbps,则通过调用虚拟机的set_link_speed命令,将虚拟机的虚拟网卡的speed值改为500,这个改动会触发虚拟机内的虚拟网卡驱动更新vi->speed的值,从虚拟网卡中读到最新的speed值500。当虚拟机内的应用程序读取/sys/class/net/ethX/speed时,就能获得更新后的速率500mbps。
为使本领域技术人员更好地理解本申请,以下通过一个具体操作的示例进一步说明本公开实施例。
S1,修改qemu虚拟化软件,virtio-net虚拟网卡增加speed字段,允许通过命令行传入虚拟网卡的速率。
例如,一个虚拟网卡的命令行配置为:
--netdev virtio-net,mac=00:22:4a:df:cc:d2,id=veth0,speed=1000
说明给虚拟机配置一个虚拟网卡,型号为virtio-net,mac地址为00:22:4a:df:cc:d2,最大传输速率为1000mbps。这里speed就是用户增加的传入虚拟网卡初始传输速率的命令行字段。这个值在虚拟机启动运行后将被保存在虚拟机的虚拟网卡中。
S2,修改虚拟机内操作系统的virtio-net网卡驱动,允许从qemu虚拟机获取speed字段的设置,并更新sysfs的/sys/class/net/ethX/speed字段,允许ethtool等工具能获取到该速率。
例如,修改虚拟机内的virtio-net虚拟网卡的驱动,该驱动中需要实现ethtool_ops.get_settings接口,该接口在虚拟机内应用程序读取/sys/class/net/ethX/speed时被调用,实现该接口的具体步骤包括:
调用ethtool_cmd_speed_set方法设置传入的ethtool_cmd结构体的speed字段的值,该值最终由应用程序访问sysfs的/sys/class/net/ethX/speed字段获取。其中,vi->speed就是从虚拟机的虚拟网卡获取的speed值。
S3,修改qemu虚拟化软件,增加set_link_speed的控制命令,允许在qemu虚拟机运行过程中,动态修改virtio-net-pci虚拟网卡的speed设置,修改虚拟机内操作系统的virtio-net 网卡驱动,能够获得修改speed设置的通知,并能同步修改sysfs的/sys/class/net/ethX/speed字段。修改后,ethtool等工具获得的是修改后的速率。
例如,set_link_speed是用户为虚拟机增加的接口,该接口提供给外部系统,用来在虚拟机运行中修改虚拟机的虚拟网卡的speed设置。
当外部系统调用虚拟机的set_link_speed接口时,将会修改虚拟机的虚拟网卡的speed字段的值。修改后,虚拟机将会给虚拟机内的虚拟网卡驱动发送一个配置更改的中断。虚拟机内的虚拟网卡驱动获得中断通知后,将从虚拟网卡的I/O端口读取到speed字段的值,并存储在虚拟网卡的vi->speed字段中。之后,当应用程序访问/sys/class/net/ethX/speed时,读取到的就是更新后的vi->speed字段的值。
为了让virtio-net虚拟网卡驱动在获得配置更改的中断后,能够同步更新vi->speed字段的值,需要修改该驱动的virtnet_config_changed方法,该方法在虚拟网卡获取配置更改的中断后被调用。需要在virtnet_config_changed方法中,增加从virtio-net虚拟网卡的I/O端口读取虚拟网卡中存储的speed值。
例如,在创建虚拟机时,虚拟网卡的speed传入参数为1000,这样,虚拟机开始运行后,虚拟网卡存储的speed值为1000。虚拟机内应用程序从/sys/class/net/ethX/speed读取到的值也为1000。当外部系统调用set_link_speed方法,将虚拟网卡存储的speed值改为500后,虚拟机内虚拟网卡的驱动将会同步更新其维护的vi->speed字段,从虚拟网卡中读取到最新的值并保存。之后,当虚拟机内应用程序再次访问/sys/class/net/ethX/speed时,将读取到更新后的值500。
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本公开实施例并不受所描述的动作顺序的限制,因为依据本公开实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本公开实施例所必须的。
实施例五
参照图5,示出了本公开的一种配置虚拟机网卡速率的装置实施例的结构框图,具体可以包括如下模块:
初始传输速率配置模块501,用于在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡 中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;
目标传输速率配置模块502,用于在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则调用所述外部接口获取目标传输速率,经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
本公开实施例的一个实施例中,所述虚拟机可以包括内部接口生成模块,所述内部接口生成模块可以包括如下子模块:
系统文件获取子模块,用于获取所述虚拟网卡的系统文件;
指定字段增添子模块,用于在所述系统文件中增添指定字段;
内部接口确定子模块,用于将增添了指定字段后的所述系统文件作为内部接口。
本公开实施例的一个实施例中,初始传输速率配置模块501可以包括如下子模块:
初始传输速率读取子模块,用于从所述内部接口的指定字段中读取所述初始传输速率;
初始传输速率保存子模块,用于将所述初始传输速率保存在所述虚拟网卡中。
本公开实施例的一个实施例中,目标传输速率配置模块502可以包括如下子模块:
速率替换子模块,用于用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
目标传输速率保存子模块,用于将所述目标传输速率保存至所述虚拟网卡。
本公开实施例的一个实施例中,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
本公开实施例的一个实施例中,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
本公开实施例的一个实施例中,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
在实际应用中运用本公开实施例,可以在虚拟机启动后,通过内部接口配置虚拟网卡的初始传输速率,在完成初始传输速率的配置后,经由外部接口获取虚拟网卡的目标传输速率,并获取目标传输速率后,经由内部接口将虚拟网卡的传输速率重新配置为目标传输速率, 从而能够动态调整虚拟网卡能够使用的带宽,更好地利用好网络带宽资源,达到充分利用网络带宽资源的目的。
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
实施例六
详细介绍本公开实施例提供的一种机器设备和一种机器可读存储介质。
如附图6所示,本公开实施例提供了一种机器设备,包括存储介质601、处理器602、网络接口603及系统总线604,存储介质601上存储有处理器602可运行的机器可执行指令,其中,所述处理器602执行所述机器可执行指令时实现以下步骤:
在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;
在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则
调用所述外部接口获取目标传输速率,以及
经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
可选地,所述内部接口通过如下方式生成:
获取所述虚拟网卡的系统文件;
在所述系统文件中增添指定字段;
将增添了指定字段后的所述系统文件作为内部接口。
可选地,将所述初始传输速率保存在所述虚拟网卡中,包括:
从所述内部接口的指定字段中读取所述初始传输速率;
将所述初始传输速率保存在所述虚拟网卡中。
可选地,经由所述内部接口将所述虚拟网卡的传输速率重新配置为所目标传输速率,包括:
用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
将所述目标传输速率保存至所述虚拟网卡。
可选地,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
可选地,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
可选地,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
可选地,在判断是否需要修改所述虚拟网卡的传输速率时,所述处理器还被所述机器可执行指令促使:
判断运行在所述虚拟机内部的应用程序的网络带宽使用率是否达到预设阈值;
若达到所述预设阈值,则确定需要修改所述虚拟网卡的传输速率。
可选地,在判断是否需要修改所述虚拟网卡的传输速率时,所述处理器还被所述机器可执行指令促使:
判断用户是否变更了网络带宽;
若用户变更了网络带宽,则确定需要修改所述虚拟网卡的传输速率。
本公开实施例还提供了一种机器可读存储介质,其上存储有机器可执行指令,其中,该机器可执行指令被处理器执行时实现以下步骤:
在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;
在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则
调用所述外部接口获取目标传输速率,以及
经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
可选地,在生成所述内部接口时,所述机器可执行指令促使所述处理器:
获取所述虚拟网卡的系统文件;
在所述系统文件中增添指定字段;
将增添了指定字段后的所述系统文件作为内部接口。
可选地,在将所述初始传输速率保存在所述虚拟网卡时,所述机器可执行指令促使所述处理器:
从所述内部接口的指定字段中读取所述初始传输速率;
将所述初始传输速率保存在所述虚拟网卡中。
可选地,在经由所述内部接口将所述虚拟网卡的传输速率重新配置为所目标传输速率时,所述机器可执行指令促使所述处理器:
用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
将所述目标传输速率保存至所述虚拟网卡。
可选地,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
可选地,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
可选地,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
可选地,在判断是否需要修改所述虚拟网卡的传输速率时,所述机器可执行指令促使所述处理器:
判断运行在所述虚拟机内部的应用程序的网络带宽使用率是否达到预设阈值;
若达到所述预设阈值,则确定需要修改所述虚拟网卡的传输速率。
可选地,在判断是否需要修改所述虚拟网卡的传输速率时,所述机器可执行指令促使所述处理器:
判断用户是否变更了网络带宽;
若用户变更了网络带宽,则确定需要修改所述虚拟网卡的传输速率。
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。
本领域内的技术人员应明白,本公开实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本公开实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本公开实施例是参照根据本公开实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令 装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本公开实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本公开实施例范围的所有变更和修改。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。
以上对本公开所提供的一种配置虚拟机网卡速率的方法、一种获取虚拟机网卡速率的方法、一种确定虚拟机网卡速率的方法,一种设置虚拟机网卡速率的方法和一种配置虚拟机网卡速率的装置,进行了详细介绍,本文中应用了具体个例对本公开的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本公开的方法及其核心思想;同时,对于本领域的一般技术人员,依据本公开的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本公开的限制。

Claims (12)

  1. 一种配置虚拟网卡速率的方法,包括:
    在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率并且允许与物理机中的外部接口进行通信;
    在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则
    调用所述外部接口获取目标传输速率,以及
    经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
  2. 根据权利要求1所述的方法,其中,所述内部接口通过如下方式生成:
    获取所述虚拟网卡的系统文件;
    在所述系统文件中增添指定字段;
    将增添了指定字段的所述系统文件作为所述内部接口。
  3. 根据权利要求2所述的方法,其中,将所述初始传输速率保存在所述虚拟网卡中,包括:
    从所述内部接口的指定字段中读取所述初始传输速率;
    将所述初始传输速率保存在所述虚拟网卡中。
  4. 根据权利要求2所述的方法,其中,经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率,包括:
    用所述目标传输速率替换所述内部接口的指定字段中的初始传输速率;
    将所述目标传输速率保存至所述虚拟网卡。
  5. 根据权利要求1所述的方法,其中,所述虚拟机基于所述虚拟网卡的目标传输速率进行通信。
  6. 根据权利要求1所述的方法,其中,所述目标传输速率包括外部网络的实时速率,或,预设的限速速率。
  7. 根据权利要求1所述的方法,其中,所述内部接口还允许与运行在虚拟机中的应用程序通信,以使得所述应用程序经由所述内部接口获取所述虚拟网卡的传输速率。
  8. 根据权利要求1所述的方法,其中,判断是否需要修改所述虚拟网卡的传输速率,包括:
    判断运行在所述虚拟机内部的应用程序的网络带宽使用率是否达到预设阈值;
    若达到所述预设阈值,则确定需要修改所述虚拟网卡的传输速率。
  9. 根据权利要求1所述的方法,其中,判断是否需要修改所述虚拟网卡的传输速率,包 括:
    判断用户是否变更了网络带宽;
    若用户变更了网络带宽,则确定需要修改所述虚拟网卡的传输速率。
  10. 一种配置虚拟网卡速率的装置,包括:
    初始传输速率配置模块,用于在虚拟机启动后,通过所述虚拟机中设置的内部接口配置所述虚拟机的虚拟网卡的初始传输速率,并将所述初始传输速率保存在所述虚拟网卡中,其中,所述内部接口用于配置所述虚拟网卡的传输速率,并且允许与物理机中的外部接口进行通信;
    目标传输速率配置模块,用于在所述虚拟机运行过程中,若需要修改所述虚拟网卡的传输速率,则调用所述外部接口获取目标传输速率,以及经由所述内部接口将所述虚拟网卡的传输速率重新配置为所述目标传输速率。
  11. 一种机器设备,包括存储介质、处理器及存储在存储介质上并可在处理器上运行的机器可执行指令,其中,所述处理器执行所述机器可执行指令时实现权利要求1-7中任意一项所述方法的步骤。
  12. 一种机器可读存储介质,其上存储有机器可执行指令,其中,该机器可执行指令被处理器执行时实现权利要求1-7任意一项所述方法的步骤。
PCT/CN2017/117514 2017-06-23 2017-12-20 一种配置虚拟网卡速率的方法及装置 WO2018233252A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CA3063781A CA3063781C (en) 2017-06-23 2017-12-20 Method and apparatus for configuring virtual network card rate
US16/685,515 US20200089522A1 (en) 2017-06-23 2019-11-15 Configuration of speed of virtual network interface card

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710487161.1 2017-06-23
CN201710487161.1A CN107222349B (zh) 2017-06-23 2017-06-23 一种配置虚拟机网卡速率的方法、装置、计算机设备和存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/685,515 Continuation US20200089522A1 (en) 2017-06-23 2019-11-15 Configuration of speed of virtual network interface card

Publications (1)

Publication Number Publication Date
WO2018233252A1 true WO2018233252A1 (zh) 2018-12-27

Family

ID=59950920

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/117514 WO2018233252A1 (zh) 2017-06-23 2017-12-20 一种配置虚拟网卡速率的方法及装置

Country Status (4)

Country Link
US (1) US20200089522A1 (zh)
CN (1) CN107222349B (zh)
CA (1) CA3063781C (zh)
WO (1) WO2018233252A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111490909A (zh) * 2020-03-08 2020-08-04 苏州浪潮智能科技有限公司 一种测试服务器nic功能的方法

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861792A (zh) * 2017-11-06 2018-03-30 郑州云海信息技术有限公司 一种基于Libvirt的虚拟机管理方法及装置
US10911547B2 (en) * 2017-12-28 2021-02-02 Dell Products L.P. Systems and methods for SMB monitor dialect
DE112018007587T5 (de) * 2018-06-19 2021-05-12 Mitsubishi Electric Corporation Programmausführungs-unterstützungsvorrichtung, programmausführungs-unterstützungsverfahren und programmausführungs-unterstützungsprogramm
CN109039697B (zh) * 2018-06-19 2019-09-17 新华三云计算技术有限公司 虚拟机网卡配置方法及装置
CN113132188B (zh) * 2019-12-31 2023-12-19 华为技术有限公司 一种通信方法及网络设备
US11329890B2 (en) * 2020-05-20 2022-05-10 Hewlett Packard Enterprise Development Lp Network-aware workload management using artificial intelligence and exploitation of asymmetric link for allocating network resources
CN112003760B (zh) * 2020-07-25 2022-02-18 苏州浪潮智能科技有限公司 检测虚拟化管理系统网络虚接的方法、装置、设备、产品
CN112260898B (zh) * 2020-10-20 2022-07-19 恒为科技(上海)股份有限公司 一种网卡及深度包检测装置
CN113259142B (zh) * 2021-07-07 2021-10-12 飞腾信息技术有限公司 虚拟机中的组播性能优化方法、系统、装置及存储介质
CN114253667B (zh) * 2021-11-19 2023-11-03 苏州浪潮智能科技有限公司 一种基于网络负载的虚拟机数据迁移智能限速方法及装置
CN114363185B (zh) * 2022-03-17 2022-10-04 阿里云计算有限公司 虚拟资源处理方法以及装置
CN115022217A (zh) * 2022-06-14 2022-09-06 深信服科技股份有限公司 一种网卡检测方法、装置及电子设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102088404A (zh) * 2010-12-10 2011-06-08 北京世纪互联工程技术服务有限公司 一种Xen虚拟机网卡限速的方法
CN102123093A (zh) * 2011-03-04 2011-07-13 华中科技大学 一种虚拟机必需网络带宽保障方法
CN103581042A (zh) * 2013-10-30 2014-02-12 华为技术有限公司 一种数据包发送的方法和设备
CN103634235A (zh) * 2013-11-01 2014-03-12 国云科技股份有限公司 一种限定虚拟机网络接口速度的方法
US20140344440A1 (en) * 2013-05-16 2014-11-20 International Business Machines Corporation Managing Network Utility of Applications on Cloud Data Centers

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102088404A (zh) * 2010-12-10 2011-06-08 北京世纪互联工程技术服务有限公司 一种Xen虚拟机网卡限速的方法
CN102123093A (zh) * 2011-03-04 2011-07-13 华中科技大学 一种虚拟机必需网络带宽保障方法
US20140344440A1 (en) * 2013-05-16 2014-11-20 International Business Machines Corporation Managing Network Utility of Applications on Cloud Data Centers
CN103581042A (zh) * 2013-10-30 2014-02-12 华为技术有限公司 一种数据包发送的方法和设备
CN103634235A (zh) * 2013-11-01 2014-03-12 国云科技股份有限公司 一种限定虚拟机网络接口速度的方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111490909A (zh) * 2020-03-08 2020-08-04 苏州浪潮智能科技有限公司 一种测试服务器nic功能的方法
CN111490909B (zh) * 2020-03-08 2022-04-26 苏州浪潮智能科技有限公司 一种测试服务器nic功能的方法

Also Published As

Publication number Publication date
CN107222349B (zh) 2021-09-10
CA3063781A1 (en) 2019-12-09
US20200089522A1 (en) 2020-03-19
CA3063781C (en) 2023-09-12
CN107222349A (zh) 2017-09-29

Similar Documents

Publication Publication Date Title
WO2018233252A1 (zh) 一种配置虚拟网卡速率的方法及装置
US11622010B2 (en) Virtualizing device management services on a multi-session platform
WO2017166785A1 (zh) 一种部署虚拟机的方法、宿主机及系统
US9031081B2 (en) Method and system for switching in a virtualized platform
US9176767B2 (en) Network interface card device pass-through with multiple nested hypervisors
WO2016177260A1 (zh) 利博伟特软件热升级方法及设备
JP4738534B2 (ja) 複数のブート可能装置間のブートネゴシエーション
US20130339950A1 (en) Intermediary virtual machine task management
US11221866B2 (en) Accelerator loading method, system, and apparatus
JP2014520327A (ja) モバイル・コンピューティング・デバイスを介して管理されたusbサービスをリモートに送達する方法および装置
WO2018201461A1 (zh) 虚拟机迁移的方法、装置和虚拟化系统
US11343141B2 (en) Methods and apparatus to migrate physical server hosts between virtual standard switches and virtual distributed switches in a network
US11416267B2 (en) Dynamic hardware accelerator selection and loading based on acceleration requirements
WO2016183832A1 (zh) 一种网络业务实例化的方法及设备
TW202121869A (zh) 虛擬網路功能的管理系統和管理方法
CN113079702A (zh) 使用单个标识和缓存虚拟磁盘置备虚拟机
TW202008154A (zh) 基於軟體容器提供雲端服務之系統及方法
US20230325203A1 (en) Provisioning dpu management operating systems using host and dpu boot coordination
US20180239628A1 (en) Hypervisor agnostic customization of virtual machines
US20240155013A1 (en) Method and apparatus for management of split-rendering in 5g networks
EP2864878B1 (en) Automated controlling of host over network
US20110106977A1 (en) Method and system for host independent secondary application processor
TW201447605A (zh) 虛擬機控制系統及方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17914707

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 3063781

Country of ref document: CA

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17914707

Country of ref document: EP

Kind code of ref document: A1