WO2015043147A1 - 一种虚拟机内存数据的迁移方法及相关装置和集群系统 - Google Patents

一种虚拟机内存数据的迁移方法及相关装置和集群系统 Download PDF

Info

Publication number
WO2015043147A1
WO2015043147A1 PCT/CN2014/074391 CN2014074391W WO2015043147A1 WO 2015043147 A1 WO2015043147 A1 WO 2015043147A1 CN 2014074391 W CN2014074391 W CN 2014074391W WO 2015043147 A1 WO2015043147 A1 WO 2015043147A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
memory
data
physical
pfn
Prior art date
Application number
PCT/CN2014/074391
Other languages
English (en)
French (fr)
Inventor
杨杰
章晓峰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP14790474.2A priority Critical patent/EP2879053B1/en
Priority to US14/534,446 priority patent/US9854036B2/en
Publication of WO2015043147A1 publication Critical patent/WO2015043147A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Definitions

  • the present invention relates to the field of communications, and in particular, to a method for migrating virtual machine memory data, a related device, and a cluster system. Background technique
  • the migration of the virtual machine is the main part of the real-time migration of the virtual machine.
  • the virtual machine can migrate the virtual machine from the source physical host to the destination physical host while maintaining the virtual machine running, and resume operation on the destination physical host to realize service integration.
  • Real-time migration of virtual machines enables online maintenance, online upgrades, load balancing of servers, and provides a solution for disaster recovery.
  • the virtual machine migration adopts a method of iteratively sending virtual machine memory, and selects the dirty pages of the iteration in batches and maps the pages to the user state of the privileged virtual machine in each iteration. The linear address space of the process.
  • the super call is called to update the page table to establish the connection between the linear address space and the physical address.
  • the remote direct memory is read by the user mode (Remote Direct Memory). Access, referred to as RDMA)
  • the interface registers the physical address corresponding to the mapped virtual machine memory to the RDMA network card, and performs subsequent data transmission according to the RDMA communication protocol through other RDMA system calls. After the data is successfully sent, the virtual machine's memory is demapped from the user state process space, and the registered physical memory is unregistered.
  • Embodiments of the present invention provide a method for migrating virtual machine memory data, a related device, and a cluster system, so as to reduce processor utilization and time overhead in a physical host where a virtual machine is located.
  • a method for migrating memory data of a virtual machine comprising: acquiring a data sending request for sending memory data of a first virtual machine, where the data sending request includes An identifier of the first virtual machine, and a physical page number (PFN) of the memory data requested to be sent; querying the correspondence information database according to the identifier of the first virtual machine, to obtain the first virtual Corresponding relationship between the virtual machine and the virtual machine; the corresponding relationship of the virtual machine is an address space of the virtual machine memory based on the identifier of the virtual machine, and the corresponding relationship
  • the PFN of the virtual machine memory and the virtual machine memory are established after the PFN of the virtual machine memory corresponding to the address space and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory Corresponding relationship of the physical memory page address; querying the first virtual machine according to the PFN of the memory data sent by the request Correspondence, to obtain the physical memory address of the requested
  • the method before the acquiring a data sending request for sending the first virtual machine memory data, the method further includes: acquiring the migration triggered by the privileged virtual machine user state process a migration request of the memory data of the first virtual machine, where the migration request includes an identifier of the first virtual machine; and acquiring the first virtual machine according to the identifier of the first virtual machine in the migration request An address space of the memory; the PFN of the virtual machine memory is obtained in the address space; and a physical memory page address of the first virtual machine memory is calculated according to the PFN of the first virtual machine memory; Establishing a correspondence between a PFN of the first virtual machine memory and a physical memory page address of the first virtual machine memory.
  • the method further includes: registering a physical memory page address of the first virtual machine memory to the RDMA network card.
  • the P FN of the memory data sent by the request is used to query the correspondence relationship of the first virtual machine, to obtain the request sending.
  • the acquiring a data sending request for sending the first virtual machine memory data includes: sequentially extracting a data sending request in a data sending request queue, where the data sending request includes different data sending requests of the virtual machine to be migrated, and the data sending request in the data sending request queue is chronologically or Sort the priority level.
  • a host device including: an obtaining unit, configured to acquire a data sending request for sending first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a request The PFN of the memory data sent;
  • a first query unit configured to query a correspondence relationship information base according to the identifier of the first virtual machine, to obtain a correspondence relationship between the first virtual machine, where the correspondence relationship information database includes a correspondence relationship of the virtual machine to be migrated
  • Corresponding relationship of the virtual machine is an address space for acquiring the memory of the virtual machine based on the identifier of the virtual machine, and the corresponding address space
  • a second query unit configured to query, according to a PFN of the memory data sent by the request, a correspondence between the first virtual machine obtained by the first query unit, and obtain a physical memory page of the memory data that is requested to be sent
  • An address sending unit a physical host for obtaining the second query unit by using an RDMA network card.
  • the host further includes an establishing unit, configured to acquire a privileged virtual machine user state before the acquiring unit acquires a data sending request for sending the first virtual machine memory data.
  • a process of migrating the migration request of the memory of the first virtual machine, where the migration request includes the identifier of the first virtual machine; and obtaining, according to the identifier of the first virtual machine in the migration request The address space of the first virtual machine memory; the PFN of the virtual machine memory is obtained in the address space; the physical memory page address of the first virtual machine memory is calculated according to the PFN of the first virtual machine memory; Correspondence between the PFN of the first virtual machine memory and the physical memory page address of the first virtual machine memory.
  • the host further includes: a first registration unit, configured to calculate, according to the PFN of the first virtual machine memory, in the establishing unit After the physical memory page address of the first virtual machine memory is acquired, the acquiring unit acquires a physical memory page address of the first virtual machine memory acquired by the establishing unit, before acquiring the data sending request for sending the first virtual machine memory data Said RDMA network card.
  • a first registration unit configured to calculate, according to the PFN of the first virtual machine memory, in the establishing unit After the physical memory page address of the first virtual machine memory is acquired, the acquiring unit acquires a physical memory page address of the first virtual machine memory acquired by the establishing unit, before acquiring the data sending request for sending the first virtual machine memory data Said RDMA network card.
  • the Host further includes: a second registration unit, configured to query, according to a PFN of the memory data sent by the second query unit according to the request, a correspondence relationship of the first virtual machine, to obtain the memory data of the request to be sent. After the physical memory page address is sent, the memory data of the drive sending unit is sent to the destination physical host, and the physical memory page address of the memory data requested by the second query unit is registered to the RDMA network card.
  • the acquiring unit is specifically configured to: sequentially extract a data sending request The data transmission request in the queue, wherein the data transmission request includes different data transmission requests of the virtual machine to be migrated, and the data transmission request in the data transmission request queue is sorted according to time sequence or priority level.
  • a physical host comprising: a hardware layer, a Host running on the hardware layer, and at least one virtual machine VM running on the Host, and the hardware layer includes a remote direct memory read Taking an RDMA network card; the at least one virtual machine includes a first virtual machine, where
  • the Host is configured to: obtain a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a physical page frame number PFN of the memory data requested to be sent;
  • the identifier of the first virtual machine is queried to the correspondence information database, and the corresponding relationship of the first virtual machine is obtained, where the correspondence relationship information database includes the correspondence between the virtual machines to be migrated, and the corresponding relationship of the virtual machines Acquiring an address space of the virtual machine memory based on the identifier of the virtual machine, and a PFN of the virtual machine memory corresponding to the address space, and a physics of the virtual machine memory corresponding to a PFN of the virtual machine memory
  • the correspondence between the PFN of the virtual machine memory and the physical memory page address of the virtual machine is established; Querying, according to the correspondence between the first virtual machine, the PFN of the memory data sent by the request, obtaining a physical memory page address of the memory data that is requested to be sent; and reading the
  • the Host is further configured to: obtain a migration triggered by a privileged virtual machine user state process before acquiring a data sending request for sending the first virtual machine memory data a migration request of the memory data of the virtual machine, where the migration request includes the identifier of the first virtual machine; and acquiring the first virtual machine memory according to the identifier of the first virtual machine in the migration request
  • the address space of the virtual machine memory is obtained in the address space; the physical memory page address of the first virtual machine memory is calculated according to the PFN of the first virtual machine memory; and the first virtual machine memory is established. Correspondence between the PFN and the physical memory page address of the first virtual machine memory.
  • the Host is further configured to: after calculating a physical memory page address of the first virtual machine memory according to a PFN of the first virtual machine memory And registering a physical memory page address of the first virtual machine memory to the RDMA network card before acquiring a data transmission request for transmitting the first virtual machine memory data.
  • the Host in combination with the third aspect or the first possible implementation manner, is further configured to: after calculating a physical memory page address of the first virtual machine memory according to a PFN of the first virtual machine memory And registering a physical memory page address of the first virtual machine memory to the RDMA network card before acquiring a data transmission request for transmitting the first virtual machine memory data.
  • the Host is further configured to: query a correspondence between the first virtual machine according to a PFN of the memory data sent according to the request, and obtain a physical memory page address of the memory data that is requested to be sent, and then use the RDMA network card to Before the memory data stored on the physical memory page address of the requested memory data is sent to the destination physical host, Registering a physical memory page address of the memory data requested to be sent to the RDMA network card.
  • the fourth aspect provides a cluster system, including: the physical host of any one of the foregoing, wherein the multiple physical hosts include a source physical host and a destination physical host, where each physical host includes a hardware layer and runs on a Host above the hardware layer, and at least one virtual machine VM running on the Host, and the hardware layer includes an RDMA network card.
  • the physical host of the embodiment of the present invention may include: a hardware layer, a Host running on the hardware layer, and at least one virtual machine VM running on the Host, the hardware layer includes an RDMA network card, The at least one virtual machine includes a first virtual machine, where the host is configured to acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and the memory data requested to be sent.
  • the host queries the correspondence information base according to the identifier of the first virtual machine, and obtains the correspondence relationship of the first virtual machine, where the correspondence relationship information database includes the correspondence relationship of the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on
  • the identifier of the virtual machine obtains the address space of the virtual machine memory, and the PFN of the virtual machine memory corresponding to the address space, and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory, and the established The correspondence between the PFN of the virtual machine memory and the physical memory page address; therefore, the host can send the memory according to the request.
  • the correspondence between query PFN first virtual machine access to the physical memory page address request data memory; and passed to the data transmission destination physical host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call.
  • the corresponding relationship of the virtual to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the utilization of the memory and the time overhead of the request are solved to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and passed through the super call. Updating the page table causes the processor utilization and time overhead in the physical machine where the virtual machine is located to be large.
  • FIG. 1 is a schematic flowchart of a virtual machine memory data migration method according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of an application scenario according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of another method for migrating memory data of a virtual machine according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of data provided by an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a method for migrating memory data of a virtual machine according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a host according to an embodiment of the present invention
  • FIG. 8 is a schematic structural diagram of another host machine according to an embodiment of the present invention
  • FIG. 9 is a schematic structural diagram of a device of a physical host according to an embodiment of the present invention
  • FIG. 10 is a schematic structural diagram of another apparatus of a physical host according to an embodiment of the present invention
  • FIG. 1 is a schematic diagram of a cluster system according to an embodiment of the present invention.
  • virtual machine VM virtual machine software can simulate one or more virtual computers on a physical host, and these virtual machines work like real computers, and can be installed on virtual machines. Operating systems and applications, virtual machines also have access to network resources. For an application running in a virtual machine, the virtual machine is like working on a real computer.
  • Hardware layer The hardware platform on which the virtualized environment runs. The hardware layer may include various hardware.
  • the hardware layer of a physical host may include a processor (such as a CPU) and a memory, and may also include a network card (such as an RDMA network card), a memory, and the like, and a high speed/low speed input/output (I/). O , Input/Output ) devices, and other devices with specific processing capabilities.
  • Host As a management layer, it manages and allocates hardware resources; presents a virtual hardware platform for virtual machines; implements scheduling and isolation of virtual machines. Among them, Host may be a virtual machine monitor (VMM); in addition, sometimes VMM and 1 privileged virtual machine cooperate, two hardware resources, such as providing virtual processors (such as VCPU), virtual memory, virtual disks, virtual network cards, and so on.
  • VMM virtual machine monitor
  • the virtual disk can correspond to a file of Host or a logical block device.
  • the virtual machine runs on the virtual hardware platform that Host prepares for it, and one or more virtual machines run on the Host.
  • Privileged virtual machine A special virtual machine, also known as a driver domain.
  • this special virtual machine is called DomO on the Xen Hypervisor platform, and real physics such as network card and SCSI disk is installed in the virtual machine.
  • the device's driver can detect and directly access these real physical devices.
  • Other virtual machines access the real physical devices through privileged virtual machines using the appropriate mechanisms provided by the hypervisor.
  • the embodiment of the present invention can be applied to the xen virtual machine platform, and can also be applied to a virtualization platform that can be used to map virtual machine memory when any one of the virtual machines is migrated. No restrictions are imposed.
  • a method for migrating memory data of a virtual machine may include the following steps: And obtaining a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a PFN of the memory data that is requested to be sent.
  • the method provided in the embodiment of the present invention It can be performed by the physical host where the first virtual machine is located, for example, by a Host on the physical host, and Host is a combination of the VMM and a privileged virtual machine running on the VMM.
  • the data send request is sent by the user state process on the privileged virtual machine to the privileged virtual machine.
  • the identifier of the virtual machine can be any parameter that can uniquely represent the virtual machine, for example, can be the domain name of the virtual machine.
  • the correspondence relationship information base includes a correspondence relationship of the virtual machines to be migrated
  • the virtual machine Corresponding relationship is an address space of the virtual machine memory based on the identifier of the virtual machine, and a PFN of the virtual machine memory corresponding to the address space, and the virtual machine corresponding to the PFN of the virtual machine memory
  • the correspondence between the PFN of the virtual machine memory and the physical memory page address of the virtual machine is established;
  • 103 Query a correspondence between the first virtual machine according to a PFN of the memory data sent by the request, and obtain a physical memory page address of the memory data that is requested to be sent;
  • the method further includes: acquiring, by the privileged virtual machine user state process, a migration request for migrating the memory data of the first virtual machine,
  • the migration request includes the identifier of the first virtual machine; the address space of the first virtual machine memory is obtained according to the identifier of the first virtual machine in the migration request; a PFN of the virtual machine memory; calculating a physical memory page address of the first virtual machine memory according to the PFN of the first virtual machine memory; establishing a PFN of the first virtual machine memory and the first virtual machine memory within the physics The correspondence between the page addresses.
  • the method further includes the process of registering the physical page memory address of the first virtual machine memory data to the RDMA network card, which may be implemented by any one of the following two methods:
  • the first A physical memory page address of a virtual machine memory is registered to the RDMA network card.
  • the physical memory page address of the entire memory of the first virtual machine is once registered to the RDMA network card. For example, if the physical memory page address corresponding to the entire memory of the first virtual machine is 0x00010000 ⁇ 0x0001ffff, then 0x00010000 ⁇ 0x0001ffff-time All are registered to the RDMA network card.
  • the physical memory page address of the memory data requested to be sent is registered to the RDMA network card. In this manner, according to each data transmission request, the physical memory page address of the memory data sent by each data transmission request request is separately registered to the RDMA network card, for example, the first virtual machine corresponds to all the memory.
  • the physical memory page address is 0x00010000-0x000 lffff
  • the physical memory page address of the memory data sent by the first data transmission request request is 0x00010000 ⁇ 0x000100ff
  • the physical memory page is passed through the RDMA network card.
  • the physical memory page address 0x00010000 ⁇ 0x0001ffff is registered to the RDMA network card before the memory data stored in the address 0x00010000 ⁇ 0x000100ff is sent to the destination physical host; for example, the physical memory page address of the memory data sent by the second data transmission request request is 0x00010100 -0x000 lOl ff, after obtaining the second data transmission request, register the physical memory page address 0x00010100 ⁇ 0x000101ff to RDMA before sending the memory data stored on the physical memory page address 0x00010100-OxOOOlOlff to the destination physical host through the RDMA network card.
  • Network card Network card.
  • the method for migrating the memory data of the virtual machine in the embodiment of the present invention obtains and sends the first virtual a data transmission request of the virtual machine memory data, wherein the data transmission request includes an identifier of the first virtual machine, and a PFN of the memory data that is requested to be sent; and the corresponding relationship information database is queried according to the identifier of the first virtual machine, and the first virtual machine is obtained.
  • the correspondence relationship information base includes a correspondence relationship of the virtual machine to be migrated, and the corresponding relationship of the virtual machine is an address space for acquiring the memory of the virtual machine based on the identifier of the virtual machine, and the virtual space corresponding to the address space
  • the PFN of the machine memory and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory the correspondence between the PFN of the virtual machine memory and the physical memory page address is established; therefore, the memory that can be sent according to the request
  • the PFN of the data queries the correspondence of the first virtual machine, and obtains the physical memory page address of the memory data requested to be sent; and then the host is requested through the RDMA network card.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call, and the PFN of the data to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical time overhead corresponding to the requested memory data solves the problem in the prior art.
  • the memory of the virtual machine needs to be mapped to the user state space and updated by the super call.
  • the page table causes the processor utilization and time overhead in the physical machine where the virtual machine is located.
  • the method for migrating the virtual machine memory data in the embodiment of the present invention may be applied to a cluster system, where the cluster system includes multiple physical hosts, and the plurality of physical hosts include a source physical host and a destination physical host, where each physical host includes a hardware layer. a host running on the hardware layer, and at least one virtual machine VM running on the host, and the hardware layer includes an RDMA network card, a processor and a memory, see FIG. 2, which is set in an embodiment of the present invention.
  • the application scenario of the cluster system is specifically described in the following specific embodiments, including two physical hosts 100 and 200, and a dedicated optical cable 300.
  • the hardware layers of the two physical hosts 100 and 200 respectively include RDMA network cards 13, 23, processors 12, 22, and memories 1 1 and 21, wherein the memory 1 1 and the memory 21 can be shared memory, and the RDMA network cards 13 and 23 can be A wireless broadband (InfiniBand) card or an Ethernet (RDMA over Converged Ethernet, RoCE) card, etc., on the hardware layers of the physical hosts 100 and 101, respectively, Hostl7, 27, wherein Hostl7 is composed of VMM 14 and a privileged virtual machine 15 running on VMM 14, which is composed of a combination of privileged virtual machines 25 running on VMM 24 and VMM 24, and at least one virtual machine 16, 26 running on VMMs 14, 24, respectively.
  • the virtual machine is a virtual machine other than the privileged virtual machine.
  • the NIC drivers corresponding to the RDMA network cards 13, 23 are loaded on the privileged virtual machines 15, 25.
  • the dedicated optical cable 300 is used to connect the RDMA network cards on the two physical hosts.
  • the dedicated optical cable 300 can be a Quad Small Form-factor Pluggable (QSPF) or other types of optical cables. No restrictions are imposed.
  • the shared storage may be a storage area network (SAN), or may be an Internet Small Computer System Interface (iSCSI) or a network attached storage (NAS). This example does not limit this.
  • the specific scenario is to migrate the virtual machine 16 on the physical host 100 (source physical host) to the physical host 200 (the destination physical host).
  • the embodiment of the present invention only describes the virtual machine migration part in the live migration of the virtual machine in detail.
  • Embodiment 2 Referring to FIG. 3, another method for migrating memory data of a virtual machine according to an embodiment of the present invention may be performed by the physical host 100. For example, it may be executed by Hostl7 running by the physical host 100, as shown in FIG. As shown, the following steps can be included:
  • S301 Obtain a migration command of the virtual machine sent by the privileged virtual machine 15 user state process, where the migration command of the virtual machine includes the identifier of the virtual machine; exemplarily, the virtual machine may be one or more, and the implementation of the present invention This example does not limit this, but the virtual machine is the same as the source physical host.
  • the privileged virtual machine 15 in Hostl 7 loads the NIC driver corresponding to the RDMA network card 13, and encapsulates all RDMA communication interfaces.
  • Each RDMA communication interface is divided into one virtual machine, for example, three virtual machines. , respectively, virtual machine 1, virtual machine 2 and virtual machine 3, virtual machine 1 corresponds to RDMA communication interface 1, virtual machine 2 corresponds to RDMA communication interface 2, virtual machine 3 corresponds to RDMA communication interface 3, RDMA communication interface 1, RDMA communication interface
  • Both the 2 and RDMA communication interfaces 3 are packaged in a NIC driver of a privileged virtual machine. among them, The RDMA communication interface is used to create protection domains, queue peers, and so on.
  • one user state process corresponds to one virtual machine.
  • virtual machine 1 corresponds to RDMA communication interface 1 and user state process 1, virtual machine.
  • virtual machine 2 corresponding to RDMA communication interface 2 and user state process 2
  • virtual machine 3 corresponding to RDMA communication interface 3 and user state process 3
  • RDMA communication interface 1 RDMA communication interface 2 and RDMA communication interface 3
  • RDMA communication interface 1 RDMA communication interface 2 and RDMA communication interface 3
  • the RDMA communication interface 1, the RDMA communication interface 2, and the RDMA communication interface 3 in the virtual machine 15 receive the virtual machine 1, the virtual machine 2, and the virtual machine 3 respectively sent by the user state process 1, the user state process 2, and the user state process 3, respectively.
  • Migration command exemplary, the identifier of the virtual machine may be a domain name (IDentity, abbreviated as ID) of the virtual machine, or may be another identifier that can uniquely represent the virtual machine.
  • the virtual machine is established according to the identifier of the virtual machine, where the correspondence is the correspondence between the PFN of the virtual machine memory and the physical memory page address.
  • the VMM 14 in the Hostl7 can obtain the address space of the virtual machine memory according to the identifier of the virtual machine in the migration request; and then obtain the PFN of the virtual machine memory according to the address space; Calculating a physical memory page address of the virtual machine memory according to a PFN of the virtual machine memory; establishing a correspondence between a PFN of the virtual machine memory and a physical memory page address of the virtual machine memory.
  • the VMM 14 in the host 1 can query the address space corresponding to the virtual machine 1 according to the domain ID of the virtual machine 1, and further Obtaining the PFN corresponding to the virtual machine 1, and assuming that the PFN range of the virtual machine 1 is 0 to 65535, the VMM 14 calculates the physical memory page address corresponding to the virtual machine 1 according to the PFN of the virtual machine 1, assuming that 0x00010000 ⁇ 0x0001fff, the Host 17 can be based on This establishes a correspondence between the two, and the virtual machine 2 and the virtual machine 3 are similar to the virtual machine 1.
  • the corresponding relationship of the virtual machine may be in the form of a corresponding relationship table between the PFN of the virtual machine memory and the physical memory page address, or may be another PFN that may include the virtual machine memory. Any form of the correspondence with the physical memory page address is not limited by the embodiment of the present invention.
  • S303 Register a physical memory page address corresponding to the PFN of the virtual machine memory to the RDMA network card.
  • the physical memory page address of the virtual machine memory acquired in the process of establishing the virtual machine in S302 may be registered, and the physical page address of the virtual machine may be registered to the RDMA network card, or the corresponding relationship may be queried according to the identifier of the virtual machine.
  • the library obtains the corresponding relationship of the virtual machine, and then searches for the physical memory page address corresponding to the PFN of the virtual machine memory according to the corresponding relationship, and then registers the physical page address of all the virtual machine memory to the RDMA network card.
  • the correspondence relationship library may include a correspondence relationship of each virtual machine to be migrated. For example, the identifier of the virtual machine 1 queries the corresponding relational library, and the corresponding relationship of the virtual machine 1 is obtained.
  • the physical memory page address of the virtual machine 1 memory is obtained. Register the physical memory page address of virtual machine 1 memory to the RDMA NIC. Exemplarily, if more virtual machines are to be migrated, the physical memory page addresses of all virtual machine memory can be separately registered to the RDMA network card 13.
  • S304 Obtain a data sending request triggered by a user state process corresponding to the virtual machine, where the data sending request includes an identifier of the virtual machine corresponding to the user state process, and a PFN of the memory data requested to be sent; for example, if there are three user state processes And requesting to send partial memory data of the virtual machine 1, the virtual machine 2, and the virtual machine 3, respectively, receiving the data sending request 1 sent by the user state process 1 corresponding to the virtual machine 1, and the data sent by the user state process 2 corresponding to the virtual machine 2.
  • the request 2 is transmitted, and the data transmission request 3 sent by the user state process 3 corresponding to the virtual machine 3 is transmitted.
  • the data transmission request 1 includes the identifier of the virtual machine 1 and the PFN of the memory data of the virtual machine 1 requested by the user state process 1 to be sent
  • the data transmission request 2 includes the identifier of the virtual machine 2
  • the virtual machine 2 that the user state process 2 requests to send.
  • the PFN and data transmission request 3 of the memory data include the identifier of the virtual machine 3 and the PFN of the memory data of the virtual machine 3 requested by the user state process 3. For example, if the number of virtual machines to be migrated includes more, the data sending request sent by the user state process corresponding to each virtual machine is obtained, and each user state process manages the migration of the corresponding virtual machine memory data.
  • the data sending request is respectively placed in the data sending request queue; optionally, the data sending request may be respectively placed in the data sending request queue according to the time of obtaining the data sending request, for example, as shown in FIG. 4
  • FIG. 4 A schematic diagram of a data sending request queue provided by an embodiment of the present invention. As shown in the figure, if data sending request 1, data sending request 2, and data sending request 3 are sequentially acquired, first, user state process 1 is sent. The data transmission request 1 is placed in the data transmission request queue, and then the data transmission request 2 sent by the user state process 2 is placed in the data transmission request queue following the data transmission request 1, and then, the user state process 3 is sent. The data transmission request 3 is placed in the data transmission request queue following the data transmission request 2.
  • the data sending request may be separately placed into the data sending request queue according to the priority of the obtained data sending request. For example, if three data sending requests are obtained, the priority is from high to low, and the data sending request is 1 , the data transmission request 2, the data transmission request 3, then, first, the data transmission request 1 sent by the user state process 1 is placed in the data transmission request queue, and then the data transmission request 2 sent by the user state process 2 is put into the data. The data transmission request queue following the request 1 is transmitted, and then the data transmission request 3 transmitted by the user state process 3 is placed in the data transmission request queue following the data transmission request 2. Certainly, if the number of the virtual machines includes more, the data sending request sent by the user state processes corresponding to each virtual machine may be sequentially placed in the data sending request queue in the above manner.
  • S306 Extract the data transmission request in the data transmission request queue in order; for example, as shown in FIG. 4, first, the data transmission request 1 is extracted from the data transmission request queue, and then the data transmission request 2 is extracted, and finally the transmission request 3 is extracted.
  • S307 Query a correspondence library according to the virtual machine identifier in the extracted data sending request, and obtain a correspondence relationship of the virtual machine.
  • S308 Query the corresponding relationship of the virtual machine according to the PFN in the data sending request, and find a physical memory page address of the memory data sent by the data sending request request;
  • S310 Asynchronously notify each user state process; For example, after the memory data of the data transmission request 1 is transmitted through the RDMA network card, the user state process 1 corresponding to the data transmission request 1 is asynchronously notified; after the memory data of the data transmission request 2 is transmitted through the RDMA network card, the corresponding data transmission request 2 is notified.
  • User state process 2 After the memory data of the data transmission request 3 is sent through the RDMA network card, the user state process 3 corresponding to the data transmission request 3 is asynchronously notified.
  • Step S305-S31 is performed in sequence
  • the PFN of each virtual machine memory is established by acquiring the migration command of the virtual machine sent by the privileged virtual machine user state process, and according to the identifier of the virtual machine included in the migration command of each virtual machine. Corresponding relationship with the physical memory page address; according to the correspondence relationship of each virtual machine, the physical memory page address corresponding to the PFN of each virtual machine memory can be obtained, and the physical memory page address of each virtual machine is registered to the RDMA network card ; then sent to the destination physical host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call, and the PFN of the data to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical memory page address corresponding to the memory data requested to be sent thereby greatly reducing the processor utilization and time overhead in the physical machine where the virtual machine is located, and solving the virtual machine in the prior art due to the virtualization platform to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and the page table is updated by the hypercall. This causes the processor utilization and time overhead of the physical machine where the virtual machine is located to be large.
  • the physical memory page of each virtual machine is sent before the RDMA network card sends data.
  • the address is once registered to the RDMA network card, and the RDMA network card can ensure that the data is successfully transmitted according to the data transmission request sent by the user state process; further, the data of the user state process corresponding to each virtual machine respectively obtained may be sent.
  • different priorities can be set for data migration of different user-mode processes, and QoS optimization is performed for different services to improve the performance of virtual machine migration.
  • Embodiment 3 Referring to FIG. 5, another method for migrating a virtual machine according to an embodiment of the present invention may be performed by the physical host 100.
  • it may be executed by Hostl7 running by the physical host 100, as shown in FIG. , can include the following steps:
  • S501 Obtain a migration command of the virtual machine sent by the privileged virtual machine user state process, where the migration command of the virtual machine includes the identifier of the virtual machine.
  • the virtual machine may be one or more, and the embodiment of the present invention There is no restriction on this, but the source physical host of the virtual machine is the same.
  • the privileged virtual machine 15 in Hostl 7 loads the NIC driver corresponding to the RDMA network card 13, and encapsulates all RDMA communication interfaces. Each RDMA communication interface is divided into one virtual machine, for example, three virtual machines.
  • virtual machine 1, virtual machine 2 and virtual machine 3 corresponds to RDMA communication interface 1
  • virtual machine 2 corresponds to RDMA communication interface 2
  • virtual machine 3 corresponds to RDMA communication interface 3
  • RDMA communication interface 1 RDMA communication interface
  • Both the 2 and RDMA communication interfaces 3 are packaged in a NIC driver of a privileged virtual machine.
  • the RDMA communication interface is used to create a protection domain, a queue peer, and the like.
  • one user state process corresponds to one virtual machine. For example, there are three virtual machines, namely, virtual machine 1, virtual machine 2, and virtual machine 3, and virtual machine 1 corresponds to RDMA communication interface 1 and user state process 1, virtual machine.
  • RDMA communication interface 1 RDMA communication interface 2 and RDMA communication interface 3 are encapsulated in privileged virtual machine 15, privilege
  • the RDMA communication interface 1, the RDMA communication interface 2, and the RDMA communication interface 3 in the virtual machine 15 respectively receive the virtual machine 1 sent by the user state process 1, the user state process 2, and the user state process 3, respectively.
  • the identifier of the virtual machine may be a domain name (IDentity, abbreviated as ID) of the virtual machine, or may be another identifier that can uniquely represent the virtual machine.
  • the virtual machine corresponding relationship is established according to the identifier of the virtual machine, and the correspondence between the virtual machine includes a correspondence between the PFN of the virtual machine memory and the physical memory page address.
  • the VMM 14 in the Host 7 can obtain the address space of the virtual machine memory according to the identifier of the virtual machine in the migration request; and then obtain the PFN of the virtual machine memory according to the address space; And calculating a physical memory page address of the virtual machine memory according to the PFN of the virtual machine memory; establishing a correspondence between the PFN of the virtual machine memory and a physical memory page address of the virtual machine memory.
  • the VMM 14 in the host 1 can query the address space corresponding to the virtual machine 1 according to the domain ID of the virtual machine 1, and further Obtaining the PFN corresponding to the virtual machine 1, and assuming that the PFN range of the virtual machine 1 is 0 to 65535, the VMM 14 calculates the physical memory page address corresponding to the virtual machine 1 according to the PFN of the virtual machine 1, assuming that 0x00010000 ⁇ 0x0001fff, the Host 17 can be based on This establishes a correspondence between the two, and the virtual machine 2 and the virtual machine 3 are similar to the virtual machine 1.
  • the mapping relationship between the PFN of the virtual machine memory and the physical memory page address may be in the form of a corresponding relationship table, or may be any other relationship between the PFN and the physical memory page address that may include the virtual machine memory.
  • the embodiment of the present invention does not limit this.
  • S503 Obtain a data sending request triggered by a user state process corresponding to the virtual machine, where the data sending request includes an identifier of the virtual machine corresponding to the user state process, and a PFN of the memory data requested to be sent; for example, if there are three user state processes And requesting to send partial memory data of the virtual machine 1, the virtual machine 2, and the virtual machine 3, respectively, obtaining the data sending request 1 triggered by the user state process 1 corresponding to the virtual machine 1, and the data triggered by the user state process 2 corresponding to the virtual machine 2 Send request 2, And a data transmission request 3 triggered by the user state process 3 corresponding to the virtual machine 3.
  • the data transmission request 1 includes the identifier of the virtual machine 1 and the PFN of the memory data of the virtual machine 1 requested by the user state process 1 to be sent
  • the data transmission request 2 includes the identifier of the virtual machine 2
  • the virtual machine 2 that the user state process 2 requests to send.
  • the PFN and data transmission request 3 of the memory data include the identifier of the virtual machine 3 and the PFN of the memory data of the virtual machine 3 requested by the user state process 3. For example, if the number of virtual machines to be migrated includes more, the data sending request triggered by the user state process corresponding to each virtual machine is obtained, and each user state process manages the migration of the corresponding virtual machine memory data.
  • the data sending request is separately placed in the data sending request queue.
  • the data sending request may be separately placed into the data sending request queue according to the time sequence of obtaining the data sending request, for example, as shown in FIG. 4
  • FIG. 4 A schematic diagram of a data sending request queue provided by an embodiment of the present invention. As shown in the figure, if data sending request 1, data sending request 2, and data sending request 3 are sequentially acquired, first, user state process 1 is sent. The data transmission request 1 is placed in the data transmission request queue, and then the data transmission request 2 sent by the user state process 2 is placed in the data transmission request queue following the data transmission request 1, and then, the user state process 3 is sent. The data transmission request 3 is placed in the data transmission request queue following the data transmission request 2.
  • the data sending request may be separately placed into the data sending request queue according to the priority of the obtained data sending request. For example, if three data sending requests are obtained, the priority is from high to low, and the data sending request is 1 , the data transmission request 2, the data transmission request 3, then, first, the data transmission request 1 sent by the user state process 1 is placed in the data transmission request queue, and then the data transmission request 2 sent by the user state process 2 is put into the data. The data transmission request queue following the request 1 is transmitted, and then the data transmission request 3 transmitted by the user state process 3 is placed in the data transmission request queue following the data transmission request 2.
  • the number of virtual machines includes more, the data sending request sent by the user state processes corresponding to each virtual machine may be sequentially placed in the data sending request queue in the above manner.
  • S505 Extract the data transmission request in the data transmission request queue in order; for example, as shown in FIG. 4, first, the data transmission request 1 is extracted from the data transmission request queue, the data transmission request 2 is extracted, and the transmission request 3 is finally extracted.
  • S506 Query a correspondence relationship library according to the virtual machine identifier in the extracted data sending request, and obtain a correspondence relationship of the virtual machine.
  • S507 Query the correspondence relationship of the virtual machine according to the PFN in the data sending request, and search for a physical memory page address of the memory data sent by the data sending request request;
  • S508 Register the physical memory page address corresponding to the extracted data transmission request to the RDMA network card; wherein, the physical memory page addresses corresponding to the respective data transmission requests are respectively registered to the RDMA network card in the order of the extracted data transmission request.
  • the privileged virtual machine 15 extracts the data transmission request 1 in the data transmission request queue and registers the physical memory page address corresponding to the data transmission request 1 to the RDMA network card; and extracts the data transmission request 2 in the data transmission request queue and transmits the data.
  • the physical memory page address corresponding to the request 2 is registered to the RDMA network card; the data transmission request 3 in the data transmission request queue is extracted in order, and the physical memory page address corresponding to the data transmission request 3 is registered to the RDMA network card.
  • S510 asynchronously notify each user state process; for example, after sending the memory data of the data transmission request 1 through the RDMA network card, asynchronously notifying the user state process 1 corresponding to the data transmission request 1; and sending the memory of the data transmission request 2 through the RDMA network card After the data, the user state process 2 corresponding to the data transmission request 2 is notified; after the memory data of the data transmission request 3 is transmitted through the RDMA network card, the user state process 3 corresponding to the data transmission request 3 is asynchronously notified.
  • step 513 The memory data of the virtual machine 16 is all sent to the destination physical machine 200, if not, step 513 is performed, and if yes, step 514 is performed;
  • Hostl7 deletes the corresponding relationship of the virtual machine and cancels the virtual machine. Save.
  • the process of migrating the virtual machine 16 from the source physical host 100 to the destination physical host 200 is completed. It can be seen that, in the embodiment of the present invention, the PFN and the physical memory page of the virtual machine memory are established according to the migration command of the virtual machine triggered by the privileged virtual machine user state process, and according to the identifier of the virtual machine included in the migration command of the virtual machine.
  • the physical memory page address corresponding to the PFN of the virtual machine memory can be obtained, and the physical memory page address of the virtual machine is registered to the RDMA network card before the data is sent through the RDMA network card;
  • the NIC sends the memory data stored in the physical memory page address of the memory data requested to be sent to the destination physical host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call.
  • the corresponding relationship of the virtual to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical memory page address corresponding to the memory data requested to be sent thereby greatly reducing the processor utilization and time overhead in the physical machine where the virtual machine is located, and solving the virtual machine in the prior art due to the virtualization platform to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and the page table is updated by the hypercall. This causes the processor utilization and time overhead of the physical machine where the virtual machine is located to be large.
  • the data transmission request sent by the user state process corresponding to each virtual machine can be uniformly managed through the data transmission request queue, and different priorities can be set for data migration of different user state processes, thereby performing different services. QoS optimization to improve the performance of virtual machine migration.
  • Embodiment 4 The embodiment of the present invention provides a host Host 60.
  • the Host 60 is deployed on a physical host together with the first virtual machine.
  • the Host 60 may include a privileged virtual machine and a VMM, where the privileged virtual machine And the VMM is deployed on the physical host with the first virtual machine. Referring to FIG.
  • the host 60 may include: an obtaining unit 601, configured to acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes The identifier of the first virtual machine, and the PFN of the memory data requested to be sent;
  • the first query unit 602 is configured to: the corresponding query information database of the first virtual machine is used to obtain the correspondence between the first virtual machine, where the corresponding relationship information database includes the correspondence of the virtual machine to be migrated.
  • the corresponding relationship of the virtual machine is an address space for acquiring the memory of the virtual machine based on the identifier of the virtual machine, and a PFN of the virtual machine memory corresponding to the address space, and a PFN of the virtual machine memory Corresponding relationship between the PFN of the virtual machine memory and the physical memory page address of the virtual machine memory after the physical memory page address of the virtual machine memory is corresponding;
  • the second query unit 603 is configured to perform the request according to the request
  • the PFN of the sent memory data queries the correspondence relationship of the first virtual machine obtained by the first query unit 602 to obtain a physical memory page address of the memory data requested to be sent;
  • the driver sending unit 604 is configured to pass the RDMA network card
  • the second query unit 603 will be the physical host of the destination.
  • the host 60 of the embodiment of the present invention may acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a PFN of the memory data requested to be sent;
  • the identifier of the first virtual machine is used to query the correspondence information database, and the corresponding relationship of the first virtual machine is obtained.
  • the correspondence information database includes the correspondence between the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on the identifier of the virtual machine.
  • the PFN of the virtual machine memory is obtained after the address space of the virtual machine memory is obtained, and the PFN of the virtual machine memory corresponding to the address space and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory.
  • the host can query the correspondence relationship of the first virtual machine according to the PFN of the memory data sent by the request, and obtain the physical memory page address of the memory data requested to be sent; .
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call.
  • the corresponding relationship of the virtual to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the memory data to be sent to the utilization and time overhead solves the problem in the prior art.
  • the memory of the virtual machine needs to be mapped to the user state space and passed through the super call. Update the page table, causing processor utilization and time in the physical machine where the virtual machine is located Big problem with sales.
  • Embodiment 5 Referring to FIG. 7 , another Host 70 according to an embodiment of the present invention is shown in FIG. 7.
  • the Host 70 includes: an establishing unit 701, a first registration unit 702, an obtaining unit 703, a first query unit 704, and a second query.
  • the establishing unit 701 is configured to acquire, by the privileged virtual machine user state process, a migration request for migrating the memory data of the first virtual machine, where the migration request includes an identifier of the first virtual machine; Obtaining, in the request, the identifier of the first virtual machine, the address space of the first virtual machine memory; obtaining the PFN of the virtual machine memory in the address space; calculating the PFN according to the first virtual machine memory a physical memory page address of the first virtual machine memory; a correspondence between a PFN of the first virtual machine memory and a physical memory page address of the first virtual machine memory; a first registration unit 702, configured to establish After the unit 701 calculates the physical memory page address of the first virtual machine memory according to the PFN of the first virtual machine memory, the obtaining unit 702 obtains a data transmission request for sending the first virtual machine memory data,
  • the physical memory page address of the first virtual machine memory acquired by the establishing unit 701 is registered to the RDMA network card.
  • the first registration unit 702 registers the physical memory page address of the entire memory of the first virtual machine to the RDMA network card at one time.
  • the physical memory page address corresponding to all the memory of the first virtual machine is 0x00010000 ⁇ 0x0001 ffff, then A registration unit 702 registers all 0x00010000 ⁇ 0x0001ffff-times to the RDMA network card.
  • the acquiring unit 601 is specifically configured to: sequentially extract a data sending request in a data sending request queue, where the data sending request includes different data sending requests of the virtual machine to be migrated, and the data sending request Data transmission requests in the queue are sorted by chronological order or priority level.
  • the host 70 of the embodiment of the present invention is configured to obtain a migration command of a virtual machine sent by a privileged virtual machine user state process, and establish a PFN of each virtual machine memory according to the identifier of the virtual machine included in the migration command of each virtual machine.
  • the physical memory page address corresponding to the PFN of each virtual machine memory may be obtained, and the physical memory page address of each virtual machine is registered to the RDMA network card; The data is sent to the destination physical host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call, and the PFN of the data to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical memory page address corresponding to the memory data requested to be sent thereby greatly reducing the processor utilization and time overhead in the physical machine where the virtual machine is located, and solving the virtual machine in the prior art due to the virtualization platform to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and the page table is updated by the hypercall. This causes the processor utilization and time overhead of the physical machine where the virtual machine is located to be large.
  • the first registration unit 702 registers the physical memory page address of each virtual machine to the RDMA network card at a time before the drive transmitting unit 706 transmits data through the RDMA network card, it can ensure that the RDMA network card transmits data according to the user state process. Request to successfully transfer relevant data.
  • the obtaining unit 703 can perform unified management on the data sending request of the user state process corresponding to each virtual machine that is respectively acquired through the data sending request queue, and can implement different priorities for data migration of different user state processes, and further Different services perform QoS optimization to improve the performance of virtual machine migration.
  • Embodiment 6 Referring to FIG. 8 , another Host 80 according to an embodiment of the present invention is shown.
  • the Host 80 includes: an establishing unit 801, an obtaining unit 802, a first query unit 803, a second query unit 804, and a first registration.
  • the establishing unit 801 is configured to obtain a migration request of the memory data of the first virtual machine that is triggered by the privileged virtual machine user state process, where the migration request includes the first Obtaining an address space of the first virtual machine memory according to the identifier of the first virtual machine in the migration request; acquiring the virtual machine memory in the address space
  • the obtaining unit 802 is specifically configured to: sequentially extract a data sending request in a data sending request queue, where the data sending request includes different data sending requests of the virtual machine to be migrated, and the data sending request Data transmission requests in the queue are sorted by chronological order or priority level.
  • the first query unit 803 is configured to be used in the identifier query correspondence relationship information database of the first virtual machine to obtain a correspondence relationship between the first virtual machine, where the correspondence relationship information database includes a correspondence of the virtual machine to be migrated. Relationship, the corresponding relationship of the virtual machine is an address space for acquiring the memory of the virtual machine based on the identifier of the virtual machine, and a PFN of the virtual machine memory corresponding to the address space, and a PFN of the virtual machine memory Corresponding relationship between the PFN of the virtual machine memory and the physical memory page address of the virtual machine memory after the physical memory page address of the virtual machine memory is corresponding; the second query unit 804 is configured to perform the request according to the request The PFN of the sent memory data queries the correspondence relationship of the first virtual machine obtained by the first query unit 803 to obtain a physical memory page address of the memory data requested to be sent; the second registration unit 805 is configured to The physical memory page address obtained by the second query unit 804 and obtained by the requesting to send the memory data is registered to the
  • the physical memory page address of the memory data sent by the first data transmission request request is 0x00010000 ⁇ 0x000100ff
  • the second registration unit 805 sets the physical memory page address through the RDMA network card after acquiring the first data transmission request. 0x00010000-0x000 Before the memory data stored on lOOff is sent to the destination physical host, the physical memory page address 0x00010000 ⁇ 0x0001 ffff is registered to the RDM A network card; for example, the second data transmission request requests the physical memory page address of the memory data sent. for
  • the second registration unit 805 sends the memory data stored on the physical memory page address 0x00010100 ⁇ 0x000101ff to the destination physical host through the RDMA network card after acquiring the second data transmission request, the physical memory page address is 0x00010100. ⁇ 0x000101 ff registered to the RDMA network card.
  • the driver sending unit 806 is configured to: after the second registration unit 805 registers the physical memory page address of the memory data obtained by the second query unit 804 and obtain the request to the RDMA network card, the second query unit by using the RDMA network card 804 got the request sent
  • the host 80 of the embodiment of the present invention is configured to acquire a migration command of a virtual machine triggered by a privileged virtual machine user state process, and establish a PFN and a physical memory page address of the virtual machine memory according to the identifier of the virtual machine included in the migration command of the virtual machine.
  • Correspondence relationship According to the corresponding relationship of the virtual machine, the physical memory page address corresponding to the PFN of the virtual machine memory can be obtained, and the physical memory page address of the virtual machine is registered to the RDMA network card before the data is sent through the RDMA network card; and then the RDMA network card is passed.
  • the memory data stored in the physical memory page address of the memory data requested to be sent is sent to the destination physical host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call.
  • the corresponding relationship of the virtual to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical memory page address corresponding to the memory data requested to be sent thereby greatly reducing the processor utilization and time overhead in the physical machine where the virtual machine is located, and solving the virtual machine in the prior art due to the virtualization platform to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and the page table is updated by the hypercall. This causes the processor utilization and time overhead of the physical machine where the virtual machine is located to be large.
  • the data transmission request sent by the user state process corresponding to each virtual machine can be uniformly managed through the data transmission request queue, and different priorities can be set for data migration of different user state processes, thereby performing different services. QoS optimization to improve the performance of virtual machine migration.
  • the obtaining unit 703 can uniformly manage the data sending request of the user state process corresponding to each virtual machine respectively acquired through the data sending request queue, and can implement the pin Set different priorities for data migration of different user-mode processes, and then optimize QoS for different services to improve the performance of virtual machine migration.
  • the seventh embodiment of the present invention provides a physical host 90.
  • the physical host 90 includes hardware, where the hardware may include an RDMA network card 901.
  • the hardware may further include at least one processor 902.
  • the memory 903 is configured to perform at least one communication bus 904 for connecting between devices in the physical host 90 for implementing connection and mutual communication between the devices.
  • the communication bus 904 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (abbreviated as EISA) Bus, etc.
  • ISA Industry Standard Architecture
  • PCI Peripheral Component
  • EISA Extended Industry Standard Architecture
  • the bus 904 can be divided into an address bus, a data bus, a control bus, and the like.
  • Memory 903 can include random access memory and provides instructions and data to processor 803.
  • the processor 902 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more configured to implement the embodiments of the present invention. integrated circuit.
  • the RDMA network card 901 can be a variety of network cards that support the RDMA function. For example, it can be an InfiniBand card or an RDMA over Converged Ethernet (RoCE) card.
  • the processor 902 is configured to: acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes the identifier of the first virtual machine, and request to send, by using an instruction stored in the memory 903.
  • the PFN of the in-memory data is obtained by querying the correspondence relationship information base according to the identifier of the first virtual machine, and the corresponding relationship of the first virtual machine is obtained, where the correspondence relationship information database includes a correspondence relationship of the virtual machines to be migrated, Corresponding relationship of the virtual machine is to acquire the virtual based on the identifier of the virtual machine
  • the virtual machine memory is established after the address space of the machine memory, and the PFN of the virtual machine memory corresponding to the address space, and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory.
  • the physical relationship of the memory data requested to be sent according to the correspondence relationship of the first virtual machine obtained by the PFN query of the memory data sent by the request The memory page address is sent to the destination physical host by the RDMA network card 901 to store the memory data stored in the physical memory page address of the acquired memory data.
  • the processor 902 is further configured to: before acquiring a data sending request for sending the first virtual machine memory data, acquiring a migration request for migrating the memory data of the first virtual machine triggered by the privileged virtual machine user state process, where The migration request includes the identifier of the first virtual machine; the address space of the first virtual machine memory is obtained according to the identifier of the first virtual machine in the migration request; a PFN of the virtual machine memory; calculating a physical memory page address of the first virtual machine memory according to the PFN of the first virtual machine memory; establishing a PFN of the first virtual machine memory and the first virtual machine memory Correspondence between physical memory page addresses. Further, the processor 902 is further configured to: register the physical page memory address of the first virtual machine memory data to the RDMA network card, which may be implemented by any one of the following two methods:
  • the processor 902 After calculating a physical memory page address of the first virtual machine memory according to the PFN of the first virtual machine memory, acquiring the first virtual machine memory before acquiring a data sending request for sending the first virtual machine memory data
  • the physical memory page address is registered to the RDMA network card.
  • the processor 902 registers the physical memory page address of the entire memory of the first virtual machine to the RDMA network card at one time. For example, if the physical memory page address corresponding to all the memory of the first virtual machine is 0x00010000 ⁇ 0x0001ffff, the Host901 will be 0x00010000. ⁇ 0x0001ffff Register all to the RDMA network card at one time.
  • the physical memory page address of the memory data requested to be sent is registered to the RDMA network card.
  • the processor 902 registers the physical memory page address of the memory data sent by each data transmission request request in batches to the RDMA network card according to each data transmission request, for example, the first virtual machine.
  • the physical memory page address corresponding to all the memory is 0x00010000-0x000 lffff, and the physical memory page address of the memory data sent by the first data transmission request request is 0x00010000 ⁇ 0x000100ff, then the processor 902 passes the first data transmission request,
  • the RDMA NIC registers the physical memory page address 0x00010000 ⁇ 0x0001 ffff to the RDMA NIC before sending the memory data stored on the physical memory page address 0x00010000-0x000 lOOff to the destination physical host; for example, the second data transmission request requests the memory to be sent.
  • the physical memory page address of the data is
  • the physical memory page address is 0x00010100 ⁇ 0x000101 ff before the memory data stored on the physical memory page address 0x00010100 ⁇ 0x000101 ff is sent to the destination physical host through the RDMA network card. Register to the RDMA network card.
  • the physical host 90 may acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a PFN of the memory data requested to be sent;
  • the identifier of the first virtual machine is used to query the correspondence information database, and the corresponding relationship of the first virtual machine is obtained.
  • the correspondence information database includes the correspondence between the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on the identifier of the virtual machine.
  • the PFN of the virtual machine memory is obtained after the address space of the virtual machine memory is obtained, and the PFN of the virtual machine memory corresponding to the address space and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory.
  • the host can query the correspondence relationship of the first virtual machine according to the PFN of the memory data sent by the request, and obtain the physical memory page address of the memory data requested to be sent; and then the RDMA network card will be requested Host.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call, and the PFN of the data to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical time overhead corresponding to the requested memory data solves the problem in the prior art.
  • the memory of the virtual machine needs to be mapped to the user state space and updated by the super call.
  • the page table causes the processor utilization and time overhead in the physical machine where the virtual machine is located.
  • Embodiment 8 The embodiment of the present invention provides another physical host 100.
  • the physical host 100 includes a hardware layer, Hostl001 running on the hardware layer, and at least one running on the HostlOO1.
  • the virtual machine VM1002, and the hardware layer includes an RDMA network card 1003.
  • the processor 1004 and the memory 1005 may be further included.
  • the Host may include a VMM on the physical host 100 and a privileged virtual machine running on the VMM.
  • the virtual machine 1002 is a virtual machine other than the privileged virtual machine on the physical host 100, and the virtual machine 1002 includes the first virtual machine.
  • the hostlOO1 is configured to acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a PFN of the memory data requested to be sent;
  • the identifier of the virtual machine is queried according to the correspondence information database, and the corresponding relationship of the first virtual machine is obtained, where the correspondence relationship information database includes the correspondence between the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on the Obtaining, by the identifier of the virtual machine, an address space of the virtual machine memory, and a PFN of the virtual machine memory corresponding to the address space, and a physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory Corresponding relationship between the PFN of the virtual machine memory and the physical memory page address of the virtual machine memory;
  • the HostlOOl is further configured to: before acquiring a data sending request for sending the first virtual machine memory data, acquiring a migration request of the memory data of the first virtual machine triggered by the privileged virtual machine user state process, where The migration request includes the identifier of the first virtual machine; the address space of the first virtual machine memory is obtained according to the identifier of the first virtual machine in the migration request; a PFN of the virtual machine memory; calculating a physical memory page address of the first virtual machine memory according to the PFN of the first virtual machine memory; establishing a PFN of the first virtual machine memory and a physicality of the first virtual machine memory The correspondence between memory page addresses. Further, the HostlOOl is further configured to: register the physical page memory address of the first virtual machine memory data to the RDMA network card, which may be implemented by any one of the following two methods:
  • the physical memory page address is registered to the RDMA network card.
  • HostlOOl registers the physical memory page address of all the memory of the first virtual machine to the RDMA network card at one time.
  • the physical memory page address corresponding to all the memory of the first virtual machine is 0x00010000 ⁇ 0x0001ffff, then Host901 will be 0x00010000 ⁇ 0x0001ffff. Register all to the RDMA network card at one time.
  • the physical memory page address of the memory data requested to be sent is registered to the RDMA network card. In this way, HostlOOl will send each request according to each data.
  • the physical memory page address of the memory data sent by the data transmission request request is registered in batches to
  • the RDMA network card for example, the physical memory page address corresponding to the entire memory of the first virtual machine is 0x00010000-0x000 lffff, and the physical memory page address of the memory data sent by the first data transmission request request is 0x00010000 ⁇ 0x000100ff, then HostlOOl obtains the first After the data is sent, the physical memory page address 0x00010000 ⁇ 0x0001 fffff is registered to the RDMA network card by the RDMA network card before the physical memory page address 0x00010000-0x000 lOOff is sent to the destination physical host; for example, the second The physical memory page address of the memory data sent by the data transmission request request is
  • the physical memory page address 0x00010100 ⁇ 0x000101 ff is sent to the destination physical host through the RDMA network card to send the memory data stored on the physical memory page address 0x00010100 ⁇ 0x000101 ff to the destination physical host. Register to the RDMA network card.
  • the physical host 100 of the embodiment of the present invention is configured to acquire a data sending request for sending the first virtual machine memory data, where the data sending request includes an identifier of the first virtual machine, and a PFN of the memory data requested to be sent;
  • the identifier of the first virtual machine is used to query the correspondence information database, and the corresponding relationship of the first virtual machine is obtained.
  • the correspondence information database includes the correspondence between the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on the identifier of the virtual machine.
  • the PFN of the virtual machine memory is obtained after the address space of the virtual machine memory is obtained, and the PFN of the virtual machine memory corresponding to the address space and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory.
  • the PFN of the memory data sent by the request is used to query the correspondence relationship of the first virtual machine, and obtain the physical memory page address of the memory data requested to be sent; and then send the request through the RDMA network card.
  • the PFN of the memory data sent by the request is used to query the correspondence relationship of the first virtual machine, and obtain the physical memory page address of the memory data requested to be sent; and then send the request through the RDMA network card.
  • the embodiment of the present invention provides a cluster system.
  • the cluster system includes: multiple physical hosts, where the multiple physical hosts include a source physical host and a destination physical host, where each physical host includes a hardware layer. And a Host running on the hardware layer and at least one virtual machine VM running on the Host, and the hardware layer includes an RDMA network card, optionally, a processor and a memory.
  • the Host may include a VMM on the physical host where the Host is located and a privileged virtual machine running on the VMM.
  • the physical host included in the cluster system of the embodiment of the present invention refers to the physical host introduced in the foregoing embodiment, and details are not described herein again.
  • the host in the source physical host can obtain a data sending request for sending the first virtual machine memory data, where the data sending request includes the identifier of the first virtual machine, and the PFN of the memory data requested to be sent.
  • the host queries the correspondence information base according to the identifier of the first virtual machine, and obtains the correspondence relationship of the first virtual machine, where the correspondence relationship information database includes the correspondence relationship of the virtual machines to be migrated, and the corresponding relationship of the virtual machine is based on the
  • the virtual machine identifier obtains the address space of the virtual machine memory, and the PFN of the virtual machine memory corresponding to the address space, and the physical memory page address of the virtual machine memory corresponding to the PFN of the virtual machine memory.
  • the memory of the virtual machine is not required to be mapped to the user state space, and the page table is updated by the super call.
  • the corresponding relationship of the virtual to be migrated and the PFN of the data transmission request can be directly obtained by the PFN.
  • the physical memory page address corresponding to the memory data requested to be sent thereby greatly reducing the processor utilization and time overhead in the physical machine where the virtual machine is located, and solving the virtual machine in the prior art due to the virtualization platform to some extent.
  • the memory of the virtual machine needs to be mapped to the user state space and the page table is updated by the hypercall. This causes the processor utilization and time overhead of the physical machine where the virtual machine is located to be large.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
  • the software functional unit described above is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform portions of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a USB flash drive, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and the like can store program codes. Medium.
  • the storage medium may include: a read only memory, a random access memory, a magnetic disk or an optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Bus Control (AREA)

Abstract

本发明实施例公开了一种虚拟机内存数据的迁移方法及相关装置和集群系统。涉及通信领域,降低了虚拟机内存迁移时的处理器利用率及时间开销。本发明实施例提供的方法包括:获取发送第一虚拟机内存数据的数据发送请求,其中,数据发送请求包含第一虚拟机的标识,以及请求发送的内存数据的PFN;根据第一虚拟机的标识查询对应关系信息库,得到第一虚拟机的对应关系,根据请求发送的内存数据的PFN查询第一虚拟机的对应关系,得到请求发送的内存数据的物理内存页地址;通过RDMA网卡将所述请求发送的内存数据的物理内存页地址存储的内存数据发送至目的物理主机。

Description

一种虚拟机内存数据的迁移方法及相关装置和集群系统 本申请要求于 2013 年 09 月 30 日提交中国专利局、 申请号为 2013 10462273.3、 发明名称为 "一种虚拟机内存数据的迁移方法及相关 装置和集群系统" 的中国专利申请的优先权, 其全部内容通过引用结 合在本申请中。
技术领域
本发明涉及通信领域, 尤其涉及一种虚拟机内存数据的迁移方法及相 关装置和集群系统。 背景技术
拟机迁移是虚拟机实时迁移的主要部分,虚拟机实时迁移可以在保持虚拟 机运行的同时, 将虚拟机从源物理主机迁移至目的物理主机, 并在目的物 理主机上恢复运行, 实现服务整合。 通过虚拟机实时迁移可以实现服务器 的在线维护、 在线升级、 负载均衡, 并为灾难恢复提供了一种解决方案。 在现有技术中, xen虚拟化平台下, 虚拟机迁移采用迭代发送虚拟机 内存的方法,每次迭代时分批次地选取当次迭代的脏页并将这些页面映射 至特权虚拟机的用户态进程的线性地址空间, 映射完成后, 再调用超级调 用进行页表的更新从而建立线性地址空间与物理地址的联系,取得映射的 线性地址后, 通过用户态的远程直接内存读取 ( Remote Direct Memory Access , 简称 RDMA ) 接口注册已映射的虚拟机内存对应的物理地址至 RDMA网卡,并通过其他 RDMA系统调用按照 RDMA通信协议进行后续 的数据传输。 在数据成功发送后, 将虚拟机的内存从用户态进程空间中解 映射, 同时注销已注册的物理内存。
发明人发现现有技术至少存在以下问题: 在虚拟化平台下, 虚拟机迁 移需要映射虚拟机的内存并通过超级调用更新页表, 导致虚拟机所在的物 理机中的中央处理器 ( Central Processing Unit, 简称 CPU ) 利用率及时间 开销较大。 发明内容 本发明实施例提供一种虚拟机内存数据的迁移方法及相关装置和集 群系统, 以降低虚拟机所在的物理主机中的处理器利用率及时间开销。 本发明实施例采用的技术方案是, 第一方面, 提供了一种虚拟机内存数据的迁移方法, 包括: 获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的物理页 才匡号 ( Physical Frame Number, 简称 PFN ) ; 根据所述第一虚拟机的标识查询对应关系信息库, 得到所述第一虚 拟机的对应关系, 其中, 所述对应关系信息库包含待迁移的虚拟机的对 应关系, 所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间, 以及所述地址空间对应的所述虚拟机内存的 PFN, 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后,建立的所述虚拟机内存的 PFN与所述虚拟机内存的物理内存页地址 的对应关系; 根据所述请求发送的内存数据的 PFN 查询所述第一虚拟机的对应 关系, 得到所述请求发送的内存数据的物理内存页地址;
通过 RDMA 网卡将所述请求发送的内存数据的物理内存页地址上 所存储的内存数据发送至目的物理主机。 在第一种可能的实现方式中, 根据第一方面, 在所述获取发送第一 虚拟机内存数据的数据发送请求之前, 所述方法还包括: 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。
在第二种可能的实现方式中, 结合第一种可能的实现方式, 在所述根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存 的物理内存页地址之后, 所述获取发送第一虚拟机内存数据的数据发送 请求之前, 所述方法还包括: 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。 在第三种可能的实现方式中, 结合第一方面或者第一种可能的实现 方式,根据所述请求发送的内存数据的 P FN查询所述第一虚拟机的对应 关系, 得到所述请求发送的内存数据的物理内存页地址之后, 通过 内存数据发送至目的物理主机之前, 所述方法还包括: 将所述请求发送的内存数据的物理内存页地址注册至所述 RDMA 网卡。
在第四种可能的实现方式中, 结合第一方面, 第一种可能的实现方 式至第三种可能的实现方式中的任一种, 所述获取发送第一虚拟机内存 数据的数据发送请求包括: 依序提取数据发送请求队列中的数据发送请求, 其中, 所述数据发 送请求包含不同的待迁移的虚拟机的数据发送请求, 所述数据发送请求 队列中的数据发送请求按照时间先后或者优先级高低进行排序。
第二方面, 提供了一种宿主机, 包括: 获取单元, 用于获取发送第一虚拟机内存数据的数据发送请求, 其 中, 所述数据发送请求包含所述第一虚拟机的标识, 以及请求发送的内 存数据的 PFN;
第一查询单元, 用于根据所述第一虚拟机的标识查询对应关系信息 库, 得到所述第一虚拟机的对应关系, 其中, 所述对应关系信息库包含 待迁移的虚拟机的对应关系, 所述虚拟机的对应关系为基于所述虚拟机 的标识获取所述虚拟机内存的地址空间, 以及所述地址空间对应的所述 虚拟机内存的 PFN,以及所述虚拟机内存的 PFN对应的所述虚拟机内存 的物理内存页地址后,建立的所述虚拟机内存的 PFN与所述虚拟机内存 的物理内存页地址的对应关系; 第二查询单元,用于根据所述请求发送的内存数据的 P F N查询所述 第一查询单元得到的所述第一虚拟机的对应关系, 获取所述请求发送的 内存数据的物理内存页地址; 驱动发送单元, 用于通过 RDMA 网卡将所述第二查询单元得到的 的物理主机。 在第一种可能的实现方式中, 结合第二方面, 所述 Host还包括 建立单元, 用于在所述获取单元获取发送第一虚拟机内存数据的数 据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。
在第二种可能的实现方式中, 结合第一种可能的实现方式, 所述 Host还包括: 第一注册单元, 用于在所述建立单元根据所述 第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理内存页地址之 后, 所述获取单元获取发送第一虚拟机内存数据的数据发送请求之前, 将所述建立单元获取的第一虚拟机内存的物理内存页地址注册至 所述 RDMA网卡。 在第三种可能的实现方式中, 结合第二方面或者第一种可能的实现 方式,
所述 Host还包括: 第二注册单元, 用于在所述第二查询单元根据 所述请求发送的内存数据的 PFN查询所述第一虚拟机的对应关系,得到 所述请求发送的内存数据的物理内存页地址之后, 所述驱动发送单元通 的内存数据发送至目的物理主机之前, 将所述第二查询单元得到的请求发送的内存数据的物理内存页地 址注册至所述 RDMA网卡。 在第四种可能的实现方式中, 结合第二方面, 第一种可能的实现方 式至第三种可能的实现方式中的任一种, 所述获取单元具体用于, 依序 提取数据发送请求队列中的数据发送请求, 其中, 所述数据发送请求包 含不同的待迁移的虚拟机的数据发送请求, 所述数据发送请求队列中的 数据发送请求按照时间先后或者优先级高低进行排序。
第三方面, 提供一种物理主机, 包括: 硬件层、 运行在所述硬件层 之上的 Host、 以及运行在所述 Host之上至少一个虚拟机 VM , 以及所述 硬件层包括远程直接内存读取 RDMA 网卡; 所述至少一个虚拟机包括 第一虚拟机, 其中,
所述 Host用于: 获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的物理页 框号 PFN; 根据所述第一虚拟机的标识查询对应关系信息库, 得到所述第一虚 拟机的对应关系, 其中, 所述对应关系信息库包含待迁移的虚拟机的对 应关系, 所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间, 以及所述地址空间对应的所述虚拟机内存的 PFN, 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后,建立的所述虚拟机内存的 PFN与所述虚拟机的物理内存页地址的对 应关系; 根据所述请求发送的内存数据的 PFN 查询所述第一虚拟机的对应 关系, 得到所述请求发送的内存数据的物理内存页地址; 通过远程直接内存读取 RDMA 网卡将所述请求发送的内存数据的
在第一种可能的实现方式中, 结合第三方面, 所述 Host还用于: 在获取发送第一虚拟机内存数据的数据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。
在第二可能的实现方式中, 结合第一种可能的实现方式, 所述 Host还用于: 在根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物 理内存页地址之后, 以及获取发送第一虚拟机内存数据的数据发送请求 之前, 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。 在第三可能的实现方式中, 结合第三方面或者第一种可能的实现方 式,
所述 Host还用于: 在根据所述请求发送的内存数据的 PFN查询所 述第一虚拟机的对应关系, 得到所述请求发送的内存数据的物理内存页 地址之后, 通过 RDMA 网卡将所述请求发送的内存数据的物理内存页 地址上所存储的内存数据发送至目的物理主机之前, 将所述请求发送的内存数据的物理内存页地址注册至所述 RDMA 网卡。
第四方面, 提供一种集群系统, 包括: 多台上述任一项所述的物理 主机, 所述多台物理主机包括源物理主机和目的物理主机, 其中每台物 理主机包括硬件层、 运行在所述硬件层之上的 Host、 以及运行在所述 Host之上的至少一个虚拟机 VM , 以及所述硬件层包括 RDMA网卡。 由上可见, 本发明实施例的物理主机可包括: 硬件层、 运行在该硬件层之 上的 Host、 以及运行在该 Host之上的至少一个虚拟机 VM , 该硬件层包 括 RDMA网卡, 所述至少一个虚拟机包括第一虚拟机; 其中, 该 Host用 于获取发送第一虚拟机内存数据的数据发送请求, 其中, 该数据发送请求 包含第一虚拟机的标识, 以及请求发送的内存数据的 PFN; 该 Host根据 第一虚拟机的标识查询对应关系信息库, 获取第一虚拟机的对应关系, 其 中, 该对应关系信息库包含待迁移的虚拟机的对应关系, 虚拟机的对应关 系为基于该虚拟机的标识获取该虚拟机内存的地址空间,以及该地址空间 对应的该虚拟机内存的 PFN, 以及该虚拟机内存的 PFN对应的该虚拟机 内存的物理内存页地址后, 建立的该虚拟机内存的 PFN与物理内存页地 址的对应关系; 所以, 该 Host可根据请求发送的内存数据的 PFN查询第 一虚拟机的对应关系, 获取请求发送的内存数据的物理内存页地址; 并通 数据发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟 机的内存映射到用户态空间并通过超级调用更新页表, 通过该待迁移虚拟 的对应关系以及数据发送求中的 PFN, 可直接查询获取请求发送的内存数 器利用率及时间开销,一定程度上解决了现有技术中由于在虚拟化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到用户态空间并通过超级 调用更新页表, 导致虚拟机所在的物理机中的处理器利用率及时间开销较 大的问题。 附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对 实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附 图。
图 1 为本发明实施例提供的一种虚拟机内存数据迁移方法的流程示 意图;
图 2为本发明实施例提供的一种应用场景的示意图; 图 3 为本发明实施例提供的另一种虚拟机内存数据迁移方法的流程 示意图; 图 4为本发明实施例提供的一种数据发送请求队列的示意图; 图 5 为本发明实施例提供的再一种虚拟机内存数据迁移的方法的流 程示意图; 图 6为本发明实施例提供的一种宿主机的结构示意图; 图 7为本发明实施例提供的另一种宿主机的结构示意图; 图 8为本发明实施例提供的另一种宿主机的结构示意图; 图 9为本发明实施例提供的一种物理主机的装置结构示意图; 图 10为本发明实施例提供的另一种物理主机的装置结构示意图; 图 1 1为本发明实施例提供的一种集群系统示意图。
具体实施方式 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进 行清楚、 完整地描述,显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没 有做出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的 范围。
为了方便理解本发明实施例,首先在此介绍本发明实施例描述中会引 入的几个术语; 虚拟机 VM: 通过虚拟机软件可以在一台物理主机上模拟出一台或者 多台虚拟的计算机, 而这些虚拟机就像真正的计算机那样进行工作, 虚拟 机上可以安装操作系统和应用程序, 虚拟机还可访问网络资源。 对于在虚 拟机中运行的应用程序而言, 虚拟机就像是在真正的计算机中进行工作。 硬件层:虚拟化环境运行的硬件平台。其中,硬件层可包括多种硬件, 例如某物理主机的硬件层可包括处理器(例如 CPU )和内存, 还可以包括 网卡 (例如 RDMA 网卡) 、 存储器等等高速 /低速输入 /输出 (I/O , Input/Output ) 设备, 及具有特定处理功能的其它设备。 宿主机(Host ) : 作为管理层, 用以完成硬件资源的管理、 分配; 为 虚拟机呈现虚拟硬件平台; 实现虚拟机的调度和隔离。 其中, Host可能是 虚拟机监控器 (VMM ) ; 此外, 有时 VMM和 1 个特权虚拟机配合, 两 硬件资源, 如提供虚拟处理器 (如 VCPU ) 、 虚拟内存、 虚拟磁盘、 虚拟 网卡等等。 其中, 该虚拟磁盘可对应 Host 的一个文件或者一个逻辑块设 备。 虚拟机运行在 Host为其准备的虚拟硬件平台上, Host上运行一个或 多个虚拟机。 特权虚拟机: 一种特殊的虚拟机, 亦可称为驱动域, 例如这种特殊 的虚拟机在 Xen Hypervisor平台上被称作 DomO ,在该虚拟机中安装了例 如网卡、 SCSI磁盘等真实物理设备的驱动程序, 能检测和直接访问这些 真实物理设备。 其他虚拟机利用 Hypervisor提供的相应机制通过特权虚 拟机访问真实物理设备。 应理角竿 , 本发明实施例可以应用于 xen虚拟机平台中, 也可以应用于 可以应用于任意一个迁移虚拟机时需要将虚拟机内存进行映射的虚拟化 平台中; 本发明实施例对此不进行限制。
实施例一 参见图 1 , 为本发明实施例提供的一种虚拟机内存数据的迁移方法, 如图 1所示, 可以包括以下步骤: 101 : 获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述 数据发送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的 PFN; 本发明实施例中提供的方法, 可以由第一虚拟机所在的物理主机执 行, 例如, 可以由该物理主机上的 Host执行, Host为 VMM和运行在该 VMM 上的特权虚拟机的结合。 数据发送请求由特权虚拟机上的用户态 进程发送给特权虚拟机。 虚拟机的标识可以为任何能够唯一表示虚拟机 的参数, 例如, 可以为虚拟机的域名。
102 : 根据所述第一虚拟机的标识查询对应关系信息库, 得到所述第 一虚拟机的对应关系, 其中, 所述对应关系信息库包含待迁移的虚拟机 的对应关系, 所述虚拟机的对应关系为基于所述虚拟机的标识获取所述 虚拟机内存的地址空间, 以及所述地址空间对应的所述虚拟机内存的 PFN, 以及所述虚拟机内存的 PFN对应的所述虚拟机内存的物理内存页 地址后, 建立的所述虚拟机内存的 PFN与所述虚拟机的物理内存页地址 的对应关系;
103 : 根据所述请求发送的内存数据的 PFN 查询所述第一虚拟机的 对应关系, 得到所述请求发送的内存数据的物理内存页地址;
104: 通过远程直接内存读取 RDMA 网卡将所述请求发送的内存数
可选的, 在所述获取发送第一虚拟机内存数据的数据发送请求之 前, 所述方法还包括: 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。 进一步的, 该方法还包括将第一虚拟机内存数据的物理页内存地址 注册给 RDMA 网卡的过程, 具体可以通过以下两种方式中任意一种方 式来实现:
1、 在所述根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内 存的物理内存页地址之后, 所述获取发送第一虚拟机内存数据的数据发 送请求之前, 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。 在这种方式下, 将第一虚拟机全部内存的物理内存页地址一次注册 给 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内存页地址为 0x00010000〜0x0001ffff, 则将 0x00010000〜0x0001ffff—次性全部注册至 RDMA网卡。
2、 在根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的 对应关系, 得到所述请求发送的内存数据的物理内存页地址之后, 通过 内存数据发送至目的物理主机之前, 将所述请求发送的内存数据的物理 内存页地址注册至所述 RDMA网卡。 在这种方式下, 根据每次的数据发送请求, 分别就将每个数据发送 请求请求发送的内存数据的物理内存页地址分批次的注册至 RDMA 网 卡, 例如, 第一虚拟机全部 内 存对应 的物理 内 存页地址为 0x00010000-0x000 lffff, 第一个数据发送请求请求发送的内存数据的物 理内存页地址为 0x00010000〜0x000100ff,则在获取第一个数据发送请求 之后, 通过 RDMA网卡将物理内存页地址 0x00010000〜0x000100ff 上存 储的 内存数据发送给目 的物理主机之前, 将物理内存页地址 0x00010000〜0x0001ffff注册至 RDMA网卡; 再例如, 第二个数据发送请 求请求发送的内存数据的物理内存页地址为 0x00010100-0x000 lOl ff,则 在获取第二个数据发送请求之后, 通过 RDMA 网卡将物理内存页地址 0x00010100-OxOOOlOlff 上存储的内存数据发送给目的物理主机之前,将 物理内存页地址 0x00010100〜0x000101ff注册至 RDMA网卡。 本发明实施例的虚拟机内存数据的迁移方法, 通过获取发送第一虚 拟机内存数据的数据发送请求, 其中, 该数据发送请求包含第一虚拟机 的标识, 以及请求发送的内存数据的 PFN; 根据第一虚拟机的标识查询 对应关系信息库, 获取第一虚拟机的对应关系, 其中, 该对应关系信息 库包含待迁移的虚拟机的对应关系, 虚拟机的对应关系为基于该虚拟机 的标识获取该虚拟机内存的地址空间, 以及该地址空间对应的该虚拟机 内存的 PFN ,以及该虚拟机内存的 PFN对应的该虚拟机内存的物理内存 页地址后, 建立的该虚拟机内存的 PFN与物理内存页地址的对应关系; 所以, 可根据请求发送的内存数据的 P F N查询第一虚拟机的对应关系, 获取请求发送的内存数据的物理内存页地址; 再通过 RDMA 网卡将请 主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟机的内存映射到用 户态空间并通过超级调用更新页表, 通过该待迁移虚拟的对应关系以及 数据发送求中的 PFN , 可直接查询获取请求发送的内存数据对应的物理 时间开销, 一定程度上解决了现有技术中由于在虚拟化平台下, 虚拟机 迁移的过程中, 需要将虚拟机的内存映射到用户态空间并通过超级调用 更新页表, 导致虚拟机所在的物理机中的处理器利用率及时间开销较大 的问题。
本发明实施例的虚拟机内存数据的迁移方法可以应用于集群系统, 该集群系统包含多台物理主机, 多台物理主机包括源物理主机和目的物 理主机, 其中, 每台物理主机包括硬件层、 运行在该硬件层之上的 Host、 以及运行在该 Host 之上的至少一个虚拟机 VM , 以及该硬件层包括 RDMA 网卡, 处理器和内存, 参见图 2 , 为本发明实施例设定的一种集 群系统的应用场景, 下述具体实施例在该场景下进行具体说明, 包括两 台物理主机 100和 200 , 以及专用光缆 300。 两台物理主机 100和 200的 硬件层分别包含 RDMA网卡 13、 23 , 处理器 12、 22 , 内存 1 1、 21 , 其 中, 内存 1 1、 内存 21可以为共享内存, RDMA网卡 13、 23可以为无线 宽带 (InfiniBand)卡或以太网(RDMA over Converged Ethernet,简称 RoCE) 卡等, 物理主机 100和 101 的硬件层上分别运行有 Hostl7、 27 , 其中, Hostl7由 VMM 14和 VMM 14上运行的特权虚拟机 15结合组成, Host27 由 VMM 24和 VMM 24上运行的特权虚拟机 25结合组成, VMM 14、 24 上分别运行有至少一个虚拟机 16、 26 , 虚拟机为特权虚拟机之外的其他 虚拟机。 特权虚拟机 15、 25上分别加载了 RDMA网卡 13、 23对应的网 卡驱动。 专用光缆 300 用于连接两台物理主机上的 RDMA 网卡, 专用光缆 300 可以为四通道 SFP 接口(Quad Small Form- factor Pluggable , 简称 QSPF) , 也可以为其它型号的光缆, 本发明实施例对此不进行限制。 上述 共享存储可以为存储网络 ( Storage Area Network, 简称 SAN ) , 也可以 为小型计算机系统接口 ( Internet Small Computer System Interface , 简称 iSCSI ) 或网络连接式存储 ( Network Attached Storage , 简称 NAS ) , 本 发明实施例对此不进行限制。 具体场景为将物理主机 100 (源物理主机) 上的虚拟机 16迁移到物理主机 200 (目的物理主机) 上。 本发明实施例 仅对将虚拟机实时迁移中的虚拟机迁移部分进行详细说明。
实施例二 参见图 3 , 为本发明实施例提供的另一种虚拟机内存数据的迁移方 法, 该方法可以由物理主机 100来执行, 例如, 可以由物理主机 100运行 的 Hostl7执行, 如图 3所示, 可以包括以下步骤:
S301 : 获取特权虚拟机 15用户态进程发送的虚拟机的迁移命令, 其 中, 虚拟机的迁移命令包含虚拟机的标识; 示例性的, 虚拟机可以为一个, 也可以为多个, 本发明实施例对此不 进行限制, 但虚拟机所在的源物理主机相同。
示例性的, Hostl 7中的特权虚拟机 15上加载了 RDMA网卡 13对应 的网卡驱动, 并封装了所有的 RDMA通信接口, 每个 RDMA通信接口分 应于一个虚拟机, 例如, 有三个虚拟机, 分别为虚拟机 1、 虚拟机 2和虚 拟机 3 , 虚拟机 1对应 RDMA通信接口 1 , 虚拟机 2对应 RDMA通信接 口 2 , 虚拟机 3对应 RDMA通信接口 3 , RDMA通信接口 1、 RDMA通信 接口 2和 RDMA通信接口 3都封装在特权虚拟机的网卡驱动中。 其中, RDMA通信接口用于创建保护域、 队列对等。 示例性的, 一个用户态进程对应一个虚拟机, 例如, 有三个虚拟机, 分别为虚拟机 1、 虚拟机 2和虚拟机 3 , 虚拟机 1对应 RDMA通信接口 1 和用户态进程 1 , 虚拟机 2对应 RDMA通信接口 2和用户态进程 2 , 虚拟 机 3对应 RDMA通信接口 3和用户态进程 3 , RDMA通信接口 1、 RDMA 通信接口 2和 RDMA通信接口 3都封装在特权虚拟机 15中, 特权虚拟机 15中的 RDMA通信接口 1、 RDMA通信接口 2和 RDMA通信接口 3分别 接收用户态进程 1、 用户态进程 2和用户态进程 3分别发送的虚拟机 1、 虚拟机 2和虚拟机 3的迁移命令。 示例性的, 虚拟机的标识可以为虚拟机的域名 ( IDentity , 简称 ID ) , 也可以为可以唯一代表虚拟机的其它标识, 本发明实施例对此不进行限 制。
S302: 才艮据虚拟机的标识建立虚拟机的对应关系, 对应关系为虚拟机 内存的 PFN与物理内存页地址的对应关系;
示例性的, Hostl7中的 VMM14可以才艮据所述迁移请求中的所述虚 拟机的标识获取所述虚拟机内存的地址空间; 然后根据所述地址空间获取所述虚拟机内存的 PFN; 再根据所述虚拟机内存的 PFN 计算所述虚拟机内存的物理内存页 地址; 建立所述虚拟机内存的 PFN 与所述虚拟机内存的物理内存页地址 之间的对应关系。 示例性的, 例如, 若虚拟机 1、 虚拟机 2和虚拟机 3分别对应一个虚 拟机的域 ID , Hostl7中的 VMM 14根据虚拟机 1的域 ID可以查询虚拟机 1对应的地址空间,进而获取该虚拟机 1对应的 PFN,假设虚拟机 1的 PFN 范围为 0〜65535 , VMM 14根据虚拟机 1的 PFN计算虚拟机 1对应的物理 内存页地址, 假设为 0x00010000〜0x0001ffff, Host 17 可以基于此建立两 者的对应关系, 虚拟机 2和虚拟机 3与虚拟机 1类似。 其中, 虚拟机的对应关系可以为虚拟机内存的 PFN与物理内存页地 址的——对应的关系表的形式,也可以为其它可以包含虚拟机内存的 PFN 与物理内存页地址的对应关系的任意形式, 本发明实施例对此不进行限 制。
S303 : 将虚拟机内存的 PFN对应的物理内存页地址注册至 RDMA网 卡;
其中, 可以 居 S302建立虚拟机的对应关系过程中获取的虚拟机内 存的物理内存页地址, 将虚拟机全部内存的物理页地址注册至 RDMA 网 卡 ,也可以才艮据虚拟机的标识查询对应关系库,获取该虚拟机的对应关系 , 再才艮据该对应关系查找该虚拟机内存的 PFN 对应的物理内存页地址, 然 后将虚拟机全部内存的物理页地址注册至 RDMA 网卡。 其中, 对应关系 库中可以包含每一个待迁移的虚拟机的对应关系。 例如, 居虚拟机 1的标识查询对应关系库, 得到虚拟机 1的对应关 系, 再才艮据虚拟机 1 内存的 PFN查询虚拟机 1的对应关系, 获取虚拟机 1 内存的物理内存页地址,将虚拟机 1 内存的物理内存页地址注册至 RDMA 网卡。 示例性的, 若待迁移的虚拟机包含更多个, 则可以将所有虚拟机内存 的物理内存页地址分别注册至 RDMA网卡 13。
S304: 获取虚拟机对应的用户态进程触发的数据发送请求, 其中, 该 数据发送请求包含用户态进程对应的虚拟机的标识, 以及请求发送的内存 数据的 PFN; 例如, 如果有三个用户态进程, 分别请求发送虚拟机 1、 虚拟机 2和 虚拟机 3的部分内存数据,接收虚拟机 1对应的用户态进程 1发送的数据 发送请求 1 , 以及虚拟机 2对应的用户态进程 2发送的数据发送请求 2 , 以及虚拟机 3对应的用户态进程 3发送的数据发送请求 3。 其中,数据发送请求 1 包含虚拟机 1的标识和用户态进程 1请求发送 的虚拟机 1的内存数据的 PFN、数据发送请求 2包含虚拟机 2的标识和用 户态进程 2请求发送的虚拟机 2的内存数据的 PFN、数据发送请求 3中包 含虚拟机 3的标识和用户态进程 3请求发送的虚拟机 3的内存数据的 PFN。 示例性的, 若待迁移的虚拟机个数包含更多个时, 获取每一个虚拟机 分别对应的用户态进程发送的数据发送请求,每个用户态进程管理对应的 虚拟机内存数据的迁移。 S305 : 将数据发送请求分别放入数据发送请求队列中; 可选的,可以按照获取到数据发送请求的时间的先后顺序将数据发送 请求分别放入数据发送请求队列中, 例如, 如图 4 , 为本发明实施例提供 的一种数据发送请求队列的示意图, 如图所示, 若依次获取到数据发送请 求 1 , 数据发送请求 2 , 数据发送请求 3 , 则, 首先, 将用户态进程 1发送 的数据发送请求 1放入数据发送请求队列中, 然后, 将用户态进程 2发送 的数据发送请求 2放入数据发送请求 1后面的数据发送请求队列中,再然 后, 将用户态进程 3发送的数据发送请求 3放入数据发送请求 2后面的数 据发送请求队列中。 可选的,可以按照获取的数据发送请求的优先级将数据发送请求分别 放入数据发送请求队列中, 例如, 若获取到 3个数据发送请求, 优先级由 高到低依次为数据发送请求 1 , 数据发送请求 2 , 数据发送请求 3 , 则, 首 先, 将用户态进程 1发送的数据发送请求 1放入数据发送请求队列中, 然 后, 将用户态进程 2发送的数据发送请求 2放入数据发送请求 1后面的数 据发送请求队列中, 再然后, 将用户态进程 3发送的数据发送请求 3放入 数据发送请求 2后面的数据发送请求队列中。 当然, 若虚拟机的个数包含更多个, 则可以按上述方式将每个虚拟机 对应的用户态进程分别发送的数据发送请求按序放入数据发送请求队列 中。
S306: 按顺序提取数据发送请求队列中的数据发送请求; 例如,如图 4所示,首先从数据发送请求队列中提取数据发送请求 1 , 再提取数据发送请求 2 , 最后提取发送请求 3。
S307: 根据提取数据发送请求中虚拟机标识查询对应关系库,得到该 虚拟机的对应关系;
S308: 根据数据发送请求中的 PFN查询该虚拟机的对应关系, 查找 数据发送请求请求发送的内存数据的物理内存页地址;
S309: 通过 RDMA网卡依次数据发送请求队列中的数据发送请求请
S310: 异步通知每一个用户态进程; 例如, 通过 RDMA网卡发送完数据发送请求 1 的内存数据后, 异步 通知数据发送请求 1对应的用户态进程 1 ;通过 RDMA网卡发送完数据发 送请求 2的内存数据后, 通知数据发送请求 2对应的用户态进程 2; 通过 RDMA网卡发送完数据发送请求 3的内存数据后,异步通知数据发送请求 3对应的用户态进程 3。
S31 1 : 虚拟机 16的内存数据是否全部发送至目的物理机 200 , 若否, 则执行步骤 312 , 若是, 则执行步骤 313 ;
S312: 再按序执行 S305-S31 1步骤;
其中, 在上述发送数据的过程中, 可以采用迭代的方式来发送, 以保 证虚拟机 16在迁移过程中的正常运行。
S313 : 将虚拟机 16的对应关系删除, 并注消虚拟机 16内存, 将虚拟 机 16在源物理机 100上销毁; 进而 , 虚拟机 26在目的物理主机 200上被 启动。
至此,完成虚拟机 16从源物理主机 100迁移至目的物理主机 200的 过程。
由上可见, 本发明实施例中, 通过获取特权虚拟机用户态进程发送 的虚拟机的迁移命令, 并根据每个虚拟机的迁移命令中包含的虚拟机的 标识建立每个虚拟机内存的 PFN与物理内存页地址的对应关系; 根据每 个虚拟机的对应关系, 可以获取每个虚拟机内存的 PFN对应的物理内存 页地址, 并将每个虚拟机的物理内存页地址注册至该 RDMA网卡; 再通 据发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟 机的内存映射到用户态空间并通过超级调用更新页表, 通过该待迁移虚 拟的对应关系以及数据发送求中的 PFN , 可直接查询获取请求发送的内 存数据对应的物理内存页地址, 进而大大降低了虚拟机所在的物理机中 的处理器利用率及时间开销, 一定程度上解决了现有技术中由于在虚拟 化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到用户态空 间并通过超级调用更新页表, 导致虚拟机所在的物理机中的处理器利用 率及时间开销较大的问题。 而且, 因为在 RDMA网卡发送数据前, 把每个虚拟机的物理内存页 地址一次性注册至该 RDMA网卡,可以保证 RDMA网卡根据用户态进程 发送的数据发送请求成功传输相关的数据; 更进一步的, 可以将分别获取的每一个虚拟机对应的用户态进程的数据发送请求 通过数据发送请求队列进行统一管理, 可以实现针对不同的用户态进程 的数据迁移设置不同优先级, 进而对不同的业务进行 QoS优化, 提高虚 拟机迁移的性能。
实施例三 参见图 5 , 为本发明实施例提供的另一种虚拟机迁移的方法, 该方法 可以由物理主机 100来执行, 例如, 可以由物理主机 100运行的 Hostl7 执行, 如图 5所示, 可以包括以下步骤:
S501 : 获取特权虚拟机用户态进程发送的虚拟机的迁移命令, 其中, 虚拟机的迁移命令包含虚拟机的标识; 示例性的, 虚拟机可以为一个, 也可以为多个, 本发明实施例对此不 进行限制, 但虚拟机所在的源物理主机相同。 示例性的, Hostl 7中的特权虚拟机 15上加载了 RDMA网卡 13对应 的网卡驱动, 并封装了所有的 RDMA通信接口, 每个 RDMA通信接口分 应于一个虚拟机, 例如, 有三个虚拟机, 分别为虚拟机 1、 虚拟机 2和虚 拟机 3 , 虚拟机 1对应 RDMA通信接口 1 , 虚拟机 2对应 RDMA通信接 口 2 , 虚拟机 3对应 RDMA通信接口 3 , RDMA通信接口 1、 RDMA通信 接口 2和 RDMA通信接口 3都封装在特权虚拟机的网卡驱动中。 其中, RDMA通信接口用于创建保护域、 队列对等。 示例性的, 一个用户态进程对应一个虚拟机, 例如, 有三个虚拟机, 分别为虚拟机 1、 虚拟机 2和虚拟机 3 , 虚拟机 1对应 RDMA通信接口 1 和用户态进程 1 , 虚拟机 2对应 RDMA通信接口 2和用户态进程 2 , 虚拟 机 3对应 RDMA通信接口 3和用户态进程 3 , RDMA通信接口 1、 RDMA 通信接口 2和 RDMA通信接口 3都封装在特权虚拟机 15中, 特权虚拟机 15中的 RDMA通信接口 1、 RDMA通信接口 2和 RDMA通信接口 3分别 接收用户态进程 1、 用户态进程 2和用户态进程 3分别发送的虚拟机 1、 虚拟机 2和虚拟机 3的迁移命令。 示例性的, 虚拟机的标识可以为虚拟机的域名 ( IDentity , 简称 ID ) , 也可以为可以唯一代表虚拟机的其它标识, 本发明实施例对此不进行限 制。
S502: 才艮据虚拟机的标识建立虚拟机的对应关系,虚拟机的对应关系 包含虚拟机内存的 PFN与物理内存页地址的对应关系;
示例性的, Hostl 7中的 VMM14可以才艮据所述迁移请求中的所述虚 拟机的标识获取所述虚拟机内存的地址空间; 然后根据所述地址空间获取所述虚拟机内存的 PFN; 再根据所述虚拟机内存的 PFN 计算所述虚拟机内存的物理内存页 地址; 建立所述虚拟机内存的 PFN 与所述虚拟机内存的物理内存页地址 之间的对应关系。 示例性的, 例如, 若虚拟机 1、 虚拟机 2和虚拟机 3分别对应一个虚 拟机的域 ID , Hostl7中的 VMM 14根据虚拟机 1的域 ID可以查询虚拟机 1对应的地址空间,进而获取该虚拟机 1对应的 PFN,假设虚拟机 1的 PFN 范围为 0〜65535 , VMM 14根据虚拟机 1的 PFN计算虚拟机 1对应的物理 内存页地址, 假设为 0x00010000〜0x0001ffff, Host 17 可以基于此建立两 者的对应关系, 虚拟机 2和虚拟机 3与虚拟机 1类似。 其中, 虚拟机的对应关系可以为虚拟机内存的 PFN与物理内存页地 址的——对应的关系表的形式,也可以为其它可以包含虚拟机内存的 PFN 与物理内存页地址的对应关系的任意形式, 本发明实施例对此不进行限 制。
S503 : 获取虚拟机对应的用户态进程触发的数据发送请求, 其中, 该 数据发送请求包含用户态进程对应的虚拟机的标识, 以及请求发送的内存 数据的 PFN; 例如, 如果有三个用户态进程, 分别请求发送虚拟机 1、 虚拟机 2和 虚拟机 3的部分内存数据, 获取虚拟机 1对应的用户态进程 1触发的数据 发送请求 1 , 以及虚拟机 2对应的用户态进程 2触发的数据发送请求 2 , 以及虚拟机 3对应的用户态进程 3触发的数据发送请求 3。 其中,数据发送请求 1 包含虚拟机 1的标识和用户态进程 1请求发送 的虚拟机 1的内存数据的 PFN、数据发送请求 2包含虚拟机 2的标识和用 户态进程 2请求发送的虚拟机 2的内存数据的 PFN、数据发送请求 3中包 含虚拟机 3的标识和用户态进程 3请求发送的虚拟机 3的内存数据的 PFN。 示例性的, 若待迁移的虚拟机个数包含更多个时, 获取每一个虚拟机 分别对应的用户态进程触发的数据发送请求,每个用户态进程管理对应的 虚拟机内存数据的迁移。
S504: 将数据发送请求分别放入数据发送请求队列中; 可选的,可以按照获取到数据发送请求的时间的先后顺序将数据发送 请求分别放入数据发送请求队列中, 例如, 如图 4 , 为本发明实施例提供 的一种数据发送请求队列的示意图, 如图所示, 若依次获取到数据发送请 求 1 , 数据发送请求 2 , 数据发送请求 3 , 则, 首先, 将用户态进程 1发送 的数据发送请求 1放入数据发送请求队列中, 然后, 将用户态进程 2发送 的数据发送请求 2放入数据发送请求 1后面的数据发送请求队列中, 再然 后, 将用户态进程 3发送的数据发送请求 3放入数据发送请求 2后面的数 据发送请求队列中。 可选的,可以按照获取的数据发送请求的优先级将数据发送请求分别 放入数据发送请求队列中, 例如, 若获取到 3个数据发送请求, 优先级由 高到低依次为数据发送请求 1 , 数据发送请求 2 , 数据发送请求 3 , 则, 首 先, 将用户态进程 1发送的数据发送请求 1放入数据发送请求队列中, 然 后, 将用户态进程 2发送的数据发送请求 2放入数据发送请求 1后面的数 据发送请求队列中, 再然后, 将用户态进程 3发送的数据发送请求 3放入 数据发送请求 2后面的数据发送请求队列中。 当然, 若虚拟机的个数包含更多个, 则可以按上述方式将每个虚拟机 对应的用户态进程分别发送的数据发送请求按序放入数据发送请求队列 中。
S505 : 按顺序提取数据发送请求队列中的数据发送请求; 例如,如图 4所示,首先从数据发送请求队列中提取数据发送请求 1 , 再提取数据发送请求 2 , 最后提取发送请求 3。 S506: 根据提取数据发送请求中虚拟机标识查询对应关系库,得到该 虚拟机的对应关系;
S507: 根据数据发送请求中的 PFN查询该虚拟机的对应关系, 查找 数据发送请求请求发送的内存数据的物理内存页地址;
S508: 将提取的数据发送请求对应的物理内存页地址注册至 RDMA 网卡; 其中,按照提取的数据发送请求的顺序将各个数据发送请求分别对应 的物理内存页地址分别注册至 RDMA网卡。 例如 , 特权虚拟机 15提取数 据发送请求队列中的数据发送请求 1并将数据发送请求 1对应的物理内存 页地址注册至 RDMA网卡;再提取数据发送请求队列中的数据发送请求 2 并将数据发送请求 2对应的物理内存页地址注册至 RDMA网卡; 再按顺 序提取数据发送请求队列中的数据发送请求 3并将数据发送请求 3对应的 物理内存页地址注册至 RDMA网卡。
S509: 通过 RDMA网卡依次数据发送请求队列中的数据发送请求请
S510: 异步通知每一个用户态进程; 例如, 通过 RDMA网卡发送完数据发送请求 1 的内存数据后, 异步 通知数据发送请求 1对应的用户态进程 1 ;通过 RDMA网卡发送完数据发 送请求 2的内存数据后, 通知数据发送请求 2对应的用户态进程 2; 通过 RDMA网卡发送完数据发送请求 3的内存数据后,异步通知数据发送请求 3对应的用户态进程 3。
S51 1 : 注销已经发送的数据发送请求对应的虚拟机的内存;
S512: 虚拟机 16的内存数据是否全部发送至目的物理机 200 , 若否, 则执行步骤 513 , 若是, 则执行步骤 514;
S513 : 执行步骤 S503-S512。
S514: 将虚拟机 16的对应关系删除, 并注消虚拟机 16内存, 将虚拟 机 16在源物理机 100上销毁, 进而虚拟机 26在目的物理主机 200上被启 动。
若是迁移完成, Hostl7 将虚拟机的对应关系删除, 并注消虚拟机内 存。
至此,完成虚拟机 16从源物理主机 100迁移至目的物理主机 200的 过程。 由上可见, 本发明实施例中, 通过获取特权虚拟机用户态进程触发 的虚拟机的迁移命令, 并根据虚拟机的迁移命令中包含的虚拟机的标识 建立虚拟机内存的 PFN与物理内存页地址的对应关系; 根据虚拟机的对 应关系, 可以获取虚拟机内存的 PFN 对应的物理内存页地址, 再通过 RDMA网卡发送数据之前将虚拟机的物理内存页地址注册至该 RDMA网 卡; 再通过 RDMA 网卡将请求发送的内存数据的物理内存页地址存储 的内存数据发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需 要将虚拟机的内存映射到用户态空间并通过超级调用更新页表, 通过该 待迁移虚拟的对应关系以及数据发送求中的 PFN, 可直接查询获取请求 发送的内存数据对应的物理内存页地址, 进而大大降低了虚拟机所在的 物理机中的处理器利用率及时间开销, 一定程度上解决了现有技术中由 于在虚拟化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到 用户态空间并通过超级调用更新页表, 导致虚拟机所在的物理机中的处 理器利用率及时间开销较大的问题。 而且, 可以将每一个虚拟机对应的用户态进程分别发送的数据发送 请求通过数据发送请求队列进行统一管理, 可以实现针对不同的用户态 进程的数据迁移设置不同优先级, 进而对不同的业务进行 QoS优化, 提 高虚拟机迁移的性能。
实施例四 本发明实施例提供一种宿主机 Host60 , 该 Host60与第一虚拟机同部 署于一个物理主机, 在一种实现方式下, 该 Host 60可以包括特权虚拟机 和 VMM ,其中特权虚拟机和 VMM与第一虚拟机同部署于一个物理主机, 参见图 6 , 该 Host60可以包括: 获取单元 601 ,用于获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发送请求包含所述第一虚拟机的标识, 以及请求发送的 内存数据的 PFN; 第一查询单元 602 , 用于 居所述第一虚拟机的标识查询对应关系 信息库, 得到所述第一虚拟机的对应关系, 其中, 所述对应关系信息库 包含待迁移的虚拟机的对应关系, 所述虚拟机的对应关系为基于所述虚 拟机的标识获取所述虚拟机内存的地址空间, 以及所述地址空间对应的 所述虚拟机内存的 PFN ,以及所述虚拟机内存的 PFN对应的所述虚拟机 内存的物理内存页地址后,建立的所述虚拟机内存的 PFN与所述虚拟机 内存的物理内存页地址的对应关系; 第二查询单元 603 , 用于根据所述请求发送的内存数据的 PFN查询 所述第一查询单元 602得到的所述第一虚拟机的对应关系, 得到所述请 求发送的内存数据的物理内存页地址; 驱动发送单元 604 , 用于通过 RDMA网卡将所述第二查询单元 603 目的物理主机。 本发明实施例提供的 Host60 , 该 Host60可获取发送第一虚拟机内 存数据的数据发送请求,其中,该数据发送请求包含第一虚拟机的标识, 以及请求发送的内存数据的 PFN; 该 Host根据第一虚拟机的标识查询 对应关系信息库, 获取第一虚拟机的对应关系, 其中, 该对应关系信息 库包含待迁移的虚拟机的对应关系, 虚拟机的对应关系为基于该虚拟机 的标识获取该虚拟机内存的地址空间, 以及该地址空间对应的该虚拟机 内存的 PFN ,以及该虚拟机内存的 PFN对应的该虚拟机内存的物理内存 页地址后, 建立的该虚拟机内存的 PFN与物理内存页地址的对应关系; 所以, 该 Host可根据请求发送的内存数据的 PFN查询第一虚拟机的对 应关系, 获取请求发送的内存数据的物理内存页地址; 再通过 RDM A 目的物理主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟机的内存 映射到用户态空间并通过超级调用更新页表, 通过该待迁移虚拟的对应 关系以及数据发送求中的 PFN, 可直接查询获取请求发送的内存数据对 利用率及时间开销, 一定程度上解决了现有技术中由于在虚拟化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到用户态空间并通过超 级调用更新页表, 导致虚拟机所在的物理机中的处理器利用率及时间开 销较大的问题。
实施例五 参见图 7 ,为本发明实施例提供的另一种 Host70 ,参见图 7 ,该 Host70 包括: 建立单元 701 , 第一注册单元 702 , 获取单元 703 , 第一查询单元 704 , 第二查询单元 705 , 驱动发送单元 706 , 其中, 获取单元 703 , 第一查询单元 704 , 第二查询单元 705 , 驱动 发送单元 706的具体功能参见实施例四中所述, 在此不再赘述。 建立单元 701 , 用于获取特权虚拟机用户态进程触发的迁移所述第 一虚拟机的内存数据的迁移请求, 其中, 所述迁移请求中包含所述第一 虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述 第一虚拟机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理 内存页地址;建立所述第一虚拟机内存的 PFN与所述第一虚拟机内存的 物理内存页地址之间的对应关系; 第一注册单元 702 , 用于在建立单元 701根据所述第一虚拟机内存 的 PFN计算所述第一虚拟机内存的物理内存页地址之后, 获取单元 702 获取发送第一虚拟机内存数据的数据发送请求之前,
将建立单元 701获取的第一虚拟机内存的物理内存页地址注册至所 述 RDMA网卡。 本实施例中, 第一注册单元 702将第一虚拟机全部内存的物理内存 页地址一次注册给 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物 理内存页地址为 0x00010000〜0x0001 ffff , 则第一注册单元 702 将 0x00010000〜0x0001ffff—次性全部注册至 RDMA网卡。 进一步的, 所述获取单元 601具体用于, 依序提取数据发送请求队 列中的数据发送请求, 其中, 所述数据发送请求包含不同的待迁移的虚 拟机的数据发送请求, 所述数据发送请求队列中的数据发送请求按照时 间先后或者优先级高低进行排序。 本发明实施例提供的 Host70 , 用于获取特权虚拟机用户态进程发送 的虚拟机的迁移命令, 并根据每个虚拟机的迁移命令中包含的虚拟机的 标识建立每个虚拟机内存的 PFN与物理内存页地址的对应关系; 根据每 个虚拟机的对应关系, 可以获取每个虚拟机内存的 PFN对应的物理内存 页地址, 并将每个虚拟机的物理内存页地址注册至该 RDMA网卡; 再通 据发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟 机的内存映射到用户态空间并通过超级调用更新页表, 通过该待迁移虚 拟的对应关系以及数据发送求中的 PFN , 可直接查询获取请求发送的内 存数据对应的物理内存页地址, 进而大大降低了虚拟机所在的物理机中 的处理器利用率及时间开销, 一定程度上解决了现有技术中由于在虚拟 化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到用户态空 间并通过超级调用更新页表, 导致虚拟机所在的物理机中的处理器利用 率及时间开销较大的问题。 而且, 因为在驱动发送单元 706通过 RDMA网卡发送数据前, 第一 注册单元 702把每个虚拟机的物理内存页地址一次性注册至该 RDMA网 卡, 可以保证 RDMA网卡根据用户态进程发送的数据发送请求成功传输 相关的数据。 而且, 获取单元 703 可以将分别获取的每一个虚拟机对应的用户态 进程的数据发送请求通过数据发送请求队列进行统一管理, 可以实现针 对不同的用户态进程的数据迁移设置不同优先级, 进而对不同的业务进 行 QoS优化, 提高虚拟机迁移的性能。
实施例六 参见图 8 ,为本发明实施例提供的另一种 Host80 ,参见图 8 ,该 Host80 包括: 建立单元 801 , 获取单元 802 , 第一查询单元 803 , 第二查询单元 804 , 第一注册单元 805 , 驱动发送单元 806 , 其中,
建立单元 801 , 用于获取特权虚拟机用户态进程触发的迁移所述第 一虚拟机的内存数据的迁移请求, 其中, 所述迁移请求中包含所述第一 虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述 第一虚拟机内存的地址空间; 居所述地址空间获取所述虚拟机内存的
PFN; 根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理 内存页地址;建立所述第一虚拟机内存的 PFN与所述第一虚拟机内存的 物理内存页地址之间的对应关系; 获取单元 802 ,用于获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发送请求包含所述第一虚拟机的标识, 以及请求发送的 内存数据的 PFN; 优选的, 所述获取单元 802具体用于, 依序提取数据发送请求队列 中的数据发送请求, 其中, 所述数据发送请求包含不同的待迁移的虚拟 机的数据发送请求, 所述数据发送请求队列中的数据发送请求按照时间 先后或者优先级高低进行排序。 第一查询单元 803 , 用于 居所述第一虚拟机的标识查询对应关系 信息库, 得到所述第一虚拟机的对应关系, 其中, 所述对应关系信息库 包含待迁移的虚拟机的对应关系, 所述虚拟机的对应关系为基于所述虚 拟机的标识获取所述虚拟机内存的地址空间, 以及所述地址空间对应的 所述虚拟机内存的 PFN ,以及所述虚拟机内存的 PFN对应的所述虚拟机 内存的物理内存页地址后,建立的所述虚拟机内存的 PFN与所述虚拟机 内存的物理内存页地址的对应关系; 第二查询单元 804 , 用于根据所述请求发送的内存数据的 PFN查询 所述第一查询单元 803得到的所述第一虚拟机的对应关系, 得到所述请 求发送的内存数据的物理内存页地址; 第二注册单元 805 , 用于将第二查询单元 804得到的得到所述请求 发送的内存数据的物理内存页地址注册至 RDMA网卡; 本实施例中, 第二注册单元 805根据每次的数据发送请求, 分别就 将每个数据发送请求请求发送的内存数据的物理内存页地址分批次的 注册至 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内存页地 址为 0x00010000〜0x0001ffff, 第一个数据发送请求请求发送的内存数据 的物理内存页地址为 0x00010000〜0x000100ff,则第二注册单元 805在获 取第一个数据发送请求之后, 通过 RDMA 网卡将物理内存页地址 0x00010000-0x000 lOOff 上存储的内存数据发送给目的物理主机之前,将 物理内存页地址 0x00010000〜0x0001 ffff 注册至 RDM A网卡; 再例如, 第二个数据发送请求请求发送的内存数据的物理内存页地址为
0x00010100-0x000101 ff, 则第二注册单元 805在获取第二个数据发送请 求之后, 通过 RDMA网卡将物理内存页地址 0x00010100〜0x000101ff 上 存储的内存数据发送给目 的物理主机之前, 将物理内存页地址 0x00010100〜0x000101 ff注册至 RDMA网卡。 驱动发送单元 806 , 用于在第二注册单元 805将第二查询单元 804 得到的得到所述请求发送的内存数据的物理内存页地址注册至 RDMA 网卡后, 通过 RDMA 网卡将所述第二查询单元 804得到的请求发送的
本发明实施例提供的 Host80 , 用于获取特权虚拟机用户态进程触发 的虚拟机的迁移命令, 并根据虚拟机的迁移命令中包含的虚拟机的标识 建立虚拟机内存的 PFN与物理内存页地址的对应关系; 根据虚拟机的对 应关系, 可以获取虚拟机内存的 PFN 对应的物理内存页地址, 再通过 RDMA网卡发送数据之前将虚拟机的物理内存页地址注册至该 RDMA网 卡; 再通过 RDMA 网卡将请求发送的内存数据的物理内存页地址存储 的内存数据发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需 要将虚拟机的内存映射到用户态空间并通过超级调用更新页表, 通过该 待迁移虚拟的对应关系以及数据发送求中的 PFN, 可直接查询获取请求 发送的内存数据对应的物理内存页地址, 进而大大降低了虚拟机所在的 物理机中的处理器利用率及时间开销, 一定程度上解决了现有技术中由 于在虚拟化平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到 用户态空间并通过超级调用更新页表, 导致虚拟机所在的物理机中的处 理器利用率及时间开销较大的问题。 而且, 可以将每一个虚拟机对应的用户态进程分别发送的数据发送 请求通过数据发送请求队列进行统一管理, 可以实现针对不同的用户态 进程的数据迁移设置不同优先级, 进而对不同的业务进行 QoS优化, 提 高虚拟机迁移的性能。 而且, 获取单元 703可以将分别获取的每一个虚拟机对应的用户态 进程的数据发送请求通过数据发送请求队列进行统一管理, 可以实现针 对不同的用户态进程的数据迁移设置不同优先级, 进而对不同的业务进 行 QoS优化, 提高虚拟机迁移的性能。
实施例七 本发明实施例提供一种物理主机 90 , 参见图 9 , 该物理主机 90包括 硬件, 其中所述硬件可以包括 RDMA网卡 901 , 可选的, 所述硬件还可以 包括至少一个处理器 902、 存储器 903 , 用于进行该物理主机 90内部各设 备之间的连接的至少一个通信总线 904 , 用于实现这些装置之间的连接和 相互通信。 其中, 通信总线 904 可以是工业标准体系结构 ( Industry Standard Architecture , 简称为 ISA ) 总线、 夕卜部设备互连 ( Peripheral Component, 简称为 PCI ) 总线或扩展工业标准体系结构 (Extended Industry Standard Architecture , 简称为 EISA ) 总线等。 该总线 904可以分为地址总线、 数 据总线、 控制总线等。 为便于表示, 图 9中仅用一条粗线表示, 但并不表 示仅有一根总线或一种类型的总线。 存储器 903可以包括随机存取存储器,并向处理器 803提供指令和数 据。 处理器 902可以是一个中央处理器 ( Central Processing Unit, 简称为 CPU ) , 或者是特定集成电路 ( Application Specific Integrated Circuit, 简 称为 ASIC ) , 或者是被配置成实施本发明实施例的一个或多个集成电路。
RDMA网卡 901 可以为支持 RDMA功能的各种网卡, 例如, 可以为 无线宽带(InfiniBand)卡或以太网(RDMA over Converged Ethernet , 简称 RoCE)卡等。 其中, 通过读取存储器 903存储的指令, 处理器 902用于, 获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的 PFN; 根据所述第一虚拟机的标识查询对应关系信息库, 得到所述第一虚 拟机的对应关系, 其中, 所述对应关系信息库包含待迁移的虚拟机的对 应关系, 所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间, 以及所述地址空间对应的所述虚拟机内存的 PFN, 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后,建立的所述虚拟机内存的 PFN与所述虚拟机内存的物理内存页地址 的对应关系; 根据所述请求发送的内存数据的 PFN 查询获取的所述第一虚拟机 的对应关系, 得到所述请求发送的内存数据的物理内存页地址; 通过 RDMA 网卡 901 将获取的请求发送的内存数据的物理内存页 地址存储的内存数据发送至目的物理主机。 进一步的, 所述处理器 902还用于: 在获取发送第一虚拟机内存数据的数据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。 进一步的, 所述处理器 902还用于: 将第一虚拟机内存数据的物理 页内存地址注册给 RDMA 网卡, 具体可以通过以下两种方式中任意一 种方式来实现:
1、 在根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的 物理内存页地址之后, 获取发送第一虚拟机内存数据的数据发送请求之 前, 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。 在这种方式下, 处理器 902将第一虚拟机全部内存的物理内存页地 址一次注册给 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内 存页地址为 0x00010000〜0x0001ffff,则 Host901将 0x00010000〜0x0001ffff 一次性全部注册至 RDMA网卡。
2、 在根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的 对应关系, 得到所述请求发送的内存数据的物理内存页地址之后, 通过 内存数据发送至目的物理主机之前, 将所述请求发送的内存数据的物理 内存页地址注册至所述 RDMA网卡。 在这种方式下, 处理器 902根据每次的数据发送请求, 分别就将每 个数据发送请求请求发送的内存数据的物理内存页地址分批次的注册 至 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内存页地址为 0x00010000-0x000 lffff, 第一个数据发送请求请求发送的内存数据的物 理内存页地址为 0x00010000〜0x000100ff,则处理器 902在获取第一个数 据发送请 求之后 , 通过 RDMA 网 卡将 物 理 内 存 页 地址 0x00010000-0x000 lOOff 上存储的内存数据发送给目的物理主机之前,将 物理内存页地址 0x00010000〜0x0001 ffff 注册至 RDMA网卡; 再例如, 第二个数据发送请求请求发送的内存数据的物理内存页地址为
0x00010100〜0x000101 ff, 则 Host901在获取第二个数据发送请求之后, 通过 RDMA网卡将物理内存页地址 0x00010100〜0x000101 ff 上存储的内 存数据发送给 目 的 物 理 主机之前 , 将物 理 内 存 页 地 址 0x00010100〜0x000101 ff注册至 RDMA网卡。
本发明实施例提供的物理主机 90 ,可获取发送第一虚拟机内存数据 的数据发送请求, 其中, 该数据发送请求包含第一虚拟机的标识, 以及 请求发送的内存数据的 PFN; 该 Host根据第一虚拟机的标识查询对应 关系信息库, 获取第一虚拟机的对应关系, 其中, 该对应关系信息库包 含待迁移的虚拟机的对应关系, 虚拟机的对应关系为基于该虚拟机的标 识获取该虚拟机内存的地址空间, 以及该地址空间对应的该虚拟机内存 的 PFN ,以及该虚拟机内存的 PFN对应的该虚拟机内存的物理内存页地 址后,建立的该虚拟机内存的 P F N与物理内存页地址的对应关系;所以, 该 Host可根据请求发送的内存数据的 PFN查询第一虚拟机的对应关系, 获取请求发送的内存数据的物理内存页地址; 再通过 RDMA 网卡将请 主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟机的内存映射到用 户态空间并通过超级调用更新页表, 通过该待迁移虚拟的对应关系以及 数据发送求中的 PFN , 可直接查询获取请求发送的内存数据对应的物理 时间开销, 一定程度上解决了现有技术中由于在虚拟化平台下, 虚拟机 迁移的过程中, 需要将虚拟机的内存映射到用户态空间并通过超级调用 更新页表, 导致虚拟机所在的物理机中的处理器利用率及时间开销较大 的问题。
实施例八 本发明实施例提供另一种物理主机 100 , 参见图 10 , 该物理主机 100 包含硬件层、 运行在所述硬件层之上的 Hostl001、 以及运行在所述 HostlOO l之上的至少一个虚拟机 VM1002 , 以及所述硬件层包括 RDMA 网卡 1003 , 可选的, 还可以包括处理器 1004 和内存 1005 ; 其中, Host 可以包括该物理主机 100上的 VMM和运行于该 VMM上的特权虚拟机, 虚拟机 1002为该物理主机 100上除特权虚拟机之外的其他虚拟机,虚拟 机 1002包括第一虚拟机。 其中, HostlOOl用于, 获取发送第一虚拟机内存数据的数据发送请求, 其中, 所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的 PFN; 根据所述第一虚拟机的标识查询对应关系信息库, 得到所述第一虚 拟机的对应关系, 其中, 所述对应关系信息库包含待迁移的虚拟机的对 应关系, 所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间, 以及所述地址空间对应的所述虚拟机内存的 PFN, 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后,建立的所述虚拟机内存的 PFN与所述虚拟机内存物理内存页地址的 对应关系;
根据所述请求发送的内存数据的 PFN 查询获取的所述第一虚拟机 的对应关系, 得到所述请求发送的内存数据的物理内存页地址; 通过 RDMA网卡 1003将获取的请求发送的内存数据的物理内存页 地址存储的内存数据发送至目的物理主机。 进一步的, 所述 HostlOOl还用于: 在获取发送第一虚拟机内存数据的数据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数 据的迁移请求, 其中, 所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟 机内存的地址空间; 居所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN 计算所述第一虚拟机内存的物理 内存页地址; 建立所述第一虚拟机内存的 PFN 与所述第一虚拟机内存的物理内 存页地址之间的对应关系。 进一步的, 所述 HostlOOl还用于: 将第一虚拟机内存数据的物理页内存地址注册给 RDMA 网卡, 具 体可以通过以下两种方式中任意一种方式来实现:
1、 在根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的 物理内存页地址之后, 获取发送第一虚拟机内存数据的数据发送请求之 前, 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。 在这种方式下, HostlOOl将第一虚拟机全部内存的物理内存页地址 一次注册给 RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内存 页地址为 0x00010000〜0x0001ffff, 则 Host901将 0x00010000〜0x0001ffff 一次性全部注册至 RDMA网卡。
2、 在根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的 对应关系, 得到所述请求发送的内存数据的物理内存页地址之后, 通过 内存数据发送至目的物理主机之前, 将所述请求发送的内存数据的物理 内存页地址注册至所述 RDMA网卡。 在这种方式下, HostlOOl根据每次的数据发送请求, 分别就将每个 数据发送请求请求发送的内存数据的物理内存页地址分批次的注册至
RDMA 网卡, 例如, 第一虚拟机全部内存对应的物理内存页地址为 0x00010000-0x000 lffff, 第一个数据发送请求请求发送的内存数据的物 理内存页地址为 0x00010000〜0x000100ff, 则 HostlOOl在获取第一个数 据发送请 求之后 , 通过 RDMA 网 卡将 物 理 内 存 页 地址 0x00010000-0x000 lOOff 上存储的内存数据发送给目的物理主机之前,将 物理内存页地址 0x00010000〜0x0001 ffff 注册至 RDMA网卡; 再例如, 第二个数据发送请求请求发送的内存数据的物理内存页地址为
0x00010100〜0x000101 ff, 则 HostlOOl在获取第二个数据发送请求之后, 通过 RDMA网卡将物理内存页地址 0x00010100〜0x000101 ff 上存储的内 存数据发送给 目 的 物 理 主机之前 , 将物 理 内 存 页 地 址 0x00010100〜0x000101 ff注册至 RDMA网卡。 本发明实施例的物理主机 100 , 用于获取发送第一虚拟机内存数据 的数据发送请求, 其中, 该数据发送请求包含第一虚拟机的标识, 以及 请求发送的内存数据的 PFN; 该 Host根据第一虚拟机的标识查询对应 关系信息库, 获取第一虚拟机的对应关系, 其中, 该对应关系信息库包 含待迁移的虚拟机的对应关系, 虚拟机的对应关系为基于该虚拟机的标 识获取该虚拟机内存的地址空间, 以及该地址空间对应的该虚拟机内存 的 PFN ,以及该虚拟机内存的 PFN对应的该虚拟机内存的物理内存页地 址后,建立的该虚拟机内存的 P F N与物理内存页地址的对应关系;所以, 可根据请求发送的内存数据的 PFN查询第一虚拟机的对应关系,获取请 求发送的内存数据的物理内存页地址; 再通过 RDMA 网卡将请求发送 此, 在虚拟机迁移的过程中, 不需要将虚拟机的内存映射到用户态空间 并通过超级调用更新页表, 通过该待迁移虚拟的对应关系以及数据发送 求中的 PFN, 可直接查询获取请求发送的内存数据对应的物理内存页地 一定程度上解决了现有技术中由于在虚拟化平台下, 虚拟机迁移的过程 中, 需要将虚拟机的内存映射到用户态空间并通过超级调用更新页表, 导致虚拟机所在的物理机中的处理器利用率及时间开销较大的问题。 实施例九 本发明实施例提供一种集群系统, 参见图 10 , 该集群系统包括: 多 台物理主机, 所述多台物理主机包括源物理主机和目的物理主机, 其中 每台物理主机包括硬件层、 运行在所述硬件层之上的 Host、 以及运行在 所述 Host之上的至少一个虚拟机 VM , 以及所述硬件层包括 RDMA网 卡, 可选的, 还可以处理器和内存。 其中, Host可以包括 Host所在的物 理主机上的 VMM和运行于该 VMM上的特权虚拟机。 以及, 本发明实施例的集群系统中包括的物理主机参考前述实施例 介绍的物理主机, 在此不再赘述。 本发明实施例的集群系统,源物理主机中的 Host可获取发送第一虚 拟机内存数据的数据发送请求, 其中, 该数据发送请求包含第一虚拟机 的标识, 以及请求发送的内存数据的 PFN; 该 Host根据第一虚拟机的 标识查询对应关系信息库, 获取第一虚拟机的对应关系, 其中, 该对应 关系信息库包含待迁移的虚拟机的对应关系, 虚拟机的对应关系为基于 该虚拟机的标识获取该虚拟机内存的地址空间, 以及该地址空间对应的 该虚拟机内存的 PFN ,以及该虚拟机内存的 PFN对应的该虚拟机内存的 物理内存页地址后,建立的该虚拟机内存的 PFN与物理内存页地址的对 应关系; 所以, 该 Host可根据请求发送的内存数据的 PFN查询第一虚 拟机的对应关系, 获取请求发送的内存数据的物理内存页地址; 再通过 发送至目的物理主机。 如此, 在虚拟机迁移的过程中, 不需要将虚拟机 的内存映射到用户态空间并通过超级调用更新页表, 通过该待迁移虚拟 的对应关系以及数据发送求中的 PFN, 可直接查询获取请求发送的内存 数据对应的物理内存页地址, 进而大大降低了虚拟机所在的物理机中的 处理器利用率及时间开销, 一定程度上解决了现有技术中由于在虚拟化 平台下, 虚拟机迁移的过程中, 需要将虚拟机的内存映射到用户态空间 并通过超级调用更新页表, 导致虚拟机所在的物理机中的处理器利用率 及时间开销较大的问题。 所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述 描述的系统, 装置和单元的具体工作过程, 可以参考前述方法实施例中的 对应过程, 在此不再赘述。 在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统, 装置 和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅 是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实 现时可以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成 到另一个系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论 的相互之间的耦合或直接耦合或通信连接可以是通过一些接口, 装置或单 元的间接耦合或通信连接, 可以是电性, 机械或其它的形式。 所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地 方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的 部分或者全部单元来实现本实施例方案的目的。 另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元 中, 也可以是各个单元单独物理包括, 也可以两个或两个以上单元集成在 一个单元中。 上述集成的单元既可以采用硬件的形式实现, 也可以采用硬 件加软件功能单元的形式实现。 上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算 机可读取存储介质中。 上述软件功能单元存储在一个存储介质中, 包括若 干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络 设备等)执行本发明各个实施例所述方法的部分步骤。 而前述的存储介质 包括: U盘、 移动硬盘、 只读存储器 ( Read-Only Memory, 简称 ROM ) 、 随机存取存储器 ( Random Access Memory, 简称 RAM ) 、 磁碟或者光盘 等各种可以存储程序代码的介质。 本领域普通技术人员可以理解上述实施例的各种方法中的全部或部 分步骤是可以通过程序来指令相关的硬件(例如处理器)来完成, 该程序 可以存储于一计算机可读存储介质中, 存储介质可以包括: 只读存储器、 随机存储器、 磁盘或光盘等。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修 改, 或者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不 使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权 利 要 求 书
1、 一种虚拟机内存数据的迁移方法,其特征在于,包括: 获取发送第一虚拟机内存数据的数据发送请求,其中 ,所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的物理页 框号 PFN; 根据所述第一虚拟机的标识查询对应关系信息库 , 得到所述第一虚 拟机的对应关系 , 其中 , 所述对应关系信息库包含待迁移的虚拟机的对 应关系 ,所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间 , 以及所述地址空间对应的所述虚拟机内存的 PFN , 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后,建立的所述虚拟机内存的 PFN与所述虚拟机内存的物理内存页地址 的对应关系 ; 根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的对应关 系 ,得到所述请求发送的内存数据的物理内存页地址;
通过远程直接内存读取 RDMA网卡将所述请求发送的内存数据的物 理内存页地址上所存储的内存数据发送至目的物理主机。
2、 根据权利要求 1所述的方法,其特征在于,在所述获取发送第一 虚拟机内存数据的数据发送请求之前,所述方法还包括: 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数据 的迁移请求,其中 ,所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟机 内存的地址空间 ; 根据所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理内 存页地址; 建立所述第一虚拟机内存的 PFN与所述第一虚拟机内存的物理内存 页地址之间的对应关系。
3、 根据权利要求 2所述的方法,其特征在于,在所述根据所述第一 虚拟机内存的 PFN计算所述第一虚拟机内存的物理内存页地址之后,所 述获取发送第一虚拟机内存数据的数据发送请求之前,所述方法还包括: 将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。
4、 根据权利要求 1或 2所述的方法,其特征在于,在所述根据所述 请求发送的内存数据的 PFN查询所述第一虚拟机的对应关系 ,得到所述 请求发送的内存数据的物理内存页地址之后 ,通过 RDMA网卡将所述请 求发送的内存数据的物理内存页地址上所存储的内存数据发送至目的物 理主机之前,所述方法还包括: 将所述请求发送的内存数据的物理内存页地址注册至所述 RDMA网 上
S o
5、 根据权利要求 1-4任一项所述方法,其特征在于 ,所述获取发送 第一虚拟机内存数据的数据发送请求包括: 依序提取数据发送请求队列中的数据发送请求,其中 ,所述数据发 送请求包含不同的待迁移的虚拟机的数据发送请求, 所述数据发送请求 队列中的数据发送请求按照时间先后或者优先级高低进行排序。
6、 一种宿主机 Host ,其特征在于 ,包括: 获取单元,用于获取发送第一虚拟机内存数据的数据发送请求,其 中 ,所述数据发送请求包含所述第一虚拟机的标识, 以及请求发送的内 存数据的物理页框号 PFN; 第一查询单元 ,用于根据所述第一虚拟机的标识查询对应关系信息 库 ,得到所述第一虚拟机的对应关系 , 其中 , 所述对应关系信息库包含 待迁移的虚拟机的对应关系 , 所述虚拟机的对应关系为基于所述虚拟机 的标识获取所述虚拟机内存的地址空间 , 以及所述地址空间对应的所述 虚拟机内存的 PFN , 以及所述虚拟机内存的 PFN对应的所述虚拟机内存 的物理内存页地址后 ,建立的所述虚拟机内存的 PFN与所述虚拟机内存 的物理内存页地址的对应关系; 第二查询单元,用于根据所述请求发送的内存数据的 PFN查询所述 第一查询单元得到的所述第一虚拟机的对应关系 , 获取所述请求发送的 内存数据的物理内存页地址; 驱动发送单元,用于通过远程直接内存读取 RDMA网卡将所述第二 查询单元得到的请求发送的内存数据的物理内存页地址上所存储的内存 数据发送至目的物理主机。
7、 根据权利要求 6所述的 Host ,其特征在于,所述 Host还包括 建立单元,用于在所述获取单元获取发送第一虚拟机内存数据的数 据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数据 的迁移请求,其中 ,所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟机 内存的地址空间 ; 根据所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理内 存页地址; 建立所述第一虚拟机内存的 PFN与所述第一虚拟机内存的物理内存 页地址之间的对应关系。
8、 根据权利要求 7所述的 Host ,其特征在于,所述 Host还包括: 第一注册单元,用于在所述建立单元根据所述第一虚拟机内存的 PFN计 算所述第一虚拟机内存的物理内存页地址之后 ,所述获取单元获取发送 第一虚拟机内存数据的数据发送请求之前 , 将所述建立单元获取的第一虚拟机内存的物理内存页地址注册至所 述 RDMA网卡。
9、 根据权利要求 6或 7所述的 Host ,其特征在于,所述 Host还包 括:第二注册单元 ,用于在所述第二查询单元根据所述请求发送的内存 数据的 PFN查询所述第一虚拟机的对应关系 ,得到所述请求发送的内存 数据的物理内存页地址之后,所述驱动发送单元通过 RDMA网卡将所述 请求发送的内存数据的物理内存页地址上所存储的内存数据发送至目的 物理主机之前, 将所述第二查询单元得到的请求发送的内存数据的物理内存页地址 注册至所述 RDMA网卡。
10、 根据权利要求 6-9任一项所述 Host ,其特征在于,所述获取单 元具体用于 , 依序提取数据发送请求队列中的数据发送请求 ,其中 ,所 述数据发送请求包含不同的待迁移的虚拟机的数据发送请求 ,所述数据 发送请求队列中的数据发送请求按照时间先后或者优先级高低进行排 序。
11、 一种物理主机 ,其特征在于 ,包括:硬件层、 运行在所述硬件 层之上的宿主机 Host、以及运行在所述 Host之上的至少一个虚拟机 VM , 以及所述硬件层包括远程直接内存读取 RDMA网卡;所述至少一个虚拟 机包括第一虚拟机,其中 ,
所述 Host用于 : 获取发送第一虚拟机内存数据的数据发送请求,其中 ,所述数据发 送请求包含所述第一虚拟机的标识, 以及请求发送的内存数据的物理页 框号 PFN; 根据所述第一虚拟机的标识查询对应关系信息库 , 得到所述第一虚 拟机的对应关系 , 其中 , 所述对应关系信息库包含待迁移的虚拟机的对 应关系 ,所述虚拟机的对应关系为基于所述虚拟机的标识获取所述虚拟 机内存的地址空间 , 以及所述地址空间对应的所述虚拟机内存的 PFN , 以及所述虚拟机内存的 PFN 对应的所述虚拟机内存的物理内存页地址 后 ,建立的所述虚拟机内存的 PFN与所述虚拟机内存的物理内存页地址 的对应关系; 根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的对应关 系 ,得到所述请求发送的内存数据的物理内存页地址; 通过所述远程直接内存读取 RDMA网卡将所述请求发送的内存数据 的物理内存页地址上所存储的内存数据发送至目的物理主机。
12、 根据权利要求 11所述的物理主机,其特征在于,所述 Host还用 于: 在获取发送第一虚拟机内存数据的数据发送请求之前, 获取特权虚拟机用户态进程触发的迁移所述第一虚拟机的内存数据 的迁移请求,其中 ,所述迁移请求中包含所述第一虚拟机的标识; 根据所述迁移请求中的所述第一虚拟机的标识获取所述第一虚拟机 内存的地址空间 ;
根据所述地址空间获取所述虚拟机内存的 PFN; 根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理内 存页地址;
建立所述第一虚拟机内存的 PFN与所述第一虚拟机内存的物理内存 页地址之间的对应关系。
13、根据权利要求 12所述物理主机,其特征在于,所述 Host还用于: 在根据所述第一虚拟机内存的 PFN计算所述第一虚拟机内存的物理 内存页地址之后 , 以及获取发送第一虚拟机内存数据的数据发送请求之 前,
将所述第一虚拟机内存的物理内存页地址注册至所述 RDMA网卡。
14、 根据权利要求 11或 12所述物理主机,其特征在于,所述 Host 还用于 :在根据所述请求发送的内存数据的 PFN查询所述第一虚拟机的 对应关系 ,得到所述请求发送的内存数据的物理内存页地址之后 , 通过 RDMA 网卡将所述请求发送的内存数据的物理内存页地址上所存储的内 存数据发送至目的物理主机之前,
将所述请求发送的内存数据的物理内存页地址注册至所述 RDMA网 上
卜 o
15、 一种集群系统,其特征在于,包括:多台如权利要求 11至 14任 一项所述的物理主机,所述多台物理主机包括源物理主机和目的物理主机, 其中每台物理主机包括硬件层、 运行在所述硬件层之上的宿主机 Host、 以 及运行在所述 Host 之上的至少一个虚拟机 VM , 以及所述硬件层包括 RDMA网卡。
PCT/CN2014/074391 2013-09-30 2014-03-31 一种虚拟机内存数据的迁移方法及相关装置和集群系统 WO2015043147A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP14790474.2A EP2879053B1 (en) 2013-09-30 2014-03-31 Virtual machine memory data migration method, related apparatus, and cluster system
US14/534,446 US9854036B2 (en) 2013-09-30 2014-11-06 Method for migrating memory data of virtual machine, and related apparatus and cluster system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310462273.3 2013-09-30
CN201310462273.3A CN103530167B (zh) 2013-09-30 2013-09-30 一种虚拟机内存数据的迁移方法及相关装置和集群系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/534,446 Continuation US9854036B2 (en) 2013-09-30 2014-11-06 Method for migrating memory data of virtual machine, and related apparatus and cluster system

Publications (1)

Publication Number Publication Date
WO2015043147A1 true WO2015043147A1 (zh) 2015-04-02

Family

ID=49932207

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/074391 WO2015043147A1 (zh) 2013-09-30 2014-03-31 一种虚拟机内存数据的迁移方法及相关装置和集群系统

Country Status (3)

Country Link
EP (1) EP2879053B1 (zh)
CN (1) CN103530167B (zh)
WO (1) WO2015043147A1 (zh)

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9854036B2 (en) 2013-09-30 2017-12-26 Huawei Technologies Co., Ltd. Method for migrating memory data of virtual machine, and related apparatus and cluster system
CN103530167B (zh) * 2013-09-30 2017-04-05 华为技术有限公司 一种虚拟机内存数据的迁移方法及相关装置和集群系统
CN104915302B (zh) * 2014-03-10 2018-07-03 华为技术有限公司 数据传输处理方法和数据传输器
CN103942087B (zh) * 2014-03-31 2017-11-17 华为技术有限公司 虚拟机热迁移方法及相关装置和集群系统
CN104410681B (zh) * 2014-11-21 2017-08-01 上海交通大学 基于远程直接内存访问的虚拟机动态迁移优化方法
US10055381B2 (en) 2015-03-13 2018-08-21 International Business Machines Corporation Controller and method for migrating RDMA memory mappings of a virtual machine
US9904627B2 (en) * 2015-03-13 2018-02-27 International Business Machines Corporation Controller and method for migrating RDMA memory mappings of a virtual machine
CN106445628A (zh) * 2015-08-11 2017-02-22 华为技术有限公司 一种虚拟化方法、装置和系统
CN106484312B (zh) * 2015-09-01 2019-07-26 北京金山云网络技术有限公司 一种虚拟机磁盘数据迁移方法及装置
CN106970915A (zh) * 2016-01-13 2017-07-21 阿里巴巴集团控股有限公司 一种业务系统数据迁移的处理方法及装置
WO2017219250A1 (zh) * 2016-06-21 2017-12-28 华为技术有限公司 一种虚拟机内存的映射方法、装置及数据传输设备
CN108123924B (zh) * 2016-11-30 2021-02-12 中兴通讯股份有限公司 一种资源管理方法及系统
CN107085535B (zh) * 2017-03-30 2020-10-27 联想(北京)有限公司 一种信息处理方法及电子设备
CN110535811B (zh) * 2018-05-25 2022-03-04 中兴通讯股份有限公司 远端内存管理方法及系统、服务端、客户端、存储介质
CN109086179B (zh) * 2018-08-20 2022-04-22 郑州云海信息技术有限公司 一种程序异常情况下的处理方法和装置
CN109828829B (zh) * 2019-01-22 2022-10-18 重庆邮电大学 一种基于灾难预警时间的虚拟机快速撤离方法
CN111666036B (zh) * 2019-03-05 2022-04-22 华为技术有限公司 一种迁移数据的方法、装置及系统
CN110795213B (zh) * 2019-12-12 2022-06-07 东北大学 一种虚拟机迁移过程中活跃内存预测迁移方法
CN112100273B (zh) * 2020-08-12 2022-10-21 福建天泉教育科技有限公司 集群数据扩容的方法、存储介质
EP4195021A4 (en) * 2020-08-29 2024-01-24 Huawei Cloud Computing Tech Co Ltd ONLINE MIGRATION METHOD AND SYSTEM FOR BASIC SERVER
US20220413886A1 (en) * 2021-06-25 2022-12-29 Intel Corporation Circuitry and methods for supporting encrypted remote direct memory access (erdma) for live migration of a virtual machine
CN113923259A (zh) * 2021-08-24 2022-01-11 阿里云计算有限公司 数据处理方法及系统
CN116185553A (zh) * 2021-11-26 2023-05-30 华为技术有限公司 数据迁移方法、装置及电子设备
CN114201313A (zh) * 2021-12-07 2022-03-18 杭州时代银通软件股份有限公司 一种消息传递系统及消息传递方法
CN114050998A (zh) * 2022-01-07 2022-02-15 阿里巴巴(中国)有限公司 实现远程直接内存访问的方法、装置、电子设备及介质
CN115712486A (zh) * 2022-11-14 2023-02-24 阿里云计算有限公司 虚拟机的热迁移控制方法和装置、介质和计算机设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137292A1 (en) * 2010-11-26 2012-05-31 Fujitsu Limited Virtual machine migrating system and method
CN102801806A (zh) * 2012-08-10 2012-11-28 薛海强 一种云计算系统及云计算资源管理方法
CN103530167A (zh) * 2013-09-30 2014-01-22 华为技术有限公司 一种虚拟机内存数据的迁移方法及相关装置和集群系统

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288921A1 (en) * 2006-06-13 2007-12-13 King Steven R Emulating a network-like communication connection between virtual machines on a physical device
US7987469B2 (en) * 2006-12-14 2011-07-26 Intel Corporation RDMA (remote direct memory access) data transfer in a virtual environment
CN101464812B (zh) * 2009-01-06 2012-05-30 北京航空航天大学 一种虚拟机迁移方法
JP5446040B2 (ja) * 2009-09-28 2014-03-19 日本電気株式会社 コンピュータシステム、及び仮想マシンのマイグレーション方法
CN102081552A (zh) * 2009-12-01 2011-06-01 华为技术有限公司 一种物理机到虚拟机的在线迁移方法、装置和系统
US20130083690A1 (en) * 2011-10-04 2013-04-04 International Business Machines Corporation Network Adapter Hardware State Migration Discovery in a Stateful Environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137292A1 (en) * 2010-11-26 2012-05-31 Fujitsu Limited Virtual machine migrating system and method
CN102801806A (zh) * 2012-08-10 2012-11-28 薛海强 一种云计算系统及云计算资源管理方法
CN103530167A (zh) * 2013-09-30 2014-01-22 华为技术有限公司 一种虚拟机内存数据的迁移方法及相关装置和集群系统

Also Published As

Publication number Publication date
EP2879053A4 (en) 2015-10-14
EP2879053A1 (en) 2015-06-03
CN103530167B (zh) 2017-04-05
EP2879053B1 (en) 2016-11-16
CN103530167A (zh) 2014-01-22

Similar Documents

Publication Publication Date Title
WO2015043147A1 (zh) 一种虚拟机内存数据的迁移方法及相关装置和集群系统
US11061712B2 (en) Hot-plugging of virtual functions in a virtualized environment
US11126358B2 (en) Data migration agnostic of pathing software or underlying protocol
US11044347B2 (en) Command communication via MPIO driver agnostic of underlying communication protocols
US9854036B2 (en) Method for migrating memory data of virtual machine, and related apparatus and cluster system
TWI625674B (zh) 用於支援在主機上運行的多個虛擬機器的nvme控制器虛擬化的系統和方法
US9529773B2 (en) Systems and methods for enabling access to extensible remote storage over a network as local storage via a logical storage controller
US10389852B2 (en) Method and system for providing a roaming remote desktop
US10013189B1 (en) Storage volume backup management for multi-tenant environments
US9501245B2 (en) Systems and methods for NVMe controller virtualization to support multiple virtual machines running on a host
US8929377B2 (en) Systems and methods for automatic rack detection
JP5837206B2 (ja) 分離された仮想空間を提供するための方法および装置
WO2018036103A1 (zh) 虚拟机创建方法、系统以及主机
CN106796500B (zh) 分布式文件系统的版本间映射
US10628196B2 (en) Distributed iSCSI target for distributed hyper-converged storage
WO2016035003A1 (en) Transparent non-uniform memory access (numa) awareness
US10367688B2 (en) Discovering changes of network interface controller names
CN108139937B (zh) 多根i/o虚拟化系统
US10237346B2 (en) Maintaining partition-tolerant distributed metadata
US10089267B2 (en) Low latency efficient sharing of resources in multi-server ecosystems
JP5439435B2 (ja) 計算機システムおよびその計算機システムにおけるディスク共有方法
US11226851B1 (en) Execution of multipath operation triggered by container application
US11914556B2 (en) Lazy virtual filesystem instantiation and caching
US20230176884A1 (en) Techniques for switching device implementations for virtual devices

Legal Events

Date Code Title Description
REEP Request for entry into the european phase

Ref document number: 2014790474

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014790474

Country of ref document: EP

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

Ref document number: 14790474

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE