WO2021129332A1 - 虚拟机部署及热迁移方法、vmm升级方法、服务器 - Google Patents

虚拟机部署及热迁移方法、vmm升级方法、服务器 Download PDF

Info

Publication number
WO2021129332A1
WO2021129332A1 PCT/CN2020/133341 CN2020133341W WO2021129332A1 WO 2021129332 A1 WO2021129332 A1 WO 2021129332A1 CN 2020133341 W CN2020133341 W CN 2020133341W WO 2021129332 A1 WO2021129332 A1 WO 2021129332A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
upgrade
page
space
hva
Prior art date
Application number
PCT/CN2020/133341
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 US17/783,417 priority Critical patent/US20230009596A1/en
Priority to EP20905775.1A priority patent/EP4080358A4/en
Publication of WO2021129332A1 publication Critical patent/WO2021129332A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • 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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • 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 disclosure relates to the field of computer technology, in particular, to a method for deploying a virtual machine, a method for hot migration of a virtual machine, a method for upgrading a VMM, a server, and a computer-readable storage medium.
  • a Virtual Machine Monitor is a program that carries the operation and monitoring of a virtual machine. In order to upgrade it to add functions or fix program defects, it is necessary to migrate the virtual machine running on the VMM. In order not to affect or interrupt the operation of the business virtual machine while migrating, the prior art is mainly accomplished by a method of online virtual machine migration and software cold patching. There are two specific types: 1. Remote migration, that is, first online hot migration of the virtual machine of the server to be upgraded to another server, then upgrade the VMM by cold patching, and finally online hot migration of the virtual machine back to the upgraded VMM Run; 2. Local migration, that is, both the new and old versions of the VMM program are started on the server host at the same time, and then the local migration technology is used to migrate the virtual machine from the old VMM to the new VMM online.
  • the above two methods of online migration combined with cold patch are essentially copying the computing resources of the virtual machine and then releasing it.
  • the entire memory space of the virtual machine needs to be copied. Therefore, it needs to be pre-installed on other servers or this server before execution.
  • Reserve computing resources at least equal to the memory space of the migrated virtual machine.
  • computing resources are usually allocated based on actual business.
  • the memory space of some virtual machines for server purposes can easily be tens or hundreds of GB, so it is difficult to achieve resources. Reserved.
  • the entire implementation process will be very complicated, time-consuming and labor-intensive.
  • the present disclosure provides a method for deploying a virtual machine, a method for hot migration of a virtual machine, a method for upgrading a VMM, a server, and a computer-readable storage medium.
  • a method for deploying a virtual machine which includes: mapping between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade Relationship, establishing a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade, wherein the upgraded virtual machine is deployed on the upgraded virtual machine monitor VMM, and the upgraded virtual machine
  • the memory configuration of the virtual machine is the same as the memory configuration of the virtual machine before the upgrade running on the VMM before the upgrade.
  • a method for hot migration of a virtual machine including: executing the above deployment method to map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade;
  • the VMM sends signaling to place the VCPU of the upgraded virtual machine in a running state, where the HPA space of the upgraded virtual machine is the HPA space of the pre-upgraded virtual machine.
  • a method for upgrading VMM includes: deploying the upgraded VMM on a host machine; starting the pre-upgrade VMM and the upgraded VMM on the host machine at the same time;
  • the migration method is to migrate the pre-upgrade virtual machine running on the pre-upgraded VMM to the post-upgrade virtual machine running on the upgraded VMM; delete the pre-upgrade VMM.
  • a server is provided.
  • the server is used as a host of a virtual machine.
  • the server includes: a storage module on which an application program is stored; one or more processors, when When the application program is executed by the one or more processors, the one or more processors implement one of the following methods: the above deployment method; the above hot migration method; the above upgrade method.
  • a computer-readable storage medium having an executable program stored on the computer-readable storage medium, and when the executable program is executed, one of the following methods can be implemented: The deployment method; the above-mentioned hot migration method; the above-mentioned upgrade method.
  • FIG. 1 is a flowchart of an implementation manner of the deployment method provided by the present disclosure
  • Figure 2 Schematic diagram of each memory concept and its conversion relationship in the virtualization scenario
  • FIG. 3 is a flowchart of another implementation manner of the deployment method provided by the present disclosure.
  • FIG. 4 is a flowchart of another implementation manner of the deployment method provided by the present disclosure.
  • FIG. 5 is a flowchart of still another implementation manner of the deployment method provided by the present disclosure.
  • FIG. 6 is a flowchart of still another implementation manner of the deployment method provided by the present disclosure.
  • FIG. 7 is a flowchart of still another implementation manner of the deployment method provided by the present disclosure.
  • FIG. 8 is a flowchart of an embodiment of the thermal migration method provided by the present disclosure.
  • FIG. 9 is a flowchart of an implementation manner of the upgrade method provided by the present disclosure.
  • FIG. 10 is a schematic diagram of the memory mapping of the virtual machine before and after the execution of the deployment method in the present disclosure.
  • FIG. 1 a method for deploying a virtual machine is provided, as shown in FIG. 1, including:
  • step S110 according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the HVA space of the virtual machine after the upgrade is established and the HVA space of the virtual machine before the upgrade is established.
  • the mapping between the HPA space of the virtual machine, where the upgraded virtual machine is deployed on the upgraded virtual machine monitor VMM, and the memory configuration of the upgraded virtual machine is consistent with all the running on the upgraded VMM
  • the memory configuration of the virtual machine before the upgrade is the same.
  • the page table (Guest Page Table, GPT) in the virtual machine provides a mapping relationship from the virtual machine virtual address (Guest Virtual Address, GVA) space to the virtual machine pseudo physical address (Guest Physical Address, GPA) space ;
  • Host Page Table (HPT) provides the mapping relationship from Host Virtual Address (HVA) space to Host Physical Address (HPA) space;
  • Page frame mapping (Memory) Slot, MS) corresponds to GPA and HVA according to the serial number.
  • page address offsets mentioned in this disclosure are all page address offsets relative to the respective address space entry addresses.
  • the page address offset of the virtual memory page in the HVA space is relative to the page address offset of the entry address of the HVA space
  • the page address offset of the physical memory page in the HPA space is relative to the HPA space.
  • the page address offset of the entry address is not limited to the page address offset of the entry address.
  • the upgraded virtual machine when deploying a virtual machine, the upgraded virtual machine is first started on the upgraded VMM, so that the memory configuration of the upgraded virtual machine is maintained with the memory configuration of the pre-upgraded virtual machine running on the pre-upgraded VMM Same, but does not allocate actual physical memory to the upgraded virtual machine. Because the memory configuration and initialization process of the virtual machine after the upgrade are consistent with the virtual machine before the upgrade, the mapping relationship between the GPA and HVA of the virtual machine after the upgrade is also consistent with the mapping relationship between the GPA and HVA of the virtual machine before the upgrade.
  • the MS of the virtual machine after the upgrade is the same as the MS of the virtual machine before the upgrade, that is, the pages of the HVA space in the virtual machine after the upgrade with the same serial number correspond to the pages of the HVA space in the virtual machine before the upgrade respectively.
  • the serial number of the page in the GPA space in the machine is the same as the page in the GPA space in the virtual machine before the upgrade; in addition, the HVA space virtual memory page of the upgraded virtual machine with the same page offset and the HVA space virtual memory page of the virtual machine before the upgrade.
  • the corresponding pages in the GPA space of the virtual machine after the upgrade and the pages in the GPA space of the virtual machine before the upgrade also have the same page offset.
  • FIG. 10(a) the pre-upgrade VMM and the post-upgrade VMM are deployed on the server at the same time, and the upgraded virtual machine is started on the upgraded VMM, but the actual physical memory HPA space is not allocated to the upgraded virtual machine. Since the memory configuration and initialization process of the virtual machine on the VMM before and after the upgrade are the same, the mapping relationship between the GPA space and the HVA space of the virtual machine before the upgrade is the same as the mapping relationship between the GPA space and the HVA space of the virtual machine after the upgrade.
  • FIG. 10(a) the mapping relationship between the GPA space and the HVA space of the virtual machine before the upgrade is the same as the mapping relationship between the GPA space and the HVA space of the virtual machine after the upgrade.
  • the numbers 1, 2, and 3 can represent the serial number of the memory page in the corresponding MS, and can also represent the page address offset of the memory in its address space. Therefore, as shown in Figure 10(a), when the numbers 1, 2, and 3 in the figure indicate serial numbers, the pages of the HVA space in the upgraded virtual machine with serial number 1 correspond to the pages of the HVA space in the virtual machine before the upgrade, respectively
  • the serial numbers of the pages in the GPA space in the virtual machine after the upgrade and the pages in the GPA space in the virtual machine before the upgrade are both 1, and the pages in the HVA space in the virtual machine after the upgrade with the serial number 2 are respectively the pages in the HVA space in the virtual machine before the upgrade
  • the sequence numbers of the corresponding pages in the GPA space in the virtual machine after the upgrade and the pages in the GPA space in the virtual machine before the upgrade are both 2; when the numbers 1, 2, and 3 in the figure represent the page address offset, the page address offset
  • the page address offset of the space page is 2. It should be noted that when the numbers 1, 2, and 3 in the figure indicate the page address offset, Figure 10 only exemplarily shows the page address offset of the page in the GPA space and the corresponding page address in the HVA space.
  • the page address offsets are equal, in actual applications, the page address offset of the page in the GPA space and the page address offset of the page in the corresponding HVA space may not be equal, as long as it is guaranteed to have the same page offset
  • the HVA space virtual memory pages of the virtual machine after the upgrade and the virtual memory pages of the virtual machine's HVA space before the upgrade respectively correspond to the pages in the GPA space of the virtual machine after the upgrade and the pages in the GPA space of the virtual machine before the upgrade also have the same pages
  • the offset is fine.
  • the pages of the HVA space in the virtual machine after the upgrade and the pages of the HVA space in the virtual machine before the upgrade with the page address offset of 1 correspond to the pages of the GPA space in the virtual machine after the upgrade and the GPA space in the virtual machine before the upgrade.
  • the page address offset of the page is 3.
  • the HPA space of the virtual machine before the upgrade is reverse-mapped to the virtual machine after the upgrade
  • the physical memory page found through the multi-level lookup table corresponds to the page in the HVA space with the same serial number or page address offset in the virtual machine before the upgrade
  • the physical pages of the HPA space are the same, that is, after the upgrade, the virtual machine can access the same physical memory pages as the virtual machine before the upgrade, thereby completing the deployment of the virtual machine after the upgrade.
  • the page with sequence number 1 corresponds to the p1 physical memory page in the HPA space
  • the page with sequence number 2 corresponds to the p2 physical memory page in the HPA space
  • the page of 3 corresponds to the p3 physical memory page of the HPA space.
  • the HPA space of the virtual machine before the upgrade is inversely mapped to the HVA space of the virtual machine after the upgrade, that is, as shown in Figure 10(b), the sequence number is 1 in the HVA space of the virtual machine after the upgrade.
  • the page corresponds to the p1 physical memory page in the HPA space
  • the page number 2 corresponds to the p2 physical memory page in the HPA space
  • the page number 3 corresponds to the p3 physical memory page in the HPA space.
  • the virtual machine after the upgrade corresponds to the same HPA space as the virtual machine before the upgrade.
  • the mapping relationship between the GPA space and HVA space of the virtual machine before the upgrade is the same as the mapping relationship between the GPA space and the HVA space of the virtual machine after the upgrade.
  • the GVA space of the virtual machine after the upgrade is
  • the mapping relationships at all levels among GPA space, HVA space, and HPA space are the same as the mapping relationships between GVA space, GPA space, HVA space, and HPA space of the virtual machine before the upgrade.
  • the program running on the upgraded virtual machine passes through the multi-level lookup table to access the physical memory pages and when running on the virtual machine before the upgrade The physical memory pages accessed are the same.
  • step S110 the memory of the physical memory page is not copied, and the HVA space of the upgraded virtual machine and the virtual machine before the upgrade are established only by copying or modifying the page table entry (PTE). Mapping between the HPA space. Therefore, the process of establishing the entire mapping relationship is very fast, and there is no need to reserve a large amount of memory resources.
  • PTE page table entry
  • the virtual machine deployment method In the virtual machine deployment method provided in the present disclosure, during the virtual machine deployment process, only the mapping relationship between the host virtual address HVA space and the host physical address HPA space is copied (you can copy or modify the page table (Page Table Entry) , PTE) to achieve) without copying the content of the entire memory space of the virtual machine. Therefore, the HVA space of the upgraded virtual machine and the virtual machine before the upgrade can be established without interrupting the virtual machine business or reserving a large amount of computing resources.
  • the mapping relationship of the machine s HPA space.
  • the deployment method is used in the virtual machine migration process, the migration from the virtual machine before the upgrade to the virtual machine after the upgrade can be realized, thereby completing the hot replacement of the old and new versions of the VMM software.
  • it is also suitable for batch hot migration of a large number of virtual machines, which can effectively save time and resource costs.
  • the deployment method may further include the following steps:
  • step S121 it is determined whether the page frame map MS of the virtual machine after the upgrade is consistent with the MS of the virtual machine before the upgrade;
  • step S122 the MS of the virtual machine before the upgrade is copied to the virtual machine after the upgrade.
  • step S121 is not particularly limited, and step S121 may be executed before step S110, or step S121 may be executed after step S110. In the embodiment shown in FIG. 3, step S121 is performed before step S110.
  • step S110 specifically includes the following steps:
  • step S111 the sequence and sequence number of the page table entries of each physical memory page in the HPA space of the virtual machine before the upgrade are determined.
  • step S112 according to the corresponding relationship between the page table entry of each physical memory page and the sequence number, each physical memory page is inversely mapped to the corresponding virtual memory page in the HVA space of the upgraded virtual machine.
  • the page table entry of the physical memory page of the HPA space corresponding to the HVA space of the virtual machine before the upgrade can be searched for according to the entry address of the HVA space of the virtual machine before the upgrade and the size information of the HVA space.
  • a list can be created, and each physical memory page and its sequence number in the sequence are sequentially stored in the above list in the sequence.
  • the physical memory page found in the table lookup is the same as the physical page in the HPA space corresponding to the page in the HVA space with the same sequence number or page address offset in the virtual machine before the upgrade, and both belong to the scope of the present disclosure.
  • step S110 further includes:
  • step S113 a multi-level page table is created for the physical memory pages that are de-mapped to the virtual memory pages of the HVA space of the upgraded virtual machine.
  • step S111 may specifically include the following steps:
  • step S111a the first entry address of the HVA space of the virtual machine before the upgrade is obtained
  • step S111b obtain the page address offset of the virtual memory page of the HVA space of the virtual machine before the upgrade corresponding to each of the physical memory pages relative to the first entry address;
  • step S111c the size order of the page address offset is determined as the order of the page table entries of each physical memory page, and the page address offset is determined as the page of the corresponding physical memory page The sequence number of the entry.
  • the page with the page address offset of 1 corresponds to the p1 physical of the HPA space
  • a page with a page address offset of 2 corresponds to a p2 physical memory page in the HPA space
  • a page with a page address offset of 3 corresponds to a p3 physical memory page in the HPA space. Therefore, the sequence number corresponding to the p1 physical memory page is 1, the sequence number corresponding to the p2 physical memory page is 2, and the sequence number corresponding to the p3 physical memory page is 3.
  • the correspondence relationship between the physical memory page and the page address offset of the corresponding virtual memory page can be obtained through the page table HPT of the host machine.
  • the page table entries of each physical memory page can be sorted according to the increment, increment, or any other manner of the offset size, and there is no special limitation on this.
  • step S112 specifically includes:
  • step S112a obtain the second entry address of the HVA space of the upgraded virtual machine
  • each of the physical memory pages is inversely mapped to the virtual memory page of the HVA space of the upgraded virtual machine, where:
  • the page address offset of the virtual memory page corresponding to each physical memory page relative to the second entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
  • the memory page reverse mapping mechanism (rmap) is used to reverse map the page table entries of the physical memory pages of the HPA space of the virtual machine before the upgrade to the page address offset corresponding to the page table entries of the physical memory page
  • the page address offset is equal to the virtual memory page of the HVA space of the target virtual machine, that is, the reverse mapping of the physical memory page to the page address offset corresponding to the page table entry of the physical memory page is completed
  • the page address offset is equal to the virtual memory page of the HVA space of the target virtual machine.
  • the deployment method further includes:
  • step S112c signaling is sent to the upgraded VMM to place the virtual central processing unit VCPU of the upgraded virtual machine in a suspended state.
  • step S112a and step S112c are not particularly limited.
  • Step S112a can be executed first and then step S112c can be executed, or step S112c can be executed first and then step S112a can be executed.
  • Step S112c can also be executed at the same time as step S112a. It is sufficient to ensure that step S112c is executed before step S112b.
  • page fault interrupt refers to the virtual memory page of the HVA space of the virtual machine after the upgrade is not mapped to the physical memory and the extended page table EPT of the virtual machine is empty after the upgrade.
  • the interrupt issued by the memory management unit of the server's central processing unit.
  • the VCPU of the virtual machine before the upgrade can be temporarily suspended, where all The time required for the physical memory page to be mapped to the virtual memory page in the HVA space of the virtual machine after the upgrade is the short pause time of the VCPU of the virtual machine before the upgrade, generally no more than 1 second.
  • the physical memory page in the process of performing step S112b to demap the physical memory page to the virtual memory page in the HVA space of the upgraded virtual machine, can be temporarily placed in a fixed state, and wait for the After the physical memory page is unmapped to the virtual memory page in the HVA space of the upgraded virtual machine, the fixed state is released.
  • step S112 through steps S112a to S112b is simple and easy to implement, but when the physical memory that needs to be demapped to the HVA space of the upgraded virtual machine is large, the VCPU of the virtual machine before the upgrade is placed in a suspended state It takes a long time and usually results in a business suspension of about 1 second, so it is only suitable for hot migration of virtual machines with small memory.
  • the present disclosure also An implementation manner of actively triggering the page fault interrupt to execute step S112 is provided.
  • step S112 specifically includes:
  • step S112d the third entry address of the HVA space of the upgraded virtual machine is obtained
  • step S112e signaling is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine in a running state
  • step S112f according to the page fault address offset generated by the page fault interrupt, the physical memory page is inversely mapped to the target virtual memory page, where the target virtual memory page is the HVA of the upgraded virtual machine
  • the virtual memory page of the space, the sequence number of the page table entry of the physical memory page is equal to the page fault address offset, and the page address offset of the target virtual memory page relative to the third entry address
  • the amount is equal to the offset of the page fault address.
  • the page fault address offset corresponds to the page address offset of the virtual memory page of the HVA space of the virtual machine after the upgrade.
  • the memory page shortage situation of the virtual machine after the upgrade and the physical memory page switching situation of the HPA space can be tracked, and in step S112g, it is determined to be pending. Whether the number of the physical memory pages on the virtual memory pages that are unmapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold.
  • step S112h when the number of the physical memory pages on the virtual memory pages to be de-mapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold, signaling is sent to the upgraded VMM to transfer After the upgrade, the VCPU of the virtual machine is placed in a suspended state.
  • step S112i the physical memory page to be demapped to the virtual memory page of the HVA space of the upgraded virtual machine is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein,
  • the page address offset of the virtual memory page corresponding to each physical memory page relative to the third entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
  • the VCPU pause time of the virtual machine after the upgrade can be controlled at the microsecond level , The business program in the virtual machine is unaware of the above suspension, so it will not cause business suspension or interruption.
  • the page address offset of the virtual memory page of the virtual machine's HVA space before the upgrade is used to determine the order of the page table entries of each physical memory page, and the physical memory page is reversed to the virtual machine after the upgrade.
  • the implementation of virtual memory pages in HVA space is not limited to this, and any sorting manner that can reflect the mapping relationship between the HVA space of the virtual machine before the upgrade and the HPA space of the virtual machine before the upgrade falls within the scope of the present disclosure.
  • the following introduces another implementation manner for determining the order of the page table entries of each physical memory page.
  • step S111 may specifically include:
  • step S111d obtain the serial number of the virtual memory page in the HVA space of the virtual machine before the upgrade corresponding to each physical memory page in the page frame map MS of the virtual machine before the upgrade;
  • step S111e the order of the size of the serial number is determined as the order of the page table entries of each of the physical memory pages, and the serial number is determined as the order number of the page table entries of the corresponding physical memory page.
  • the page with serial number 1 corresponds to the p1 physical memory page in the HPA space
  • the page with serial number 2 Corresponds to the p2 physical memory page in the HPA space
  • the page number 3 corresponds to the p3 physical memory page in the HPA space. Therefore, the sequence number corresponding to the p1 physical memory page is 1, the sequence number corresponding to the p2 physical memory page is 2, and the sequence number corresponding to the p3 physical memory page is 3.
  • a method for hot migration of a virtual machine including:
  • step S210 the aforementioned deployment method is executed to map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade;
  • step S220 signaling is sent to the upgraded VMM to place the VCPU of the upgraded virtual machine in a running state, wherein the HPA space of the upgraded virtual machine is the HPA space of the upgraded virtual machine .
  • FIG. 10 shows a schematic diagram of memory mapping before and after the hot migration of a virtual machine using the hot migration method provided by the present disclosure.
  • Fig. 10(a) is the memory mapping situation of the virtual machine before the hot migration
  • Fig. 10(b) is the memory mapping situation of the virtual machine after the hot migration. It can be seen that before and after the hot migration, the virtual machine runs on the same HPA space, and because the content of the physical memory page is not copied, the entire hot migration process is very fast, and the business program of the virtual machine is unaware.
  • the virtual machine hot migration method provided in the present disclosure uses the virtual machine deployment method provided in the present disclosure to deploy the upgraded virtual machine by establishing a mapping relationship between the HVA space of the virtual machine after the upgrade and the HPA space of the virtual machine before the upgrade.
  • the mapping relationship between the host's virtual address HVA space and the host's physical address HPA space is copied (which can be achieved by copying or modifying Page Table Entry (PTE)), instead of copying the virtual machine's
  • PTE Page Table Entry
  • the pre-upgrade virtual machine can be migrated to the post-upgrade virtual machine without interrupting the virtual machine business and without the need to reserve a large amount of computing resources, thereby realizing the transition from the pre-upgrade virtual machine to the post-upgrade virtual machine migrate.
  • the hot migration method is also suitable for batch hot migration of a large number of virtual machines, which can effectively save time and resource costs.
  • the upgrade method includes:
  • step S310 deploy the upgraded VMM on the host
  • step S320 the VMM before the upgrade and the VMM after the upgrade are simultaneously started on the host computer
  • step S330 the above-mentioned hot migration method is executed to migrate the pre-upgrade virtual machine running on the pre-upgraded VMM to the upgraded virtual machine running on the upgraded VMM;
  • step S340 the VMM before the upgrade is deleted.
  • the method for upgrading the VMM naturally includes the above-mentioned step of copying the back-end device information of the virtual machine before the upgrade saved in the VMM before the upgrade to the VMM after the upgrade.
  • the server kernel since the extended page table EPT of the virtual machine in the server kernel is initially empty after the upgrade, as the virtual machine runs after the upgrade, the server kernel will start to establish the EPT of the upgraded virtual machine according to the same MS of the virtual machine before the upgrade. Thereby forming a high-speed conversion from GPA to HPA.
  • the VMM upgrade method provided in the present disclosure uses the hot migration method provided in the present disclosure to realize the hot migration of virtual machines running on the VMM, thereby realizing the hot upgrade of the VMM, which can effectively save time and resource costs.
  • VMM software includes VMware's vSphere, Microsoft Hyper-V, QEMU, XEN, KVM, etc. before the upgrade.
  • the following respectively takes QEMU-KVM and XEN as examples to further illustrate the virtual machine deployment method, hot migration method, and VMM upgrade method provided in the present disclosure.
  • This embodiment runs on an x86 server, the CPU adopts Intel(R)Xeon(R)CPU E5-2640, and the EPT function has been enabled.
  • the operating system runs the 2.6 version of the LINUX kernel, uses QEMU-KVM as the virtualized VMM (Hypervisor), and at the same time runs the Window 7 system virtual machine that business users are using.
  • the user's virtual machine runs normally on the QEMU before the upgrade.
  • the GPA space used by the operating system (windows 7) in the virtual machine before the upgrade and the HVA space of the QEMU process before the upgrade are mapped through the kvm_memory_slot data structure maintained by the kernel KVM module.
  • the HVA space is mapped to the physical memory pages in the GPA space through the multi-level page table maintained by the server LINUX kernel, including the PTE.
  • the upgraded virtual machine is created through KVM on the upgraded QEMU, but the actual physical memory is not allocated to the upgraded virtual machine, and the VCPU of the upgraded virtual machine is placed in a suspended state.
  • the migration execution thread of the QEMU program before the upgrade is connected with the migration thread of the QEMU program after the upgrade through the Transmission Control Protocol (TCP), and the back-end device information such as virtual network card and virtio is synchronized.
  • TCP Transmission Control Protocol
  • step S111a is specifically executed as the following steps:
  • step S111b is specifically executed as the following steps:
  • VMA Virtual Memory Area
  • the memory walk mechanism provided by the kernel is used to traverse the multi-level page table corresponding to the virtual machine HVA before the upgrade step by step. For example, for the x86_64 linux kernel in this embodiment, it is necessary to traverse the PGD table, the PUD table, the PMD table, and the last PTE table in sequence to find the pointers of all HVA memory pages (end of step S111b).
  • step S111c is specifically executed as the following steps:
  • step S112a is specifically executed as the following steps:
  • step S112b is specifically executed as the following steps:
  • page_set_anon_rmap calculates the offset of the relative entry address of the saved page pointers in sequence and maps them to the HVA space of the upgraded virtual machine.
  • step S113 is specifically executed as: creating a multi-level page table.
  • the page table is switched from the virtual machine before the upgrade to the virtual machine after the upgrade.
  • step S121 is executed after step S110.
  • thermal migration method provided in the second aspect of the present disclosure can be executed according to the following steps:
  • Step S210 is specifically executed as the various steps described above;
  • Step S220 is specifically executed as: putting the VCPU of the upgraded virtual machine into a running state.
  • the KVM module Since the EPT of the virtual machine is initially empty after the upgrade, the KVM module enters the Page Fault process by continuously accessing the HVA address space during operation. According to the kvm_memory_slot structure in the KVM module and the virtual machine before the upgrade, the mapping information is found , And gradually establish a new EPT table.
  • the purpose of this embodiment is to minimize the VCPU pause time of the virtual machine during page table switching.
  • the running software and hardware environment and the state of the host machine and virtual machine before the QEMU upgrade are the same as those in the first embodiment. Only the steps of reverse mapping the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade are different.
  • step S112e is specifically executed as the following steps:
  • the kernel will generate page faults Interrupt (no_page_fault).
  • step S112f is specifically executed as the following steps:
  • page_set_anon_r-map is mapped to the HVA space of the upgraded virtual machine.
  • step S113 is specifically executed as follows:
  • step S112g is specifically executed as follows:
  • step S112h is specifically executed as follows:
  • the VCPU of the virtual machine after the upgrade is suspended.
  • step S112i is specifically executed as follows:
  • the KVM module will gradually create a new EPT table based on the kvm_memory_slot that is consistent with the virtual machine before the upgrade. After the final upgrade, all memory pages of the virtual machine will complete the EPT table creation and take effect on the KVM module, realizing high-speed conversion from GPA to HPA.
  • XEN is used as the virtualized VMM (Hypervisor) software.
  • step S111 is specifically executed as the following steps:
  • the memory walk (page table traversal) mechanism provided by the kernel is used to traverse the multi-level page table corresponding to the old virtual machine HVA level by level.
  • the memory walk page table traversal
  • the memory walk page table traversal mechanism provided by the kernel is used to traverse the multi-level page table corresponding to the old virtual machine HVA level by level.
  • the x86_64 architecture linux kernel as an example, traverse sequentially PGD table, PUD table, PMD table, and finally PTE table, find all HVA memory page pointers (end of step S111).
  • step S112 is specifically executed as the following steps:
  • step S113 is specifically executed as the following steps
  • thermal migration method provided in the second aspect of the present disclosure can be executed according to the following steps:
  • Step S210 is specifically executed as the various steps described above;
  • Step S220 is specifically executed as: putting the upgraded virtual machine VCPU in a running state, so as to automatically create a corresponding shadow page table or EPT page table by continuously accessing the HVA address space during operation.
  • a server is provided.
  • the server is used as a host of a virtual machine.
  • the server includes: a storage module on which an application program is stored; one or more processors, when When the application program is executed by the one or more processors, the one or more processors implement one of the following methods: the above deployment method; the above hot migration method; the above upgrade method.
  • a computer-readable storage medium stores an executable program, and when the executable program is executed, one of the following methods can be implemented: The deployment method; the above-mentioned hot migration method; the above-mentioned upgrade method.
  • the virtual machine hot migration method the VMM upgrade method, the server and the computer-readable storage medium provided by the embodiments of the present disclosure
  • the virtual machine deployment process only the host machine virtual address HVA space and The mapping relationship between the HPA space of the host's physical address (which can be realized by copying or modifying the Page Table Entry (PTE)) without copying the content of the entire memory space of the virtual machine, so it can be used without interrupting the virtual machine business
  • the mapping relationship between the HVA space of the virtual machine after the upgrade and the HPA space of the virtual machine before the upgrade is also established without reserving a large amount of computing resources.
  • the deployment method When the deployment method is used in the virtual machine migration process, the migration from the virtual machine before the upgrade to the virtual machine after the upgrade can be realized, and the hot replacement of the old and new versions of the VMM software can be completed. Moreover, it is also suitable for batch hot migration of a large number of virtual machines, which can effectively save time and resource costs.
  • Computer-readable storage media include volatile and non-volatile, removable and non-removable implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data) In addition to the medium.
  • Computer-readable storage media include but are not limited to RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage media, Or any other medium that can be used to store desired information and that can be accessed by a computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Stored Programmes (AREA)

Abstract

一种虚拟机的部署方法、一种虚拟机的热迁移方法、一种VMM的升级方法、一种服务器和一种计算机可读存储介质。部署方法包括:根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射,所述升级后虚拟机部署在升级后的虚拟机监控器VMM上,且所述升级后虚拟机的内存配置与在升级前的VMM上运行的所述升级前虚拟机的内存配置相同(S110)。

Description

虚拟机部署及热迁移方法、VMM升级方法、服务器
相关申请的交叉引用
本申请基于申请号为201911355638.6、申请日为2019年12月25日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本公开涉及计算机技术领域,具体地,涉及一种虚拟机的部署方法,一种虚拟机的热迁移方法、一种VMM的升级方法、一种服务器和一种计算机可读存储介质。
背景技术
虚拟机监控器(Virtual Machine Monitor,VMM)是承载虚拟机运行及监视的程序,为了对它进行升级以增加功能或修复程序缺陷,需要对在VMM上运行的虚拟机进行迁移。为了在迁移的同时不影响或中断业务虚拟机的运行,现有技术主要通过虚拟机在线迁移、结合软件冷补丁的方法来完成。具体可以分两种:一、异地迁移,即先将待升级服务器的虚拟机在线热迁移到其它服务器,然后用冷补丁的方法升级VMM,最后再将虚拟机在线热迁移回升级后的VMM上运行;二、本地迁移,即服务器主机上同时启动新旧两个版本的VMM程序,然后使用本地迁移技术将虚拟机从旧VMM迁移在线热迁移到新VMM上。
以上两种在线迁移结合冷补丁的方法,其本质都是虚拟机计算资源先复制后释放,执行过程中需要对虚拟机整个内存空间内容进行复制,因此在执行前需要在其它服务器或本服务器预留至少等于被迁移虚拟机内存空间的计算资源。但在实际中,计算资源通常都是根据实际业务分配好的,而且在云计算服务器虚拟化场景中,有些服务器用途的虚拟机的内存空间动辄几十、上百GB,因此很难做到资源预留。而且当涉及到大量虚拟机需要迁移时,整个实施过程也会非常复杂,耗时耗力。
发明内容
为解决上述问题的至少一个方面,本公开提供一种虚拟机的部署方法、一种虚拟机的热迁移方法、一种VMM的升级方法、一种服务器和一种计算机可读存储介质。
作为本公开的第一个方面,提供一种虚拟机的部署方法,包括:根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射,其中,所述升级后虚拟机部署在升级后的虚拟机监控器VMM上,且所述升级后虚拟机的内存配置与在升级前的VMM上运行的所述升级前虚拟机的内存配置相同。
作为本公开的第二个方面,提供一种虚拟机的热迁移方法,包括:执行上述的部署方法,以将升 级前虚拟机的HPA空间映射到升级后虚拟机的HVA空间;向升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于运行状态,其中,所述升级后虚拟机的HPA空间为所述升级前虚拟机的HPA空间。
作为本公开的第三个方面,提供一种VMM的升级方法,包括:将升级后的VMM部署在宿主机上;在宿主机上同时启动升级前的VMM和升级后的VMM;执行上述的热迁移方法,以将在升级前的VMM上运行的升级前虚拟机迁移到在升级后的VMM上运行的升级后虚拟机;删除升级前的VMM。
作为本公开的第四个方面,提供一种服务器,所述服务器用作虚拟机的宿主机,所述服务器包括:存储模块,该存储模块上存储有应用程序;一个或多个处理器,当所述应用程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现以下方法中的一者:上述的部署方法;上述的热迁移方法;上述的升级方法。
作为本公开的第五个方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有可执行程序,所述可执行程序被执行时能够实现以下方法中的一者:上述的部署方法;上述的热迁移方法;上述的升级方法。
附图说明
附图是用来提供对本公开的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本公开,但并不构成对本公开的限制。在附图中:
图1是本公开提供的部署方法的一种实施方式的流程图;
图2虚拟化场景中各内存概念及其转换关系示意图;
图3是本公开提供的部署方法的另一种实施方式的流程图;
图4是本公开提供的部署方法的又一种实施方式的流程图;
图5是本公开提供的部署方法的再一种实施方式的流程图;
图6是本公开提供的部署方法的再一种实施方式的流程图;
图7是本公开提供的部署方法的再一种实施方式的流程图;
图8是本公开提供的热迁移方法的一种实施方式的流程图;
图9是本公开提供的升级方法的一种实施方式的流程图;
图10是本公开中的部署方法执行前后虚拟机内存映射示意图。
具体实施方式
以下结合附图对本公开的具体实施方式进行详细说明。应当理解的是,此处所描述的具体实施方式仅用于说明和解释本公开,并不用于限制本公开。
作为本公开的第一个方面,提供一种虚拟机的部署方法,如图1所示,包括:
在步骤S110中,根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射,其中,所述升级后虚拟机部署在升级后的虚拟机监控器VMM上,且所述升级后虚拟机的内存 配置与在升级前的VMM上运行的所述升级前虚拟机的内存配置相同。
如图2所示,虚拟机内的页表(Guest Page Table,GPT)提供了虚拟机虚拟地址(Guest Virtual Address,GVA)空间到虚拟机伪物理地址(Guest Physical Address,GPA)空间的映射关系;宿主机的页表(Host Page Table,HPT)提供了宿主机虚拟地址(Host Virtual Address,HVA)空间到宿主机物理地址(Host Physical Address,HPA)空间的映射关系;页框映射图(Memory Slot,MS)则将GPA和HVA按照序号进行了对应。
需要说明的是,在本公开中提到的页地址偏移量都是相对于各自地址空间入口地址的页地址偏移量。例如,HVA空间的虚拟内存页的页地址偏移量是相对于所述HVA空间的入口地址的页地址偏移量,HPA空间的物理内存页的页地址偏移量是相对于所述HPA空间的入口地址的页地址偏移量。
在本公开中,当进行虚拟机部署时,先在升级后的VMM上启动升级后虚拟机,使升级后虚拟机的内存配置与在升级前的VMM上运行的升级前虚拟机的内存配置保持一致,但不向升级后虚拟机分配实际的物理内存。因为升级后虚拟机与升级前虚拟机的内存配置和初始化过程是一致的,所以升级后虚拟机的GPA到HVA的映射关系与升级前虚拟机的GPA到HVA的映射关系也保持一致。具体来说,升级后虚拟机的MS与升级前虚拟机的MS一致,即,具有相同序号的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的序号相同;此外,具有相同页偏移量的升级后虚拟机的HVA空间虚拟内存页与升级前虚拟机的HVA空间虚拟内存页分别对应的升级后虚拟机的GPA空间中的页与升级前虚拟机的GPA空间中的页也具有相同的页偏移量。
下面结合图10对升级前后虚拟机的地址空间的映射关系做进一步说明。在图10(a)中,在服务器上同时部署升级前VMM和升级后VMM,并且在升级后的VMM上启动升级后虚拟机,但未向升级后虚拟机分配实际的物理内存HPA空间。由于在升级前后的VMM上虚拟机的内存配置和初始化过程是一致的,因此,升级前虚拟机的GPA空间与HVA空间的映射关系和升级后虚拟机的GPA空间与HVA空间的映射关系相同。在图10中,数字1、2、3可以表示内存页在对应的MS中的序号,也可以表示内存在其地址空间中的页地址偏移量。因此,如图10(a)所示,当图中的数字1、2、3表示序号时,序号为1的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的序号都为1,序号为2的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的序号都为2;当图中的数字1、2、3表示页地址偏移量时,页地址偏移量为1的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的页地址偏移量都为1,页地址偏移量为2的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的页地 址偏移量都为2。需要说明的是,当图中的数字1、2、3表示页地址偏移量时,图10仅示例性的画出了GPA空间的页的页地址偏移量与对应的HVA空间的页的页地址偏移量相等的情况,在实际应用中,GPA空间的页的页地址偏移量与对应的HVA空间的页的页地址偏移量可以不相等,只要保证具有相同页偏移量的升级后虚拟机的HVA空间虚拟内存页与升级前虚拟机的HVA空间虚拟内存页分别对应的升级后虚拟机的GPA空间中的页与升级前虚拟机的GPA空间中的页也具有相同的页偏移量即可。例如,页地址偏移量为1的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页的页地址偏移量都为3。
在本公开中,按照升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间的映射关系,将升级前虚拟机的HPA空间反映射到升级后虚拟机的HVA空间上,当升级后虚拟机访问HVA空间的页时,经过多级查表查到的物理内存页与升级前虚拟机中具有相同序号或页地址偏移量的HVA空间的页所对应的HPA空间的物理页是相同的,即,升级后虚拟机可以访问与升级前虚拟机相同的物理内存页,从而完成升级后虚拟机的部署。
下面结合图10做进一步说明。如图10(a)所示,在升级前虚拟机的HVA空间中,序号为1的页对应于HPA空间的p1物理内存页,序号为2的页对应于HPA空间的p2物理内存页,序号为3的页对应于HPA空间的p3物理内存页。在本公开的步骤S110中,升级前虚拟机的HPA空间反映射到升级后虚拟机的HVA空间上,即如图10(b)所示,在升级后虚拟机的HVA空间中,序号为1的页对应于HPA空间的p1物理内存页,序号为2的页对应于HPA空间的p2物理内存页,序号为3的页对应于HPA空间的p3物理内存页。也就是说,升级后虚拟机与升级前虚拟机对应于同一块HPA空间。如前文所述,升级前虚拟机的GPA空间与HVA空间的映射关系和升级后虚拟机的GPA空间与HVA空间的映射关系相同,因此,如图10所示,升级后虚拟机的GVA空间、GPA空间、HVA空间、HPA空间之间的各级映射关系与升级前虚拟机的GVA空间、GPA空间、HVA空间、HPA空间之间的各级映射关系均相同。在图10(b)中,将升级前的VMM删除并启动升级后虚拟机后,在升级后虚拟机上运行的程序经过多级查表访问的物理内存页与在升级前虚拟机上运行时访问的物理内存页相同。
如图10所示,在步骤S110中,并没有复制物理内存页的内存,仅通过复制或修改页表(Page Table Entry,PTE)建立了升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射。因此,整个映射关系的建立过程非常迅速,且不需要预留大量的内存资源。
本公开提供的虚拟机的部署方法,在虚拟机部署过程中,仅复制了宿主机虚拟地址HVA空间与宿主机物理地址HPA空间之间的映射关系(可通过复制或修改页表(Page Table Entry,PTE)来实现),而不用复制虚拟机的整个内存空间的内容,因此可以在不中断虚拟机业务也无需预留大量的计算资源的情况下建立升级后虚拟机的HVA空间与升级前虚拟机的HPA空间的映射关系。当所述部署方法用于虚拟机迁移过程中时,能够实现从升级前虚拟机到升级后虚拟机的迁移,进而完成VMM软件新旧版本 的热替换。而且,还适用于大量虚拟机的批量热迁移,能够有效节省时间成本和资源成本。
在本公开中,当升级后虚拟机在访问HVA空间的页时,为了使经过多级查表查到的物理内存页与升级前虚拟机中具有相同序号或页地址偏移量的HVA空间的页所对应的HPA空间的物理页是相同的,升级后虚拟机的MS应当与升级前虚拟机的MS保持一致。为了确保升级后虚拟机的MS应当与升级前虚拟机的MS保持一致,如图3所示,在启动升级后虚拟机后,所述部署方法还可以包括以下步骤:
在步骤S121中,判断所述升级后虚拟机的页框映射图MS与所述升级前虚拟机的MS是否一致;
若不一致,则在步骤S122中,将所述升级前虚拟机的MS复制到所述升级后虚拟机。
在本公开中,对步骤S121与步骤S110之间的顺序不做特殊的限定,可以在步骤S110之前执行步骤S121,也可以在步骤S110之后执行步骤S121。在图3中所示的实施方式中,在步骤S110之前执行步骤S121。
在本公开中,对如何实施步骤S110不做特殊限定,作为一种可选实施方式,如图3所示,步骤S110具体包括以下步骤:
在步骤S111中,确定升级前虚拟机的HPA空间中各个所述物理内存页的页表项的顺序及顺序号。
在步骤S112中,根据各个所述物理内存页的页表项与所述顺序号的对应关系,将各个所述物理内存页反映射到相应的升级后虚拟机的HVA空间的虚拟内存页上。
在本公开中,可以根据升级前虚拟机的HVA空间的入口地址和HVA空间的大小信息,查找升级前虚拟机的HVA空间对应的HPA空间的物理内存页的页表项。在确定各个物理内存页的页表项的顺序后,可以创建一个列表,将各个物理内存页及其在所述顺序中的顺序号,按照所述顺序依次保存到上述列表中。
在本公开中,对于如何将所述物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页上不作具体限定,只要当升级后虚拟机在访问HVA空间的页时,使经过多级查表查到的物理内存页与升级前虚拟机中具有相同序号或页地址偏移量的HVA空间的页所对应的HPA空间的物理页是相同的,都属于本公开的范围。
为了节省内存空间,在内存管理中多采用多级页表。当为反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的物理内存页创建完善多级页表,就最终完成了HPA空间的物理内存页的页表项从升级前虚拟机的HVA空间到升级后虚拟机的HVA空间的切换。相应地,如图3所示,在步骤S112之后,步骤S110还包括:
在步骤S113中,为反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的物理内存页创建多级页表。
由前述分析可知,具有相同页地址偏移量的升级后虚拟机的HVA空间虚拟内存页与升级前虚拟机的HVA空间虚拟内存页分别对应的升级后虚拟机的GPA空间中的页与升级前虚拟机的GPA空间中的页 也具有相同的页地址偏移量。因此,如图4所示,步骤S111可以具体包括以下步骤:
在步骤S111a中,获取升级前虚拟机的HVA空间的第一入口地址;
在步骤S111b中,获取各个所述物理内存页对应的升级前虚拟机的HVA空间的虚拟内存页相对于所述第一入口地址的页地址偏移量;
在步骤S111c中,将所述页地址偏移量的大小顺序确定为各个所述物理内存页的页表项的所述顺序,将所述页地址偏移量确定为对应的物理内存页的页表项的所述顺序号。
如图10所示,当图中的数字1、2、3表示页地址偏移量时,在升级前虚拟机的HVA空间中,页地址偏移量为1的页对应于HPA空间的p1物理内存页,页地址偏移量为2的页对应于HPA空间的p2物理内存页,页地址偏移量为3的页对应于HPA空间的p3物理内存页。因此,p1物理内存页对应的顺序号为1,p2物理内存页对应的顺序号为2,p3物理内存页对应的顺序号为3。
在本公开中,可以通过宿主机的页表HPT得到物理内存页与与其对应的虚拟内存页的页地址偏移量的对应关系。可以根据偏移量大小的递增、递增或其他任意一种方式对各个所述物理内存页的页表项进行排序,对此不作特殊限定。
在本公开中,对如何实现步骤S112不做特殊限定,作为一种可选实施方式,如图5所示,步骤S112具体包括:
在步骤S112a中,获取所述升级后虚拟机的HVA空间的第二入口地址;
在步骤S112b中,按照所述顺序号递增的顺序,以所述第二入口地址为起点,将各个所述物理内存页反映射到所述升级后虚拟机的HVA空间虚拟内存页上,其中,每一个所述物理内存页对应的所述虚拟内存页相对于所述第二入口地址的页地址偏移量与所述物理内存页的页表项对应的所述顺序号相等。
在本公开中,利用内存页反向映射机制(rmap)将升级前虚拟机的HPA空间的物理内存页的页表项反映射到页地址偏移量与所述物理内存页的页表项对应的页地址偏移量相等的目标虚拟机的HVA空间的虚拟内存页上,也即完成了将所述物理内存页反映射到页地址偏移量与所述物理内存页的页表项对应的页地址偏移量相等的目标虚拟机的HVA空间的虚拟内存页上。
为了防止升级后虚拟机的虚拟中央处理器(VCPU)运行产生缺页中断,在执行步骤S112b之前,所述部署方法还包括:
在步骤S112c中,向所述升级后的VMM发送信令,以将所述升级后虚拟机的虚拟中央处理器VCPU置于暂停状态。
对步骤S112a与步骤S112c之间的先后顺序不做特殊限定,可以先执行步骤S112a后执行步骤S112c,也可以先执行步骤S112c再执行步骤S112a,还可以在执行步骤S112a的同时执行步骤S112c,只要确保步骤S112c在步骤S112b之前执行即可。
需要指出的是,此处的“缺页中断”指的是由于升级后虚拟机的HVA空间的虚拟内存页没有映射到物理内存且升级后虚拟机的扩展页表EPT为空,当升级后虚拟机访问物理内存时,服务器中央处理器的内存管理单元所发出的中断。
在某些具体的应用场景下,在执行步骤S112b将物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页上的过程中,可以将升级前虚拟机的VCPU短暂暂停,其中,所有物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页上所需时间即为升级前虚拟机的VCPU短暂暂停的时间,一般不超过1秒。
在另外一些具体的应用场景下,在执行步骤S112b将物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页上的过程中,可以将该物理内存页暂时置为固定状态,待该物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页上后,解除其固定状态。
通过将升级前虚拟机的VCPU短暂暂停或将物理内存页暂时置为固定状态,可以防止升级前虚拟机的VCPU修改、添加或删除物理内存页,确保将物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页前后,物理内存页的页表或页内容保持一致,进而使业务程序能够在升级前虚拟机和升级后虚拟机上接续运行。
上述通过步骤S112a到S112b实现步骤S112的实施方式流程简单、易于实现,但当需要反映射到升级后虚拟机的HVA空间的物理内存较大时,将升级前虚拟机的VCPU置于暂停状态的时间较长,通常会导致业务长达1秒钟左右的暂停,因此仅适用于内存较小的虚拟机的热迁移。为了缩短将物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页导致的在虚拟机上运行的业务程序的暂停时间,以适用于内存较大的虚拟机的热迁移,本公开还提供一种主动触发缺页中断,以执行步骤S112的实施方式。在本实施方式中,如图6所示,步骤S112具体包括:
在步骤S112d中,获取所述升级后虚拟机的HVA空间的第三入口地址;
在步骤S112e中,向所述升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于运行状态;
在步骤S112f中,根据缺页中断产生的缺页地址偏移量,将所述物理内存页反映射到目标虚拟内存页上,其中,所述目标虚拟内存页为所述升级后虚拟机的HVA空间的虚拟内存页,所述物理内存页的页表项的顺序号与所述缺页地址偏移量相等,且所述目标虚拟内存页的相对于所述第三入口地址的页地址偏移量与所述缺页地址偏移量相等。
由于未向升级后虚拟机分配实际的物理内存,当升级后VCPU运行访问内存时,会产生缺页中断,并产生缺页地址偏移量。所述缺页地址偏移量对应于升级后虚拟机的HVA空间的虚拟内存页的页地址偏移量。
为了进一步缩短上述业务程序的暂停时间,可以在升级后虚拟机运行过程中,对升级后虚拟机内存缺页情况及HPA空间的物理内存页切换情况进行跟踪,并且,在步骤S112g中,判断待反映射到所 述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页的数量是否小于预定阈值。
在步骤S112h中,当待反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页的数量小于预定阈值时,向所述升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于暂停状态。
在步骤S112i中,将待反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页反映射到所述升级后虚拟机的HVA空间的虚拟内存页上,其中,每一个所述物理内存页对应的所述虚拟内存页相对于所述第三入口地址的页地址偏移量与所述物理内存页的页表项对应的所述顺序号相等。
由于此时需一次性反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页的数量已经很少,升级后虚拟机的VCPU暂停的时间可以控制在微秒级,虚拟机内的业务程序对上述暂停无感知,因此不会引起业务暂停或中断。
上文中详细介绍了以升级前虚拟机的HVA空间的虚拟内存页的页地址偏移量确定各个所述物理内存页的页表项的顺序、并将物理内存页反映射到升级后虚拟机的HVA空间的虚拟内存页的实施方式。当然,本公开并不限于此,任何能够反映升级前虚拟机的HVA空间与升级前虚拟机的HPA空间的映射关系的排序方式都属于本公开的范围。下面介绍另外一种确定各个所述物理内存页的页表项的顺序的实施方式。
由前述分析可知,升级后虚拟机的MS与升级前虚拟机的MS一致,即,在MS中具有相同序号的升级后虚拟机中HVA空间的页与升级前虚拟机中HVA空间的页分别对应的升级后虚拟机中GPA空间的页与升级前虚拟机中GPA空间的页在MS中的序号相同。因此,在本公开中,如图7所示,步骤S111可以具体包括:
在步骤S111d中,获取各个物理内存页对应的升级前虚拟机的HVA空间的虚拟内存页在所述升级前虚拟机的页框映射图MS中的序号;
在步骤S111e中,将所述序号的大小顺序确定为各个所述物理内存页的页表项的所述顺序,将所述序号确定为对应物理内存页的页表项的所述顺序号。
如图10所示,当图中的数字1、2、3表示序号时,在升级前虚拟机的HVA空间中,序号为1的页对应于HPA空间的p1物理内存页,序号为2的页对应于HPA空间的p2物理内存页,序号为3的页对应于HPA空间的p3物理内存页。因此,p1物理内存页对应的顺序号为1,p2物理内存页对应的顺序号为2,p3物理内存页对应的顺序号为3。
作为本公开的第二个方面,提供一种虚拟机的热迁移方法,如图8所示,包括:
在步骤S210中,执行上述的部署方法,以将升级前虚拟机的HPA空间映射到升级后虚拟机的HVA空间;
在步骤S220中,向升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于运行状态,其中,所述升级后虚拟机的HPA空间为所述升级前虚拟机的HPA空间。
图10示出了使用本公开提供的热迁移方法对虚拟机进行热迁移前后的内存映射示意图。其中,图10(a)为热迁移前虚拟机内存映射情况,图10(b)为热迁移后虚拟机内存映射情况。可见,热迁移前后,虚拟机在同一HPA空间上运行,且由于不对物理内存页的内容进行复制,整个热迁移过程非常迅速,虚拟机的业务程序无感知。
本公开提供的虚拟机的热迁移方法,使用本公开提供的虚拟机的部署方法通过建立升级后虚拟机的HVA空间与升级前虚拟机的HPA空间的映射关系部署升级后虚拟机,在虚拟机迁移过程中,仅复制了宿主机虚拟地址HVA空间与宿主机物理地址HPA空间之间的映射关系(可通过复制或修改页表(Page Table Entry,PTE)来实现),而不用复制虚拟机的整个内存空间的内容,因此可以在不中断虚拟机业务也无需预留大量的计算资源的情况下将升级前虚拟机迁移到升级后虚拟机,从而实现从升级前虚拟机到升级后虚拟机的迁移。而且,所述热迁移方法还适用于大量虚拟机的批量热迁移,能够有效节省时间成本和资源成本。
作为本公开的第三个方面,提供一种VMM的升级方法。如图9所示,所述升级方法包括:
在步骤S310中,将升级后的VMM部署在宿主机上;
在步骤S320中,在宿主机上同时启动升级前的VMM和升级后的VMM;
在步骤S330中,执行上述的热迁移方法,以将在升级前的VMM上运行的升级前虚拟机迁移到在升级后的VMM上运行的升级虚拟机;
在步骤S340中,删除升级前的VMM。
需要说明的是,现存的技术在对虚拟机进行热迁移时,为了确保虚拟机业务对迁移过程无感知,必须将升级前的VMM保存的升级前虚拟机后端设备信息复制到升级后的VMM上,因此,本公开提供的VMM的升级方法当然地包含上述将升级前的VMM保存的升级前虚拟机后端设备信息复制到升级后的VMM上的步骤。
此外,由于升级后虚拟机在服务器内核里的扩展页表EPT初始为空,随着升级后虚拟机的运行,服务器内核会根据和升级前虚拟机一致的MS开始建立升级后虚拟机的EPT,从而形成从GPA到HPA的高速转换。
本公开提供的VMM的升级方法,使用本公开提供的热迁移方法实现了VMM上运行的虚拟机的热迁移,进而实现了VMM的热升级,能够有效节省时间成本和资源成本。
目前,常用的VMM软件包括VMware公司的vSphere、微软Hyper-V、开升级前的QEMU,XEN,KVM等。下面分别以QEMU-KVM和XEN为例,对本公开提供的虚拟机的部署方法、热迁移方法以及VMM的升级方法作进一步说明。
实施例一
本实施例运行在x86服务器,CPU采用Intel(R)Xeon(R)CPU E5-2640,并已开启EPT功能。操作系统运行2.6版本LINUX的内核,以QEMU-KVM作为虚拟化VMM(Hypervisor),同时在上面运行了业务用户正在使用的Window 7系统虚拟机。
用户的虚拟机在升级前的QEMU上正常运行,升级前虚拟机内操作系统(windows 7)所用的GPA空间和升级前的QEMU进程的HVA空间通过内核KVM模块维护的kvm_memory_slot数据结构建立映射关系,而HVA空间又通过服务器LINUX内核维护的、包括PTE的多级页表映射到GPA空间的物理内存页上。
在升级后的QEMU上通过KVM创建升级后虚拟机,但不向升级后虚拟机分配实际的物理内存,将升级后虚拟机的VCPU置于暂停状态。
将升级前的QEMU程序的迁移执行线程,通过传输控制协议(TCP,Transmission Control Protocol)与升级后的QEMU程序的迁移线程建立连接,同步虚拟网卡、virtio等后端设备信息。
将升级前虚拟机的VCPU置于暂停状态。
本公开第一个方面所提供的部署方法中步骤S111a被具体执行为以下步骤:
获取升级前虚拟机HVA空间的起始地址。
本公开第一个方面所提供的部署方法中步骤S111b被具体执行为以下步骤:
通过HVA的起始地址找到内核中该HVA空间对应的虚拟内存空间(VMA,Virtual Memory Area);
根据HVA的起始地址及VMA红黑树,利用内核提供的页表遍历(memory walk)机制,逐级遍历旧升级前虚拟机HVA对应的多级页表。例如,对于本实施例中的x86_64的linux内核,需要依次遍历PGD表、PUD表、PMD表、及最后的PTE表,找到所有HVA内存页的指针(步骤S111b结束)。
本公开第一个方面所提供的部署方法中步骤S111c被具体执行为以下步骤:
创建一个列表将上述升级前虚拟机HVA空间对应的所有页指针按序排列保存。
本公开第一个方面所提供的部署方法中步骤S112a被具体执行为以下步骤:
获取升级后虚拟机的HVA空间入口地址。
本公开第一个方面所提供的部署方法中步骤S112b被具体执行为以下步骤:
通过内核的反向映射匿名页的技术(page_set_anon_rmap)将上述保存的页指针按序计算相对入口地址的偏移后,映射到升级后虚拟机的HVA空间内。
本公开第一个方面所提供的部署方法中步骤S113被具体执行为:创建多级页表。
此时即完成了页表从升级前虚拟机切换到升级后虚拟机。
确认升级后虚拟机与升级前虚拟机的kvm_memory_slot结构中,GPA空间到HVA空间序号对应关系一致。正常由于升级后虚拟机与升级前虚拟机的内存配置一样,初始化过程一样,kvm_memory_slot 中的映射关系应当是一致的。该步骤相当于本公开第一方面所提供的步骤S121,可以看出,在此实施方式中,在步骤S110之后执行步骤S121。
在本实施例中,可以按照如下步骤执行本公开第二个方面所提供的热迁移方法:
步骤S210被具体执行为上文中所述的各个步骤;
步骤S220被具体执行为:将升级后虚拟机的VCPU置于运行状态。
由于升级后虚拟机的EPT初始为空表,运行中通过不停访问HVA地址空间,使得KVM模块进入Page Fault流程,根据KVM模块内和升级前虚拟机一致的kvm_memory_slot结构,找出其中的映射信息,逐渐建立EPT新表。
最终升级后虚拟机所有内存页在KVM模块上完成EPT建表并生效,实现从GPA到HPA高速转换。确认升级后虚拟机的正常运行后,删除升级前的QEMU运行进程。
实施例二
本实施例的目的在于尽量缩减虚拟机在页表切换期间VCPU暂停的时间,运行的软硬件环境及QEMU升级前的宿主机、虚拟机状态均和实施例一相同。只有将升级前虚拟机的HPA空间反映射到升级后虚拟机的HVA空间的步骤不同。
本公开第一个方面所提供的部署方法中步骤S112e被具体执行为以下步骤:
将升级后虚拟机VCPU置于运行状态,由于没有向升级后虚拟机的HVA空间分配实际物理内存,因此当升级后虚拟机的HVA空间中某个HVA地址被访存时,内核会产生缺页中断(no_page_fault)。
本公开第一个方面所提供的部署方法中步骤S112f被具体执行为以下步骤:
根据缺页中断所需的缺页地址偏移,在保存的升级前虚拟机HVA空间对应的所有页指针中进行查找,找到对应同样偏移的页的指针,通过内核的反向映射匿名页的技术(page_set_anon_r-map)映射到升级后虚拟机的HVA空间内。
本公开第一个方面所提供的部署方法中步骤S113被具体执行为:
创建该页对应的多级页表。
本公开第一个方面所提供的部署方法中步骤S112g被具体执行为:
保持对升级后虚拟机内存缺页情况及页表切换情况的检查.
本公开第一个方面所提供的部署方法中步骤S112h被具体执行为:
当待切换页数目少于一定阈值时,暂停升级后虚拟机VCPU.
本公开第一个方面所提供的部署方法中步骤S112i被具体执行为:
一次反向映射所有剩余内存到升级后虚拟机HVA空间,并创建多级页表。
在上述缺页并依次切换内存页的过程中,KVM模块也会根据和升级前虚拟机一致的kvm_memory_slot逐渐建立EPT新表。最终升级后虚拟机所有内存页在KVM模块上完成EPT建表并生 效,实现从GPA到HPA高速转换。
确认升级后虚拟机的正常运行后,删除升级前的QEMU运行进程。
实施例三
本实施例以XEN作为虚拟化VMM(Hypervisor)软件。
在升级后的XEN hypervisor上创建升级后虚拟机,但不申请实际的HVA内存,将升级后虚拟机VCPU处于暂停状态。
暂停升级前虚拟机VCPU的执行。
本公开第一个方面所提供的部署方法中步骤S111被具体执行为以下步骤:
获取升级前虚拟机的HVA空间入口地址,传入服务器LINUX操作系统内核;
根据HVA的起始地址及VMA红黑树,利用内核提供的memory walk(页表遍历)机制,逐级遍历旧虚拟机HVA对应的多级页表,以x86_64架构的linux内核为例,依次遍历PGD表、PUD表、PMD表、及最后的PTE表,找到所有的HVA内存页指针(步骤S111结束)。
本公开第一个方面所提供的部署方法中步骤S112被具体执行为以下步骤:
通过XEN的TestSetPagePinned()方法,将遍历的HVA对应的内存页打上标记并锁定;
获取升级后虚拟机的HVA空间入口地址。同时遍历页表,通过XEN的PagePinned()方法判断内存页是否打上标记并锁定;
将锁定的页通过map_pages_to_xen映射到升级后虚拟机的HVA空间上(步骤S112结束)。
本公开第一个方面所提供的部署方法中步骤S113被具体执行为以下步骤
创建完善相应的多级页表,作为升级后虚拟机实际的运行内存。通过ClearPagePinned()方法清除锁定标记。
在本实施例中,可以按照如下步骤执行本公开第二个方面所提供的热迁移方法:
步骤S210被具体执行为上文中所述的各个步骤;
步骤S220被具体执行为:将升级后虚拟机VCPU置于运行状态,以在运行中通过不停访问HVA地址空间,自动创建相应的影子页表或EPT页表。
确认升级后虚拟机正常运行后,删除升级前的XEN上的虚拟机进程。
作为本公开的第四个方面,提供一种服务器,所述服务器用作虚拟机的宿主机,所述服务器包括:存储模块,该存储模块上存储有应用程序;一个或多个处理器,当所述应用程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现以下方法中的一者:上述的部署方法;上述的热迁移方法;上述的升级方法。
上文已经对本公开提供的部署方法、热迁移方法或升级方法的工作原理及有益效果进行了详细的描述,此处不再赘述。
作为本公开的第五个方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有可执行程序, 所述可执行程序被执行时能够实现以下方法中的一者:上述的部署方法;上述的热迁移方法;上述的升级方法。
通过本公开实施例提供的虚拟机的部署方法、虚拟机的热迁移方法、VMM的升级方法、服务器和计算机可读存储介质,在虚拟机部署过程中,仅复制了宿主机虚拟地址HVA空间与宿主机物理地址HPA空间之间的映射关系(可通过复制或修改页表(Page Table Entry,PTE)来实现),而不用复制虚拟机的整个内存空间的内容,因此可以在不中断虚拟机业务也无需预留大量的计算资源的情况下建立升级后虚拟机的HVA空间与升级前虚拟机的HPA空间的映射关系。当所述部署方法用于虚拟机迁移过程中时,能够实现从升级前虚拟机到升级后虚拟机的迁移,进而完成VMM软件新旧版本的热替换。而且,还适用于大量虚拟机的批量热迁移,能够有效节省时间成本和资源成本。
计算机可读存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机可读存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储介质、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。
可以理解的是,以上实施方式仅仅是为了说明本公开的原理而采用的示例性实施方式,然而本公开并不局限于此。对于本领域内的普通技术人员而言,在不脱离本公开的原理和实质的情况下,可以做出各种变型和改进,这些变型和改进也视为本公开的保护范围。

Claims (14)

  1. 一种虚拟机的部署方法,包括:
    根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射,其中,
    所述升级后虚拟机部署在升级后的虚拟机监控器VMM上,且所述升级后虚拟机的内存配置与在升级前的VMM上运行的所述升级前虚拟机的内存配置相同。
  2. 根据权利要求1所述的部署方法,其中,根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射的步骤包括:
    确定升级前虚拟机的HPA空间中各个物理内存页的页表项的顺序及顺序号;
    根据各个所述物理内存页的页表项与所述顺序号的对应关系,将各个所述物理内存页反映射到相应的升级后虚拟机的HVA空间的虚拟内存页上。
  3. 根据权利要求2所述的部署方法,其中,确定升级前虚拟机的HPA空间中各个物理内存页的页表项的顺序及顺序号的步骤包括:
    获取升级前虚拟机的HVA空间的第一入口地址;
    确定各个所述物理内存页对应的升级前虚拟机的HVA空间虚拟内存页相对于所述第一入口地址的页地址偏移量;
    将所述页地址偏移量的大小顺序确定为各个所述物理内存页的页表项的所述顺序,将所述页地址偏移量确定为对应的物理内存页的页表项的所述顺序号。
  4. 根据权利要求3所述的部署方法,其中,根据各个所述物理内存页的页表项与所述顺序号的对应关系,将各个所述物理内存页反映射到相应的升级后虚拟机的HVA空间的虚拟内存页上的步骤包括:
    获取所述升级后虚拟机的HVA空间的第二入口地址;
    按照所述顺序号递增的顺序,以所述第二入口地址为起点,将各个所述物理内存页反映射到所述升级后虚拟机的HVA空间的虚拟内存页上,其中,每一个所述物理内存页对应的所述虚拟内存页相对于所述第二入口地址的页地址偏移量与所述物理内存页的页表项对应的所述顺序号相等。
  5. 根据权利要求4所述的部署方法,其中,在按照所述顺序号递增的顺序,以所述第二入口地址为起点,将各个所述物理内存页反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的步骤之前,所述部署方法还包括:
    向所述升级后的VMM发送信令,以将所述升级后虚拟机的虚拟中央处理器VCPU置于暂停状态。
  6. 根据权利要求3所述的部署方法,其中,根据各个所述物理内存页的页表项与所述顺序号的 对应关系,将各个所述物理内存页反映射到相应的升级后虚拟机的HVA空间的虚拟内存页上的步骤包括:
    获取所述升级后虚拟机的HVA空间的第三入口地址;
    向所述升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于运行状态;
    根据缺页中断产生的缺页地址偏移量,将所述物理内存页反映射到目标虚拟内存页上,其中,所述目标虚拟内存页为所述升级后虚拟机的HVA空间的虚拟内存页,所述物理内存页的页表项的顺序号与所述缺页地址偏移量相等,且所述目标虚拟内存页的相对于所述第三入口地址的页地址偏移量与所述缺页地址偏移量相等。
  7. 根据权利要求6所述的部署方法,其中,在根据缺页中断产生的缺页地址偏移量,将所述物理内存页反映射到目标虚拟内存页上的步骤之后,所述部署方法还包括:
    判断待反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页的数量是否小于预定阈值;
    响应于待反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页的数量小于所述预定阈值,向所述升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于暂停状态;
    将待反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页反映射到所述升级后虚拟机的HVA空间的虚拟内存页上,其中,每一个所述物理内存页对应的所述虚拟内存页相对于所述第三入口地址的页地址偏移量与所述物理内存页的页表项对应的所述顺序号相等。
  8. 根据权利要求2所述的部署方法,其中,确定各个所述物理内存页的页表项的顺序的步骤包括:
    获取各个物理内存页对应的升级前虚拟机的HVA空间的虚拟内存页在所述升级前虚拟机的页框映射图MS中的序号;
    将所述序号的大小顺序确定为各个所述物理内存页的页表项的顺序,将所述序号确定为对应物理内存页的页表项的所述顺序号。
  9. 根据权利要求2至8中任意一项所述的部署方法,其中,在根据各个所述物理内存页的页表项与所述顺序号的对应关系,将所述物理内存页反映射到相应的升级后虚拟机的HVA空间的虚拟内存页上的步骤之后,所述部署方法还包括:
    为反映射到所述升级后虚拟机的HVA空间的虚拟内存页上的所述物理内存页创建多级页表。
  10. 根据权利要求1至8中任意一项所述的部署方法,其中,在根据升级前虚拟机的宿主机虚拟地址HVA空间与所述升级前虚拟机的宿主机物理地址HPA空间之间的映射关系,建立升级后虚拟机的HVA空间与所述升级前虚拟机的HPA空间之间的映射的步骤之前,所述部署方法还包括:
    判断所述升级后虚拟机的MS与所述升级前虚拟机的MS是否一致;
    若不一致,将所述升级前虚拟机的MS复制到所述升级后虚拟机。
  11. 一种虚拟机的热迁移方法,包括:
    执行权利要求1至10任意一项所述的部署方法,以将升级前虚拟机的HPA空间映射到升级后虚拟机的HVA空间;
    向升级后的VMM发送信令,以将所述升级后虚拟机的VCPU置于运行状态,其中,所述升级后虚拟机的HPA空间为所述升级前虚拟机的HPA空间。
  12. 一种VMM的升级方法,包括:
    将升级后的VMM部署在宿主机上;
    在宿主机上同时启动升级前的VMM和升级后的VMM;
    执行权利要求11所述的热迁移方法,以将在升级前的VMM上运行的升级前虚拟机迁移到在升级后的VMM上运行的升级后虚拟机;
    删除升级前的VMM。
  13. 一种服务器,所述服务器用作虚拟机的宿主机,所述服务器包括:
    存储模块,该存储模块上存储有应用程序;
    一个或多个处理器,当所述应用程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现以下方法中的一者:
    权利要求1至10中任意一项所述的部署方法;
    权利要求11所述的热迁移方法;
    权利要求12所述的升级方法。
  14. 一种计算机可读存储介质,所述计算机可读存储介质上存储有可执行程序,所述可执行程序被执行时能够实现以下方法中的一者:
    权利要求1至10中任意一项所述的部署方法;
    权利要求11所述的热迁移方法;
    权利要求12所述的升级方法。
PCT/CN2020/133341 2019-12-25 2020-12-02 虚拟机部署及热迁移方法、vmm升级方法、服务器 WO2021129332A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/783,417 US20230009596A1 (en) 2019-12-25 2020-12-02 Virtual machine deployment and hot-migration methods, vmm upgrade method, and server
EP20905775.1A EP4080358A4 (en) 2019-12-25 2020-12-02 VIRTUAL MACHINE DEPLOYMENT AND HOT MIGRATION PROCESSES, VMM UPGRADE PROCESS AND SERVER

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911355638.6A CN113032086A (zh) 2019-12-25 2019-12-25 虚拟机部署及热迁移方法、vmm升级方法、服务器
CN201911355638.6 2019-12-25

Publications (1)

Publication Number Publication Date
WO2021129332A1 true WO2021129332A1 (zh) 2021-07-01

Family

ID=76458285

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/133341 WO2021129332A1 (zh) 2019-12-25 2020-12-02 虚拟机部署及热迁移方法、vmm升级方法、服务器

Country Status (4)

Country Link
US (1) US20230009596A1 (zh)
EP (1) EP4080358A4 (zh)
CN (1) CN113032086A (zh)
WO (1) WO2021129332A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434371A (zh) * 2021-08-26 2021-09-24 阿里云计算有限公司 内存访问信息的采集方法、计算设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113391881B (zh) * 2021-06-28 2023-07-14 元心信息科技集团有限公司 中断的管理方法、装置、电子设备及计算机存储介质
CN115061954B (zh) * 2022-08-18 2022-11-29 统信软件技术有限公司 一种缺页中断处理方法、计算设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110314203A1 (en) * 2010-06-18 2011-12-22 Chen Lee-Chung Resource adjustment methods and systems for virtual machines
CN103942087A (zh) * 2014-03-31 2014-07-23 华为技术有限公司 虚拟机热迁移方法及相关装置和集群系统
CN104636181A (zh) * 2013-11-08 2015-05-20 国际商业机器公司 用于迁移虚拟机的方法和系统
CN107278292A (zh) * 2016-06-21 2017-10-20 华为技术有限公司 一种虚拟机内存的映射方法、装置及数据传输设备
US20180060117A1 (en) * 2016-08-29 2018-03-01 Vmware, Inc. Live migration of virtual computing instances between data centers

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7636831B1 (en) * 2006-03-31 2009-12-22 Vmware, Inc. Optimization of reverse mappings for immutable guest physical pages of virtual memories in a virtualized computer system
US10705867B2 (en) * 2016-06-22 2020-07-07 Vmware, Inc. Hypervisor exchange with virtual machines in memory
CN107168769B (zh) * 2017-03-30 2020-12-18 联想(北京)有限公司 一种信息处理方法及电子设备
US11016798B2 (en) * 2018-06-01 2021-05-25 The Research Foundation for the State University Multi-hypervisor virtual machines that run on multiple co-located hypervisors

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110314203A1 (en) * 2010-06-18 2011-12-22 Chen Lee-Chung Resource adjustment methods and systems for virtual machines
CN104636181A (zh) * 2013-11-08 2015-05-20 国际商业机器公司 用于迁移虚拟机的方法和系统
CN103942087A (zh) * 2014-03-31 2014-07-23 华为技术有限公司 虚拟机热迁移方法及相关装置和集群系统
CN107278292A (zh) * 2016-06-21 2017-10-20 华为技术有限公司 一种虚拟机内存的映射方法、装置及数据传输设备
US20180060117A1 (en) * 2016-08-29 2018-03-01 Vmware, Inc. Live migration of virtual computing instances between data centers

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4080358A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434371A (zh) * 2021-08-26 2021-09-24 阿里云计算有限公司 内存访问信息的采集方法、计算设备及存储介质

Also Published As

Publication number Publication date
US20230009596A1 (en) 2023-01-12
EP4080358A4 (en) 2023-01-25
EP4080358A1 (en) 2022-10-26
CN113032086A (zh) 2021-06-25

Similar Documents

Publication Publication Date Title
WO2021129332A1 (zh) 虚拟机部署及热迁移方法、vmm升级方法、服务器
US9317279B2 (en) Virtual machine block substitution
US10552230B2 (en) Post-copy migration of a group of virtual machines that share memory
US10817333B2 (en) Managing memory in devices that host virtual machines and have shared memory
US9330013B2 (en) Method of cloning data in a memory for a virtual machine, product of computer programs and computer system therewith
US9405642B2 (en) Providing virtual machine migration reliability using an intermediary storage device
US9135049B2 (en) Performing thin-provisioning operations on virtual disk images using native features of the storage domain
US20160266938A1 (en) Load balancing function deploying method and apparatus
US20150205542A1 (en) Virtual machine migration in shared storage environment
US11809888B2 (en) Virtual machine memory migration facilitated by persistent memory devices
US10162657B2 (en) Device and method for address translation setting in nested virtualization environment
US9558023B2 (en) Live application mobility from one operating system level to an updated operating system level and applying overlay files to the updated operating system
US10860393B2 (en) Tracking driver load and unload on windows OS
CN108713189B (zh) 推测性虚拟机执行
Doddamani et al. Fast and live hypervisor replacement
US10503659B2 (en) Post-copy VM migration speedup using free page hinting
US10768959B2 (en) Virtual machine migration using memory page hints
US20140208034A1 (en) System And Method for Efficient Paravirtualized OS Process Switching
US20230195533A1 (en) Prepopulating page tables for memory of workloads during live migrations
US20200167171A1 (en) Virtual machine booting using disk metadata
US11543988B1 (en) Preserving large pages of memory across live migrations of workloads
US11586371B2 (en) Prepopulating page tables for memory of workloads during live migrations
Mihailescu et al. FreeBSD-Live Migration feature for bhyve
US20230176889A1 (en) Update of virtual machines using clones
WO2024041351A1 (en) Disabling processor facility on new processor generation without breaking binary compatibility

Legal Events

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

Ref document number: 20905775

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020905775

Country of ref document: EP

Effective date: 20220722