[go: up one dir, main page]

WO2014161133A1 - 虚拟机的数据交换方法、装置和系统 - Google Patents

虚拟机的数据交换方法、装置和系统 Download PDF

Info

Publication number
WO2014161133A1
WO2014161133A1 PCT/CN2013/073563 CN2013073563W WO2014161133A1 WO 2014161133 A1 WO2014161133 A1 WO 2014161133A1 CN 2013073563 W CN2013073563 W CN 2013073563W WO 2014161133 A1 WO2014161133 A1 WO 2014161133A1
Authority
WO
WIPO (PCT)
Prior art keywords
network card
data
card interface
physical
virtual network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2013/073563
Other languages
English (en)
French (fr)
Inventor
秦传瑜
逯云松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to PCT/CN2013/073563 priority Critical patent/WO2014161133A1/zh
Priority to CN201380001038.4A priority patent/CN103621026B/zh
Publication of WO2014161133A1 publication Critical patent/WO2014161133A1/zh
Priority to US14/683,131 priority patent/US10033637B2/en
Anticipated expiration legal-status Critical
Priority to US16/016,082 priority patent/US11121971B2/en
Ceased legal-status Critical Current

Links

Classifications

    • 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
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/58Association of routers
    • H04L45/586Association of routers of virtual routers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a data exchange method, apparatus, and system for a virtual machine. Background technique
  • VMs virtual machines
  • host also referred to as a physical host
  • the virtual machine presents the user as a normal physical machine. Therefore, in addition to the virtual machine.
  • virtual machines and external networks also have communication needs.
  • the mainstream virtual machine data exchange scheme has two types: soft switching and hard switching.
  • software switching refers to the behavior of using a software to imitate a physical switch, which is more complicated; and hard switching refers to using a NIC chip or using physics.
  • the switch implements the behavior of a switching logic. That is to say, the external data exchange of the virtual machine occurs on the hardware.
  • the hardware straight-through technology can be used to directly allocate the physical network card interface to the virtual machine, or use SR-IOV (single Root I/O Virtualization, VF (virtual function, virtual device simulated by SR-IO V device), allows the virtual machine to directly use the network card, so that data exchange can occur.
  • SR-IOV single Root I/O Virtualization
  • VF virtual function, virtual device simulated by SR-IO V device
  • the scheme can eliminate the consumption of the host by the virtual machine and the performance of the host, and the Layer 2 switch (L2switch) of the NIC is used to query the media access layer (MAC, Media Access Control) of the internal VF.
  • L2switch Layer 2 switch
  • MAC Media Access Control
  • the embodiment of the invention provides a data exchange method, device and system for a virtual machine, which can improve data exchange efficiency without reducing performance and flexibility, and eliminate communication between virtual machines in the host to the host to some extent. The impact of communication between other virtual machines and devices outside the host.
  • an embodiment of the present invention provides a data exchange method for a virtual machine, including: acquiring data that needs to be sent to a destination node in a physical host, where the data carries a MAC address of a destination node;
  • the destination virtual interface is determined. If the destination virtual network card is a node other than the physical host, the physical network card interface (out_port) is determined, and the physical network card corresponding to the physical network card interface is determined. The data is sent out of the physical host.
  • the determining whether the destination node is a node in the physical host or a node outside the physical host according to the MAC address of the destination node carried in the data may include:
  • the first mapping table includes a correspondence between a MAC address and a virtual network card (NIC) interface; if yes, determining a destination node The node in the physical host, if not, determines that the destination node is a node outside the physical host.
  • NIC virtual network card
  • the determining a destination virtual network card interface sends the data to the destination virtual network card corresponding to the destination virtual network interface
  • the purpose of the virtual machine can include:
  • the determining, according to the MAC address of the destination node carried in the data, whether the destination node is a node in the physical host or a section outside the physical host Points can include:
  • the first mapping table includes a correspondence between the MAC address and the virtual network card interface
  • the determining the destination virtual network card interface is: determining that the found virtual network card interface corresponding to the MAC address is the destination virtual network card interface.
  • the determining a physical network card interface, and sending the data to the physical host by using a physical network card corresponding to the physical network card interface may include:
  • the virtual network card interface obtaining, by the virtual network card interface, a physical network card interface corresponding to the virtual network card interface, where the second mapping table includes a correspondence between the virtual network card interface and the physical network card interface;
  • the method may further include:
  • the first mapping table does not perform media access layer address learning (Mac-learning).
  • the method may further include: receiving, by the physical network card, data from outside the physical host, the data carrying from outside the physical host The MAC address of the destination node;
  • the physical network card determines, according to the MAC address of the destination node carried in the data from the physical host, the corresponding destination virtual network card.
  • Interfaces which can include:
  • the virtual network card interface corresponding to the MAC address is searched from the first mapping table according to the MAC address of the destination node that is carried in the data from the physical host, and the virtual network card interface corresponding to the MAC address is the destination virtual
  • the NIC interface, the first mapping table includes a correspondence between a MAC address and a virtual NIC interface.
  • the method may further include:
  • the data from the physical host is discarded.
  • the embodiment of the present invention further provides a data exchange device of a virtual machine, including an acquiring unit, a determining unit, a first processing unit, and a second processing unit;
  • An acquiring unit configured to acquire data that needs to be sent to the destination node in the physical host, where the data carries the MAC address of the destination node;
  • a determining unit configured to determine, according to a MAC address of the destination node carried in the data, whether the destination node is a node in the physical host or a node outside the physical host;
  • a first processing unit configured to: when the determining unit determines that the destination node is a node in the physical host, determine the destination virtual network card interface, and send the data to the corresponding destination virtual machine by using the destination virtual network card corresponding to the destination virtual network card interface; ;
  • a second processing unit configured to: when the determining unit determines that the destination node is a node other than the physical host, determine a physical NIC interface, and send the data to the outside of the physical host by using a physical NIC corresponding to the physical NIC interface.
  • the determining unit may be specifically configured to determine whether a MAC address of the destination node carried in the data exists in the first mapping table, if the data is present. If the MAC address of the destination node is carried, the destination node is determined to be a node in the physical host. If the MAC address of the destination node carried in the data does not exist, the destination node is determined to be a node other than the physical host.
  • a mapping table includes a correspondence between a MAC address and a virtual network card interface;
  • the first processing unit may be specifically configured to: when the determining unit determines that the destination node is a node in the physical host, The MAC address of the destination node carried in the data is used to search for the destination virtual network card interface corresponding to the MAC address from the first mapping table, and the virtual network card interface corresponding to the MAC address is the destination virtual network card interface. Depicting the destination virtual network card corresponding to the virtual network card interface to send the data to the corresponding destination virtual machine;
  • the determining unit may be configured to: search, according to a MAC address of the destination node carried in the data, a first mapping table that is corresponding to the MAC address. If the virtual network card interface corresponding to the MAC address is found, the destination node is determined to be a node in the physical host; if the virtual network card interface corresponding to the MAC address is not found, the destination node is determined as a node outside the physical host, where the first mapping table includes a correspondence between a MAC address and a virtual network card interface;
  • the first processing unit is configured to: when the determining unit determines that the destination node is a node in the physical host, determine that the discovered virtual network card interface corresponding to the MAC address is the target virtual network card interface.
  • the second processing unit may be specifically configured to acquire, when the determining unit determines, that the destination node is a node other than the physical host, a virtual network card interface, the physical network card interface corresponding to the virtual network card interface is obtained from the second mapping table according to the virtual network card interface, and the data is sent to the physical host by using a physical network card corresponding to the physical network card interface.
  • the second mapping table includes a correspondence between a virtual network card interface and a physical network card interface.
  • the data exchange device may further include a detecting unit, and the detecting unit is configured to: when detecting that the backend virtual network card accesses the physical host, generate a corresponding virtual network card interface, and Adding, to the first mapping table, the virtual network card interface corresponding to the specified MAC address; and detecting that the backend virtual network card is removed from the physical host, deleting the corresponding information in the first mapping table The virtual network card interface of the specified MAC address.
  • the data switching apparatus may further include a receiving unit, a determining unit, and a sending unit;
  • a receiving unit configured to receive data from outside the physical host by using a physical network card, where the data from the physical host carries the MAC address of the destination node;
  • a determining unit configured to perform, according to the destination node carried in the data from outside the physical host
  • the MAC address determines the corresponding destination virtual network card interface
  • a sending unit configured to send the data from the physical host to the corresponding virtual machine by using the destination virtual network card corresponding to the destination virtual network card interface.
  • the determining unit may be specifically configured to: according to the MAC address of the destination node carried in the data from the physical host
  • the first mapping table searches for a virtual network card interface corresponding to the MAC address, and the virtual network card interface corresponding to the MAC address is a destination virtual network card interface, where the first mapping table includes a correspondence between a MAC address and a virtual network card interface. relationship.
  • the determining unit may be further configured to: when the virtual network card interface corresponding to the MAC address is not found in the first mapping table, according to the MAC address of the destination node carried in the data from the physical host , discarding the data from outside the physical host.
  • the embodiment of the present invention further provides a communication system, including at least two physical hosts, where the at least two physical hosts include a first physical host and a second physical host;
  • the first physical host is configured to obtain data that needs to be sent to the destination node in the first physical host, where the data carries the MAC address of the destination node, and determines the destination node as the physical host according to the MAC address of the destination node carried in the data.
  • the node in the first physical host is the node outside the physical host; if the node in the physical host is the node, the destination virtual NIC interface is determined, and the node outside the target physical host determines the physical NIC interface.
  • the network card sends the data to the second physical host.
  • the second physical host is configured to receive data sent by the first physical host.
  • the first physical host may be specifically configured to obtain data that needs to be sent to the destination node in the physical host, and determine whether the data exists in the first mapping table. If the MAC address of the destination node is carried in the first mapping table, the destination node is determined to be a node in the first physical host, and is carried according to the data.
  • the virtual network card interface corresponding to the MAC address is the virtual network card interface corresponding to the MAC address, and the destination virtual network card interface corresponds to the target virtual network card interface.
  • the destination virtual node sends the data to the corresponding destination virtual machine; if the MAC address of the destination node carried in the data does not exist in the first mapping table, determining that the destination node is a node outside the physical host, And determining a physical NIC interface, and sending the data to the second physics by using a physical NIC corresponding to the physical NIC interface Machine; the first mapping table comprises a mapping between the MAC address and the virtual network interface.
  • the first physical host is specifically configured to obtain data that needs to be sent to the destination node in the physical host, according to the MAC address of the destination node carried in the data. Determining, by the first mapping table, a virtual network card interface corresponding to the MAC address, and if the virtual network card interface corresponding to the MAC address is found in the first mapping table, determining that the destination node is in the first physical host a node, and determining that the virtual network card interface corresponding to the MAC address is the destination virtual network card interface, and sending the data to the corresponding destination virtual machine by using the destination virtual network card corresponding to the destination virtual network interface If the virtual network card interface corresponding to the MAC address is not found, determining that the destination node is a node outside the physical host, and determining a physical network card interface, sending the data to the physical network card corresponding to the physical network card interface.
  • the first mapping table includes a correspondence between a MAC address and a virtual network card
  • the first physical host is specifically configured to obtain The virtual network card interface used to receive the data, the physical network card interface corresponding to the virtual network card interface is obtained from the second mapping table according to the virtual network card interface, and the physical network card corresponding to the physical network card interface is used.
  • the data is sent to the first physical host, and the second mapping table includes a correspondence between the virtual network card interface and the physical network card interface.
  • the second physical host is further used to A physical host sends data;
  • the first physical host may further be configured to receive data sent by the second physical host by using a physical network card, where the data carries a MAC address of the destination node, and the corresponding destination virtual network card interface is determined according to the MAC address of the data, by using the The destination virtual network card corresponding to the destination virtual network card interface sends the data from the second physical host to the corresponding destination virtual machine.
  • the embodiment of the present invention further provides a physical host, including a processor located in a physical host kernel space, at least one virtual machine running in a physical host user space, and at least one physical network card at a physical host hardware layer, where:
  • the processor is configured to obtain data that needs to be sent to the destination node in the physical host, where the data carries the MAC address of the destination node, and the destination node is determined as the node in the physical host according to the MAC address of the destination node carried in the data. Or the node outside the physical host, if it is a node in the physical host, determine the destination virtual network card interface, and send the data to the corresponding destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface, if The node outside the physical host determines the physical NIC interface, and sends the data to the physical NIC corresponding to the physical NIC interface;
  • a virtual machine configured to receive data sent by the processor
  • a physical network card configured to receive data sent by the processor, and send the data to the outside of the physical host.
  • the processor may be configured to obtain data that needs to be sent to the destination node in the physical host, and determine whether the data is carried in the first mapping table.
  • the MAC address of the destination node, the first mapping table includes a correspondence between the MAC address and the virtual network card interface; if the MAC address of the destination node carried in the data exists in the first mapping table, determining that the destination node is the physical host And the virtual network card interface corresponding to the MAC address is configured by the virtual network card interface corresponding to the MAC address, according to the MAC address of the destination node carried in the data, and the virtual network card interface corresponding to the MAC address is The destination virtual network card interface, the virtual machine; if the MAC address of the destination node carried in the data does not exist in the first mapping table, determining that the destination node is a node outside the physical host, and determining a physical network card interface, the data is Send A physical network card corresponding to the physical network card interface.
  • the processor may be configured to obtain data that needs to be sent to the destination node in the physical host, according to the MAC address of the destination node carried in the data from the first
  • the mapping table is configured to find a destination virtual network card interface corresponding to the MAC address, where the first mapping table includes a correspondence between a MAC address and a virtual network card interface, and if a virtual network card interface corresponding to the MAC address is found, the purpose is determined.
  • the node is a node in the physical host, and determines that the discovered virtual network card interface corresponding to the MAC address is the destination virtual network card interface, and the data is generated by the destination virtual network card corresponding to the destination virtual network card interface.
  • the processor may be specifically used for determining purposes.
  • the node is a node other than the physical host
  • the virtual network card interface used to receive the data is obtained, and the physical network card interface corresponding to the virtual network card interface is obtained from the second mapping table according to the virtual network card interface.
  • the second mapping table includes a correspondence between the virtual network card interface and the physical network card interface, and the data is sent to the physical network card corresponding to the physical network card interface.
  • the physical network card is further configured to receive from a physical host. External data, the data from outside the physical host carries the MAC address of the destination node, and the data from the physical host is sent to the processor;
  • the processor is further configured to determine, according to the MAC address of the destination node carried in the data from the physical host, the corresponding virtual network card interface, where the virtual network card interface corresponding to the MAC address is the destination virtual network card interface. And sending the data to the corresponding destination virtual machine by using the destination virtual network card corresponding to the destination virtual network card interface.
  • the processor is further configured to: in a MAC address of the destination node that is carried in the data according to the data from the physical host, When the virtual network card interface corresponding to the MAC address is not found in the first mapping table, the data from the physical host is discarded.
  • the data to be sent to the destination node in the physical host is obtained, and the destination node is determined as the node in the physical host or the node outside the physical host according to the MAC address of the destination node carried in the data;
  • the node in the physical host determines the destination virtual network card interface, and sends the data to the corresponding destination virtual machine through the virtual network card corresponding to the virtual network card interface.
  • the physical network card interface is determined. Sending the data to the outside of the physical host through the physical NIC corresponding to the physical NIC interface. Because the solution exchanges data between virtual machines in the virtual machine, the communication between the virtual machines in the host and the communication between the virtual machines in the host and the devices outside the host are distinguished between the virtual machines in the host. Communication, instead of going through the physical network card, directly determines the destination virtual network card interface, and then communicates with the destination virtual machine, that is, only the content copy between the virtual machines at this time, so the PCI bus bandwidth is not wasted, which can be improved The data exchange efficiency does not affect the communication between other virtual machines in the host and the devices outside the host.
  • the physical network card interface is determined, and then the physical network card is passed.
  • the physical NIC corresponding to the interface communicates with the device outside the physical host.
  • the physical NIC needs to pass through. Therefore, it is convenient to control the data entering the physical host. For example, as long as the physical NIC does not enable the promiscuous mode, It is possible to control the data entering the physical host to be valid data, reducing The consumption of data can further improve the efficiency of data exchange; in other words, the scheme can improve the efficiency of data exchange without reducing its performance and flexibility, and to some extent eliminate the communication between virtual machines in the host to other virtual machines in the host. The impact of communication between the machine and the device outside the host.
  • FIG. 1 is a flowchart of a data exchange method of a virtual machine according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a data exchange method of a virtual machine according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a data exchange method of a virtual machine according to an embodiment of the present invention. Schematic diagram of the host;
  • FIG. 3c is a flow chart of sending in a data exchange method of a virtual machine according to an embodiment of the present invention
  • FIG. 3 is a flowchart of receiving a data exchange method of a virtual machine according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a scenario when a personal computer accesses a web server according to an embodiment of the present invention
  • FIG. Figure 5a is a schematic diagram of a scenario in which a cloud desktop user A accesses a host external website according to an embodiment of the present invention
  • Figure 5b is a flowchart of a cloud desktop user A accessing a host external website according to an embodiment of the present invention
  • 6 is a schematic structural diagram of a data exchange apparatus of a virtual machine according to an embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of a data exchange apparatus of another virtual machine according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a physical host according to an embodiment of the present invention.
  • FIG. 8b is another schematic structural diagram of a physical host according to an embodiment of the present invention.
  • FIG. 9 is still another schematic structural diagram of a physical host according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a communication system according to an embodiment of the present invention. detailed description
  • MAC address A hardware address that defines the location of a network device.
  • a network card has a globally unique fixed MAC address.
  • Host Also called the host, it is the host where the virtual machine is located, also known as the physical host.
  • EthO/Local Connection The name of the network card is displayed in the linux/windows system.
  • NIC Network card
  • Virtual NIC A network card simulated in the host is used to provide network capabilities to the virtual machine. It does not have the ability to send and receive data outside the host. It needs to use physical network cards.
  • the virtual network card can be divided into front-end virtual network cards and In the embodiment of the present invention, the virtual network card mainly refers to a back-end virtual network card.
  • SR-IOV Single Root I/O Virtualization: Single I/O Virtual Technology, in one device Multiple virtual hardware is simulated on the other to be directly allocated to the virtual machine, avoiding the overhead of software simulation.
  • VF virtual function
  • STP Spanning Tree Protocol
  • STP Spanning tree protocol, which blocks a looped bridge network into a loop-free tree topology by blocking redundant links, preventing broadcast storms on Layer 2 networks. .
  • Embodiments of the present invention provide a data exchange method, apparatus, and system for a virtual machine. The following is a detailed description.
  • Embodiment 1
  • the physical host in the embodiment of the present invention may be a physical server or the like.
  • a data exchange method for a virtual machine includes: acquiring data that needs to be sent to a destination node in a physical host, and determining, according to a MAC address of the destination node carried in the data, whether the destination node is a node in the physical host or a physical host. The node, if it is a node in the physical host, determines the destination virtual network card interface, and sends the data to the corresponding destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface; if the node is outside the physical host, The physical network card interface (out_port) is determined, and the data is sent to the physical host through the physical network card corresponding to the physical network interface.
  • the destination node may be a node in the physical host, and the container is called a node in the host, such as a virtual machine, or may be a node outside the physical host, and the device is called a node outside the host, such as a device outside the host (for example, Other physical hosts, etc.), and so on.
  • step 102 Determine, according to the data obtained in step 101, whether the destination node is an intra-host node or a host external node. If it is an intra-host node, step 103 is performed, and if it is an out-of-host node, step 104 is performed.
  • the data obtained in step 101 may be sent to a back-end virtual network card (NIC) in the physical host, and the data is sent to the back-end virtual network card.
  • NIC virtual network card
  • the switch module in the physical host it is required that the switch module here is in the kernel space of the physical host
  • the switch module determines, according to the data, whether the destination node is a host node or a host node, and if it is a host node, Step 103 is executed. If it is an out-of-host node, step 104 is performed.
  • the step "determining whether the destination node is a host node or a host node according to the data" may be implemented in any of the following manners:
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the switch module is similar to the existing bridge, it maintains a mapping table, such as a mac-port table, but the switch module is different from the current bridge, and the existing bridge needs to be carried out on a packet-by-package basis.
  • Media access layer address learning Mac-learning
  • the virtual network card interface in the first mapping table is generated when the backend virtual network card interface is connected to the host, and is deleted when the backend virtual network card is removed, and may not be MAC.
  • Address learning that is, the first mapping table changes only when the backend virtual network card is added or removed, and there is no need to perform MAC address learning on a packet-by-packet basis.
  • the MAC address learning refers to the first mapping table based on learning the forwarding of each packet entering the switch.
  • the mac-port table is the basic principle of the traditional switch.
  • the data exchange method of the virtual machine in the embodiment of the present invention may further include:
  • the virtual network interface When the virtual network card is connected to the physical host, the virtual network interface is generated, and the virtual network interface corresponding to the specified MAC address is added to the first mapping table (for example, the corresponding virtual network interface is generated).
  • the virtual network card interface When the virtual network card interface is configured, a MAC address is specified, and the correspondence between the MAC and the generated virtual network card interface is recorded in the first mapping table; and the back-end virtual network card is detected from the physical host.
  • the virtual network card interface corresponding to the specified MAC address is deleted in the first mapping table, that is, the removed backend virtual network card is deleted.
  • step 102 If it is determined in step 102 that the destination node is an intra-node node, determine the destination virtual network card interface, and send the data to the corresponding destination virtual network through the destination virtual network card corresponding to the destination virtual network card interface.
  • 3 ⁇ 4 port can be: 3 ⁇ 4 mouth:
  • step 102 it is determined whether the destination node is a node in the host or an out-of-host node by using the "MAC address of the destination node in the first mapping table", then, according to the destination node carried in the data, The MAC address of the virtual network card interface corresponding to the MAC address is obtained from the first mapping table. In the embodiment of the present invention, it is referred to as the destination virtual network card interface, and then according to the purpose, if in step 102, If the virtual network card interface corresponding to the MAC address can be found in a mapping table to determine whether the destination node is a node in the host or a node outside the host, then the virtual network card corresponding to the discovered virtual network card interface can be directly obtained. Send the data to the corresponding destination VM. In this case, determine the destination virtual NIC interface as follows:
  • step 102 If it is determined in step 102 that the destination node is an out-of-host node, determine a physical NIC interface (refer to the destination physical NIC interface), and send the data to the physical host through the physical NIC corresponding to the physical NIC interface.
  • a physical NIC interface (refer to the destination physical NIC interface)
  • send the data to the physical host through the physical NIC corresponding to the physical NIC interface For example, the details can be as follows:
  • Obtaining a virtual network card interface which is used in the embodiment of the present invention, is referred to as a source virtual network card interface, and the virtual network card interface used to receive the data is searched and obtained from the second mapping table according to the virtual network card interface.
  • the physical NIC interface corresponding to the NIC interface for example, the physical NIC interface corresponding to the virtual NIC interface is obtained by searching the second mapping table, and then the data is sent to the physical host through the physical NIC corresponding to the physical NIC interface.
  • the second mapping table may include a correspondence between a virtual network card interface and a physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • the source virtual network card interface refers to a virtual network card interface used when receiving data
  • the destination virtual network card interface refers to a destination node that is obtained by searching the first mapping table and is carried in the data. (such as the destination virtual machine) the virtual network card interface corresponding to the MAC address, should It is understood that the virtual network card interface is the source virtual network card interface through the virtual network card interface; the virtual network card interface is the destination virtual network card interface, the source virtual network card interface and the destination.
  • the virtual NIC interface can be the same interface or a different interface.
  • the network card including the physical network card and the virtual network card
  • the network card interface including the physical network interface and the virtual network interface
  • An active network card interface and a destination network card interface (such as a destination physical network card interface or a destination virtual network card interface, etc., for convenience of description, the destination physical network card interface is referred to as a physical network card interface in the embodiment of the present invention), for example, when If the network card interface receives the uplink data, the network card interface that receives the uplink data may be referred to as a source network card interface.
  • the source network card interface is referred to as a source physical network card interface.
  • the NIC interface is a virtual NIC interface
  • the source NIC interface is called a source virtual NIC interface.
  • the network card interface for sending the downlink data may be referred to as the destination network card interface.
  • the destination network card interface is called the destination.
  • the physical NIC interface is generated when the physical NIC is connected to the physical host, and is deleted when the physical NIC is removed from the physical host.
  • the virtual network card interface and the physical network card interface are in a corresponding relationship (or a mapping relationship)
  • the MAC address of the back-end virtual network card is also sent to the unicast list of the physical network card corresponding to the physical network card interface, for the The physical NIC can filter the data when it receives data.
  • the communication between the virtual machines in the host and the communication between the virtual machine in the host and the device outside the host are distinguished, if it is within the host.
  • the communication between the virtual machines does not need to go through the physical network card, but directly determines the destination virtual network card interface, and then communicates with the destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface, that is, only the virtual machine at this time.
  • the content is copied, so the PCI bus bandwidth is not wasted, the data exchange efficiency can be improved, and the communication between other virtual machines in the host and the devices outside the host is not affected; and if it is a virtual machine in the host and a device outside the host Inter-communication determines the physical NIC interface, and then communicates with the physical host NIC through the physical NIC corresponding to the physical NIC interface.
  • the physical NIC needs to pass through, so it is convenient to enter the physical host.
  • the data is controlled. For example, as long as the physical network card does not enable the promiscuous mode, then the data entering the physical host can be controlled to be valid data, reducing the consumption of invalid data, and the data exchange efficiency can be further improved.
  • the virtual machine needs to pass through the physical host when sending and receiving data, it is convenient to provide further functions for the virtual machine in the host.
  • the virtual machine can be provided with ACL and flow control functions in the host. That is to say, the solution can improve the efficiency of data exchange without reducing its performance and flexibility, and to some extent eliminate the influence of communication between virtual machines in the host on communication between other virtual machines in the host and devices outside the host. And facilitating subsequent provision of further functions for the virtual machine in the host, such as providing ACL and flow control functions.
  • the first embodiment describes the sending process in the data exchange method of the virtual machine.
  • the data exchange method of the virtual machine may further include a receiving process.
  • the virtual machine in the same physical host receives data outside the host.
  • the method for data exchange of the virtual machine may further include: receiving, by the physical network card, data from outside the physical host, according to the destination node carried in the data from the physical host.
  • the MAC address is determined to correspond to the destination virtual network card interface, and the data from the physical host is sent to the corresponding destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface.
  • the specific information may be as follows:
  • the virtual network card interface corresponding to the MAC address is searched from the first mapping table according to the MAC address of the destination node carried in the data from outside the physical host.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the virtual network card interface in the first mapping table is generated when the back-end virtual network card is connected to the host, and is deleted when the back-end virtual network card is removed, and MAC address learning (Mac-learning) may not be performed.
  • the first mapping table only changes when the backend virtual network card is added or removed, and there is no need to perform MAC learning on a packet-by-package basis.
  • the data exchange method of the virtual machine may further include:
  • the MAC address of the back-end virtual network card can also be sent to the physical network interface.
  • the physical network card can use the list to filter the data when receiving the data, so that the data entering the physical host is valid data. , reduce the consumption of invalid data.
  • the data from the physical host is sent to the corresponding destination virtual machine through the virtual network card interface corresponding to the MAC address found in step 202.
  • the embodiment of the present invention needs to pass the physical network card when receiving data from the host, so that the data entering the physical host can be conveniently controlled. For example, as long as the physical network card does not enable the promiscuous mode, then the control can be controlled.
  • the data in the physical host is valid data, which reduces the consumption of invalid data and improves the efficiency of data exchange.
  • the virtual machine since the virtual machine needs to pass through the physical host when receiving data, it can provide ACL and flow for the virtual machine in the host. control function. That is to say, the solution can improve data exchange efficiency without reducing performance and flexibility, and realize ACL and flow control functions for virtual machines in the host. According to the methods described in the first and second embodiments, the details will be further exemplified in the third, fourth and fifth embodiments.
  • Embodiment 3 the details will be further exemplified in the third, fourth and fifth embodiments.
  • FIG. 3a is a schematic diagram of a scenario of a data exchange method of a virtual machine according to an embodiment of the present invention.
  • the scenario of the data exchange method of the virtual machine provided by the embodiment of the present invention includes multiple physical hosts, where each physical host includes a hardware layer, a kernel space above the hardware layer, and a user space above the kernel space, where
  • the user space includes one or more virtual machines
  • the hardware layer includes a network connection device (ie, a physical network card), a processor and a memory (not shown), etc.
  • the kernel space can be understood as a system management layer.
  • the kernel space includes a backend virtual network card (not shown) and a switch module; and, it should be understood that each virtual machine may include virtual hardware (eg, a virtual processor, a virtual network card, etc.), above the virtual hardware Client operating system, an application on the client operating system, wherein the client operating system may include a driver, such as a virtual network card driver; and, the physical host may be connected to a physical switch through a physical network card, thereby Achieve connectivity to the Internet, and implementation and systems Other physical host to communicate.
  • virtual hardware eg, a virtual processor, a virtual network card, etc.
  • the client operating system may include a driver, such as a virtual network card driver
  • the physical host may be connected to a physical switch through a physical network card, thereby Achieve connectivity to the Internet, and implementation and systems Other physical host to communicate.
  • Figure 3b is a schematic diagram of a physical host (in order to better describe the relationship between components, in addition to the physical host, the figure also gives the physical switch and the Internet), where: 1, for the virtual machine send data:
  • the virtual machine is used to send data (for example, a packet).
  • the application in the virtual machine 1 sends a packet, and the packet is processed by the client operating system in the virtual machine 1 (which can be understood as the core of the virtual machine 1).
  • the virtual network card driver in the virtual machine 1 After being passed to the virtual network card driver in the virtual machine 1, and the virtual network card driver transfers the processed data to the backend virtual network card 1;
  • the back-end virtual network card is used to transmit the received data to the switching module; in other words, the data is processed by the back-end virtual network card into the switching module;
  • the switch module may be called map_switch, and is configured to receive data sent by the backend virtual network card, and determine, according to the MAC address of the destination node carried in the data, whether the destination node is a host node or a host node; if it is a host node, determine The destination virtual network card interface determines the physical network card interface through the destination virtual network card point, and sends the data to the physical network card corresponding to the physical network card interface through the physical network card interface.
  • Physical NIC Used to send this data out of the physical host. 2. In addition, receive data for the virtual machine:
  • Physical NIC Also used to receive data from outside the physical host and pass the data to the switch module;
  • the switching module is further configured to: receive data from a physical network card and send data from the physical host, determine a corresponding virtual network interface according to the MAC address of the destination node carried in the data, and transmit the data to the corresponding destination through the destination virtual network interface.
  • Virtual network card that is, a back-end virtual network card, such as the back-end virtual network card 1;
  • the back-end virtual network card the data is delivered to the corresponding destination virtual machine. Specifically, the back-end virtual network card 1 transfers the data to the virtual network card driver in the corresponding destination virtual machine, and is transmitted by the virtual network card driver in the destination virtual machine. The client operating system in the destination virtual machine is transferred to the corresponding application processing in the destination virtual machine by the client operating system in the destination virtual machine.
  • the physical network card may specifically adopt an SR-IOV physical network card, so that the multi-channel characteristics of the multi-queue network card of the SR-IOV physical network card and the Layer 2 switching of the network card can be fully utilized.
  • a data exchange method of a virtual machine may be as follows:
  • A301 Acquire data that needs to be sent to the destination node in the physical host, and send the data to the back-end virtual network card in the physical host.
  • the details can be as follows:
  • the data is acquired and processed by the kernel of the virtual machine, and then the data is submitted to the virtual network card driver in the virtual machine, and the virtual network card driver sends the data to the physical host.
  • Backend virtual NIC Backend virtual NIC.
  • the destination node may be a node in the physical host, and the device is called a host node, such as a virtual machine, or may be a node outside the physical host, and the device is called a host external node, such as a device outside the host, etc. Wait.
  • the backend virtual network card sends the data to a switching module located in the physical host.
  • the switching module determines whether the MAC address of the destination node carried in the data exists in the first mapping table, and if it is determined that the MAC of the destination node carried in the data exists The address is determined to be the in-host node, that is, the current communication is the intra-host communication, and then step A304 is performed. If it is determined that the MAC address of the destination node carried in the data does not exist, the destination node is determined to be the external node of the host. That is, the current communication is the out-of-host communication, and then step A305 is performed.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the virtual network card interface in the first mapping table is generated when the back-end virtual network card is connected to the host, and is deleted when the back-end virtual network card is removed, and MAC address learning may not be performed.
  • the first mapping table changes only when the back-end virtual network card is added or removed, and there is no need to perform MAC address learning on a packet-by-package basis.
  • the first mapping table is maintained by the switching module.
  • the following method may be used to determine:
  • step A304 Determining, according to the MAC address of the destination node carried in the data, the virtual network card interface corresponding to the MAC address from the first mapping table, and if the virtual network card interface corresponding to the MAC address is found, determining that the destination node is an intra-node node, Then, step A304 is performed; if the virtual network card interface corresponding to the MAC address is not found, it is determined that the destination node is a host external node, and then step A305 is performed.
  • the switching module determines the destination virtual network card interface, and sends the data to the corresponding destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface, where the process ends; for example, the following may be specifically :
  • the switching module searches the first mapping table for the virtual network card interface (in_port) corresponding to the MAC address according to the MAC address of the destination node carried in the data, that is, the destination virtual network card interface, and then uses the destination virtual network card interface corresponding to the destination virtual The network card sends the data to the corresponding destination virtual machine.
  • step A303 the method of "can find the virtual network card interface corresponding to the MAC address in the first mapping table" is used to determine whether the destination node is a node in the host or a node outside the host, then this The data may be directly sent to the corresponding destination virtual machine through the destination virtual network card corresponding to the discovered virtual network card interface.
  • the switching module determines the physical NIC interface. (out_port), the data is sent to the physical host through the physical network card corresponding to the physical NIC interface, and the process ends; for example, the specific information may be as follows:
  • the switching module obtains the physical NIC interface corresponding to the source virtual NIC interface of the data by searching the second mapping table, and then sends the data to the physical host through the physical NIC corresponding to the physical NIC interface.
  • the second mapping table may include a correspondence between a virtual network card interface and a physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • a data exchange method of a virtual machine may be as follows:
  • the physical network card receives data from outside the physical host.
  • the physical network card can receive data from the physical host. valid data.
  • the physical network card sends the data from the physical host to the switching module, and the switching module determines whether the MAC address of the destination node carried in the data outside the physical host exists in the first mapping table, if the self-physical host exists The MAC address of the destination node carried in the external data, and obtains the virtual network interface corresponding to the MAC address.
  • the details can be as follows:
  • the physical network card drives the data (that is, the data from the physical host) through the physical network card, and submits the data to the physical network card interface (the physical network card interface is located on the switching module), and the physical mapping interface is used to query the first mapping table. If the MAC address of the destination node carried in the data is found in the first mapping table, the virtual network interface (ie, the destination virtual network interface) corresponding to the MAC address is obtained.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the virtual network card interface in the first mapping table is generated when the back-end virtual network card is connected to the host, and is deleted when the back-end virtual network card is removed, and MAC address learning may not be performed.
  • the first mapping table only changes when the backend virtual network card is added or removed, and no MAC address learning needs to be done on a packet-by-package basis.
  • the data may be directly discarded; of course, if the data has been filtered in step B301.
  • the physical host is valid data, that is, the corresponding MAC address can be found in the first mapping table.
  • the switch module sends the data from the physical host to the corresponding destination virtual machine by using the destination virtual network card corresponding to the virtual network card interface determined in step B302.
  • the data from the physical host may be sent by the physical network card to the back-end virtual network card corresponding to the virtual network card interface determined in step B302, and then the data from the physical host is sent by the back-end virtual network card to the destination. virtual machine.
  • the communication between the virtual machines in the host and the communication between the virtual machine in the host and the device outside the host are distinguished, if it is within the host.
  • the communication between the virtual machines does not need to go through the physical network card, but directly determines the destination virtual network card interface, and then communicates with the destination virtual machine through the destination virtual network card corresponding to the destination virtual network card interface, that is, only the virtual machine at this time.
  • the content is copied, so the PCI bus bandwidth is not wasted, the data exchange efficiency can be improved, and the communication between other virtual machines in the host and the devices outside the host is not affected; and if it is a virtual machine in the host and a device outside the host Inter-communication determines the physical NIC interface, and then communicates with the physical host device through the physical NIC interface.
  • the physical NIC needs to pass through, so it is convenient to enter the data of the physical host. Control, for example, as long as the physical NIC does not turn on promiscuous mode, then It can control the data entering the physical host to be valid data, reduce the consumption of invalid data, and further improve the data exchange efficiency.
  • the virtual machine since the virtual machine needs to go through the physical host when sending and receiving data, it can be a virtual machine in the host.
  • the physical host includes three virtual machines as an example for description.
  • the three virtual machines are virtual machines of two web pages (web) servers and virtual machines of one database server, that is, virtual machines of the web server A.
  • the virtual machine of the web server A is referred to as the web server A
  • the virtual machine of the web server B is referred to as the web server B
  • the virtual machine of the database server is referred to as the database server.
  • the local connection interface ethO on the two web servers and the database server is connected to the switch module through the virtual network card.
  • the corresponding physical network card interface is not specified, and the local connection interfaces ethl of the two web servers are exchanged through the virtual network card.
  • Module, and specify the corresponding physical NIC interface that is, as shown in Figure 4a, the details are as follows:
  • the two local connection interfaces ethO and ethl of the web server A are respectively connected to the virtual network card ⁇ _1 ⁇ 2 and v_nic3, and the two local connection interfaces ethO and ethl of the web server B are respectively connected to the virtual network card ⁇ _1 ⁇ 4 and ⁇ _11 ⁇ 5, the database
  • the local connection interface ethO is connected to the virtual network card v_nicl; the virtual network card ⁇ _11 1, v_nic2, v_nic3, ⁇ _1 ⁇ 4 and ⁇ _1 ⁇ 5 respectively through virtual network card interface 1 (in_portl), virtual network card interface 2 (in_port2), virtual network card interface 3 ( in_port3 ), virtual NIC interface 4 ( in_port4 ), and virtual NIC interface 5 ( in_port5 ) are connected to the switch module.
  • the virtual network card interface 3 and the virtual network card interface 5 respectively have corresponding physical network card interfaces, that is, the virtual network card interface 3 corresponds to the physical network card interface 1 (out_portl), and the virtual network card interface 5 corresponds to the physical network card interface 2 (out_port2), and
  • the MAC address of the virtual network card corresponding to the virtual network card interface 3 and the MAC address of the virtual network card corresponding to the virtual network card interface 5 are respectively sent to the corresponding physical network card.
  • the physical network card may be an "SR-IOV" network card. It can be delivered to each VF.
  • the physical NIC interface 1 corresponds to VF2, and the physical NIC interface 2 corresponds to VF3.
  • the data communication between the virtual machines inside all the physical hosts can not pass through the physical network card, and when the web server communicates with the devices outside the domain physical host, the data can also be sent to the respective VFs for transmission.
  • the web server when an external user accesses the physical host, it can also perform data filtering on the physical NIC and then offload it to VF2 and VF3, and then directly send it to the corresponding virtual machine at the physical NIC interface.
  • the specific process of the data exchange method of the virtual machine may be as follows:
  • the personal computer sends data and sends it to the physical switch via the Internet.
  • the physical switch sends the data to a physical network card on the physical host, such as a "SR-IOV" network card.
  • the physical network card internally exchanges the data, and sends the data to VF2.
  • the data is delivered to the corresponding physical NIC interface 1.
  • Physical NIC interface 1 Query the first mapping table, and find that the MAC address of the destination node is the virtual NIC interface 3, and then send the data to the virtual NIC interface 3.
  • the virtual network card corresponding to the virtual network card interface 3 is v_nic3, and the virtual machine corresponding to the ⁇ _1 ⁇ 3 is the web server A. Therefore, the virtual network card interface 3 sends the data to the web server A, and the application in the web server A The program handles it.
  • the embodiment of the present invention needs to pass the physical network card (including the VF), so that the data entering the physical host can be conveniently controlled, for example, as long as the physical network card does not enable the promiscuous mode. Then, it is possible to control the data entering the physical host to be valid data, reduce the consumption of invalid data, and improve the efficiency of data exchange; in addition, since the virtual machine needs to pass through the physical host when receiving data, it can be virtualized in the host.
  • the machine provides ACL and flow control functions. In other words, the solution can improve the efficiency of data exchange without reducing its performance and flexibility, and provide ACL and flow control functions for virtual machines in the host.
  • the physical host includes three virtual machines as an example for description.
  • the three virtual machines are the virtual machine of the desktop cloud user A, the virtual machine of the desktop cloud user B, and the virtual machine of the desktop cloud user C, and the device is called a desktop cloud user.
  • A, desktop cloud user B and desktop cloud users (.
  • the local connection interface of the desktop cloud user A, the local connection interface of the desktop cloud user B, and the local connection interface ethO of the desktop cloud user C are all connected to the switch module through the virtual network card, and the corresponding physical network card interface is specified, and the desktop cloud user C is specified.
  • the local connection interface ethl is connected to the switch module through the virtual NIC, the corresponding physical NIC interface is not specified, as shown in Figure 5a.
  • the local connection interface of the desktop cloud user A is connected to the virtual network card v_nicl
  • the local connection interface of the desktop cloud user B is connected to the virtual network card v_nic2
  • the local connection interface ethO of the desktop cloud user C is connected to the virtual network card.
  • V_nic3 the local connection interface ethl of the desktop cloud user C is connected to the virtual network card v_nic4; wherein, the virtual network - v_nicl, v_nic2, ⁇ _1 ⁇ 3 and ⁇ _1 ⁇ 4 respectively pass the virtual network card interface 1 (in_portl), the virtual network card interface 2 (in_port2) ), virtual network card interface 3 ( in_port3 ) and virtual network card interface 4 ( in_port4 ) access to the switch module.
  • the virtual network card interface 1, the virtual network card interface 2, and the virtual network card interface 3 respectively have corresponding physical network card interfaces, that is, the virtual network card interface 1 and the virtual network card interface 2 correspond to the physical network card interface 1 (out_portl), and the virtual network card interface 3 Corresponds to physical NIC interface 2 ( out_port2 ).
  • the virtual network card interface 4 does not specify a corresponding physical network interface.
  • Desktop cloud user A sends out the data of the website, and after processing it through the kernel, the virtual network card driver in the virtual machine of the desktop cloud user A is delivered.
  • the virtual network card in the virtual machine sends the data to the backend virtual network card in the physical host.
  • v_nicl sends the data to the switching module located in the physical host through the virtual network interface 1 .
  • the switching module After receiving the data, the switching module queries the first mapping table to determine whether the MAC address of the destination node carried in the data exists in the first mapping table, and the data is sent to the device outside the host because the data is sent. When the MAC address of the destination node is not queried in the first mapping table, step 505 is performed.
  • the switching module may also search for a virtual network card interface corresponding to the MAC address from the first mapping table according to the MAC address of the destination node carried in the data, and send the data to the host outside the host. If the virtual network card interface corresponding to the MAC address of the destination node is not queried in the first mapping table, step 505 is performed.
  • the switch module queries the second mapping table, obtains a physical NIC interface corresponding to the virtual NIC interface 1, that is, the physical NIC interface 1, and then sends the data to the physical NIC interface 1.
  • the physical network card interface 1 submits the data to the physical network card 1 and sends the data to the physical switch by the physical network card.
  • the physical switch sends the data to the corresponding website via the Internet.
  • the virtual machine in the host when the data exchange of the virtual machine is performed, the virtual machine in the host is used.
  • the communication between the virtual machine and the device outside the host is distinguished from the communication between the virtual machines in the host. If the communication between the virtual machines in the host is not required, the virtual network card is not required to be directly determined, but the destination virtual network card interface is directly determined. Then, the destination virtual network card corresponding to the destination virtual network card interface communicates with the destination virtual machine, that is, only the content copy between the virtual machines is at this time, so the PCI bus bandwidth is not wasted, and the data exchange efficiency can be improved without affecting.
  • the communication between the other virtual machines in the host and the devices outside the host if the communication between the virtual machine in the host and the device outside the host, the physical network card interface is determined, and then the physical network card and the physical host corresponding to the physical network card interface are determined.
  • the external device communicates. Because it communicates with the device outside the physical host, it needs to pass the physical network card. Therefore, it is convenient to control the data entering the physical host. For example, as long as the physical network card does not open the promiscuous mode, it can be controlled to enter the physical host. Data is valid data, reducing the consumption of invalid data , can further improve the efficiency of data exchange;
  • the virtual machine needs to pass through the physical host when sending and receiving data, it is convenient to provide further functions for the virtual machine in the host.
  • the virtual machine can be provided with ACL and flow control functions in the host. That is to say, the solution can improve the efficiency of data exchange without reducing its performance and flexibility, and to some extent eliminate the influence of communication between virtual machines in the host on communication between other virtual machines in the host and devices outside the host. And facilitating subsequent provision of further functions for the virtual machine in the host, such as providing ACL and flow control functions.
  • the embodiment of the present invention further provides a data exchange device for a virtual machine.
  • the data exchange device of the virtual machine includes an obtaining unit 601, a determining unit 602, and a first processing unit 603. And a second processing unit 604;
  • the obtaining unit 601 is configured to acquire data that needs to be sent to the destination node in the physical host, where the data carries the MAC address of the destination node.
  • the destination node may be a node in the physical host, and the device is called a host node, such as a virtual machine, or may be a node outside the physical host, and the device is called a host external node, such as a device outside the host, etc. Wait.
  • the determining unit 602 is configured to determine, according to the MAC address of the destination node carried in the data acquired by the obtaining unit 601, whether the destination node is an intra-host node or a host external node;
  • the first processing unit 603 is configured to: when the determining unit 602 determines that the destination node is an intra-host node, determine the destination virtual network card interface, and send the data to the corresponding destination virtual machine by using the destination virtual network card corresponding to the destination virtual network card interface;
  • the second processing unit 604 is configured to: when the determining unit 602 determines that the destination node is an out-of-host node, determine a physical network card interface, and send the data to the physical host through the physical network card corresponding to the physical network card interface.
  • the determining unit 602 may be configured to send the data to a back-end virtual network card in the physical host, where the back-end virtual network card sends the data to a switching module located in the physical host, and the switching module is configured according to the data. Determining whether the destination node is an intra-host node or a host external node;
  • the first processing unit 603 may be specifically configured to: when the determining unit 602 determines that the destination node is an intra-host node, the switching module determines the destination virtual network card interface, and the switching module passes the destination virtual network card interface corresponding to the destination virtual The network card sends the data to the corresponding destination virtual machine;
  • the second processing unit 604 is specifically configured to: when the determining unit 602 determines that the destination node is an out-of-host node, the switching module determines the physical network card interface, and sends the data to the physical host through the physical network card corresponding to the physical network card interface. .
  • the determining unit 602 may be specifically configured to determine whether a MAC address of the destination node carried in the data exists in the first mapping table, and if there is a MAC address of the destination node carried in the data, determining that the destination node is a node in the host If the MAC address of the destination node carried in the data does not exist, it is determined that the destination node is an out-of-host node.
  • the first processing unit 603 may be specifically configured to: when the determining unit 602 determines that the destination node is an intra-host node, search for the MAC address corresponding to the MAC address from the first mapping table according to the MAC address of the destination node carried in the data.
  • the virtual network card interface that is, the destination virtual network card interface, sends the data to the corresponding destination virtual machine through the virtual network card corresponding to the virtual network card interface.
  • the determining unit 602 is specifically configured to: search, according to the MAC address of the destination node carried in the data, the virtual network card interface corresponding to the MAC address from the first mapping table; if the MAC address corresponding to the MAC address is found, The virtual network card interface determines that the destination node is a node in the host; if the virtual network card interface corresponding to the MAC address is not found, the destination node is determined to be an external node of the host.
  • the first processing unit 603 may specifically determine, in the determining unit 602, that the destination node is When the node in the physical host is a node, the virtual network card interface corresponding to the MAC address that is found is determined as the destination virtual network card interface. which is:
  • the first processing unit 603 may be specifically configured to: when the determining unit 602 determines that the destination node is an intra-host node, determine that the discovered virtual network card interface corresponding to the MAC address is a destination virtual network card interface, by using the purpose.
  • the destination virtual network card corresponding to the virtual network card interface sends the data to the corresponding destination virtual machine.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the virtual network card interface in the first mapping table is generated when the back-end virtual network card interface is connected to the host, and is deleted when the back-end virtual network card is removed, and MAC address learning (Mac-learning) may not be performed.
  • the first mapping table is changed only when the backend virtual network card is added or removed, and there is no need to perform MAC address learning on a packet-by-package basis. That is, the data exchange device of the virtual machine may further include a detecting unit;
  • a detecting unit configured to: when the back-end virtual network card accesses the physical host, generate a corresponding virtual network card interface, and add the virtual network card interface corresponding to the specified MAC address in the first mapping table; and, detect When the backend virtual network card is removed from the physical host, the virtual network card interface corresponding to the specified MAC address is deleted in the first mapping table.
  • the second processing unit 604 is specifically configured to: when the determining unit 602 determines that the destination node is an out-of-host node, obtain a source virtual network card interface of the data, and look up the second mapping table according to the source virtual network card interface. Obtaining a physical NIC interface corresponding to the source virtual NIC interface, and sending the data to the physical host through the physical NIC corresponding to the physical NIC interface.
  • the second mapping table may include a correspondence between a virtual network card interface and a physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • the physical NIC interface is generated when the physical NIC is connected to the physical host, and is deleted when the physical NIC is removed from the physical host.
  • the virtual network card interface and the physical network card interface are associated with each other (or a mapping relationship)
  • the MAC address of the back-end virtual network card is also sent to the unicast list of the physical network card corresponding to the physical network card interface, for the The physical NIC can filter the data when it receives data.
  • the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same entity or a plurality of entities.
  • the data switching device of the virtual machine may be a device such as a physical host, and the physical
  • the data switching device of the virtual machine may be a device such as a physical host, and the physical
  • the structure of the host reference may be made to the foregoing description, and details are not described herein again.
  • the specific implementation of the above various units refer to the foregoing embodiments, and details are not described herein again.
  • the data exchange device of the virtual machine in the embodiment of the present invention performs communication between the virtual machines in the host and the communication between the virtual machine in the host and the device outside the host when performing data exchange of the virtual machine. Differentiate, if the communication between the virtual machines in the host is not required to pass through the physical network card, the first processing unit 603 directly determines the destination virtual network card interface, and then the destination virtual network card interface and destination corresponding to the destination virtual network card interface.
  • the virtual machine communicates, that is, it is only a copy of the content between the virtual machines, so the PCI bus bandwidth is not wasted, the data exchange efficiency can be improved, and the communication between other virtual machines and the devices outside the host is not affected;
  • the second processing unit 604 needs to determine the physical network card interface, and then communicates with the physical host external device through the physical network card corresponding to the physical network interface, because the physical host When the external device communicates, it needs to pass the physical network card, so it is easy to advance.
  • the physical host data is controlled.
  • the data entering the physical host can be controlled to be valid data, reducing the consumption of invalid data, and further improving the data exchange efficiency;
  • the solution can improve the efficiency of data exchange without reducing its performance and flexibility, and to some extent eliminate the influence of communication between virtual machines in the host on communication between other virtual machines in the host and devices outside the host.
  • ACL and flow control functions for virtual machines in the host Example VII.
  • the data exchange device of the virtual machine can be used for receiving data from outside the physical host in addition to the data.
  • the data exchange device of the virtual machine The receiving unit 701, the determining unit 702, and the sending unit 703 may also be included;
  • the receiving unit 701 is configured to receive data from the physical host through the physical network card, where the data from the physical host carries the MAC address of the destination node;
  • the determining unit 702 is configured to determine, according to the MAC address of the destination node carried in the data received by the receiving unit 701, a corresponding destination virtual network card interface;
  • the sending unit 703 is configured to send the data to the corresponding destination virtual machine by using the virtual network card corresponding to the destination virtual network card interface.
  • the virtual network card interface that is found may be used to determine a corresponding back-end virtual network card, and the data is sent to the destination virtual machine by using the determined back-end virtual network card.
  • the determining unit 702 is specifically configured to search, according to the MAC address of the destination node carried in the data from the physical host, the virtual network card interface corresponding to the MAC address, that is, the destination virtual network card interface, from the first mapping table;
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the virtual network card interface in the first mapping table is generated when the back-end virtual network card is connected to the host, and is deleted when the back-end virtual network card is removed, and MAC address learning (Mac-learning) may not be performed, and the first mapping is performed.
  • the table changes only when the back-end virtual NIC is added or removed, and there is no need to perform MAC address learning on a packet-by-package basis.
  • the data may be directly discarded. which is:
  • the determining unit 702 is further configured to: when the virtual network card interface corresponding to the MAC address is not found in the first mapping table, according to the MAC address of the destination node carried in the data from the physical host, discard the source Data outside the physical host.
  • the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same entity or a plurality of entities.
  • the data switching device of the virtual machine may be a device such as a physical host, and the physical The host may include a processor, a physical network card, and a virtual machine.
  • the data exchange device of the virtual machine in the embodiment of the present invention needs to pass the physical network card when receiving data from the host, so that the data entering the physical host can be conveniently controlled, for example, as long as the physical network card is not turned on. Mode, then you can control the data entering the physical host is valid data, reduce the consumption of invalid data, can improve the efficiency of data exchange;
  • the virtual machine needs to go through the physical host when receiving data, it can be in the host Provide ACL and flow control for virtual machines. In other words, the solution can improve data exchange efficiency without reducing performance and flexibility, and provide ACL and flow control functions for virtual machines in the host.
  • Example VIII Example VIII.
  • the embodiment of the present invention further provides a communication system.
  • the communication system includes at least two physical hosts, where the at least two physical hosts include a first physical host 1001 and a second physical host 1002. , among them:
  • the first physical host 1001 is configured to obtain data that needs to be sent to the destination node in the physical host (ie, the first physical host 1001), where the data carries the MAC address of the destination node, and is determined according to the MAC address of the destination node carried in the data. If the destination node is the internal node of the physical host or the external node of the physical host; if the node is the physical host, determine the destination virtual NIC interface, and send the data to the corresponding destination virtual machine through the virtual NIC corresponding to the destination virtual NIC interface. If the physical host is an external node, the physical network card interface is determined, and the data is sent to the corresponding second physical host 1002 through the physical network card corresponding to the physical network interface.
  • the second physical host 1002 is configured to receive data sent by the first physical host 1001.
  • the first physical host 1001 may be configured to obtain data that needs to be sent to the destination node in the physical host (ie, the first physical host 1001), and determine whether the MAC of the destination node carried in the data exists in the first mapping table.
  • An address if the MAC address of the destination node carried in the data exists in the first mapping table, determining that the destination node is a node in the physical host (that is, the first physical host), and according to the destination node carried in the data
  • the MAC address is used to search for the virtual network card interface corresponding to the MAC address from the first mapping table, that is, the destination virtual network card interface, and the virtual network card corresponding to the virtual network card interface of the destination sends the data to the corresponding destination virtual machine; If the MAC address of the destination node carried in the data does not exist in the mapping table, the destination node is determined as the external node of the host, and the physical network card interface is determined, and the data is sent to the second physical host through the physical network card corresponding to the physical
  • the first physical host 1001 may be configured to search, according to the MAC address of the destination node carried in the data, the virtual network card interface corresponding to the MAC address from the first mapping table, if the MAC address is found Corresponding virtual network card interface (ie, the destination virtual network card interface), determining that the destination node is a node in the physical host (the first physical host 1001), and determining that the discovered virtual network card interface corresponding to the MAC address is the destination virtual
  • the NIC interface sends the data to the corresponding destination virtual machine through the virtual NIC corresponding to the virtual NIC interface; if the virtual NIC interface corresponding to the MAC address is not found, the destination node is determined as the external node of the host, and the object is determined.
  • the NIC interface sends the data to the second physical host 1002 through the physical NIC corresponding to the physical NIC interface.
  • the first mapping table may include information such as a correspondence between a MAC address and a virtual network card interface.
  • the first mapping table may be a mac-port table.
  • the first physical host 1001 is configured to obtain a source virtual network card interface of the data, and obtain, according to the source virtual network card interface carried in the data, a physical corresponding to the source virtual network card interface from the second mapping table.
  • the NIC interface sends the data to the outside of the first physical host 1001 through the physical NIC corresponding to the physical NIC interface.
  • the second mapping table may include a correspondence between a virtual network card interface and a physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • the second physical host 1002 can also be used to send data to the first physical host.
  • the first physical host 1001 is further configured to receive data from the second physical host 1002 through the physical network card, where the data from the second physical host 1002 carries the MAC address of the destination node; according to the second physical host 1002
  • the MAC address of the destination node carried in the data determines the corresponding destination virtual network card interface in the physical host (that is, the first physical host 1001); the virtual network card corresponding to the virtual network card interface of the destination uses the data from the second physical host 1002.
  • Send to the corresponding destination virtual machine can be as follows:
  • the first physical host 1001 may be configured to: according to the MAC address of the destination node carried in the data from the second physical host 1002, look up the virtual network card interface corresponding to the MAC address from the first mapping table, that is, the destination virtual network card. The interface sends the data from the second physical host 1002 to the corresponding destination virtual machine through the virtual network card corresponding to the destination virtual network card interface.
  • the first physical host 1001 may be further configured to: find, according to the MAC address of the destination node carried in the data from the second physical host 1002, the virtual network interface corresponding to the MAC address from the first mapping table. At this time, the data from the second physical host 1002 is discarded.
  • the data exchange device of any of the virtual machines provided by the embodiment of the present invention is integrated in the physical host.
  • the communication system may also include other devices, other devices outside the physical host, such as physical switches, other servers, and/or personal computers, and the like, and details are not described herein.
  • the communication system can also realize the beneficial effects of the data exchange device of the virtual machine described in Embodiments 6 and 7, and details are not described herein again.
  • the embodiment of the present invention further provides a physical host.
  • the physical host includes at least one virtual machine located in a user space of the physical host, such as a first virtual machine 802A and a second virtual machine 802B.
  • the switching module 800 located in the kernel space of the physical host and at least one virtual network card, such as the first virtual network card 801 A and the second virtual network card 801B (for illustrative purposes only, the number Not limited to), and at least one physical network card 803 located at the hardware layer of the physical host (for illustrative purposes only, the number is not limited), where:
  • the first virtual machine 802A is configured to send data that needs to be sent to the destination node, where the data carries a MAC address of the destination node;
  • the application in the first virtual machine 802A sends data, and the data is processed by the client operating system in the first virtual machine 802A (which can be understood as the kernel of the first virtual machine 802A), and then transmitted to the first virtual machine.
  • a virtual network card driver in the 802A and the virtual network card driver transfers the processed data to the first virtual network card 801 A;
  • the first virtual network card 801A for transmitting the data to the switching module 800; in other words, the data is processed by the first virtual network card 801 A into the switching module 800;
  • the switching module 800 is configured to determine, according to the MAC address of the destination node carried in the data, whether the destination node is an intra-host node or a host external node; if the intra-host node is, determine the destination virtual NIC interface, and use the destination virtual NIC interface The data is delivered to the corresponding destination virtual network card; if it is the external node of the host, the physical network card interface is determined, and the data is transmitted to the physical network card corresponding to the physical network card interface through the physical network card interface.
  • the target virtual network card herein may be, for example, a second virtual network card 801B; the destination virtual machine herein may be, for example, a second virtual machine 802B; the physical network card herein may be, for example, a physical network card 803;
  • the second virtual network card 801B for transmitting the data to a corresponding destination virtual machine, such as the second virtual machine 802B;
  • the physical network card 803 is configured to send the data to the outside of the physical host.
  • the switching module 800 may be specifically configured to determine whether a MAC address of the destination node carried in the data exists in the first mapping table, and if yes, determine that the destination node is a node in the host, and according to the data, The destination MAC address of the destination node is searched from the first mapping table for the destination virtual network card interface corresponding to the MAC address, and the data is transmitted to the corresponding destination virtual network card, for example, the second virtual network card. 801B; If no, the destination node is determined to be an out-of-host node, and the physical network card interface is determined, and the data is transmitted to the physical network card 803 corresponding to the physical network card interface through the physical network card interface.
  • the switching module 800 may be configured to: according to the MAC address of the destination node carried in the data, search for a virtual network interface (ie, a destination virtual network interface) corresponding to the MAC address from the first mapping table, if The virtual network card interface corresponding to the MAC address is found, and the destination node is determined to be the intra-host node, and the virtual network card interface corresponding to the MAC address is determined as the destination virtual network card interface, and the destination virtual network card interface is The data is delivered to the corresponding destination virtual network card, for example, the second virtual network card 801B; if the virtual network card interface corresponding to the MAC address is not found, the destination node is determined to be the external node of the host, and the physical network card interface is determined.
  • the physical NIC interface passes the data to the corresponding physical NIC 803.
  • the source virtual network card interface carried in the data may be searched in the second mapping table to obtain a physical network card interface corresponding to the source virtual network card interface, that is,
  • the switching module 800 is specifically configured to: when determining that the destination node is an out-of-host node, obtain the virtual network card interface (also referred to as a source virtual network card interface) used to receive the data, according to the source virtual network card interface carried in the data.
  • the physical mapping card interface corresponding to the source virtual network card interface is obtained in the second mapping table, and the data is transmitted to the physical network card 803 corresponding to the physical network card interface through the physical network card interface.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the second mapping table may include a correspondence between the virtual network card interface and the physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • the destination virtual network card interface in the first mapping table is on the virtual network card (specifically The virtual network card is generated when it is connected to the host and deleted when the back-end virtual network card is removed. MAC address learning (Mac-learning) is not performed.
  • the first mapping table is only added when the back-end virtual network card is added or removed. Change without having to do MAC address learning on a packet-by-package basis.
  • the physical NIC interface is generated when the physical NIC 803 accesses the physical host, and is deleted when the physical NIC 803 is removed from the physical host.
  • the physical NIC interface is generated when the physical NIC 803 accesses the physical host, and is deleted when the physical NIC 803 is removed from the physical host.
  • the MAC address of the back-end virtual network card is also sent to the unicast list of the physical network card corresponding to the physical network card interface.
  • the physical network card 803 can filter the data when receiving data.
  • Physical network card 803 is further configured to receive data from outside the physical host, the data from the physical host carries the MAC address of the destination node, and the data from the physical host is transmitted to the switching module 800;
  • the switching module 800 is further configured to receive data from the physical host 802 and send data from the physical host, determine a corresponding virtual NIC interface according to the MAC address of the destination node carried in the data, and transmit the data to the corresponding virtual NIC interface.
  • the purpose of the virtual network card need to be explained, the virtual network card here, for example, may be the first virtual network card 801A;
  • the first virtual network card 801 A is also used to transfer data to the corresponding destination virtual machine.
  • the destination virtual machine may be, for example, the first virtual machine 802A; specifically, the first virtual machine
  • the virtual network card driver is passed to the client operating system in the destination virtual machine, and then transmitted by the client operating system in the destination virtual machine to the corresponding application processing in the destination virtual machine (such as the first virtual machine 802A).
  • the switching module 800 may be: searching for the destination virtual network card interface corresponding to the MAC address from the first mapping table according to the MAC address of the destination node carried in the data from the physical host.
  • the destination virtual network card interface transmits data to the corresponding destination virtual network card.
  • the destination virtual network card herein may be, for example, the first virtual network card 801A.
  • the data may be directly discarded. which is:
  • the switching module 800 can also be configured to discard the virtual network card interface corresponding to the MAC address from the first mapping table according to the MAC address of the destination node carried in the data from the physical host. Data from outside the physical host.
  • the physical host of the embodiment of the present invention when data exchange of the virtual machine is performed, communication between the virtual machine in the host (such as the first virtual machine 802A and the second virtual machine 802B) and the host are The virtual machine (such as the first virtual machine 802A or the second virtual machine 802B) is distinguished from the communication between the external devices. If the communication between the virtual machines in the host is performed, the physical network card 803 does not need to be passed. Directly determine the destination virtual NIC interface, and then communicate with the destination virtual machine through the destination virtual NIC corresponding to the destination virtual NIC interface, that is, only the content copy between the virtual machines at this time, so the PCI bus bandwidth is not wasted, and the data can be improved.
  • the exchange efficiency does not affect the communication between other virtual machines in the host and the devices outside the host; if the communication between the virtual machine in the host and the device outside the host, the physical network card interface is determined, and then the physical network card interface is adopted.
  • the corresponding physical NIC 803 communicates with the device outside the physical host, because it communicates with the device outside the physical host.
  • it is convenient to control the data entering the physical host For example, as long as the physical network card 803 does not enable the promiscuous mode, then the data entering the physical host can be controlled to be valid data, reducing the consumption of invalid data. , can further improve the efficiency of data exchange;
  • the virtual machine needs to pass through the physical host when sending and receiving data, it is convenient to provide further functions for the virtual machine in the host.
  • the virtual machine can be provided with ACL and flow control functions in the host. That is to say, the solution can improve the efficiency of data exchange without reducing its performance and flexibility, and to some extent eliminate the influence of communication between virtual machines in the host on communication between other virtual machines in the host and devices outside the host. And facilitating subsequent provision of further functions for the virtual machine in the host, such as providing ACL and flow control functions.
  • the embodiment of the present invention further provides a physical host.
  • the physical host includes at least one virtual machine 802 running in a physical host user space and a processor 801 and at least one physical entity at a physical host hardware layer.
  • Network card 803 where:
  • the processor 801 is configured to obtain data that needs to be sent to the destination node in the physical host, where the data carries the MAC address of the destination node, and determines, according to the MAC address of the destination node carried in the data, whether the destination node is a host node or a host node. If it is a node in the host, determine the destination virtual network card machine 802, if it is a host external node, determine the physical network card interface, and send the data to the physical network card 803 corresponding to the physical network card interface;
  • a virtual machine 802 configured to receive data sent by the processor 801;
  • the physical network card 803 is configured to receive data sent by the processor 801 and send the data to the physical host.
  • the processor 801 is specifically configured to obtain data that needs to be sent to the destination node in the physical host, determine whether the MAC address of the destination node carried in the data exists in the first mapping table, and if yes, determine that the destination node is The node in the host searches for the destination virtual network card interface corresponding to the MAC address from the first mapping table according to the MAC address of the destination node carried in the data, and sends the data to the corresponding virtual network card corresponding to the virtual network card interface.
  • the target virtual machine 802 if not, the destination node is determined as the external node of the host, and the physical network card interface is determined, and the data is sent to the physical network card 803 corresponding to the physical network card interface.
  • the processor 801 is specifically configured to search, according to the MAC address of the destination node carried in the data, the virtual network interface (ie, the destination virtual network interface) corresponding to the MAC address from the first mapping table, if The virtual network card interface corresponding to the MAC address is found, and the destination node is determined to be the intra-host node, and the virtual network interface corresponding to the MAC address is determined as the destination virtual network card interface, and the virtual network card interface corresponding to the destination is used.
  • the virtual network card sends the data to the corresponding destination virtual machine 802.
  • the destination node is determined to be the external node of the host, and the physical network card interface is determined, and the data is sent to the physical network.
  • the source virtual network card interface carried in the data may be searched in the second mapping table to obtain a physical network card interface corresponding to the source virtual network card interface, that is,
  • the processor 801 is specifically configured to: when determining that the destination node is an out-of-host node, obtain a source virtual network card interface of the data, and obtain, according to the source virtual network card interface carried in the data, the source virtual network interface from the second mapping table.
  • the physical NIC interface corresponding to the NIC interface sends the data to the physical NIC The physical NIC corresponding to the interface.
  • the first mapping table may include information such as a correspondence between the MAC address and the virtual network interface (in_port).
  • the first mapping table may be a mac-port table.
  • the second mapping table may include a correspondence between the virtual network card interface and the physical network card interface.
  • the virtual network card interface and the physical network card interface may be in a one-to-one relationship or a many-to-one relationship. That is, the same physical network card interface may correspond to multiple virtual network card interfaces.
  • the destination virtual network card interface in the first mapping table is generated when the virtual network card (specifically, the back-end virtual network card) interface is connected to the host, and is deleted when the back-end virtual network card is removed, and the MAC address may not be performed.
  • Learning Mac-learning
  • the first mapping table is changed only when the back-end virtual network card is added or removed, and there is no need to perform MAC address learning on a packet-by-package basis.
  • the physical NIC interface is generated when the physical NIC accesses the physical host and is deleted when the physical NIC is removed from the physical host.
  • the physical NIC interface is generated when the physical NIC 803 accesses the physical host, and is deleted when the physical NIC 803 is removed from the physical host.
  • the MAC address of the back-end virtual network card is also sent to the unicast list of the physical network card corresponding to the physical network card interface.
  • the physical network card 803 can filter the data when receiving data.
  • the physical network card 803 is further configured to receive data from outside the physical host, where the data from the physical host carries the MAC address of the destination node, and the data from the physical host is sent to the processor 801.
  • the processor 801 is further configured to receive data from the physical host and send the physical network card 803, and determine the virtual network card interface corresponding to the physical network card according to the MAC address of the destination node carried in the data from the physical host (ie, The virtual NIC interface is configured to send the data from the physical host to the destination virtual machine 802 through the virtual NIC corresponding to the virtual NIC interface.
  • the virtual NIC interface is configured to send the data from the physical host to the destination virtual machine 802 through the virtual NIC corresponding to the virtual NIC interface.
  • the specifics can be: 3 ⁇ 4 under:
  • the processor 801 is specifically configured to search, according to the MAC address of the destination node carried in the data from the physical host, the virtual network card interface corresponding to the MAC address from the first mapping table, where the virtual network card interface corresponding to the destination is The virtual network card sends the data from outside the physical host to the destination virtual machine 802.
  • the data can be directly discarded. which is:
  • the processor 801 is further configured to: when the virtual network card interface corresponding to the MAC address is not found in the first mapping table, according to the MAC address of the destination node carried in the data from the physical host, discard the Data from outside the physical host.
  • the processor 801 of the physical host in the embodiment of the present invention distinguishes the communication between the virtual machine and the communication between the virtual machine and the device outside the host when the data exchange of the virtual machine is performed, if it is a virtual machine
  • the communication between the two does not need to go through the physical network card 803, but directly determines the destination virtual network card interface, and then communicates with the destination virtual machine 802 through the virtual network card interface, that is, only the content copy between the virtual machines 802 is at this time. Therefore, the PCI bus bandwidth is not wasted, and the communication between the other virtual machine 802 and the device outside the host is not affected. If the communication is with the device outside the host, the destination physical network card 803 needs to be determined, and then the physical network card is used.
  • the 803 communicates with the device outside the physical host.
  • the physical network card 803 needs to pass through. Therefore, it is convenient to control the data entering the physical host. For example, as long as the physical network card 803 does not enable the promiscuous mode, then Control the data entering the physical host is valid data, reduce no Consumption data, data exchange efficiency can be improved;
  • the virtual machine 802 sending and receiving data need to go through a physical host, can be provided and the flow control ACL for the virtual machine 802 within the host.
  • the solution can improve the data exchange efficiency without reducing the performance and flexibility, and eliminate the influence of the communication between the virtual machines in the host on the communication between the other virtual machines 802 and the devices outside the host, and
  • the virtual machine 802 is provided with ACL and flow control functions in the host.
  • the embodiment of the present invention further provides a physical host.
  • the physical host may include at least one processor 901, such as a CPU, at least one network interface 904, such as a physical network card, or other user interface 903. And a memory 905 and at least one communication bus 902.
  • the communication bus 902 is used to implement connection communication between these components.
  • the network interface 904 is configured to implement connection communication between the physical host and the network, such as the network connection.
  • Port 904 can be used to connect devices such as physical network cards and/or physical switches.
  • the user interface 903 may include a display, a keyboard or other pointing device, such as a mouse, a trackball, a touchpad or a touch sensitive display.
  • the memory 905 may include a high speed random access memory (RAM), and may also include a non-volatile memory such as at least one disk memory.
  • the memory 905 can also include at least one storage device located away from the processor 901.
  • memory 605 stores the following elements, executable modules or data structures, or a subset thereof, or their extension set:
  • Operating system 9051 which contains various system programs for implementing various basic services and handling hardware-based tasks
  • Application module 9052 which contains various applications for implementing various application services.
  • the application module 9052 includes, but is not limited to, a switch module, various virtual network cards, and virtual network card related modules, such as an acquisition unit, a determination unit, a first processing unit, and a second processing unit.
  • the processor 901 is configured to obtain data that needs to be sent to the destination node in the physical host, where the data carries the MAC address of the destination node, and determines that the destination node is the physical host according to the MAC address of the destination node carried in the data.
  • the node is also the external node of the physical host. If the node is the physical host, the destination virtual NIC interface is determined, and the virtual NIC corresponding to the virtual NIC interface sends the data to the corresponding destination virtual machine. Then, the physical network card interface is determined, and the data is sent to the physical network card corresponding to the physical network card interface, so as to send the data to the physical host.
  • the processor 901 is specifically configured to determine whether a MAC address of the destination node that is carried in the data exists in the first mapping table, where the first mapping table includes a correspondence between the MAC address and the destination virtual network card interface. If yes, the destination node is determined to be the intra-host node, and the corresponding destination virtual network card interface is obtained according to the MAC address of the destination node carried in the data, and the data is sent to the destination through the virtual network card interface corresponding to the destination virtual network card interface.
  • the virtual machine if not, determining that the destination node is an out-of-host node, and obtaining a corresponding physical NIC interface according to the source virtual NIC interface of the data.
  • the source virtual NIC interface corresponding to the data may be obtained by searching the second mapping table. a physical NIC interface, and then sending the data to a physical NIC corresponding to the physical NIC interface, so that This data is sent outside the physical host.
  • the processor 901 is further configured to receive, by using a physical network card, data from outside the physical host, where the data from the physical host carries the MAC address of the destination node; and the physical network card is configured according to the MAC address of the destination node carried in the data.
  • the address is determined to correspond to the destination virtual network card interface, and the data is sent to the corresponding destination virtual machine through the virtual network card corresponding to the destination virtual network card interface.
  • the communication between the virtual machines in the machine and the communication between the virtual machine and the device outside the host are distinguished. If the communication between the virtual machines is performed, the physical network card is not required to be directly determined, but the destination virtual network card interface is directly determined, and then The virtual network card interface communicates with the destination virtual machine, that is, only the content copy between the virtual machines is at this time, so the PCI bus bandwidth is not wasted, and the communication between other virtual machines and the devices outside the host is not affected; If the communication is performed with the device outside the host, the physical NIC needs to be determined, and then the physical NIC is used to communicate with the device outside the physical host.
  • the physical NIC is required to communicate with the device outside the physical host. Control the data entering the physical host. For example, as long as the physical network card does not open the promiscuous mode, then the data entering the physical host can be controlled to be valid data, reducing the consumption of invalid data, and improving the data exchange efficiency.
  • the virtual machine can provide ACL and flow control functions for the virtual machine in the host. That is to say, the solution can improve the data exchange efficiency without reducing the performance and flexibility, and eliminate the influence of the communication between the virtual machines in the host on the communication between other virtual machines and the devices outside the host, and realize the host.
  • ACL and flow control for virtual machines A person skilled in the art may understand that all or part of the various steps of the foregoing embodiments may be completed by a program instructing related hardware.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Read only memory (ROM, Read Only Memory), random access memory (RAM), disk or optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明实施例提供一种虚拟机的数据交换方法,包括:获取物理主机内需要发送给目的节点的数据,根据该数据确定目的节点为本物理主机内的节点还是本物理主机外的节点,若为本物理主机内的节点,则确定目的虚拟网卡接口,通过该目的虚拟网卡接口对应的虚拟网卡将所述数据发给对应的目的虚拟机,若为本物理主机外的节点,则确定物理网卡接口,通过所述物理网卡接口对应的物理网卡将所述数据发送至所述物理主机外。此外,本发明实施例还提供相应的装置和系统。

Description

虚拟机的数据交换方法、 装置和系统 技术领域
本发明涉及通信技术领域, 具体涉及一种虚拟机的数据交换方法、装置和 系统。 背景技术
在虚拟化技术产生以后, 多个虚拟机(VM, Virtual Machine )共存于一 个主机(Host, 后文亦称为物理主机) 内部, 虚拟机对用户呈现好似一个正常 的物理机, 因此, 除了虚拟机之间有数据交换需求之外, 虚拟机与外界网络也 有通信的需求。
现在主流的虚拟机数据交换方案有软交换和硬交换两种, 其中,软件交换 指的是用软件模仿一个物理交换机的行为, 实现较为繁瑣; 而硬交换指的是在 网卡芯片上或利用物理交换机来实现一个交换逻辑的行为,也就是说,虚拟机 对外的数据交换发生在硬件上, 例如, 具体可以使用硬件直通技术, 将物理网 卡接口直接分配给虚拟机,或者使用 SR-IOV(单根 I/O虚拟技术, Single Root I/O Virtualization ) 网卡生成的 VF ( virtual function , SR-IO V设备模拟出来的虚拟 设备), 使得虚拟机能直接使用网卡, 这样, 数据交换就可以发生在物理交换 机或网卡上的交换逻辑模块上。 该方案可以消除虚拟机使用网络对主机的消 耗, 性能较好, 而且网卡内部的第二层交换机(L2switch, Layer 2 switch )是 查询内部 VF的媒体接入层(MAC, Media Access Control) 转发, 逻辑上没有 环路, 可以避免生成树协议(STP, Spanning Tree Protocol ) 的开销, 实现较 为灵活。
在对现有技术的研究和实践过程中, 本发明的发明人发现, 虽然现有的这 种硬交换方案相对于软交换而言, 性能和灵活性都有所提高,但其数据交换效 率并不够高, 比如, 虚拟机通信全部都需要先经过网卡, 以及无论是与主机内 的单元还是主机外的设备进行通信都会消耗周边原件扩展接口( PCI, Pedpherd Component Interconnect) 总线带宽, 等等, 而且, 在该方案中, 主机内虚拟机 间的通信还会影响主机内的其他虚拟机与主机外设备间的通信。 发明内容
本发明实施例提供一种虚拟机的数据交换方法、装置和系统, 可以在不降 低其性能和灵活性的前提下,提高数据交换效率, 一定程度上消除主机内虚拟 机间的通信对主机内的其他虚拟机与主机外设备间的通信的影响。
第一方面, 本发明实施例提供一种虚拟机的数据交换方法, 包括: 获取物理主机内需要发送给目的节点的数据,所述数据中携带目的节点的 MAC地址;
根据所述数据中携带的目的节点的 MAC地址确定目的节点为本物理主机 内的节点还是本物理主机外的节点;
若为本物理主机内的节点, 则确定目的虚拟接口,通过所述目的虚拟网卡 若为本物理主机外的节点, 则确定物理网卡接口 (out_port ), 通过所述物 理网卡接口对应的物理网卡将所述数据发送至所述物理主机外。
在第一种可能的实施方式中, 结合第一方面, 所述根据所述数据中携带的 目的节点的 MAC地址确定目的节点为本物理主机内的节点还是本物理主机外 的节点, 可以包括:
确定第一映射表中是否存在所述数据中携带的目的节点的 MAC地址, 所 述第一映射表包括 MAC地址和虚拟网卡( NIC , Network Interface Card )接口 的对应关系; 若是, 则确定目的节点为本物理主机内的节点, 若否, 则确定目 的节点为本物理主机外的节点。
在第二种可能的实施方式中, 结合第一方面的第一种可能的实施方式, 所 述确定目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将 所述数据发给对应的目的虚拟机, 可以包括:
根据所述数据中携带的目的节点的 MAC地址从第一映射表中查找与所述 MAC地址对应的目的虚拟网卡接口 ( in_port );
通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的 目的虚拟机。
在第三种可能的实施方式中, 结合第一方面, 所述根据所述数据中携带的 目的节点的 MAC地址确定目的节点为物理主机内的节点还是物理主机外的节 点, 可以包括:
根据所述数据中携带的目的节点的 MAC地址从第一映射表中查找与所述 MAC地址对应的虚拟网卡接口, 所述第一映射表包括 MAC地址和虚拟网卡 接口的对应关系;
若查找到与所述 MAC地址对应的虚拟网卡接口, 则确定目的节点为本物 理主机内的节点;
若查找不到与所述 MAC地址对应的虚拟网卡接口, 则确定目的节点为本 物理主机外的节点;
其中, 所述确定目的虚拟网卡接口为: 确定所述查找到的与所述 MAC地 址对应的虚拟网卡接口为所述目的虚拟网卡接口。
在第四种可能的实施方式中, 结合第一方面, 所述确定物理网卡接口, 通 过所述物理网卡接口对应的物理网卡将所述数据发送至所述物理主机外 ,可以 包括:
获取接收所述数据时所使用的虚拟网卡接口;
根据所述虚拟网卡接口从第二映射表中查找得到与所述虚拟网卡接口对 应的物理网卡接口,所述第二映射表包括虚拟网卡接口和物理网卡接口的对应 关系;
通过所述物理网卡接口对应的物理网卡将所述数据发送至所述物理主机 夕卜。
在第五种可能的实施方式中, 结合第一方面的第一种可能的实施方式、第 一方面的第二种可能的实施方式、第一方面的第三种可能的实施方式或第一方 面的第四种可能的实施方式, 该方法还可以包括:
检测到后端虚拟网卡接入本物理主机时, 生成虚拟网卡接口, 并在所述第 一映射表中添加对应于指定的 MAC地址的所述虚拟网卡接口; 以及,
检测到后端虚拟网卡从本物理主机上移除时,在所述第一映射表中删除对 应于所述指定的 MAC地址的所述虚拟网卡接口;
其中, 所述第一映射表不进行媒体接入层地址学习 ( Mac-learning )。 在第六种可能的实施方式中, 结合第一方面, 该方法还可以包括: 通过物理网卡接收来自物理主机外的数据,该来自物理主机外的数据携带 目的节点的 MAC地址;
根据所述来自物理主机外的数据中携带的目的节点的 MAC地址确定对应 目的虚拟网卡接口;
通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来自物理主机外 的数据发送给对应的目的虚拟机。
在第七种可能的实施方式中, 结合第一方面的第六种可能的实施方式, 所 述由物理网卡根据所述来自物理主机外的数据中携带的目的节点的 MAC地址 确定对应目的虚拟网卡接口, 可以包括:
根据所述来自物理主机外的数据中携带的目的节点的 MAC地址从第一映 射表中查找与所述 MAC地址对应的虚拟网卡接口, 所述与所述 MAC地址对 应的虚拟网卡接口为目的虚拟网卡接口, 所述第一映射表包括 MAC地址和虚 拟网卡接口的对应关系。
此外, 可选的, 在所述通过物理网卡接收来自物理主机外的数据之后, 该 方法还可以包括:
根据所述来自物理主机外的数据中携带的目的节点的 MAC地址, 从第一 映射表中查找不到与所述 MAC地址对应的虚拟网卡接口时, 丟弃所述来自物 理主机外的数据。
第二方面, 本发明实施例还提供一种虚拟机的数据交换装置, 包括获取单 元、 判断单元、 第一处理单元和第二处理单元;
获取单元, 用于获取物理主机内需要发送给目的节点的数据, 该数据中携 带目的节点的 MAC地址;
判断单元, 用于根据所述数据中携带的目的节点的 MAC地址确定目的节 点为物理主机内的节点还是物理主机外的节点;
第一处理单元, 用于在判断单元确定目的节点为物理主机内的节点时,确 定目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述 数据发给对应的目的虚拟机;
第二处理单元, 用于在判断单元确定目的节点为物理主机外的节点时,确 定物理网卡接口,通过所述物理网卡接口对应的物理网卡将所述数据发送至所 述物理主机外。 在第一种可能的实现方式中, 结合第二方面, 所述判断单元, 具体可以用 于确定第一映射表中是否存在所述数据中携带的目的节点的 MAC地址, 若存 在所述数据中携带的目的节点的 MAC地址, 则确定目的节点为本物理主机内 的节点, 若不存在所述数据中携带的目的节点的 MAC地址, 则确定目的节点 为本物理主机外的节点; 所述第一映射表包括 MAC地址和虚拟网卡接口的对 应关系;
在第二种可能的实现方式中, 结合第二方面的第一种可能的实现方式, 所 述第一处理单元,具体可以用于在判断单元确定目的节点为本物理主机内的节 点时, 根据所述数据中携带的目的节点的 MAC地址从第一映射表中查找与所 述 MAC地址对应的目的虚拟网卡接口, 所述与所述 MAC地址对应的虚拟网 卡接口为目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡 将所述数据发给对应的目的虚拟机;
在第三种可能的实现方式中, 结合第二方面, 所述判断单元, 具体可以用 于根据所述数据中携带的目的节点的 MAC 地址从第一映射表中查找与所述 MAC地址对应的虚拟网卡接口; 若查找到与所述 MAC地址对应的虚拟网卡 接口, 则确定目的节点为本物理主机内的节点; 若查找不到与所述 MAC地址 对应的虚拟网卡接口, 则确定目的节点为本物理主机外的节点, 所述第一映射 表包括 MAC地址和虚拟网卡接口的对应关系;
则所述第一处理单元,具体用于在判断单元确定目的节点为本物理主机内 的节点时, 确定所述查找到的与所述 MAC地址对应的虚拟网卡接口为所述目 的虚拟网卡接口。
在第四种可能的实现方式中, 结合第二方面, 所述第二处理单元, 具体可 以用于在判断单元确定目的节点为本物理主机外的节点时,获取接收所述数据 时所使用的虚拟网卡接口,根据所述虚拟网卡接口从第二映射表中查找得到与 所述虚拟网卡接口对应的物理网卡接口,通过所述物理网卡接口对应的物理网 卡将所述数据发送至所述物理主机外;所述第二映射表包括虚拟网卡接口和物 理网卡接口的对应关系。
在第五种可能的实现方式中, 结合第二方面的第一种可能的实施方式、第 二方面的第二种可能的实施方式、第二方面的第三种可能的实施方式或第二方 面的第四种可能的实施方式, 该数据交换装置, 还可以包括检测单元; 检测单元, 用于检测到后端虚拟网卡接入本物理主机时, 生成对应的虚拟 网卡接口, 并在所述第一映射表中添加对应于指定的 MAC地址的所述虚拟网 卡接口; 以及, 检测到所述后端虚拟网卡从本物理主机上移除时, 在所述第一 映射表中删除对应于所述指定的 MAC地址的所述虚拟网卡接口。
在第六种可能的实现方式中, 结合第二方面, 该数据交换装置, 还可以包 括接收单元、 确定单元和发送单元;
接收单元, 用于通过物理网卡接收来自物理主机外的数据, 该来自物理主 机外的数据携带目的节点的 MAC地址;
确定单元, 用于根据所述来自物理主机外的数据中携带的目的节点的
MAC地址确定对应目的虚拟网卡接口;
发送单元,用于通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来 自物理主机外的数据发送给对应的虚拟机。
在第七种可能的实现方式中, 结合第二方面的第六种可能的实施方式, 所 述确定单元,具体可以用于根据所述来自物理主机外的数据中携带的目的节点 的 MAC地址从第一映射表中查找与所述 MAC地址对应的虚拟网卡接口, 所 述与所述 MAC地址对应的虚拟网卡接口为目的虚拟网卡接口, 所述第一映射 表包括 MAC地址和虚拟网卡接口的对应关系。
此外, 所述确定单元,还可以用于在根据所述来自物理主机外的数据中携 带的目的节点的 MAC地址, 从第一映射表中查找不到与所述 MAC地址对应 的虚拟网卡接口时, 丟弃所述来自物理主机外的数据。
第三方面, 本发明实施例还提供一种通信系统, 包括至少两台物理主机, 其中所述至少两台物理主机包括第一物理主机和第二物理主机;
第一物理主机, 用于获取第一物理主机内需要发送给目的节点的数据, 该 数据中携带目的节点的 MAC地址, 根据所述数据中携带的目的节点的 MAC 地址确定目的节点为本物理主机 (即第一物理主机 )内的节点还是本物理主机 外的节点; 若为本物理主机内的节点, 则确定目的虚拟网卡接口, 通过所述目 本物理主机外的节点, 则确定物理网卡接口,通过所述物理网卡接口对应的物 理网卡将该数据发送至第二物理主机。
第二物理主机, 用于接收第一物理主机发送的数据。
在第一种可能的实现方式中, 结合第三方面, 所述第一物理主机, 具体可 以用于获取本物理主机内需要发送给目的节点的数据,确定第一映射表中是否 存在所述数据中携带的目的节点的 MAC地址, 若所述第一映射表中存在所述 数据中携带的目的节点的 MAC地址, 则确定目的节点为第一物理主机内的节 点, 并根据所述数据中携带的目的节点的 MAC地址从第一映射表中查找与所 述 MAC地址对应的虚拟网卡接口, 所述与所述 MAC地址对应的虚拟网卡接 口为目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所 述数据发给对应的目的虚拟机;若所述第一映射表中不存在所述数据中携带的 目的节点的 MAC地址, 则确定目的节点为本物理主机外的节点, 并确定物理 网卡接口,通过所述物理网卡接口对应的物理网卡将该数据发送至第二物理主 机; 所述第一映射表包括 MAC地址和虚拟网卡接口的对应关系。
在第二种可能的实现方式中, 结合第三方面, 所述第一物理主机, 具体用 于获取本物理主机内需要发送给目的节点的数据,根据所述数据中携带的目的 节点的 MAC地址从第一映射表中查找与所述 MAC地址对应的虚拟网卡接口, 若所述第一映射表中查找到与所述 MAC地址对应的虚拟网卡接口, 则确定目 的节点为第一物理主机内的节点, 并确定所述查找到的与所述 MAC地址对应 的虚拟网卡接口为所述目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的 目的虚拟网卡将所述数据发给对应的目的虚拟机; 若查找不到与所述 MAC地 址对应的虚拟网卡接口,则确定目的节点为本物理主机外的节点, 并确定物理 网卡接口,通过所述物理网卡接口对应的物理网卡将该数据发送至第二物理主 机; 所述第一映射表包括 MAC地址和虚拟网卡接口的对应关系。
在第三种可能的实现方式中, 结合第三方面、第三方面的第一种可能的实 现方式或第三方面的第二种可能的实现方式, 所述第一物理主机, 具体用于获 取接收所述数据时所使用的虚拟网卡接口,根据所述虚拟网卡接口从第二映射 表中查找得到与所述虚拟网卡接口对应的物理网卡接口,通过所述物理网卡接 口对应的物理网卡将所述数据发送至第一物理主机外,所述第二映射表包括虚 拟网卡接口和物理网卡接口的对应关系。 在第四种可能的实现方式中, 结合第三方面、第三方面的第一种可能的实 现方式或第三方面的第二种可能的实现方式,所述第二物理主机还用于向第一 物理主机发送数据;
所述第一物理主机,还可以用于通过物理网卡接收第二物理主机发送的数 据, 该数据携带目的节点的 MAC地址, ^据所述数据的 MAC地址确定对应 目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来 自第二物理主机的数据发送给对应的目的虚拟机。
第四方面, 本发明实施例还提供一种物理主机, 包括位于物理主机内核空 间的处理器、运行于物理主机用户空间的至少一个虚拟机和位于物理主机硬件 层的至少一个物理网卡, 其中:
处理器, 用于获取物理主机内需要发送给目的节点的数据, 该数据中携带 目的节点的 MAC地址, ^据所述数据中携带的目的节点的 MAC地址确定目 的节点为本物理主机内的节点还是本物理主机外的节点,若为本物理主机内的 节点, 则确定目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟 网卡将所述数据发给对应的目的虚拟机, 若为本物理主机外的节点, 则确定物 理网卡接口, 将所述数据发送给物理网卡接口对应的物理网卡;
虚拟机, 用于接收所述处理器发送的数据;
物理网卡, 用于接收所述处理器发送的数据, 并将所述数据发送至所述物 理主机外。
在第一种可能实现的方式中, 结合第四方面, 所述处理器, 具体可以用于 获取物理主机内需要发送给目的节点的数据,确定第一映射表中是否存在所述 数据中携带的目的节点的 MAC地址, 所述第一映射表包括 MAC地址和虚拟 网卡接口的对应关系; 若第一映射表中存在所述数据中携带的目的节点的 MAC地址, 则确定目的节点为本物理主机内的节点, 并根据所述数据中携带 的目的节点的 MAC地址从所述第一映射表中查找与所述 MAC地址对应的虚 拟网卡接口,所述与所述 MAC地址对应的虚拟网卡接口为目的虚拟网卡接口, 虚拟机; 若第一映射表中不存在所述数据中携带的目的节点的 MAC地址, 则 确定目的节点为本物理主机外的节点, 并确定物理网卡接口,将所述数据发送 给所述物理网卡接口对应的物理网卡。
在第二种可能实现的方式中, 结合第四方面, 所述处理器具体可以用于获 取物理主机内需要发送给目的节点的数据,根据所述数据中携带的目的节点的 MAC地址从第一映射表中查找与所述 MAC地址对应的目的虚拟网卡接口, 所述第一映射表包括 MAC地址和虚拟网卡接口的对应关系, 若查找到与所述 MAC地址对应的虚拟网卡接口, 则确定目的节点为本物理主机内的节点, 并 确定所述查找到的与所述 MAC地址对应的虚拟网卡接口为所述目的虚拟网卡 接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的 目的虚拟机; 若查找不到与所述 MAC地址对应的虚拟网卡接口, 则确定目的 节点为本物理主机外的节点, 并确定物理网卡接口,将所述数据发送给所述物 理网卡接口对应的物理网卡。
在第三种可能实现的方式中, 结合第四方面、第四方面的第一种可能实现 的方式或第四方面的第二种可能实现的方式,所述处理器具体可以用于在确定 目的节点为本物理主机外的节点时,获取接收所述数据时所使用的虚拟网卡接 口,根据所述虚拟网卡接口从第二映射表中查找得到与所述虚拟网卡接口对应 的物理网卡接口,所述第二映射表包括虚拟网卡接口和物理网卡接口的对应关 系, 将所述数据发送给所述物理网卡接口对应的物理网卡。
在第四种可能实现的方式中, 结合第四方面、第四方面的第一种可能实现 的方式或第四方面的第二种可能实现的方式,所述物理网卡还用于接收来自物 理主机外的数据, 该来自物理主机外的数据携带目的节点的 MAC地址, 将所 述来自物理主机外的数据发送给处理器;
则,所述处理器还用于根据所述来自物理主机外的数据中携带的目的节点 的 MAC地址确定对应的虚拟网卡接口, 所述与所述 MAC地址对应的虚拟网 卡接口为目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡 将所述数据发给对应的目的虚拟机。
在第五种可能实现的方式中, 结合第四方面的第四种可能实现的方式, 所 述处理器, 还用于在根据所述来自物理主机外的数据中携带的目的节点的 MAC地址, 从第一映射表中查找不到与所述 MAC地址对应的虚拟网卡接口 时, 丟弃所述来自物理主机外的数据。 本发明实施例中, 采用获取物理主机内需要发送给目的节点的数据,根据 该数据中携带的目的节点的 MAC地址确定目的节点为本物理主机内的节点还 是本物理主机外的节点;若为本物理主机内的节点,则确定目的虚拟网卡接口, 通过该目的虚拟网卡接口对应的虚拟网卡将该数据发给对应的目的虚拟机,若 为本物理主机外的节点, 则确定物理网卡接口,通过该物理网卡接口对应的物 理网卡将该数据发送至所述物理主机外。由于该方案在进行虚拟机的数据交换 时,对主机内的虚拟机之间的通信, 以及主机内的虚拟机与主机外设备之间的 通信进行区分, 若为主机内的虚拟机之间的通信, 则不需要经过物理网卡, 而 是直接确定目的虚拟网卡接口, 然后与目的虚拟机进行通信, 也就是说, 此时 只是虚拟机间的内容拷贝, 因此不会浪费 PCI总线带宽,可以提高数据交换效 率,也不会影响主机内的其他虚拟机与主机外设备间的通信; 而若为主机内的 虚拟机与主机外设备之间的通信, 则确定物理网卡接口, 然后通过该物理网卡 接口对应的物理网卡与物理主机外设备进行通信,由于与物理主机外设备进行 通信时, 都需要经过物理网卡, 所以便于对进入物理主机的数据进行控制, 比 如只要物理网卡不开启混杂模式,那么就可以控制进入物理主机里的数据均为 有效数据, 减少无效数据的消耗, 可以进一步提高数据交换效率; 换言之, 该 方案可以在不降低其性能和灵活性的前提下,提高数据交换效率, 一定程度上 消除主机内虚拟机间的通信对主机内其他虚拟机与主机外设备间的通信的影 响。 附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所 需要使用的附图作筒单地介绍,显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例, 对于本领域技术人员来讲, 在不付出创造性劳动的前提下, 还 可以根据这些附图获得其他的附图。
图 1是本发明实施例提供的虚拟机的数据交换方法的流程图;
图 2是本发明实施例提供的虚拟机的数据交换方法的另一流程图; 图 3a为本发明实施例提供的虚拟机的数据交换方法的场景示意图; 图 3b是本发明实施例提供的物理主机的结构示意图;
图 3c是本发明实施例提供的虚拟机的数据交换方法中的发送流程图; 图 3d是本发明实施例提供的虚拟机的数据交换方法中的接收流程图; 图 4a是本发明实施例提供的个人计算机访问网页服务器时的场景示意图; 图 4b是本发明实施例提供的个人计算机访问网页服务器的流程图; 图 5a是本发明实施例提供的云桌面用户 A访问主机外网站的场景示意图; 图 5b是本发明实施例提供的云桌面用户 A访问主机外网站的流程图; 图 6是本发明实施例虚拟机的数据交换装置的结构示意图;
图 7是本发明实施例另一虚拟机的数据交换装置的结构示意图;
图 8a是本发明实施例提供的物理主机的结构示意图;
图 8b是本发明实施例提供的物理主机的另一结构示意图;
图 9是本发明实施例提供的物理主机的再一结构示意图;
图 10是本发明实施例提供的通信系统的结构示意图。 具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域技术人员在没有作出创造性劳 动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
为了方便理解本发明实施例,首先在此介绍本发明实施例描述中会引入的 几个要素。
媒体接入层(MAC, Media Access Control )位址: 硬件位址, 用来定义 网络设备的位置, 一个网卡会有一个全球唯一固定的 MAC地址。
主机(Host ): 也叫宿主机, 是虚拟机所在的主机, 亦称为物理主机。 EthO/本地连接: linux/windows系统中显示网卡的名称。
桥( Bridge ): 一个在 linux kernel ( linux内核 )里用来模拟交换机的模块。 网卡(NIC, Network Interface Card ), 包括虚拟网卡和物理网卡。
虚拟网卡( virtual nic ): 在主机里模拟出的一个网卡用来给虚拟机提供网 络能力, 本身没有对主机外的数据收发能力, 需要借助于物理网卡; 一般虚拟 网卡可以分为前端虚拟网卡和后端虚拟网卡,在本发明实施例中,虚拟网卡主 要指的是后端虚拟网卡。
SR-IOV ( Single Root I/O Virtualization ): 单根 I/O虚拟技术, 在一个设备 上模拟出多个虚拟硬件以便直接分配给虚拟机, 避免了软件模拟的开销。
VF ( virtual function ): SR-IOV设备模拟出来的虚拟设备。
树协议(STP, Spanning Tree Protocol ): 生成树协议, 通过阻断冗余链路, 使一个有回路的桥接网络修剪成一个无回路的树形拓朴结构,防止二层网络的 广播风暴的产生。
MAC地址学习 ( Mac-learning ), 通过学习每一个进入交换机的报文生成 转发所依据的 mac-port表, 是传统交换机工作的基本原理。 本发明实施例提供一种虚拟机的数据交换方法、装置和系统。 以下分别进 行详细说明。 实施例一、
本发明实施例站在物理主机内的虚拟机发送数据的角度进行描述,本发明 实施例中的物理主机可以是物理服务器等。
一种虚拟机的数据交换方法, 包括: 获取物理主机内需要发送给目的节点 的数据,根据该数据中携带的目的节点的 MAC地址确定目的节点为本物理主 机内的节点还是本物理主机外的节点, 若为本物理主机内的节点, 则确定目的 虚拟网卡接口,通过该目的虚拟网卡接口对应的目的虚拟网卡将该数据发给对 应的目的虚拟机;若为本物理主机外的节点,则确定物理网卡接口(out_port ), 通过该物理网卡接口对应的物理网卡将该数据发送至该物理主机外。
如图 1所示, 具体流程可以如下:
101、 获取物理主机内需要发送给目的节点的数据, 该数据中携带目的节 点的 MAC地址。
其中, 该目的节点可以是本物理主机内的节点, 筒称主机内节点, 比如虚 拟机等, 也可以是本物理主机外的节点, 筒称主机外节点, 比如主机外的某个 设备 (比如其他的物理主机等 ), 等等。
102、 根据步骤 101中获取到的数据确定目的节点为主机内节点还是主机 外节点,若为主机内节点,则执行步骤 103 ,若为主机外节点,则执行步骤 104。
例如,具体可以将步骤 101中获取到的数据发送给物理主机内的后端虚拟 网卡( NIC , Network Interface Card ) , 由该后端虚拟网卡将该数据发送给位于 物理主机内的交换模块(需要说明的是, 这里的交换模块处于物理主机的内核 空间中),由交换模块根据该数据确定目的节点为主机内节点还是主机外节点, 若为主机内节点, 则执行步骤 103, 若为主机外节点, 则执行步骤 104。
其中, 步骤 "根据该数据确定目的节点为主机内节点还是主机外节点"具 体可以采用如下任意一种方式来实现:
确定第一映射表中是否存在该数据中携带的目的节点的 MAC地址,若是, 则确定目的节点为主机内节点; 若否, 则确定目的节点为主机外节点。
或者,
根据该数据中携带的目的节点的 MAC 地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口, 若查找到与该 MAC地址对应的虚拟网卡接 口, 则确定目的节点为主机内节点; 若查找不到与该 MAC地址对应的虚拟网 卡接口, 则确定目的节点为主机外节点。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
需说明的是, 虽然该交换模块与现有的桥(Bridge )类似, 都维护一个映 射表,比如 mac-port表,但是该交换模块与现在的 Bridge并不同,现有的 Bridge 需要逐包进行媒体接入层地址学习 ( Mac-learning ), 而该第一映射表中的虚拟 网卡接口在后端虚拟网卡接口接入主机时生成, 并在后端虚拟网卡移除时删 除, 可以不进行 MAC地址学习, 也就是说, 该第一映射表只在后端虚拟网卡 加入或移除时才变化, 而无需逐包进行 MAC地址学习。
其中, MAC地址学习, 指的是通过学习每一个进入交换机的报文生成转 发所依据的第一映射表, 比如 mac-port表, 是传统交换机工作的基本原理。
相应的, 本发明实施例的该虚拟机的数据交换方法还可以包括:
检测到后端虚拟网卡接入本物理主机时, 生成对应的虚拟网卡接口, 并在 该第一映射表中添加对应于指定的 MAC地址的该虚拟网卡接口 (比如, 在生 成对应的虚拟网卡接口时,可以为该生成的虚拟网卡接口指定一个 MAC地址, 并将该 MAC和生成的虚拟网卡接口的对应关系记录在第一映射表中); 以及, 检测到该后端虚拟网卡从本物理主机上移除时,在该第一映射表中删除对应于 该指定的 MAC地址的该虚拟网卡接口, 即删除该移除的后端虚拟网卡之前接 入该物理主机时生成的虚拟网卡接口和该虚拟网卡接口对应的 MAC地址。
103、 若在步骤 102中确定目的节点为主机内节点, 则确定目的虚拟网卡 接口,通过该目的虚拟网卡接口对应的目的虚拟网卡将该数据发给对应的目的 虚^ (机; 例: ¾口, 具体可以: ¾口下:
如果在步骤 102中, 是通过 "第一映射表中是否存在目的节点的 MAC地 址"来确定目的节点是主机内的节点还是主机外节点的, 则此时, 可以根据该 数据中携带的目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应 的虚拟网卡接口, 在本发明实施例中, 称为目的虚拟网卡接口, 然后根据该目 而如果在步骤 102中, 是通过 "从第一映射表中是否能查找到与该 MAC 地址对应的虚拟网卡接口" 来确定目的节点是主机内的节点还是主机外节点 的, 则此时, 可以直接根据查找到的虚拟网卡接口对应的虚拟网卡将该数据发 给对应的目的虚拟机; 即此时, 确定目的虚拟网卡接口具体为:
确定该查找到的与该 MAC 地址对应的虚拟网卡接口为目的虚拟网卡接 口。
104、 若在步骤 102中确定目的节点为主机外节点, 则确定物理网卡接口 (指目的物理网卡接口 ), 通过该物理网卡接口对应的物理网卡将该数据发送 至物理主机外。 例如, 具体可以如下:
获取接收该数据时所采用的虚拟网卡接口,在本发明实施例中, 称为源虚 拟网卡接口,根据所述接收该数据时所采用的虚拟网卡接口从第二映射表中查 找得到与该虚拟网卡接口对应的物理网卡接口, 比如, 可以通过查找第二映射 表获取该虚拟网卡接口对应的物理网卡接口,然后通过该物理网卡接口对应的 物理网卡将该数据发送至该物理主机外。
其中, 第二映射表可以包括虚拟网卡接口和物理网卡接口的对应关系。其 中,虚拟网卡接口和物理网卡接口可以是一对一的关系,也可以是多对一的关 系, 也就是说, 同一个物理网卡接口可以对应多个虚拟网卡接口。
需说明的是, 其中, 源虚拟网卡接口指的是接收数据时所采用的虚拟网卡 接口,而目的虚拟网卡接口指的是通过查找第一映射表所获取到的与该数据中 携带的目的节点(比如目的虚拟机)的 MAC地址所对应的虚拟网卡接口, 应 当理解的是,通过该虚拟网卡接口接收数据, 那这个虚拟网卡接口为源虚拟网 卡接口; 通过该虚拟网卡接口发送数据, 那这个虚拟网卡接口为目的虚拟网卡 接口, 该源虚拟网卡接口和目的虚拟网卡接口可以是相同的接口,也可以是不 同的接口。 应当理解的是, 在实际应用中, 网卡(包括物理网卡和虚拟网卡) 及网卡接口 (包括物理网卡接口和虚拟网卡接口)都是双向的, 当针对某个具 体的报文(即数据 )才有源网卡接口与目的网卡接口 (比如目的物理网卡接口 或目的虚拟网卡接口等, 其中, 为了描述方便, 目的物理网卡接口在本发明实 施例中筒称为物理网卡接口 )一说, 例如, 当通过该网卡接口接收上行数据, 则该接收上行数据的网卡接口可以称为源网卡接口, 具体的,如果该网卡接口 为物理网卡接口, 则此时, 该源网卡接口称为源物理网卡接口; 而如果该网卡 接口为虚拟网卡接口, 则该源网卡接口称为源虚拟网卡接口。 又例如, 当通过 该网卡接口发送下行数据,则该发送下行数据的网卡接口可以称为目的网卡接 口, 具体的, 如果该网卡接口为物理网卡接口, 则此时, 该目的网卡接口称为 目的物理网卡接口; 而如果该网卡接口为虚拟网卡接口, 则该目的网卡接口称 为目的虚拟网卡接口等等, 在此不再赘述。
此外, 还需说明的是, 物理网卡接口在物理网卡接入物理主机时生成, 并 在物理网卡从物理主机移除时删除。 另外,在虚拟网卡接口和物理网卡接口建 立对应关系 (或称为映射关系)时, 后端虚拟网卡的 MAC地址也被下发到物 理网卡接口对应的物理网卡的单播列表中,以供该物理网卡在接收数据时可以 对数据进行过滤。
由上可知, 本发明实施例在进行虚拟机的数据交换时,对主机内的虚拟机 之间的通信, 以及主机内的虚拟机与主机外设备之间的通信进行区分, 若为主 机内的虚拟机之间的通信, 则不需要经过物理网卡, 而是直接确定目的虚拟网 卡接口,然后通过目的虚拟网卡接口对应的目的虚拟网卡与目的虚拟机进行通 信, 也就是说, 此时只是虚拟机间的内容拷贝, 因此不会浪费 PCI总线带宽, 可以提高数据交换效率,也不会影响主机内的其他虚拟机与主机外设备间的通 信; 而若为主机内的虚拟机与主机外设备之间的通信, 则确定物理网卡接口, 然后通过该物理网卡接口对应的物理网卡与物理主机外设备进行通信,由于与 物理主机外设备进行通信时,都需要经过物理网卡, 所以便于对进入物理主机 的数据进行控制, 比如只要物理网卡不开启混杂模式, 那么就可以控制进入物 理主机里的数据均为有效数据, 减少无效数据的消耗, 可以进一步提高数据交 换效率。
此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以便于后续在 主机内为虚拟机提供进一步的功能,比如可以在主机内为虚拟机提供 ACL和流 控制功能。 也就是说, 该方案可以在不降低其性能和灵活性的前提下, 提高数 据交换效率,一定程度上消除主机内虚拟机间的通信对主机内其他虚拟机与主 机外设备间的通信的影响、 以及便于后续在主机内为虚拟机提供进一步的功 能, 比如提供 ACL和流控制功能。 实施例二、
实施例一描述的主要是虚拟机的数据交换方法中发送流程, 此外, 该虚拟 机的数据交换方法还可以包括接收流程,换言之, 即站在同一物理主机内的虚 拟机接收主机外的数据的角度进行描述; 即在实施例一的基础上, 该虚拟机的 数据交换方法, 还可以包括: 通过物理网卡接收来自物理主机外的数据, 根据 该来自物理主机外的数据中携带的目的节点的 MAC地址确定对应目的虚拟网 卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将该来自物理主机外 的数据发送给对应的目的虚拟机。
如图 2所示, 具体流程可以如下:
201、 通过物理网卡接收来自物理主机外的数据, 该来自物理主机外的数 据中携带目的节点的 MAC地址。
202、 根据该来自物理主机外的数据中携带的目的节点的 MAC地址确定 对应目的虚拟网卡接口; 例如, 具体可以如下:
根据该来自物理主机外的数据中携带的目的节点的 MAC地址, 从第一映 射表中查找与该 MAC地址对应的虚拟网卡接口。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
其中, 该第一映射表中的虚拟网卡接口在后端虚拟网卡接入主机时生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC地址学习 (Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除时才变化, 而无需逐包进行 MAC 学习。
此外,如果确定第一映射表中不存在该来自物理主机外的数据中携带的目 的节点的 MAC地址,则可以直接丟弃该来自物理主机外的数据。即在步骤"通 过物理网卡接收来自物理主机外的数据" (即步骤 101 )之后, 该虚拟机的数 据交换方法还可以包括:
根据该来自物理主机外的数据中携带的目的节点的 MAC地址, 从第一映 射表中查找不到与该 MAC地址对应的虚拟网卡接口时,丟弃该来自物理主机 外的数据。
需说明的是,正如实施例一种所描述的,在虚拟网卡接口和物理网卡接口 建立对应关系 (或称为映射关系)时, 后端虚拟网卡的 MAC地址也可以被下 发到物理网卡接口对应的物理网卡的单播列表中, 这样, 在本步骤(即步骤 202 ) 中, 物理网卡在接收数据时就可以利用该列表对数据进行过滤, 从而使 得进入物理主机内的数据均为有效数据, 减少无效数据的消耗。
203、 通过所述目的虚拟网卡接口对应的目的虚拟网卡将该来自物理主机 外的数据发送给对应的目的虚拟机。 例如, 具体可以如下:
通过步骤 202中查找到的 MAC地址对应的虚拟网卡接口将该来自物理主 机外的数据发送给对应的目的虚拟机。
由上可知, 本发明实施例在接收来自主机外的数据时, 均需要通过物理网 卡, 所以可以方便地对进入物理主机的数据进行控制, 比如只要物理网卡不开 启混杂模式, 那么就可以控制进入物理主机里的数据均为有效数据, 减少无效 数据的消耗, 可以提高数据交换效率; 此外, 由于虚拟机在接收数据时, 都需 要经过物理主机, 所以可以在主机内为虚拟机提供 ACL和流控制功能。也就是 说, 该方案可以在不降低其性能和灵活性的前提下, 提高数据交换效率, 以及 实现在主机内为虚拟机提供 ACL和流控制功能。 根据实施例一和二所描述的方法, 以下将在实施三、 四和五中举例作进一 步详细说明。 实施例三、
在本实施例中, 将以物理主机为例进行详细说明。 参见图 3a, 该图 3a为本发明实施例所提供的虚拟机的数据交换方法的场 景示意图。
本发明实施例所提供的虚拟机的数据交换方法的场景包括多个物理主机, 其中每个物理主机包括硬件层、该硬件层之上的内核空间和该内核空间之上的 用户空间, 其中所述用户空间包括一个或多个虚拟机, 所述硬件层包括网络连 接设备(即物理网卡), 处理器以及存储器(图中未示意)等等, 所述内核空 间可以理解为系统管理层, 所述内核空间包括后端虚拟网卡(图中未示意)和 交换模块; 以及, 应当理解的是, 每个虚拟机可以包括虚拟硬件(例如虚拟处 理器、 虚拟网卡等)、 所述虚拟硬件之上的客户端操作系统, 该客户端操作系 统之上的应用程序,其中该客户端操作系统可以包括驱动,例如虚拟网卡驱动; 以及, 物理主机可以通过物理网卡与物理交换机( Physical Switch )连接, 从 而实现与英特网(Internet )的连接, 以及实现与系统中的其他物理主机进行通 信。
参见图 3b, 图 3b为物理主机的一个结构示意图 (为了更好地描述各部件 之间的关系, 除了物理主机之外, 图中还给物理交换机和英特网), 其中: 1、 针对虚拟机发送数据:
虚拟机: 用于发送数据 (例如报文); 具体的, 虚拟机 1中的应用发送报 文, 该报文经过虚拟机 1中的客户端操作系统(可以理解为虚拟机 1的内核) 处理后,被传递给虚拟机 1中的虚拟网卡驱动, 并由该虚拟网卡驱动将处理后 的数据传递给后端虚拟网卡 1 ;
后端虚拟网卡: 用于将收到的数据, 传递给交换模块; 换言之, 数据经后 端虚拟网卡进入交换模块处理;
交换模块: 可以称为 map_switch, 用于接收后端虚拟网卡发送的数据, 根 据该数据中携带的目的节点的 MAC地址确定目的节点为主机内节点还是主机 外节点; 若为主机内节点, 则确定目的虚拟网卡接口, 通过所述目的虚拟网卡 点, 则确定物理网卡接口,通过该物理网卡接口将该数据发送给该物理网卡接 口对应的物理网卡。
物理网卡: 用于将该数据发送至物理主机外。 2、 此外, 针对虚拟机接收数据:
物理网卡: 还用于接收来自本物理主机外的数据, 并将该数据传递给交换 模块;
交换模块: 还用于接收物理网卡发送的来自物理主机外的数据,根据该数 据中携带的目的节点的 MAC地址确定对应目的虚拟网卡接口, 通过所述目的 虚拟网卡接口将数据传递给对应的目的虚拟网卡(即某个后端虚拟网卡, 例如 后端虚拟网卡 1 );
后端虚拟网卡: 将数据传递给对应的目的虚拟机, 具体的, 后端虚拟网卡 1将数据传递给对应的目的虚拟机中的该虚拟网卡驱动, 由目的虚拟机中的该 虚拟网卡驱动传递给目的虚拟机中的客户端操作系统,进而由目的虚拟机中的 客户端操作系统传递给目的虚拟机中的对应的应用处理。
其中, 该物理网卡具体可以采用 SR-IOV物理网卡, 从而可以充分利用 SR-IOV物理网卡的多队列网卡的多通路特性, 以及网卡自带的二层交换
(L2switch) 逻辑功能, 在整体上提高物理主机的性能。
基于上述的物理主机的结构示意图,以下将分别从发送流程和接收流程两 方面对其数据交换方法进行详细说明。
(一 )发送流程;
如图 3c所示, 一种虚拟机的数据交换方法, 具体流程可以如下:
A301、 获取物理主机内需要发送给目的节点的数据, 并将该数据发送给 物理主机内的后端虚拟网卡。 具体可以如下:
当虚拟机的应用程序开始发送数据时, 获取该数据, 并经过虚拟机的内核 处理, 然后将该数据提交给虚拟机内的虚拟网卡驱动, 由虚拟网卡驱动将该数 据发送给物理主机内的后端虚拟网卡。
其中, 该目的节点可以是本物理主机内的节点, 筒称主机内节点, 比如虚 拟机等, 也可以是本物理主机外的节点, 筒称主机外节点, 比如主机外的某个 设备, 等等。
A302、 后端虚拟网卡将该数据发送给位于物理主机内的交换模块。
A303、 交换模块在接收到该数据后, 确定第一映射表中是否存在该数据 中携带的目的节点的 MAC地址,若确定存在该数据中携带的目的节点的 MAC 地址, 则确定目的节点为主机内节点, 即表明当前的通信为主机内通信, 于是 执行步骤 A304; 若确定不存在该数据中携带的目的节点的 MAC地址, 则确 定目的节点为主机外节点, 即表明当前的通信为主机外通信, 于是执行步骤 A305。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
需说明的是,该第一映射表中的虚拟网卡接口在后端虚拟网卡接入主机时 生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC地址学习
( Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除时才变化, 而无 需逐包进行 MAC地址学习。 该第一映射表由交换模块进行维护。
还需说明的是,除了采用上述方法来确定目的节点为主机内节点还是主机 外节点之外, 还可以采用如下方法来进行判断:
根据该数据中携带的目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口, 若查找到与该 MAC地址对应的虚拟网卡接 口,则确定目的节点为主机内节点,于是执行步骤 A304;若查找不到与该 MAC 地址对应的虚拟网卡接口, 则确定目的节点为主机外节点, 于是执行步骤 A305。
A304、 若目的节点为主机内节点, 则交换模块确定目的虚拟网卡接口, 并通过该目的虚拟网卡接口对应的目的虚拟网卡将该数据发给对应的目的虚 拟机, 流程结束; 例如, 具体可以如下:
交换模块根据该数据中携带的目的节点的 MAC地址从第一映射表中查找 与该 MAC地址对应的虚拟网卡接口 ( in_port ), 即目的虚拟网卡接口, 然后 通过该目的虚拟网卡接口对应的目的虚拟网卡将该数据发给对应的目的虚拟 机。
此外, 如果在步骤 A303中, 是采用 "从第一映射表中是否能查找到与 该 MAC地址对应的虚拟网卡接口"的方法来确定目的节点是主机内的节点还 是主机外节点的, 则此时, 可以直接通过查找到的虚拟网卡接口对应的目的虚 拟网卡将该数据发给对应的目的虚拟机。
A305、 若目的节点为主机外节点, 则交换模块确定物理网卡接口 ( out_port ) ,通过该物理网卡接口对应的物理网卡将该数据发送至所述物理主 机外, 流程结束; 比如, 具体可以如下:
交换模块通过查找第二映射表获取该数据的源虚拟网卡接口对应的物理 网卡接口,然后通过该物理网卡接口对应的物理网卡将该数据发送至所述物理 主机外。
其中, 第二映射表可以包括虚拟网卡接口和物理网卡接口的对应关系。其 中,虚拟网卡接口和物理网卡接口可以是一对一的关系,也可以是多对一的关 系, 也就是说, 同一个物理网卡接口可以对应多个虚拟网卡接口。
(二)接收流程;
如图 3d所示, 一种虚拟机的数据交换方法, 具体流程可以如下:
B301、 物理网卡接收来自物理主机外的数据。
需说明的是, 可选的, 如果在此之前, 虚拟机的 MAC地址已经下发至物 理网卡的单播列表, 则此时物理网卡在接收来自物理主机外的数据之后, 就可 据, 即有效数据。
B302、 物理网卡将该来自物理主机外的数据发送给交换模块, 由交换模 块确定第一映射表中是否存在该自物理主机外的数据中携带的目的节点的 MAC地址, 若存在该自物理主机外的数据中携带的目的节点的 MAC地址, 获取该 MAC地址对应的虚拟网卡接口。 例如, 具体可以如下:
经过中断处理, 物理网卡将该数据 (即该来自物理主机外的数据)经由物 理网卡驱动, 提交给物理网卡接口 (该物理网卡接口位于交换模块上), 由物 理网卡接口查询第一映射表,若在第一映射表中查找到该数据中携带的目的节 点的 MAC地址, 则获取该 MAC地址对应的虚拟网卡接口 (即目的虚拟网卡 接口)。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
需说明的是,该第一映射表中的虚拟网卡接口在后端虚拟网卡接入主机时 生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC地址学习
( Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除时才变化, 而无 需逐包进行 MAC地址学习。
此外,如果物理网卡接口确定第一映射表中不存在该来自物理主机外的数 据中携带的目的节点的 MAC地址, 则可以直接丟弃该数据; 当然, 如果在步 骤 B301中已经对数据进行过滤, 则一般的, 进入物理主机的都是有效数据, 即都可以在第一映射表中找到相应的 MAC地址。
B303、交换模块通过步骤 B302中确定的虚拟网卡接口对应的目的虚拟网 卡将该来自物理主机外的数据发送给对应的目的虚拟机。
例如, 具体可以由物理网卡将该来自物理主机外的数据发送给步骤 B302 中确定的虚拟网卡接口对应的后端虚拟网卡,然后由后端虚拟网卡将该来自物 理主机外的数据发送给该目的虚拟机。
由上可知, 本发明实施例在进行虚拟机的数据交换时,对主机内的虚拟机 之间的通信, 以及主机内的虚拟机与主机外设备之间的通信进行区分, 若为主 机内的虚拟机之间的通信, 则不需要经过物理网卡, 而是直接确定目的虚拟网 卡接口,然后通过目的虚拟网卡接口对应的目的虚拟网卡与目的虚拟机进行通 信, 也就是说, 此时只是虚拟机间的内容拷贝, 因此不会浪费 PCI总线带宽, 可以提高数据交换效率,也不会影响主机内的其他虚拟机与主机外设备间的通 信; 而若为主机内的虚拟机与主机外设备之间的通信, 则确定物理网卡接口, 然后通过该物理网卡接口对应的与物理主机外设备进行通信,由于与物理主机 外设备进行通信时,都需要经过物理网卡, 所以便于对进入物理主机的数据进 行控制, 比如只要物理网卡不开启混杂模式, 那么就可以控制进入物理主机里 的数据均为有效数据, 减少无效数据的消耗, 可以进一步提高数据交换效率; 此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以可以在主机 内为虚拟机提供 ACL和流控制功能。 也就是说, 该方案可以在不降低其性能 和灵活性的前提下,提高数据交换效率,一定程度上消除主机内虚拟机间的通 信对主机内其他虚拟机与主机外设备间的通信的影响、以及实现在主机内为虚 拟机提供 ACL和流控制功能。 实施例四、
根据实施例三所描述的方法,在本实施例中,将以该物理主机包括三个虚 拟机为例进行说明。 该物理主机的具体介绍可参见实施例三, 而本实施例中, 三个虚拟机分别 为两台网页 (web )服务器的虚拟机和一台数据库服务器的虚拟机, 即网页服 务器 A的虚拟机、 网页服务器 B的虚拟机和数据库服务器的虚拟机, 其中, 数 据库服务器对这两台网页服务器提供服务。 为了描述方便, 在本实施例中, 将 网页服务器 A的虚拟机筒称为网页服务器 A,网页服务器 B的虚拟机筒称为网页 服务器 B , 将数据库服务器的虚拟机筒称为数据库服务器。
两台网页服务器上和数据库服务器的本地连接接口 ethO均通过虚拟网卡 接入交换模块, 但是, 不指定对应的物理网卡接口, 而两台网页服务器的本地 连接接口 ethl则均通过虚拟网卡接入交换模块, 且指定对应的物理网卡接口。 即如图 4a所示, 具体如下:
网页服务器 A的两个本地连接接口 ethO和 ethl分别连接虚拟网卡¥_1^2和 v_nic3 , 网页服务器 B的两个本地连接接口 ethO和 ethl分别连接虚拟网卡¥_1^4 和¥_11^5 , 数据库的本地连接接口 ethO连接虚拟网卡 v_nicl ; 虚拟网卡¥_11 1、 v_nic2、 v_nic3、 ¥_1^4和¥_1^5分别通过虚拟网卡接口 1 ( in_portl ) 、 虚拟网 卡接口 2 ( in_port2 )、 虚拟网卡接口 3 ( in_port3 )、 虚拟网卡接口 4 ( in_port4 ) 和虚拟网卡接口 5 ( in_port5 )接入交换模块。 其中, 虚拟网卡接口 3和虚拟网 卡接口 5分别指定有对应的物理网卡接口,即虚拟网卡接口 3对应物理网卡接口 1 ( out_portl ) , 虚拟网卡接口 5对应物理网卡接口 2 ( out_port2 ) , 并且, 将 虚拟网卡接口 3对应的虚拟网卡的 MAC地址和虚拟网卡接口 5对应的虚拟网卡 的 MAC地址分别下发给对应的物理网卡, 比如该物理网卡具体可以为 "SR-IOV" 网卡, 则此时具体可以下发给各个 VF, 其中, 物理网卡接口 1对应 VF2, 物理网卡接口 2对应 VF3。 这样, 所有物理主机内部的虚拟机之间的数据 通信就可以都不经过物理网卡,而网页服务器在域物理主机外的设备进行通信 时, 也可以将数据交给各自的 VF进行发送。 此外, 外部用户访问该物理主机 时, 也可以先在物理网卡处进行数据过滤后分流至 VF2和 VF3 , 然后在物理网 卡接口处直接发给对应的虚拟机。
以个人计算机向网页服务器 A发送数据为例, 如图 4b所示, 该虚拟机的数 据交换方法的具体流程可以如下:
401、 个人计算机发送数据, 经由英特网发送至物理交换机。 402、物理交换机将该数据发送给物理主机上的物理网卡, 比如" SR-IOV" 网卡。
403、 物理网卡对该数据进行内部交换, 并将该数据发送给的 VF2。
404、 VF2的网卡驱动经过中断处理后, 将该数据交给对应的物理网卡接 口 1。
405、 物理网卡接口 1查询第一映射表, 发现目的节点的 MAC地址是虚拟 网卡接口 3, 于是将该数据发给虚拟网卡接口 3。
406、 由于虚拟网卡接口 3对应的虚拟网卡为 v_nic3 , 而¥_1^3对应的虚拟 机是网页服务器 A, 因此, 虚拟网卡接口 3将该数据发送给网页服务器 A, 由网 页服务器 A中的应用程序进行处理。
由上可知, 本发明实施例在接收来自物理主机外的数据时, 均需要通过物 理网卡(包括 VF ) , 所以可以方便地对进入物理主机的数据进行控制, 比如只 要物理网卡不开启混杂模式,那么就可以控制进入物理主机里的数据均为有效 数据, 减少无效数据的消耗, 可以提高数据交换效率; 此外, 由于虚拟机在接 收数据时,都需要经过物理主机, 所以可以在主机内为虚拟机提供 ACL和流控 制功能。 也就是说, 该方案可以在不降低其性能和灵活性的前提下, 提高数据 交换效率, 以及实现在主机内为虚拟机提供 ACL和流控制功能。 实施例五、
与实施例四相同的是, 在本实施例中, 同样以该物理主机包括三个虚拟机 为例进行说明。该物理主机的具体介绍可参见实施例三。与实施例四不同的是, 在本实施例中, 三个虚拟机分别为桌面云用户 A的虚拟机、 桌面云用户 B的虚 拟机和桌面云用户 C的虚拟机, 筒称为桌面云用户 A、桌面云用户 B和桌面云用 户(。
桌面云用户 A的本地连接接口、 桌面云用户 B的本地连接接口、 以及桌面 云用户 C的本地连接接口 ethO均通过虚拟网卡接入交换模块, 且指定对应的物 理网卡接口, 而桌面云用户 C的本地连接接口 ethl在通过虚拟网卡接入交换模 块后, 不指定对应的物理网卡接口, 即如图 5a所示, 具体如下:
桌面云用户 A的本地连接接口连接虚拟网卡 v_nicl , 桌面云用户 B的本地 连接接口连接虚拟网卡 v_nic2,桌面云用户 C的本地连接接口 ethO连接虚拟网卡 v_nic3 , 桌面云用户 C的本地连接接口 ethl连接虚拟网卡 v_nic4; 其中, 虚拟网 - v_nicl , v_nic2、 ¥_1^3和¥_1^4分别通过虚拟网卡接口 1 ( in_portl )、 虚拟 网卡接口 2 ( in_port2 )、虚拟网卡接口 3 ( in_port3 )和虚拟网卡接口 4 ( in_port4 ) 接入交换模块。 其中, 虚拟网卡接口 1、 虚拟网卡接口 2和虚拟网卡接口 3分别 指定有对应的物理网卡接口,即虚拟网卡接口 1和虚拟网卡接口 2均对应物理网 卡接口 1 ( out_portl ), 而虚拟网卡接口 3对应物理网卡接口 2 ( out_port2 )。 虚 拟网卡接口 4不指定对应的物理网卡接口。
以云桌面用户 A发出访问网站的数据为例, 如图 5b所示, 该虚拟机的数据 交换方法的具体流程可以如下:
501、 桌面云用户 A发出访问网站的数据, 经由内核处理后, 交给桌面云 用户 A的虚拟机内的虚拟网卡驱动。
502、 虚拟机内的虚拟网卡将该数据发送给物理主机内的后端虚拟网卡 v_nicl o
503、 v_nicl将该数据通过虚拟网卡接口 1发送给位于物理主机内的交换模 块。
504、 交换模块在接收到该数据后, 查询第一映射表, 确定第一映射表中 是否存在该数据中携带的目的节点的 MAC地址, 由于该数据时发送给主机外 的设备的, 因此此时在第一映射表中查询不到该目的节点的 MAC地址, 于是, 执行步骤 505。
或者, 交换模块在接收到该数据后,也可以根据该数据中携带的目的节点 的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口, 由于该 数据时发送给主机外的设备的,因此此时在第一映射表中查询不到该目的节点 的 MAC地址对应的虚拟网卡接口, 于是执行步骤 505。
505、交换模块查询第二映射表,获取虚拟网卡接口 1对应的物理网卡接口, 即物理网卡接口 1 , 然后将该数据发送给物理网卡接口 1。
506、 物理网卡接口 1将该数据提交给物理网卡 1 , 并由物理网卡将该数据 发送给物理交换机。
507、 物理交换机经由英特网, 将该数据发送给相应的网站。
由上可知, 本发明实施例在进行虚拟机的数据交换时,对主机内的虚拟机 之间的通信, 以及主机内的虚拟机与主机外设备之间的通信进行区分, 若为主 机内的虚拟机之间的通信, 则不需要经过物理网卡, 而是直接确定目的虚拟网 卡接口,然后通过目的虚拟网卡接口对应的目的虚拟网卡与目的虚拟机进行通 信, 也就是说, 此时只是虚拟机间的内容拷贝, 因此不会浪费 PCI总线带宽, 可以提高数据交换效率,也不会影响主机内的其他虚拟机与主机外设备间的通 信; 而若为主机内的虚拟机与主机外设备之间的通信, 则确定物理网卡接口, 然后通过该物理网卡接口对应的物理网卡与物理主机外设备进行通信,由于与 物理主机外设备进行通信时,都需要经过物理网卡, 所以便于对进入物理主机 的数据进行控制, 比如只要物理网卡不开启混杂模式, 那么就可以控制进入物 理主机里的数据均为有效数据, 减少无效数据的消耗, 可以进一步提高数据交 换效率;
此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以便于后续在 主机内为虚拟机提供进一步的功能,比如可以在主机内为虚拟机提供 ACL和流 控制功能。 也就是说, 该方案可以在不降低其性能和灵活性的前提下, 提高数 据交换效率,一定程度上消除主机内虚拟机间的通信对主机内其他虚拟机与主 机外设备间的通信的影响、 以及便于后续在主机内为虚拟机提供进一步的功 能, 比如提供 ACL和流控制功能。 实施例六、
为了更好地实施以上方法,本发明实施例还提供一种虚拟机的数据交换装 置, 如图 6所示, 该虚拟机的数据交换装置包括获取单元 601、 判断单元 602、 第一处理单元 603和第二处理单元 604;
获取单元 601 , 用于获取物理主机内需要发送给目的节点的数据, 该数据 携带目的节点的 MAC地址;
其中, 该目的节点可以是本物理主机内的节点, 筒称主机内节点, 比如虚 拟机等, 也可以是本物理主机外的节点, 筒称主机外节点, 比如主机外的某个 设备, 等等。
判断单元 602, 用于根据获取单元 601获取到的数据中携带的目的节点的 MAC地址确定目的节点为主机内节点还是主机外节点; 第一处理单元 603 , 用于在判断单元 602确定目的节点为主机内节点时, 确定目的虚拟网卡接口,通过该目的虚拟网卡接口对应的目的虚拟网卡将该数 据发给对应的目的虚拟机;
第二处理单元 604, 用于在判断单元 602确定目的节点为主机外节点时, 确定物理网卡接口,通过该物理网卡接口对应的物理网卡将该数据发送至该物 理主机外。
其中, 判断单元 602, 具体可以用于将该数据发送给物理主机内的后端虚 拟网卡, 由该后端虚拟网卡将该数据发送给位于物理主机内的交换模块, 并由 交换模块根据该数据确定目的节点为主机内节点还是主机外节点;
则此时, 第一处理单元 603, 具体可以用于在判断单元 602确定目的节点 为主机内节点时, 由交换模块确定目的虚拟网卡接口, 并由交换模块通过该目 的虚拟网卡接口对应的目的虚拟网卡将该数据发给对应的目的虚拟机;
第二处理单元 604, 具体可以用于在判断单元 602确定目的节点为主机外 节点时, 由交换模块确定物理网卡接口,通过该物理网卡接口对应的物理网卡 将该数据发送至所述物理主机外。
例如, 判断单元 602, 具体可以用于确定第一映射表中是否存在该数据中 携带的目的节点的 MAC地址,若存在该数据中携带的目的节点的 MAC地址, 则确定目的节点为主机内节点, 若不存在该数据中携带的目的节点的 MAC地 址, 则确定目的节点为主机外节点。
则此时, 第一处理单元 603, 具体可以用于在判断单元 602确定目的节点 为主机内节点时, 根据该数据中携带的目的节点的 MAC地址从第一映射表中 查找与该 MAC地址对应的虚拟网卡接口, 即目的虚拟网卡接口, 通过该目的 虚拟网卡接口对应的虚拟网卡将该数据发给对应的目的虚拟机。
或者, 又例如, 判断单元 602, 具体可以用于根据该数据中携带的目的节 点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口; 若 查找到与该 MAC地址对应的虚拟网卡接口, 则确定目的节点为主机内节点; 若查找不到与该 MAC地址对应的虚拟网卡接口, 则确定目的节点为主机外节 点。
则此时,所述第一处理单元 603具体可以在判断单元 602确定目的节点为 本物理主机内的节点时, 确定所述查找到的与所述 MAC地址对应的虚拟网卡 接口为目的虚拟网卡接口。 即:
所述第一处理单元 603 , 具体可以用于在判断单元 602确定目的节点为主 机内节点时, 确定所述查找到的与所述 MAC地址对应的虚拟网卡接口为目的 虚拟网卡接口,通过该目的虚拟网卡接口对应的目的虚拟网卡将该数据发给对 应的目的虚拟机。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
需说明的是,该第一映射表中的虚拟网卡接口在后端虚拟网卡接口接入主 机时生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC 地址学习 ( Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除时才变化, 而无 需逐包进行 MAC地址学习。 也就是说, 该虚拟机的数据交换装置还可以包括 检测单元;
检测单元, 用于检测到后端虚拟网卡接入本物理主机时, 生成对应的虚拟 网卡接口, 并在该第一映射表中添加对应于指定的 MAC地址的所述虚拟网卡 接口; 以及, 检测到该后端虚拟网卡从本物理主机上移除时, 在第一映射表中 删除对应于该指定的 MAC地址的所述虚拟网卡接口。
可选的, 第二处理单元 604, 具体可以用于在判断单元 602确定目的节点为 主机外节点时, 获取所述数据的源虚拟网卡接口,根据该源虚拟网卡接口从第 二映射表中查找得到与该源虚拟网卡接口对应的物理网卡接口,通过该物理网 卡接口对应的物理网卡将该数据发送至所述物理主机外。
其中, 第二映射表可以包括虚拟网卡接口和物理网卡接口的对应关系。其 中,虚拟网卡接口和物理网卡接口可以是一对一的关系,也可以是多对一的关 系, 也就是说, 同一个物理网卡接口可以对应多个虚拟网卡接口。
此外, 需说明的是, 物理网卡接口在物理网卡接入物理主机时生成, 并在 物理网卡从物理主机移除时删除。 另外,在虚拟网卡接口和物理网卡接口建立 对应关系 (或称为映射关系) 时, 后端虚拟网卡的 MAC地址也被下发到物理 网卡接口对应的物理网卡的单播列表中,以供该物理网卡在接收数据时可以对 数据进行过滤。 具体实施时, 以上各个单元可以作为独立的实体来实现,也可以进行任意 组合, 作为同一或若干个实体来实现, 例如, 该虚拟机的数据交换装置具体可 以为物理主机等设备, 而该物理主机的结构可以参考前述描述内容, 这里不再 赘述。 以上各个单元的具体实施可参见前面的实施例, 在此不再赘述。
由上可知,本发明实施例的虚拟机的数据交换装置在进行虚拟机的数据交 换时,对主机内的虚拟机之间的通信, 以及主机内的虚拟机与主机外设备之间 的通信进行区分, 若为主机内的虚拟机之间的通信, 则不需要经过物理网卡, 而是由第一处理单元 603直接确定目的虚拟网卡接口, 然后通过目的虚拟网卡 接口对应的目的虚拟网卡接口与目的虚拟机进行通信,也就是说, 此时只是虚 拟机间的内容拷贝, 因此不会浪费 PCI总线带宽, 可以提高数据交换效率, 也 不会影响其他虚拟机与主机外设备间的通信;而若为主机内的虚拟机与主机外 设备之间的通信, 则需要由第二处理单元 604确定物理网卡接口, 然后通过该 物理网卡接口对应的物理网卡与物理主机外设备进行通信,由于与物理主机外 设备进行通信时,都需要经过物理网卡, 所以便于对进入物理主机的数据进行 控制, 比如只要物理网卡不开启混杂模式, 那么就可以控制进入物理主机里的 数据均为有效数据, 减少无效数据的消耗, 可以进一步提高数据交换效率; 此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以可以在主机 内为虚拟机提供 ACL和流控制功能。也就是说, 该方案可以在不降低其性能和 灵活性的前提下,提高数据交换效率, 一定程度上消除主机内虚拟机间的通信 对主机内其他虚拟机与主机外设备间的通信的影响、以及实现在主机内为虚拟 机提供 ACL和流控制功能。 实施例七、
该虚拟机的数据交换装置除了可以用于发送数据之外,还可以用于接收来 自物理主机外的数据, 机在实施例六的基础上, 如图 7所示, 该虚拟机的数据 交换装置还可以包括接收单元 701、 确定单元 702和发送单元 703;
接收单元 701 , 用于通过物理网卡接收来自物理主机外的数据, 该来自物 理主机外的数据携带目的节点的 MAC地址;
确定单元 702, 用于根据接收单元 701接收到的数据中携带的目的节点的 MAC地址确定对应目的虚拟网卡接口; 发送单元 703, 用于将通过目的虚拟网卡接口对应的虚拟网卡该数据发送 给对应的目的虚拟机。
比如, 具体可以利用该查找到的虚拟网卡接口确定对应的后端虚拟网卡, 通过确定的后端虚拟网卡将该数据发送给该目的虚拟机。
其中, 确定单元 702, 具体可以用于根据所述来自物理主机外的数据中携 带的目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网 卡接口, 即目的虚拟网卡接口;
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。
其中, 该第一映射表中的虚拟网卡接口在后端虚拟网卡接入主机时生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC地址学习 (Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除时才变化, 而无需逐包进行 MAC 地址学习。
此外,如果物理网卡确定第一映射表中不存在该数据中携带的目的节点的 MAC地址, 则可以直接丟弃该数据。 即:
确定单元 702, 还可以用于在根据该来自物理主机外的数据中携带的目的 节点的 MAC地址, 从第一映射表中查找不到与该 MAC地址对应的虚拟网卡 接口时, 丟弃该来自物理主机外的数据。
具体实施时, 以上各个单元可以作为独立的实体来实现,也可以进行任意 组合, 作为同一或若干个实体来实现, 例如, 该虚拟机的数据交换装置具体可 以为物理主机等设备, 而该物理主机可以包括处理器、物理网卡和虚拟机等设 备, 以上各个单元的具体实施可参见前面的实施例, 在此不再赘述。
由上可知,本发明实施例的虚拟机的数据交换装置在接收来自主机外的数 据时,均需要通过物理网卡,所以可以方便地对进入物理主机的数据进行控制, 比如只要物理网卡不开启混杂模式,那么就可以控制进入物理主机里的数据均 为有效数据, 减少无效数据的消耗, 可以提高数据交换效率; 此外, 由于虚拟 机在接收数据时,都需要经过物理主机, 所以可以在主机内为虚拟机提供 ACL 和流控制功能。 也就是说, 该方案可以在不降低其性能和灵活性的前提下, 提 高数据交换效率, 以及实现在主机内为虚拟机提供 ACL和流控制功能。 实施例八、
相应的, 本发明实施例还提供一种通信系统, 如图 10所示, 该通信系统包 括至少两台物理主机,其中所述至少两台物理主机包括第一物理主机 1001和第 二物理主机 1002, 其中:
第一物理主机 1001 , 用于获取本物理主机(即第一物理主机 1001 ) 内需 要发送给目的节点的数据, 该数据携带目的节点的 MAC地址, 根据该数据中 携带的目的节点的 MAC地址确定目的节点为本物理主机内节点还是本物理主 机外节点; 若为本物理主机内节点, 则确定目的虚拟网卡接口, 通过该目的虚 拟网卡接口对应的虚拟网卡将该数据发给对应的目的虚拟机;若为本物理主机 外节点, 则确定物理网卡接口,通过该物理网卡接口对应的物理网卡将该数据 发送至对应的第二物理主机 1002。
第二物理主机 1002, 用于接收第一物理主机 1001发送的数据。
例如, 第一物理主机 1001 , 具体可以用于获取本物理主机(即第一物理 主机 1001 ) 内需要发送给目的节点的数据, 确定第一映射表中是否存在该数 据中携带的目的节点的 MAC地址, 若该第一映射表中存在该数据中携带的目 的节点的 MAC地址, 则确定目的节点为本物理主机 (即第一物理主机 ) 内的 节点, 并根据该数据中携带的目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口, 即目的虚拟网卡接口, 通过该目的虚拟网卡 接口对应的虚拟网卡将将该数据发给对应的目的虚拟机;若该第一映射表中不 存在该数据中携带的目的节点的 MAC地址, 则确定目的节点为主机外节点, 并确定物理网卡接口,通过该物理网卡接口对应的物理网卡将该数据发送至第 二物理主机 1002。
或者, 又例如, 第一物理主机 1001 , 具体可以用于根据该数据中携带的 目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接 口, 若查找到与该 MAC地址对应的虚拟网卡接口 (即目的虚拟网卡接口 ), 则确定目的节点为本物理主机(第一物理主机 1001 ) 内的节点, 并确定该查 找到的与该 MAC地址对应的虚拟网卡接口为目的虚拟网卡接口, 通过该目的 虚拟网卡接口对应的虚拟网卡将该数据发给对应的目的虚拟机;若查找不到与 该 MAC地址对应的虚拟网卡接口, 则确定目的节点为主机外节点, 并确定物 理网卡接口,通过该物理网卡接口对应的物理网卡将该数据发送至第二物理主 机 1002。
其中,第一映射表可以包括 MAC地址和虚拟网卡接口的对应关系等信息, 比如该第一映射表具体可以为 mac-port表。
可选的, 第一物理主机 1001 , 具体可以用于获取该数据的源虚拟网卡接 口,根据该数据中携带的源虚拟网卡接口从第二映射表中查找得到与该源虚拟 网卡接口对应的物理网卡接口,通过该物理网卡接口对应的物理网卡将该数据 发送至第一物理主机 1001外。
其中, 第二映射表可以包括虚拟网卡接口和物理网卡接口的对应关系。其 中,虚拟网卡接口和物理网卡接口可以是一对一的关系,也可以是多对一的关 系, 也就是说, 同一个物理网卡接口可以对应多个虚拟网卡接口。
应当理解的是, 该第二物理主机 1002还可以用于向该第一物理主机发送 数据。
相应的, 第一物理主机 1001 , 还可以用于通过物理网卡接收来自第二物 理主机 1002的数据, 该来自第二物理主机 1002的数据携带目的节点的 MAC 地址; 根据该来自第二物理主机 1002的数据中携带的目的节点的 MAC地址 确定本物理主机 (即第一物理主机 1001 ) 内的对应目的虚拟网卡接口; 通过 该目的虚拟网卡接口对应的虚拟网卡将该来自第二物理主机 1002的数据发送 给对应的目的虚拟机。 例如, 具体可以如下:
第一物理主机 1001 , 具体可以用于根据该来自第二物理主机 1002的数据 中携带的目的节点的 MAC地址, 从第一映射表中查找与该 MAC地址对应的 虚拟网卡接口, 即目的虚拟网卡接口,通过该目的虚拟网卡接口对应的虚拟网 卡将该来自第二物理主机 1002的数据发送给对应目的虚拟机。
此外, 该第一物理主机 1001 , 还可以用于根据该来自第二物理主机 1002 的数据中携带的目的节点的 MAC地址, 从第一映射表中查找不到与该 MAC 地址对应的虚拟网卡接口时, 丟弃该来自第二物理主机 1002的数据。
应当理解的是,在一种实现方式下, 本发明实施例提供的任一种虚拟机的 数据交换装置集成在所述物理主机内, 具体可参见实施例六和七,在此不再赘 述。 以上各个设备的具体实施可参见前面的实施例, 在此不再赘述。 此外, 该通信系统还可以包括其他设备, 物理主机外的其他设备, 比如物 理交换机、 其他的服务器和 /或个人计算机, 等等, 在此不再赘述。
该通信系统同样可以实现实施例六和七中所描述的虚拟机的数据交换装 置的有益效果, 在此不再赘述。 实施例九、
相应的, 本发明实施例还提供一种物理主机, 如图 8a所示, 该物理主机 包括位于所述物理主机的用户空间的至少一个虚拟机, 比如第一虚拟机 802A 和第二虚拟机 802B (仅供示意, 对数量不做限定)、 位于所述物理主机的内核 空间的交换模块 800和至少一个虚拟网卡, 比如第一虚拟网卡 801 A和第二虚 拟网卡 801B (仅供示意, 对数量不做限定), 以及位于所述物理主机的硬件层 的至少一个物理网卡 803 (仅供示意, 对数量不做限定), 其中:
所述第一虚拟机 802A: 用于将需要发送给目的节点的数据发送, 该数据 携带目的节点的 MAC地址;
具体的, 第一虚拟机 802A中的应用发送数据, 该数据经过第一虚拟机 802A中的客户端操作系统(可以理解为第一虚拟机 802A的内核)处理后, 被传递给第一虚拟机 802A中的虚拟网卡驱动, 并由该虚拟网卡驱动将处理后 的数据传递给第一虚拟网卡 801 A;
所述第一虚拟网卡 801A: 用于将所述数据传递给交换模块 800; 换言之, 数据经第一虚拟网卡 801 A进入交换模块 800处理;
交换模块 800: 用于 ^据该数据中携带的目的节点的 MAC地址确定目的 节点为主机内节点还是主机外节点; 若为主机内节点, 则确定目的虚拟网卡接 口,通过所述目的虚拟网卡接口将所述数据传递给对应的目的虚拟网卡; 若为 主机外节点, 则确定物理网卡接口,通过该物理网卡接口将该数据传递给该物 理网卡接口对应的物理网卡。
需要说明的是, 这里的目的虚拟网卡, 例如可以是第二虚拟网卡 801B; 这里的目的虚拟机, 例如可以是第二虚拟机 802B; 这里的物理网卡, 例如可 以是物理网卡 803;
所述第二虚拟网卡 801B: 用于将所述数据传递给对应的目的虚拟机, 例 如第二虚拟机 802B; 所述物理网卡 803: 用于将该数据发送至物理主机外。
在一种实现方式下, 交换模块 800, 具体可以用于确定第一映射表中是否 存在该数据中携带的目的节点的 MAC地址, 若是, 则确定目的节点为主机内 节点, 并根据该数据中携带的目的节点的 MAC地址从第一映射表中查找与该 MAC地址对应的目的虚拟网卡接口, 通过所述目的虚拟网卡接口将所述数据 传递给对应的目的虚拟网卡, 比如是第二虚拟网卡 801B; 若否, 则确定目的 节点为主机外节点, 并确定物理网卡接口,通过该物理网卡接口将该数据传递 给该物理网卡接口对应的物理网卡 803。
或者, 可选的, 交换模块 800, 具体可以用于根据该数据中携带的目的节 点的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口 (即目 的虚拟网卡接口), 若查找到与该 MAC地址对应的虚拟网卡接口, 则确定目的 节点为主机内节点, 并确定该查找到的与该 MAC地址对应的虚拟网卡接口为 目的虚拟网卡接口,通过所述目的虚拟网卡接口将所述数据传递给对应的目的 虚拟网卡, 比如是第二虚拟网卡 801B; 若查找不到与该 MAC地址对应的虚拟 网卡接口, 则确定目的节点为主机外节点, 并确定物理网卡接口, 通过所述物 理网卡接口将所述数据传递给对应的物理网卡 803。
其中, 可以根据该数据中携带的源虚拟网卡接口在第二映射表中查找, 以 得到与该源虚拟网卡接口对应的物理网卡接口, 即:
交换模块 800, 具体可以用于在确定目的节点为主机外节点时, 获取该接 收该数据所采用的虚拟网卡接口 (亦称为源虚拟网卡接口), 根据该数据中携 带的源虚拟网卡接口从第二映射表中查找得到与所述源虚拟网卡接口对应的 物理网卡接口,通过该物理网卡接口将该数据传递给该物理网卡接口对应的物 理网卡 803。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。第二映射表可以包括 虚拟网卡接口和物理网卡接口的对应关系。 其中,虚拟网卡接口和物理网卡接 口可以是一对一的关系, 也可以是多对一的关系, 也就是说, 同一个物理网卡 接口可以对应多个虚拟网卡接口。
需说明的是, 该第一映射表中的目的虚拟网卡接口在虚拟网卡(具体为后 端虚拟网卡)接入主机时生成, 并在后端虚拟网卡移除时删除, 可以不进行 MAC地址学习 (Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移除 时才变化, 而无需逐包进行 MAC地址学习。 而物理网卡接口则在物理网卡 803 接入物理主机时生成, 并在物理网卡 803从物理主机移除时删除。
此外,还需说明的是, 物理网卡接口在物理网卡 803接入物理主机时生成, 并在物理网卡 803从物理主机移除时删除。 另外, 在虚拟网卡接口和物理网卡 接口建立对应关系 (或称为映射关系) 时, 后端虚拟网卡的 MAC地址也被下 发到物理网卡接口对应的物理网卡的单播列表中, 以供该物理网卡 803在接收 数据时可以对数据进行过滤。
此外, 针对第一虚拟机 802A接收数据:
物理网卡 803: 还用于接收来自物理主机外的数据, 该来自物理主机外的 数据携带目的节点的 MAC地址, 将该来自物理主机外的数据传递给交换模块 800;
交换模块 800: 还用于接收物理网卡 803发送的来自物理主机外的数据, 根据该数据中携带的目的节点的 MAC地址确定对应目的虚拟网卡接口, 通过 所述目的虚拟网卡接口将数据传递给对应的目的虚拟网卡; 需要说明的是, 这 里的目的虚拟网卡, 例如可以是第一虚拟网卡 801A;
所述第一虚拟网卡 801 A: 还用于将数据传递给对应的目的虚拟机, 需要 说明的是, 这里的目的虚拟机, 例如可以是第一虚拟机 802A; 具体的, 第一 虚拟机中的该虚拟网卡驱动传递给目的虚拟机中的客户端操作系统,进而由目 的虚拟机中的客户端操作系统传递给目的虚拟机(比如可以是第一虚拟机 802A ) 中的对应的应用处理。
在一种实现方式下, 交换模块 800具体可以是: 根据该来自物理主机外的 数据中携带的目的节点的 MAC地址从该第一映射表中查找与该 MAC地址对应 的目的虚拟网卡接口,通过所述目的虚拟网卡接口将数据传递给对应的目的虚 拟网卡;需要说明的是,这里的目的虚拟网卡,例如可以是第一虚拟网卡 801A。
此外, 如果确定第一映射表中不存在该数据中携带的目的节点的 MAC地 址(或者不存在与该 MAC地址对应的虚拟网卡接口),则可以直接丟弃该数据。 即:
该交换模块 800, 还可以用于在根据该来自物理主机外的数据中携带的目 的节点的 MAC地址, 从第一映射表中查找不到与该 MAC地址对应的虚拟网卡 接口时, 丟弃该来自物理主机外的数据。
以上各个设备的具体实施可参见前面的实施例, 在此不再赘述。
由上可知, 本发明实施例的物理主机中, 在进行虚拟机的数据交换时, 对 主机内的虚拟机(比如第一虚拟机 802A和第二虚拟机 802B )之间的通信, 以 及主机内的虚拟机(比如第一虚拟机 802A或第二虚拟机 802B ) 与主机外设备 之间的通信进行区分, 若为主机内的虚拟机之间的通信, 则不需要经过物理网 卡 803, 而是直接确定目的虚拟网卡接口, 然后通过目的虚拟网卡接口对应的 目的虚拟网卡与目的虚拟机进行通信, 也就是说, 此时只是虚拟机间的内容拷 贝, 因此不会浪费 PCI总线带宽, 可以提高数据交换效率, 也不会影响主机内 的其他虚拟机与主机外设备间的通信;而若为主机内的虚拟机与主机外设备之 间的通信,则确定物理网卡接口,然后通过该物理网卡接口对应的物理网卡 803 与物理主机外设备进行通信, 由于与物理主机外设备进行通信时,都需要经过 物理网卡 803 , 所以便于对进入物理主机的数据进行控制, 比如只要物理网卡 803不开启混杂模式, 那么就可以控制进入物理主机里的数据均为有效数据, 减少无效数据的消耗, 可以进一步提高数据交换效率;
此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以便于后续在 主机内为虚拟机提供进一步的功能,比如可以在主机内为虚拟机提供 ACL和流 控制功能。 也就是说, 该方案可以在不降低其性能和灵活性的前提下, 提高数 据交换效率,一定程度上消除主机内虚拟机间的通信对主机内其他虚拟机与主 机外设备间的通信的影响、 以及便于后续在主机内为虚拟机提供进一步的功 能, 比如提供 ACL和流控制功能。 实施例十、
相应的, 本发明实施例还提供一种物理主机, 如图 8b所示, 该物理主机 包括运行于物理主机用户空间的至少一个虚拟机 802 和位于物理主机硬件层 的处理器 801和至少一个物理网卡 803, 其中: 处理器 801 , 用于获取物理主机内需要发送给目的节点的数据, 该数据携 带目的节点的 MAC地址, 根据该数据中携带的目的节点的 MAC地址确定目 的节点为主机内节点还是主机外节点, 若为主机内节点, 则确定目的虚拟网卡 机 802, 若为主机外节点, 则确定物理网卡接口, 将该数据发送给物理网卡接 口对应的物理网卡 803;
虚拟机 802, 用于接收处理器 801发送的数据;
物理网卡 803, 用于接收处理器 801发送的数据, 并将该数据发送至该物 理主机外。
可选的, 处理器 801 , 具体可以用于获取物理主机内需要发送给目的节点 的数据, 确定第一映射表中是否存在该数据中携带的目的节点的 MAC地址, 若是,则确定目的节点为主机内节点,并根据该数据中携带的目的节点的 MAC 地址从第一映射表中查找与该 MAC地址对应的目的虚拟网卡接口, 通过该虚 拟网卡接口对应的虚拟网卡将该数据发给对应的目的虚拟机 802; 若否, 则确 定目的节点为主机外节点, 并确定物理网卡接口,将该数据发送给该物理网卡 接口对应的物理网卡 803。
或者, 可选的, 处理器 801 , 具体可以用于根据该数据中携带的目的节点 的 MAC地址从第一映射表中查找与该 MAC地址对应的虚拟网卡接口 (即目的 虚拟网卡接口), 若查找到与该 MAC地址对应的虚拟网卡接口, 则确定目的节 点为主机内节点, 并确定该查找到的与该 MAC地址对应的虚拟网卡接口为目 的虚拟网卡接口,通过该目的虚拟网卡接口对应的虚拟网卡将该数据发给对应 目的虚拟机 802; 若查找不到与该 MAC地址对应的虚拟网卡接口, 则确定目的 节点为主机外节点, 并确定物理网卡接口,将该数据发送给所述物理网卡接口 对应的物理网卡 803。
其中, 可以根据该数据中携带的源虚拟网卡接口在第二映射表中查找, 以 得到与该源虚拟网卡接口对应的物理网卡接口, 即:
处理器 801 , 具体可以用于在确定目的节点为主机外节点时, 获取该数据 的源虚拟网卡接口,根据该数据中携带的源虚拟网卡接口从第二映射表中查找 得到与所述源虚拟网卡接口对应的物理网卡接口,将该数据发送给该物理网卡 接口对应的物理网卡。
其中, 第一映射表可以包括 MAC地址和虚拟网卡接口 (in_port ) 的对应 关系等信息, 比如该第一映射表具体可以为 mac-port表。第二映射表可以包括 虚拟网卡接口和物理网卡接口的对应关系。 其中,虚拟网卡接口和物理网卡接 口可以是一对一的关系, 也可以是多对一的关系, 也就是说, 同一个物理网卡 接口可以对应多个虚拟网卡接口。
需说明的是, 该第一映射表中的目的虚拟网卡接口在虚拟网卡(具体为后 端虚拟网卡)接口接入主机时生成, 并在后端虚拟网卡移除时删除, 可以不进 行 MAC地址学习 ( Mac-learning ), 该第一映射表只在后端虚拟网卡加入或移 除时才变化, 而无需逐包进行 MAC地址学习。 而物理网卡接口则在物理网卡 接入物理主机时生成, 并在物理网卡从物理主机移除时删除。
此外,还需说明的是, 物理网卡接口在物理网卡 803接入物理主机时生成, 并在物理网卡 803从物理主机移除时删除。 另外, 在虚拟网卡接口和物理网卡 接口建立对应关系 (或称为映射关系) 时, 后端虚拟网卡的 MAC地址也被下 发到物理网卡接口对应的物理网卡的单播列表中, 以供该物理网卡 803在接收 数据时可以对数据进行过滤。
可选的, 物理网卡 803, 还用于接收来自物理主机外的数据, 该来自物理 主机外的数据携带目的节点的 MAC地址, 将该来自物理主机外的数据发送给 处理器 801。
则此时, 处理器 801 ,还用于接收物理网卡 803发送的来自物理主机外的数 据, 根据该来自物理主机外的数据中携带的目的节点的 MAC地址确定物理网 卡对应的虚拟网卡接口 (即目的虚拟网卡接口;), 通过该目的虚拟网卡接口对 应的虚拟网卡该来自物理主机外的数据发送给该目的虚拟机 802。 例如, 具体 可以: ¾口下:
处理器 801 , 具体可以用于根据该来自物理主机外的数据中携带的目的节 点的 MAC地址从该第一映射表中查找与该 MAC地址对应的虚拟网卡接口, 通 过该目的虚拟网卡接口对应的虚拟网卡将该来自物理主机外的数据发送给该 目的虚拟机 802。
此外, 如果确定第一映射表中不存在该数据中携带的目的节点的 MAC地 址(或者不存在与该 MAC地址对应的虚拟网卡接口 ),则可以直接丟弃该数据。 即:
该处理器 801 , 还可以用于在根据该来自物理主机外的数据中携带的目的 节点的 MAC地址, 从第一映射表中查找不到与该 MAC地址对应的虚拟网卡接 口时, 丟弃该来自物理主机外的数据。
需说明的是, 处理器的各个线程主要在图 8中的内核空间中运行, 详见前 面的实施例, 在此不再赘述。
以上各个设备的具体实施可参见前面的实施例, 在此不再赘述。
由上可知, 本发明实施例的物理主机的处理器 801在进行虚拟机的数据交 换时, 对虚拟机之间的通信, 以及虚拟机与主机外设备之间的通信进行区分, 若为虚拟机之间的通信, 则不需要经过物理网卡 803 , 而是直接确定目的虚拟 网卡接口, 然后通过虚拟网卡接口与目的虚拟机 802进行通信, 也就是说, 此 时只是虚拟机 802间的内容拷贝, 因此不会浪费 PCI总线带宽,也不会影响其他 虚拟机 802与主机外设备间的通信; 而若为与主机外设备之间的通信, 则需要 确定目的物理网卡 803 ,然后通过该目的物理网卡 803与物理主机外设备进行通 信, 由于与物理主机外设备进行通信时, 都需要经过物理网卡 803 , 所以便于 对进入物理主机的数据进行控制, 比如只要物理网卡 803不开启混杂模式, 那 么就可以控制进入物理主机里的数据均为有效数据, 减少无效数据的消耗, 可 以提高数据交换效率; 此外, 由于虚拟机 802在收发数据时, 都需要经过物理 主机, 所以可以在主机内为虚拟机 802提供 ACL和流控制功能。 也就是说, 该 方案可以在不降低其性能和灵活性的前提下,提高数据交换效率, 消除主机内 虚拟机间的通信对其他虚拟机 802与主机外设备间的通信的影响、 以及实现在 主机内为虚拟机 802提供 ACL和流控制功能。 实施例十一、
相应的, 本发明实施例还提供一种物理主机, 如图 9所示, 该物理主机可 以包括至少一个处理器 901 , 例如 CPU, 至少一个网络接口 904, 例如物理网 卡, 或者其他的用户接口 903 , 以及存储器 905和至少一个通信总线 902。
其中, 通信总线 902用于实现这些组件之间的连接通信。
网络接口 904用于实现该物理主机和网络之间的连接通信, 比如该网络接 口 904可以用于连接物理网卡和 /或物理交换机等设备。
可选的, 用户接口 903 , 可以包括显示器, 键盘或者其他点击设备, 例如, 鼠标, 轨迹球(trackball ) , 触感板或者触感显示屏等。
存储器 905可能包括高速随机存取记忆体 ( RAM , Random Access Memory) , 也可能还包括非不稳定的存储器( non- volatile memory ), 例如至少 一个磁盘存储器。 可选的, 该存储器 905还可以包括至少一个位于远离前述处 理器 901的存储装置。
在一些实施方式中, 存储器 605存储了如下的元素, 可执行模块或者数据 结构, 或者他们的子集, 或者他们的扩展集:
操作系统 9051 , 包含各种系统程序, 用于实现各种基础业务以及处理基于 硬件的任务;
应用模块 9052, 包含各种应用程序, 用于实现各种应用业务。
应用模块 9052中包括但不限于交换模块,各种虚拟网卡、 以及虚拟网卡相 关的模块, 比如获取单元、 判断单元、 第一处理单元和第二处理单元等。
具体地, 处理器 901 , 用于获取本物理主机内需要发送给目的节点的数据, 该数据携带目的节点的 MAC地址, 根据该数据中携带的目的节点的 MAC地址 确定目的节点为本物理主机内节点还是本物理主机外节点,若为本物理主机内 节点, 则确定目的虚拟网卡接口,通过该虚拟网卡接口对应的虚拟网卡将该数 据发给对应的目的虚拟机, 若为本物理主机外节点, 则确定物理网卡接口, 将 该数据发送给物理网卡接口对应的物理网卡, 以便将该数据发送至物理主机 夕卜。
可选的, 该处理器 901 , 具体用于确定第一映射表中是否存在该数据中携 带的目的节点的 MAC地址, 其中, 该第一映射表包括 MAC地址和目的虚拟网 卡接口的对应关系; 若是, 则确定目的节点为主机内节点, 并根据所述数据中 携带的目的节点的 MAC地址获取对应的目的虚拟网卡接口, 通过该目的虚拟 网卡接口对应的虚拟网卡接口将该数据发给该目的虚拟机; 若否, 则确定目的 节点为主机外节点, 根据该数据的源虚拟网卡接口获取对应的物理网卡接口, 比如,具体可以通过查找第二映射表获取所述数据的源虚拟网卡接口对应的物 理网卡接口, 然后将该数据发送给所述物理网卡接口对应的物理网卡, 以便将 该数据发送至物理主机外。
可选的,该处理器 901 ,还用于通过物理网卡接收来自物理主机外的数据, 该来自物理主机外的数据携带目的节点的 MAC地址; 由物理网卡根据该数据 中携带的目的节点的 MAC地址确定对应目的虚拟网卡接口, 并通过该目的虚 拟网卡接口对应的虚拟网卡该数据发送给对应的目的虚拟机,具体可参见前面 实施例, 在此不再赘述。
以上各个设备的具体实施可参见前面的实施例, 在此不再赘述。 机内的虚拟机之间的通信, 以及虚拟机与主机外设备之间的通信进行区分, 若 为虚拟机之间的通信, 则不需要经过物理网卡, 而是直接确定目的虚拟网卡接 口, 然后通过该虚拟网卡接口与目的虚拟机进行通信, 也就是说, 此时只是虚 拟机间的内容拷贝, 因此不会浪费 PCI总线带宽,也不会影响其他虚拟机与主 机外设备间的通信; 而若为与主机外设备之间的通信, 则需要确定目的物理网 卡, 然后通过该目的物理网卡与物理主机外设备进行通信, 由于与物理主机外 设备进行通信时,都需要经过物理网卡, 所以便于对进入物理主机的数据进行 控制, 比如只要物理网卡不开启混杂模式, 那么就可以控制进入物理主机里的 数据均为有效数据, 减少无效数据的消耗, 可以提高数据交换效率。
此外, 由于虚拟机在收发数据时, 都需要经过物理主机, 所以可以在主机 内为虚拟机提供 ACL和流控制功能。 也就是说, 该方案可以在不降低其性能 和灵活性的前提下,提高数据交换效率, 消除主机内虚拟机间的通信对其他虚 拟机与主机外设备间的通信的影响、 以及实现在主机内为虚拟机提供 ACL和 流控制功能。 本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读 存储介质中, 存储介质可以包括: 只读存储器(ROM, Read Only Memory ), 随机存取记忆体(RAM, Random Access Memory ) , 磁盘或光盘等。
以上对本发明实施例所提供的一种虚拟机的数据交换方法、装置和系统进 述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时, 对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均 会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求
1、 一种虚拟机的数据交换方法, 其特征在于, 包括:
获取物理主机内需要发送给目的节点的数据,所述数据中携带目的节点的 媒体接入层地址;
根据所述数据中携带的目的节点的媒体接入层地址确定目的节点为本物 理主机内的节点还是本物理主机外的节点;
若为本物理主机内的节点, 则确定目的虚拟网卡接口,通过所述目的虚拟 若为本物理主机外的节点, 则确定物理网卡接口,通过所述物理网卡接口 对应的物理网卡将所述数据发送至所述物理主机外。
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述数据中携带 的目的节点的媒体接入层地址确定目的节点为本物理主机内的节点还是本物 理主机外的节点, 包括:
确定第一映射表中是否存在所述数据中携带的目的节点的媒体接入层地 址, 所述第一映射表包括媒体接入层地址和虚拟网卡接口的对应关系;
若所述第一映射表中存在所述数据中携带的目的节点的媒体接入层地址, 则确定目的节点为本物理主机内的节点;
若所述第一映射表中不存在所述数据中携带的目的节点的媒体接入层地 址, 则确定目的节点为本物理主机外的节点。
3、 根据权利要求 2所述的方法, 其特征在于, 所述确定目的虚拟网卡接 口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的目 的虚拟机, 包括:
根据所述数据中携带的目的节点的媒体接入层地址从第一映射表中查找 与所述媒体接入层地址对应的虚拟网卡接口,所述与所述媒体接入层地址对应 的虚拟网卡接口为目的虚拟网卡接口;
通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的 目的虚拟机。
4、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述数据中携带 的目的节点的媒体接入层地址确定目的节点为本物理主机内的节点还是本物 理主机外的节点, 包括:
根据所述数据中携带的目的节点的媒体接入层地址从第一映射表中查找 与所述媒体接入层地址对应的虚拟网卡接口,所述第一映射表包括媒体接入层 地址和虚拟网卡接口的对应关系;
若查找到与所述媒体接入层地址对应的虚拟网卡接口,则确定目的节点为 本物理主机内的节点;
若查找不到与所述媒体接入层地址对应的虚拟网卡接口,则确定目的节点 为本物理主机外的节点;
其中, 所述确定目的虚拟网卡接口为: 确定所述查找到的与所述媒体接入 层地址对应的虚拟网卡接口为所述目的虚拟网卡接口。
5、 根据权利要求 2至 4任一项所述的方法, 其特征在于, 还包括: 检测到后端虚拟网卡接入本物理主机时, 生成对应的虚拟网卡接口, 并在 所述第一映射表中添加对应于指定的媒体接入层地址的所述虚拟网卡接口;以 及,
检测到所述后端虚拟网卡从本物理主机上移除时,在所述第一映射表中删 除对应于所述指定的媒体接入层地址的所述虚拟网卡接口。
6、 根据权利要求 1至 4任一项所述的方法, 其特征在于, 所述确定物理 网卡接口,通过所述物理网卡接口对应的物理网卡将所述数据发送至所述物理 主机外, 包括:
获取接收所述数据时所使用的虚拟网卡接口;
根据所述虚拟网卡接口从第二映射表中查找得到与所述虚拟网卡接口对 应的物理网卡接口,所述第二映射表包括虚拟网卡接口和物理网卡接口的对应 关系;
通过所述物理网卡接口对应的物理网卡将所述数据发送至所述物理主机 外。
7、 根据权利要求 1项所述的方法, 其特征在于, 还包括:
通过物理网卡接收来自物理主机外的数据,该来自物理主机外的数据中携 带目的节点的媒体接入层地址;
根据所述来自物理主机外的数据中携带的目的节点的媒体接入层地址确 定对应的目的虚拟网卡接口;
通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来自物理主机外 的数据发送给对应的目的虚拟机。
8、 根据权利要求 7所述的方法, 其特征在于, 所述根据所述来自物理主 机外的数据中携带的目的节点的媒体接入层地址确定对应的目的虚拟网卡接 口, 包括:
根据所述来自物理主机外的数据中携带的目的节点的媒体接入层地址,从 第一映射表中查找与所述媒体接入层地址对应的虚拟网卡接口,所述与所述媒 体接入层地址对应的虚拟网卡接口为目的虚拟网卡接口,所述第一映射表包括 媒体接入层地址和虚拟网卡接口的对应关系。
9、 根据权利要求 8所述的方法, 其特征在于, 所述通过物理网卡接收来 自物理主机外的数据之后, 还包括:
根据所述来自物理主机外的数据中携带的目的节点的媒体接入层地址,从 所述第一映射表中查找不到与所述媒体接入层地址对应的虚拟网卡接口时,丟 弃所述来自物理主机外的数据。
10、 一种虚拟机的数据交换装置, 其特征在于, 包括:
获取单元, 用于获取物理主机内需要发送给目的节点的数据, 所述数据中 携带目的节点的媒体接入层地址;
判断单元,用于根据所述数据中携带的目的节点的媒体接入层地址确定目 的节点为本物理主机内的节点还是本物理主机外的节点;
第一处理单元,用于在所述判断单元确定目的节点为本物理主机内的节点 时,确定目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡 将所述数据发给对应的目的虚拟机;
第二处理单元,用于在所述判断单元确定目的节点为本物理主机外的节点 时,确定物理网卡接口,通过所述物理网卡接口对应的物理网卡将所述数据发 送至所述物理主机外。
11、 根据权利要求 10所述的虚拟机的数据交换装置, 其特征在于, 所述判断单元,具体用于确定第一映射表中是否存在所述数据中携带的目 的节点的媒体接入层地址,若存在所述数据中携带的目的节点的媒体接入层地 址, 则确定目的节点为本物理主机内的节点, 若不存在所述数据中携带的目的 节点的媒体接入层地址, 则确定目的节点为本物理主机外的节点; 所述第一映 射表包括媒体接入层地址和虚拟网卡接口的对应关系。
12、 根据权利要求 11所述的虚拟机的数据交换装置, 其特征在于, 所述第一处理单元,具体用于在判断单元确定目的节点为本物理主机内的 节点时,根据所述数据中携带的目的节点的媒体接入层地址从第一映射表中查 找与所述媒体接入层地址对应的虚拟网卡接口,所述与所述媒体接入层地址对 应的虚拟网卡接口为目的虚拟网卡接口,通过所述目的虚拟网卡接口对应的目 的虚拟网卡将所述数据发给对应的目的虚拟机。
13、 根据权利要求 10所述的虚拟机的数据交换装置, 其特征在于, 所述判断单元,具体用于根据所述数据中携带的目的节点的媒体接入层地 址从第一映射表中查找与所述媒体接入层地址对应的虚拟网卡接口;若查找到 与所述媒体接入层地址对应的虚拟网卡接口,则确定目的节点为本物理主机内 的节点; 若查找不到与所述媒体接入层地址对应的虚拟网卡接口, 则确定目的 节点为本物理主机外的节点,所述第一映射表包括媒体接入层地址和虚拟网卡 接口的对应关系;
则所述第一处理单元,具体用于在判断单元确定目的节点为本物理主机内 的节点时,确定所述查找到的与所述媒体接入层地址对应的虚拟网卡接口为所 述目的虚拟网卡接口。
14、根据权利要求 11至 13任一项所述的虚拟机的数据交换装置, 其特征 在于, 还包括检测单元;
检测单元, 用于检测到后端虚拟网卡接入本物理主机时, 生成对应的虚拟 网卡接口,并在所述第一映射表中添加对应于指定的媒体接入层地址的所述虚 拟网卡接口; 以及, 检测到所述后端虚拟网卡从本物理主机上移除时, 在所述 第一映射表中删除对应于所述指定的媒体接入层地址的所述虚拟网卡接口。
15、根据权利要求 10至 13任一项所述的虚拟机的数据交换装置, 其特征 在于,
所述第二处理单元,具体用于在所述判断单元确定目的节点为本物理主机 外的节点时, 获取接收述数据时所使用的虚拟网卡接口,根据所述虚拟网卡接 口从第二映射表中查找得到与所述虚拟网卡接口对应的物理网卡接口,通过所 述物理网卡接口对应的物理网卡将所述数据发送至所述物理主机外;所述第二 映射表包括虚拟网卡接口和物理网卡接口的对应关系。
16、 根据权利要求 10所述的虚拟机的数据交换装置, 其特征在于, 还包 括接收单元、 确定单元和发送单元;
接收单元, 用于通过物理网卡接收来自物理主机外的数据, 该来自物理主 机外的数据中携带目的节点的媒体接入层地址;
确定单元,用于根据所述来自物理主机外的数据中携带的目的节点的媒体 接入层地址确定对应的目的虚拟网卡接口;
发送单元,用于通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来 自物理主机外的数据发送给对应的目的虚拟机。
17、 根据权利要求 16所述的虚拟机的数据交换装置, 其特征在于, 所述确定单元,具体用于根据所述来自物理主机外的数据中携带的目的节 点的媒体接入层地址从第一映射表中查找与所述媒体接入层地址对应的虚拟 网卡接口,所述与所述媒体接入层地址对应的虚拟网卡接口为目的虚拟网卡接 口, 所述第一映射表包括媒体接入层地址和虚拟网卡接口的对应关系。
18、 根据权利要求 17所述的虚拟机的数据交换装置, 其特征在于, 所述确定单元,还用于在根据所述来自物理主机外的数据中携带的目的节 点的媒体接入层地址,从所述第一映射表中查找不到与所述媒体接入层地址对 应的虚拟网卡接口时, 丟弃所述来自物理主机外的数据。
19、 一种通信系统, 其特征在于, 包括至少两台物理主机, 其中所述至少 两台物理主机包括第一物理主机和第二物理主机;
第一物理主机, 用于获取本物理主机内需要发送给目的节点的数据, 所述 数据中携带目的节点的媒体接入层地址,根据所述数据中携带的目的节点的媒 体接入层地址确定目的节点为本物理主机内的节点还是本物理主机外的节点; 若为本物理主机内的节点, 则确定目的虚拟网卡接口,通过所述目的虚拟网卡 外的节点, 则确定物理网卡接口,通过所述物理网卡接口对应的物理网卡将该 数据发送至第二物理主机。 第二物理主机, 用于接收第一物理主机发送的数据。
20、 根据权利要求 19所述的通信系统, 其特征在于,
所述第一物理主机,具体用于获取本物理主机内需要发送给目的节点的数 据, 确定第一映射表中是否存在所述数据中携带的目的节点的媒体接入层地 址, 若所述第一映射表中存在所述数据中携带的目的节点的媒体接入层地址, 则确定目的节点为第一物理主机内的节点,并根据所述数据中携带的目的节点 的媒体接入层地址从第一映射表中查找与所述媒体接入层地址对应的虚拟网 卡接口, 所述与所述媒体接入层地址对应的虚拟网卡接口为目的虚拟网卡接 口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的目 的虚拟机;若所述第一映射表中不存在所述数据中携带的目的节点的媒体接入 层地址, 则确定目的节点为第一物理主机外的节点, 并确定物理网卡接口, 通 过所述物理网卡接口对应的物理网卡将该数据发送至第二物理主机;所述第一 映射表包括媒体接入层地址和虚拟网卡接口的对应关系。
21、 根据权利要求 19所述的通信系统, 其特征在于,
所述第一物理主机,具体用于获取本物理主机内需要发送给目的节点的数 据,根据所述数据中携带的目的节点的媒体接入层地址从第一映射表中查找与 所述媒体接入层地址对应的虚拟网卡接口,若查找到与所述媒体接入层地址对 应的虚拟网卡接口, 则确定目的节点为第一物理主机内的节点, 并确定所述查 找到的与所述媒体接入层地址对应的虚拟网卡接口为所述目的虚拟网卡接口, 虚拟机; 若查找不到与所述媒体接入层地址对应的虚拟网卡接口, 则确定目的 节点为第一物理主机外的节点, 并确定物理网卡接口,通过所述物理网卡接口 对应的物理网卡将该数据发送至第二物理主机;所述第一映射表包括媒体接入 层地址和虚拟网卡接口的对应关系。
22、 根据权利要求 19至 21任一项所述的通信系统, 其特征在于, 所述第二物理主机还用于向第一物理主机发送数据;
所述第一物理主机还用于通过物理网卡接收所述第二物理主机发送的数 据, 根据所述数据的目的节点的媒体接入层地址确定对应的目的虚拟网卡接 口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述来自第二物理主机 的数据发送给对应的目的虚拟机。
23、 一种物理主机, 其特征在于, 包括: 运行于物理主机用户空间的至少 一个虚拟机和位于物理主机硬件层的处理器和至少一个物理网卡, 其中: 处理器, 用于获取物理主机内需要发送给目的节点的数据, 所述数据中携 带目的节点的媒体接入层地址,根据所述数据中携带的目的节点的媒体接入层 地址确定目的节点为本物理主机内的节点还是本物理主机外的节点,若为本物 理主机内的节点, 则确定目的虚拟网卡接口,通过所述目的虚拟网卡接口对应 点, 则确定物理网卡接口, 将所述数据发送给物理网卡接口对应的物理网卡; 虚拟机, 用于接收所述处理器发送的数据;
物理网卡, 用于接收所述处理器发送的数据, 并将所述数据发送至所述物 理主机外。
24、 根据权利要求 23所述的物理主机, 其特征在于,
所述处理器具体用于获取物理主机内需要发送给目的节点的数据,确定第 一映射表中是否存在所述数据中携带的目的节点的媒体接入层地址,所述第一 映射表包括媒体接入层地址和虚拟网卡接口的对应关系;若第一映射表中存在 所述数据中携带的目的节点的媒体接入层地址,则确定目的节点为本物理主机 内的节点,并根据所述数据中携带的目的节点的媒体接入层地址从所述第一映 射表中查找与所述媒体接入层地址对应的虚拟网卡接口,所述与所述媒体接入 层地址对应的虚拟网卡接口为目的虚拟网卡接口,通过所述目的虚拟网卡接口 在所述数据中携带的目的节点的媒体接入层地址,则确定目的节点为本物理主 机外的节点, 并确定物理网卡接口,将所述数据发送给所述物理网卡接口对应 的物理网卡。
25、 根据权利要求 23所述的物理主机, 其特征在于,
所述处理器具体用于获取物理主机内需要发送给目的节点的数据,根据所 述数据中携带的目的节点的媒体接入层地址从第一映射表中查找与所述媒体 接入层地址对应的虚拟网卡接口,所述第一映射表包括媒体接入层地址和虚拟 网卡接口的对应关系, 若查找到与所述媒体接入层地址对应的虚拟网卡接口, 则确定所述查找到的与所述媒体接入层地址对应的虚拟网卡接口为所述目的 虚拟网卡接口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发 给对应的目的虚拟机; 若查找不到与所述媒体接入层地址对应的虚拟网卡接 口, 则确定目的节点为本物理主机外的节点, 并确定物理网卡接口, 将所述数 据发送给所述物理网卡接口对应的物理网卡。
26、 根据权利要求 24或 25所述的物理主机, 其特征在于,
所述物理网卡还用于接收来自物理主机外的数据,将所述来自物理主机外 的数据发送给处理器;
所述处理器还用于根据所述来自物理主机外的数据中携带的目的节点的 媒体接入层地址从所述第一映射表中查找与所述媒体接入层地址对应的虚拟 网卡接口,所述与所述媒体接入层地址对应的虚拟网卡接口为目的虚拟网卡接 口,通过所述目的虚拟网卡接口对应的目的虚拟网卡将所述数据发给对应的目 的虚拟机。
27、 根据权利要求 26所述的物理主机, 其特征在于,
所述处理器,还用于在根据所述来自物理主机外的数据中携带的目的节点 的媒体接入层地址,从第一映射表中查找不到与所述媒体接入层地址对应的虚 拟网卡接口时, 丟弃所述来自物理主机外的数据。
PCT/CN2013/073563 2013-04-01 2013-04-01 虚拟机的数据交换方法、装置和系统 Ceased WO2014161133A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
PCT/CN2013/073563 WO2014161133A1 (zh) 2013-04-01 2013-04-01 虚拟机的数据交换方法、装置和系统
CN201380001038.4A CN103621026B (zh) 2013-04-01 2013-04-01 虚拟机的数据交换方法、装置和系统
US14/683,131 US10033637B2 (en) 2013-04-01 2015-04-09 Method and apparatus for switching data between virtual machines, and communications system
US16/016,082 US11121971B2 (en) 2013-04-01 2018-06-22 Method and apparatus for switching data between virtual machines, and communications system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/073563 WO2014161133A1 (zh) 2013-04-01 2013-04-01 虚拟机的数据交换方法、装置和系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/683,131 Continuation US10033637B2 (en) 2013-04-01 2015-04-09 Method and apparatus for switching data between virtual machines, and communications system

Publications (1)

Publication Number Publication Date
WO2014161133A1 true WO2014161133A1 (zh) 2014-10-09

Family

ID=50169877

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/073563 Ceased WO2014161133A1 (zh) 2013-04-01 2013-04-01 虚拟机的数据交换方法、装置和系统

Country Status (3)

Country Link
US (2) US10033637B2 (zh)
CN (1) CN103621026B (zh)
WO (1) WO2014161133A1 (zh)

Families Citing this family (48)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473136B (zh) * 2013-09-02 2017-06-13 华为技术有限公司 一种虚拟机的资源配置方法和通信设备
US9825913B2 (en) 2014-06-04 2017-11-21 Nicira, Inc. Use of stateless marking to speed up stateful firewall rule processing
US9692698B2 (en) 2014-06-30 2017-06-27 Nicira, Inc. Methods and systems to offload overlay network packet encapsulation to hardware
US9419897B2 (en) * 2014-06-30 2016-08-16 Nicira, Inc. Methods and systems for providing multi-tenancy support for Single Root I/O Virtualization
US9148408B1 (en) 2014-10-06 2015-09-29 Cryptzone North America, Inc. Systems and methods for protecting network devices
US9906497B2 (en) 2014-10-06 2018-02-27 Cryptzone North America, Inc. Multi-tunneling virtual network adapter
CN104486234B (zh) * 2014-11-21 2018-10-30 华为技术有限公司 一种将业务交换机卸载到物理网卡的方法及服务器
CN104601428B (zh) * 2014-12-23 2018-10-09 广州亦云信息技术有限公司 虚拟机之间的通信方法
CN104883302B (zh) * 2015-03-18 2018-11-09 华为技术有限公司 一种数据包转发的方法、装置及系统
CN106557444B (zh) * 2015-09-30 2022-01-25 中兴通讯股份有限公司 实现sr-iov网卡的方法和装置、实现动态迁移的方法和装置
US9866519B2 (en) 2015-10-16 2018-01-09 Cryptzone North America, Inc. Name resolving in segmented networks
KR102389028B1 (ko) * 2016-01-04 2022-04-22 한국전자통신연구원 가상 데스크탑 간의 데이터 고속 전송 장치 및 방법
US10412048B2 (en) 2016-02-08 2019-09-10 Cryptzone North America, Inc. Protecting network devices by a firewall
US11038845B2 (en) 2016-02-23 2021-06-15 Nicira, Inc. Firewall in a virtualized computing environment using physical network interface controller (PNIC) level firewall rules
WO2018000195A1 (zh) * 2016-06-28 2018-01-04 华为技术有限公司 一种报文传输方法、虚拟交换机及服务器
CN107992352A (zh) * 2016-10-26 2018-05-04 阿里巴巴集团控股有限公司 用于虚拟化场景的数据交互方法及设备
JP6513835B2 (ja) * 2016-11-09 2019-05-15 ホアウェイ・テクノロジーズ・カンパニー・リミテッド クラウドコンピューティングシステムにおけるパケット処理方法、ホスト、およびシステム
AU2016414390B2 (en) 2016-11-09 2019-06-20 Huawei Technologies Co., Ltd. Packet processing method in cloud computing system, host, and system
WO2018133035A1 (zh) * 2017-01-20 2018-07-26 华为技术有限公司 用于转发数据包的方法、网卡、主机设备和计算机系统
CN108390809B (zh) * 2017-02-03 2020-12-11 北京华耀科技有限公司 一种基于vf混杂模式的桥接方法及其系统
CN107832242A (zh) * 2017-10-31 2018-03-23 郑州云海信息技术有限公司 一种数据传输方法、系统、装置及计算机可读存储介质
CN108920252A (zh) * 2018-06-15 2018-11-30 西安微电子技术研究所 一种基于多队列千兆以太网控制器的io虚拟化装置
CN109522114A (zh) * 2018-09-30 2019-03-26 华东计算技术研究所(中国电子科技集团公司第三十二研究所) 虚拟化框架的雷达数据高速通信处理模块
CN111277516B (zh) * 2018-12-05 2021-04-16 大唐移动通信设备有限公司 用户面集中单元、数据处理装置及数据处理方法
CN109672618B (zh) * 2019-01-18 2021-07-06 新华三技术有限公司合肥分公司 冗余接口处理方法、装置、服务器及存储介质
CN110661884A (zh) * 2019-10-23 2020-01-07 西安雷风电子科技有限公司 一种云端桌面和本地桌面的切换系统及方法
CN110990110A (zh) * 2019-10-30 2020-04-10 烽火通信科技股份有限公司 一种基于Sriov网卡的虚拟机创建方法及装置
CN110798541B (zh) * 2019-10-31 2022-09-09 新华三大数据技术有限公司 接口共享、报文转发方法、装置、电子设备及存储介质
CN111327635B (zh) * 2020-03-09 2023-07-14 深信服科技股份有限公司 数据传输方法、服务器及可读存储设备
RU2020116377A (ru) * 2020-05-19 2021-11-19 ИЭмСи АйПи ХОЛДИНГ КОМПАНИ, ЛЛС Система и способ улучшений lacp
US11962518B2 (en) 2020-06-02 2024-04-16 VMware LLC Hardware acceleration techniques using flow selection
US11875172B2 (en) 2020-09-28 2024-01-16 VMware LLC Bare metal computer for booting copies of VM images on multiple computing devices using a smart NIC
US11636053B2 (en) 2020-09-28 2023-04-25 Vmware, Inc. Emulating a local storage by accessing an external storage through a shared port of a NIC
US11792134B2 (en) 2020-09-28 2023-10-17 Vmware, Inc. Configuring PNIC to perform flow processing offload using virtual port identifiers
US12021759B2 (en) 2020-09-28 2024-06-25 VMware LLC Packet processing with hardware offload units
US11824931B2 (en) 2020-09-28 2023-11-21 Vmware, Inc. Using physical and virtual functions associated with a NIC to access an external storage through network fabric driver
US11593278B2 (en) 2020-09-28 2023-02-28 Vmware, Inc. Using machine executing on a NIC to access a third party storage not supported by a NIC or host
US12229578B2 (en) 2021-12-22 2025-02-18 VMware LLC Teaming of smart NICs
US11863376B2 (en) 2021-12-22 2024-01-02 Vmware, Inc. Smart NIC leader election
US11995024B2 (en) 2021-12-22 2024-05-28 VMware LLC State sharing between smart NICs
US12373237B2 (en) 2022-05-27 2025-07-29 VMware LLC Logical memory addressing by smart NIC across multiple devices
US12481444B2 (en) 2022-06-21 2025-11-25 VMware LLC Smart NIC responding to requests from client device
US11928062B2 (en) 2022-06-21 2024-03-12 VMware LLC Accelerating data message classification with smart NICs
US11928367B2 (en) 2022-06-21 2024-03-12 VMware LLC Logical memory addressing for network devices
US11899594B2 (en) 2022-06-21 2024-02-13 VMware LLC Maintenance of data message classification cache on smart NIC
CN115811449B (zh) * 2022-11-08 2025-05-13 广州骏伯网络科技有限公司 一种云计算平台虚拟私有网络系统和网络控制方法
CN116319561A (zh) * 2023-02-28 2023-06-23 浙江大华技术股份有限公司 流量控制方法、电子设备以及存储介质
US20240388544A1 (en) * 2023-05-16 2024-11-21 Lawrence Li Apparatus and method for pooling network interface cards in a cloud network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459618A (zh) * 2009-01-06 2009-06-17 北京航空航天大学 虚拟机网络的数据包转发方法和装置
CN101465863A (zh) * 2009-01-14 2009-06-24 北京航空航天大学 一种内核虚拟机环境下高效网络i/o的实现方法
US20100306358A1 (en) * 2009-05-29 2010-12-02 Sun Microsystems, Inc. Handling of multiple mac unicast addresses with virtual machines
CN102984043A (zh) * 2012-11-02 2013-03-20 中兴通讯股份有限公司 组播数据流的转发方法及装置

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7227838B1 (en) * 2001-12-14 2007-06-05 Cisco Technology, Inc. Enhanced internal router redundancy
JP4622835B2 (ja) * 2005-12-07 2011-02-02 株式会社日立製作所 仮想計算機システム及びそのネットワーク通信方法
US7630368B2 (en) * 2006-06-30 2009-12-08 Sun Microsystems, Inc. Virtual network interface card loopback fastpath
JP4862743B2 (ja) * 2007-05-17 2012-01-25 日本電気株式会社 ノード、通信方法およびノード用プログラム
US7962647B2 (en) * 2008-11-24 2011-06-14 Vmware, Inc. Application delivery control module for virtual network switch
WO2011087085A1 (ja) * 2010-01-14 2011-07-21 日本電気株式会社 計算機、ネットワーク接続切替え方法およびプログラム
CN102147840B (zh) * 2010-02-05 2013-08-28 中国长城计算机深圳股份有限公司 一种通过虚拟机实现网络控制的方法
US8989187B2 (en) * 2010-06-04 2015-03-24 Coraid, Inc. Method and system of scaling a cloud computing network
US8990824B2 (en) * 2011-04-28 2015-03-24 Dell Products L.P. System and method for automated virtual network configuration
US20120287931A1 (en) * 2011-05-13 2012-11-15 International Business Machines Corporation Techniques for securing a virtualized computing environment using a physical network switch
US8635614B2 (en) * 2011-05-14 2014-01-21 International Business Machines Corporation Method for providing location independent dynamic port mirroring on distributed virtual switches
US20150049636A1 (en) * 2012-03-27 2015-02-19 Hideyuki Tai Control apparatus, physical node, terminal apparatus, communication system, port status display method, and program
US9059868B2 (en) * 2012-06-28 2015-06-16 Dell Products, Lp System and method for associating VLANs with virtual switch ports
US9178815B2 (en) * 2013-03-05 2015-11-03 Intel Corporation NIC flow switching
US9344349B2 (en) * 2013-07-12 2016-05-17 Nicira, Inc. Tracing network packets by a cluster of network controllers

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459618A (zh) * 2009-01-06 2009-06-17 北京航空航天大学 虚拟机网络的数据包转发方法和装置
CN101465863A (zh) * 2009-01-14 2009-06-24 北京航空航天大学 一种内核虚拟机环境下高效网络i/o的实现方法
US20100306358A1 (en) * 2009-05-29 2010-12-02 Sun Microsystems, Inc. Handling of multiple mac unicast addresses with virtual machines
CN102984043A (zh) * 2012-11-02 2013-03-20 中兴通讯股份有限公司 组播数据流的转发方法及装置

Also Published As

Publication number Publication date
US11121971B2 (en) 2021-09-14
US20150215207A1 (en) 2015-07-30
US10033637B2 (en) 2018-07-24
CN103621026A (zh) 2014-03-05
CN103621026B (zh) 2017-06-13
US20180302325A1 (en) 2018-10-18

Similar Documents

Publication Publication Date Title
WO2014161133A1 (zh) 虚拟机的数据交换方法、装置和系统
CN111221758B (zh) 处理远程直接内存访问请求的方法和计算机设备
CA3008896C (en) Multi-path transport design
US7996569B2 (en) Method and system for zero copy in a virtualized network environment
JP7034187B2 (ja) データ処理方法、ネットワークインタフェースカード、及びサーバ
JP4343760B2 (ja) ネットワークプロトコル処理装置
US8713180B2 (en) Zero-copy network and file offload for web and application servers
US7844746B2 (en) Accessing an effective address and determining whether the effective address is associated with remotely coupled I/O adapters
CN103404084B (zh) Mac地址强制转发装置及方法
CN102790777B (zh) 网络接口适配器注册方法及驱动设备、服务器
CN110636139B (zh) 一种云负载均衡的优化方法及系统
CN104636185B (zh) 业务上下文管理方法、物理主机、pcie设备及迁移管理设备
WO2015117303A1 (zh) 一种虚拟设备访问方法及装置
WO2015003295A1 (zh) 一种在虚拟域中通信的方法、设备和系统
EP2359242A1 (en) Copy circumvention in a virtual network environment
CN103678203A (zh) 一种实现网卡零拷贝方法及装置
US20120303701A1 (en) Transmitting internet protocol over scsi in a high availability cluster
CN103036759B (zh) 一种x86虚拟化条件下降低网络i/o操作cpu开销的系统
CN108063737A (zh) 一种FCoE存储区域网读请求处理方法及系统
Wu et al. The design and implementation of database audit system framework
CN1209709C (zh) 物理隔离交换机及其隔离控制方法
JP4485875B2 (ja) ストレージ接続変更方法、ストレージ管理システム及びプログラム
CN114866537B (zh) 一种跨主机跨网络的文件传输方法及系统
CN104283945B (zh) 存储系统、存储区域系统设备及数据传输方法
Fang et al. NetDAM: Network Direct Attached Memory with Programmable In-Memory Computing ISA

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: 13881412

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13881412

Country of ref document: EP

Kind code of ref document: A1