A Method and Device for Correcting Cross-Host Architecture Migration of Virtual Machines

By obtaining the differential state points between the source host and the target host, and dynamically adjusting the instructions and storage status of the virtual machine, the problem of inefficient migration of virtual machines across host architectures is solved, and efficient migration process and full utilization of computing performance is achieved.

CN113760451BActive Publication Date: 2025-07-11KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110843800.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-26
Publication Date
2025-07-11
Estimated Expiration
2041-07-26

AI Technical Summary

Technical Problem

The prior art is inefficient in the process of cross-host architecture migration of virtual machines, and may lead to loss of physical host computing power and interruption of virtual machine operation, and fail to effectively deal with the problem of inconsistent storage status.

Method used

By obtaining the differential state points of the source host and the target host, including the instruction differential state points and storage differential state points, dynamically adjusting the instructions and storage state of the virtual machine to adapt to the architecture of the target host, the migration process is performed concurrently using the staged correction method, the virtualization management layer obtains the memory state access address, and setting a self-trapping processing function and address query portal for differential state correction.

Benefits of technology

Improve the efficiency of virtual machines' cross-host architecture migration, make full use of physical host computing performance, reduce the performance impact during the migration process, and solve the problem of inconsistent storage status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760451B_ABST
    Figure CN113760451B_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for correcting cross-host architecture migration of a virtual machine. The method includes: obtaining difference state points of a source host and a target host, where the difference state points include instruction difference state points and storage difference state points; determining an instruction difference state and a storage difference state of the virtual machine according to the difference state points, and the virtual machine runs on the source host; correcting the instruction difference state of the virtual machine according to the instruction difference state points, and at the same time, correcting the storage difference state of the virtual machine according to the storage difference state points. The present application does not require setting an intersection of the architecture levels of the source and the target for the virtual machine to be migrated, and corrects the storage difference state while correcting the instruction difference state of the virtual machine, which can reduce the loss of the computing power of the physical host while improving the migration success rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers. Specifically, this application designs a method and device for correcting virtual machine cross-host architecture migration. Background Art

[0002] In the cloud computing environment, the cloud host live migration technology is an important technical means for cloud computing server integration and is widely used in production. In actual production, due to different procurement manufacturers and different procurement batches, it is impossible to make the production cluster achieve exactly the same CPU model. In this case, there will be architectural differences in physical hosts in the migration cluster.

[0003] In the prior art, for example, the application number is: CN201710962991.5, and the name is: A method and device for virtual machine migration of heterogeneous CPUs. This application proposes a method to achieve virtual machine cross-host architecture migration. Although this method can ensure the completion of the migration, it is generally a relatively static processing strategy: during the migration, the instruction status is modified based on the largest intersection of the source virtual machine and the target host. When the virtual machine migrates from a high-level architecture host to a low-level architecture host, the virtual machine instruction status is replaced with the low-level status. In subsequent migrations, even when migrating to a high-level architecture host, it will still run in the low-level status. Although this solution does not set a fixed baseline, in actual operation, the virtual machine instruction status is still artificially degraded to achieve migration compatibility. Therefore, the technical solution provided by this application does not make full use of the computing power of the physical host, resulting in a loss of host computing power.

[0004] At the same time, the solution provided by the above application sets the timing of modifying the instruction status before the start of the migration. However, for the modification of the instruction status, technically, the virtual machine needs to be in a suspended state, and the running suspension will cause the business system to interrupt. And it is obviously an unreasonable way to have the virtual machine business interrupt before the start of the migration. In addition, the discussion of the modification of the virtual machine running state in this application is limited to regarding its own solution as a process of the overall processing framework, and there is no specific discussion on the solution itself. Moreover, this application only provides the modification of the virtual machine instruction status and does not consider dealing with the inconsistency of the storage state. In fact, the inconsistency of the virtual machine storage state also constitutes a factor that substantially affects the virtual machine cross-host architecture migration. Summary of the Invention

[0005] The purpose of this application is to provide a method and device for correcting virtual machine cross-host architecture migration to solve the problem of low efficiency in the process of virtual machine cross-host architecture migration in the prior art.

[0006] In the first aspect of the embodiments of the present application, a method for correcting a virtual machine cross-host architecture is provided, including:

[0007] Obtain the difference state points of the source host and the target host, where the difference state points include instruction difference state points and storage difference state points;

[0008] Determine the instruction difference state and the storage difference state of the virtual machine according to the difference state points, and the virtual machine runs on the source host;

[0009] Correct the instruction difference state of the virtual machine according to the instruction difference state points, and at the same time, correct the storage difference state of the virtual machine according to the storage difference state points.

[0010] In the second aspect of the embodiments of the present application, a device for correcting virtual machine cross-host architecture migration is provided, including:

[0011] A data acquisition module, configured to acquire the difference state points of the source host and the target host, and attach an update flag to be updated to each state difference point;

[0012] A data analysis module, configured to determine whether each difference state point has been updated, and determine whether the state difference point is an instruction difference state point or a storage difference state point;

[0013] A data processing module, configured to correct the instruction difference state and the storage difference state of the virtual machine according to all the difference state points.

[0014] In the third aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned method for correcting virtual machine cross-host architecture migration are implemented.

[0015] In the fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided. The computer storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for correcting virtual machine cross-host architecture migration are implemented.

[0016] The beneficial effects of a virtual machine cross-host architecture migration correction method provided by an embodiment of the present application are as follows: By obtaining the difference state points between the source host and the target host, it is not necessary to set an intersection of the architecture levels of the source and the target for the virtual machine to be migrated, minimizing the loss of the computing power of the physical host. The difference state points include instruction difference state points and storage difference state points; according to the difference state points, the instruction difference state and the storage difference state of the virtual machine are determined. According to the instruction difference state points, the instruction difference state of the virtual machine is corrected. At the same time, according to the storage difference state points, the storage difference state of the virtual machine is corrected. While correcting the instruction difference state of the virtual machine, the storage difference state of the virtual machine is also corrected, fully considering the problem of storage inconsistency during the virtual machine migration process, and maximizing the virtual machine cross-host architecture migration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by an embodiment of the present application;

[0018] Figure 2 It is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by another embodiment of the present application;

[0019] Figure 3 It is a schematic flowchart of a virtual machine cross-organization migration correction method provided by another embodiment of the present application;

[0020] Figure 4 It is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by still another embodiment of the present application;

[0021] Figure 5 It is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by still another embodiment of the present application;

[0022] Figure 6 It is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by yet another embodiment of the present application;

[0023] Figure 7 It is a structure diagram of virtual machine cross-architecture migration difference state information provided by an embodiment of the present application;

[0024] Figure 8 It is a schematic diagram of the principle for determining the access address of the storage difference state in virtual machine cross-architecture migration provided by an embodiment of the present application;

[0025] Figure 9 It is a flowchart of the correction timing of the virtual machine running state provided by an embodiment of the present application;

[0026] Figure 10Schematic diagram of the operation principle for correcting the running state of a virtual machine provided in an embodiment of the present application;

[0027] Figure 11 Schematic structural diagram of a device for correcting cross-host architecture migration of a virtual machine provided in an embodiment of the present application;

[0028] Figure 12 Schematic block diagram of an electronic device for correcting cross-host architecture migration of a virtual machine provided in an embodiment of the present application. Detailed implementation manners

[0029] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the technical solutions in the present application and are not used to limit the present application.

[0030] Figure 1 Flow chart of a method for correcting cross-host architecture migration of a virtual machine provided in an embodiment of the present application, including:

[0031] S101: Obtain the difference state points of the source host and the target host;

[0032] Under a certain main system hardware structure, the difference state points of the source host and the target host are relatively determined and will not change with software operation. And since the virtual machine runs on the source host, a difference state point information library visible at both ends of the migration, namely the source host and the target host, can be set. The difference state points in the information library can be determined through manual experiments and supplemented to the information library, or can be determined through software operation and supplemented to the information library, which is not limited herein.

[0033] S102: Determine the instruction difference state and storage difference state of the virtual machine according to the difference state points;

[0034] The difference state points can include two types, namely instruction difference state points and storage difference state points. If the type of the difference state point is an instruction difference state point, then at this difference state point, the virtual machine is in an instruction difference state; similarly, if the type of the difference state point is a storage difference state point, then at this difference state point, the virtual machine processes a storage difference state.

[0035] S103: Correct the instruction difference state of the virtual machine according to the instruction difference state points, and at the same time, correct the storage difference state of the virtual machine according to the storage difference state points.

[0036] The instruction difference state represents the inconsistent state of the virtual CPU during the operation of the virtual machine caused by the architecture, which is specifically reflected by the virtual machine registers. Therefore, for the instruction difference state of the virtual machine, the method of writing the value of the target host register into the corresponding register of the virtual machine can be adopted, but is not limited to this, so as to correct the instruction difference state of the virtual machine.

[0037] The storage difference state indicates that there are differences in the deterministic descriptions of the memory model characteristics for different architectures, which is specifically reflected by the data in the associated memory area. Therefore, for the storage difference state of the virtual machine, the method of writing the value of the target host memory area into the corresponding memory area of the virtual machine can be adopted, but is not limited to this, so as to correct the storage difference state of the virtual machine.

[0038] In the above embodiments provided by the present application, by obtaining the difference state points of the source host and the target host, where the difference state points include instruction difference state points and storage difference state points; according to the difference state points, determining the instruction difference state and the storage difference state of the virtual machine, where the virtual machine runs on the source host; according to the instruction difference state points, correcting the instruction difference state of the virtual machine, and at the same time, according to the storage difference state points, correcting the storage difference state of the virtual machine. Correcting the virtual machine according to the difference state points does not require setting an intersection of the architecture levels of the source and the target for the virtual machine to be migrated, which can reduce the loss of the computing power of the physical host. At the same time, it fully considers the inconsistent descriptions of the memory model characteristics by the two end hosts when the virtual machine migrates across architectures, corrects the instruction difference state of the virtual machine while correcting the storage difference state, thereby improving the migration success rate.

[0039] As Figure 2 shown is a schematic flowchart of a method for correcting the cross-host architecture migration of a virtual machine provided by another embodiment of the present application on the basis of the above Figure 1 shown embodiment, including:

[0040] S201: During the execution of the migration process of the virtual machine, perform the first correction on the running state of the virtual machine;

[0041] During the migration of the virtual machine, the method of setting a threshold or other preset conditions can be adopted. When the preset conditions are met, start to perform the first correction on the running state of the virtual machine. For example, a threshold can be set in advance, and at the same time, continuously synchronously transmit the memory page data while keeping the virtual machine running. When the migration process is about to be completed, that is, when the amount of remaining untransmitted memory page data reaches the preset threshold, freeze the virtual machine running on the source host to complete the first correction of the running state of the virtual machine in a manner concurrent with the migration process.

[0042] S202: After the execution of the migration process of the virtual machine is completed, perform the second correction on the running state of the virtual machine.

[0043] When the virtual machine migration is completed, that is, when the last remaining amount of the virtual machine is migrated, a second correction of the running state of the virtual machine is performed before restoring the running state of the virtual machine again.

[0044] In the above embodiments provided by the present application, by adopting a phased manner, the running state of the virtual machine executing the migration process is corrected. At the same time, since during the first correction of the running state of the virtual machine, the correction process and the last remaining amount transmission process of the migration process are executed concurrently, and in practice, the time required for the correction process is less than the time required for the migration process, the impact of the correction on the migration performance is minimized. Moreover, the correction amount in the first stage is much larger than that in the second stage. After the first stage of correction is completed, the remaining amount to be corrected is very small, so the second correction of the running state of the virtual machine will be completed in a very short time.

[0045] Figure 3 As shown in the above Figure 1 Based on the above embodiments shown, the following is a schematic flowchart of a virtual machine cross-host architecture migration correction method provided by another embodiment of the present application, including:

[0046] S301: The virtual machine enters the migration preparation state;

[0047] The whole process of the virtual machine migration mechanism can generally be divided into three stages: source host-side migration preparation, migration in progress, and migration completion. Before correcting the running state of the virtual machine, the virtual machine needs to enter the migration preparation state.

[0048] S302: Obtain the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host;

[0049] The virtual machine storage difference state includes multiple memory difference state points, and each memory difference state point corresponds to one or more storage difference memory areas.

[0050] S303: Determine the access address of the storage difference memory area of the virtual machine according to the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host.

[0051] The access address of a storage difference memory area can be represented by a binary tuple composed of the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host.

[0052] In the above embodiments provided by the present application, by obtaining the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host, the access address of the storage difference memory area affected by the virtual machine that may change randomly is determined, ensuring the implementation of the final correction operation of the running state of the virtual machine.

[0053] Such asFigure 4 As shown in the above Figure 3 Shown in the above embodiment, the following is a schematic flowchart of a method for correcting virtual machine cross-host architecture migration provided by another embodiment of the present application, including:

[0054] S401: During the initialization process of the virtual machine, input the trap handling function of a specific memory area indicated by the memory model characteristic state;

[0055] When the virtual machine boots up and the boot process reaches a specific memory area, due to the pre-set trap handling function, an actual trap operation will occur.

[0056] S402: Through the virtualization management layer, use the trap handling function of the specific memory area to obtain the access address of the memory state area of the virtual machine;

[0057] In the trap handling function, the trap operation will map the access address of a specific area inside the virtual machine to form a virtual machine access address accessible by the host virtualization management layer.

[0058] S403: During the initialization process of the target host, input the address query entry of a specific memory area indicated by the memory model characteristic state;

[0059] When the target host is initialized, this process is in the migration preparation stage and the migration process has not actually started.

[0060] S404: The target host obtains the access address of the memory state area of the target host through the address query entry to prepare for migration.

[0061] In this embodiment, the address query entry is used to obtain the access address for a specific memory area.

[0062] In the above embodiment provided by the present application, by setting the trap handling function, the virtualization management layer is used to obtain the access address of the specific memory area of the virtual machine; by inputting the address query entry of the specific memory area for the target host, the access address of the specific memory area of the target host is obtained. Record the obtained access addresses of each host into the storage difference status information library to complete the data entry of the host storage difference status access address and prepare for the subsequent migration.

[0063] Such as Figure 5 As shown in the above Figure 1 Shown in the above embodiment, the following is a schematic flowchart of a method for correcting virtual machine cross-host architecture migration provided by another embodiment of the present application, including:

[0064] S501: Write the register value of the target host into the corresponding register of the virtual machine to complete the correction of the instruction difference state;

[0065] When correcting the instruction difference state of a virtual machine, first, according to the register identifier of the instruction difference state in the difference state point information library, read the values of the registers of the virtual machine and the target host, and then perform a status consistency check. If they are inconsistent, write the value of the target host register into the corresponding register of the virtual machine. Specifically, if the architecture level of the target host is lower than that of the source host, correct the running state of the virtual machine downward in level; if the architecture level of the target host is higher than that of the source host, correct the running state of the virtual machine upward in level.

[0066] S502: Write the memory area value of the target host into the corresponding memory area of the virtual machine to complete the correction of the storage difference state.

[0067] When correcting the storage difference state of a virtual machine, first, associate the current difference state point with the record of the storage difference state, and then traverse the storage difference state point again to obtain the current memory area point. For the virtual machine access address and the target host access address of the memory area recorded in the difference state point information library, perform an addressing access to obtain the corresponding data, and perform a status consistency determination. If they are not consistent, write the target host memory area value into the corresponding memory area of the virtual machine. Specifically, if the architecture level of the target host is lower than that of the source host, correct the running state of the virtual machine downward in level; if the architecture level of the target host is higher than that of the source host, correct the running state of the virtual machine upward in level.

[0068] In the above embodiments provided by the present application, when correcting the running state of the virtual machine, replace the instruction level of the current virtual machine with the instruction level of the target physical machine, that is: when the virtual machine migrates from a high architecture level to a low architecture level, the running state of the virtual machine is adjusted downward in level; conversely, the running state of the virtual machine is adjusted upward in level. Different from the prior art in which the virtual machine to be migrated always makes a downward adjustment to the low architecture level state, the present application makes a dynamic adjustment to the virtual machine, that is, adaptively makes an upward or downward running state adjustment, making full use of the computing performance of the physical host.

[0069] Such as Figure 6 shown is based on the above Figure 1 shown embodiment. The flowchart of the virtual machine cross-host architecture migration correction method provided by another embodiment of the present application includes:

[0070] S601: For each difference state point, determine whether the difference state point has been updated;

[0071] In this embodiment, it is possible to determine whether the difference state point has been updated by means of an update flag attached to the difference state point.

[0072] S602: If the difference status point is not updated, determine whether the difference status point is an instruction difference status point or a storage difference status point; if the difference status point has been updated, skip this difference status point and judge the next difference status point.

[0073] In this embodiment, it is necessary to traverse all difference status points to determine the types of all unupdated difference status points. The type of the difference status point corresponds to the running state of the virtual machine at this point.

[0074] S603: If the difference status point is an instruction difference status point, determine that the virtual machine is in an instruction difference state; if the difference status point is a storage difference status point, determine that the virtual machine is in a storage difference state.

[0075] In the above embodiment provided by this application, different from the prior art: every time, a query operation is performed on all status points of the virtual machine and the target host, and the largest intersection is taken. By judging the update status of each difference status point, this application specifically processes the unupdated difference status points, saving the time required for each operation and improving the efficiency of virtual machine cross-host architecture migration.

[0076] To facilitate those skilled in the art to understand the technical solutions in this application and to make the technical solutions in this application clearer, a specific implementation example is now provided to clearly illustrate the technical solutions in this application.

[0077] Figure 7 The structure diagram of the difference status information for virtual machine cross-architecture migration provided for an implementation example of this application. Among them, module 700 represents a specific physical machine main architecture, marked with ARCH_X, and in practice, it is a description of the physical main architecture to which a migration cluster belongs.

[0078] Module 710 represents the inconsistent instruction status under the ARCH_X main architecture, which can be divided into multiple specific types, such as: instruction status types a, b, and c. Each instruction status is composed of one or more register identifiers, and each register identifier also includes a flag indicating whether it can be updated. This flag is used to implement incremental updates in subsequent phased state updates. The instruction difference status set will definitely contain one or more memory model characteristic state records, marked with IS_MMS. This type of status describes the inconsistent points of the memory model characteristics caused by architecture differences, and actually indicates a storage difference status, which corresponds to module 720.

[0079] Module 720 represents an inconsistent storage state belonging to the ARCH_X main architecture. The specific record entries are multiple memory state points, such as a, b, and c, etc. This module records the memory model characteristic state points pointed to by Module 710, and further associates with one or more memory regions. A memory region is represented by a pair of access addresses of the virtual machine and the target host.

[0080] The state information library is pre-established and data entry is completed before the migration starts. The virtual machine instruction state of Module 710 is imported during the initialization of the state library. Since the registers associated with the instruction state affecting migration correspond to the hardware architecture of the physical host and remain unchanged, they will not change during software execution. For the data entry of the virtual machine storage state of 720: For the data of the virtual machine access address, it is completed before the virtual machine on the migration source node starts booting. The specific process is shown in Figure 8 the description; For the data of the target host access address, it is completed on the target node during the migration preparation stage before the migration starts.

[0081] Figure 8 It is a schematic diagram for determining the access address of the storage difference state across architectures. It shows the working principle of determining the access address of the random storage difference state before migration.

[0082] It should be noted first that under a main architecture, although the memory model characteristic state IS_MMS indicating the storage state is determined, the memory access address of each IS_MMS is uncertain, that is: during each system initialization, the memory access address corresponding to IS_MMS may change. In order to be able to perform differential comparison of the virtual machine storage state during migration, it is necessary to establish a method for tracking the access address corresponding to the storage difference state. Figure 8 This is a schematic diagram of this method.

[0083] The determination of the access address of the virtual machine storage difference state is carried out in the following steps on the migration source node.

[0084] Step S811, during virtual machine initialization, add and set a trap handling for a specific memory region indicated by the memory model characteristic state IS_MMS. Each trap handling is a trigger location.

[0085] Steps S812 and S813, the virtual machine boots. When the boot process reaches the memory region determined in the previous step, because the corresponding trap handling has been set in the previous step, an actual trap operation occurs. The trap operation is responded to by the virtualization management layer, and the trap operation passes the virtual machine address location to the virtualization management layer.

[0086] Step S814: In the virtualization management layer, map the virtual machine address location passed in from the previous step to be accessible by the host, forming a virtual machine access address accessible by the host virtualization management layer.

[0087] Step S815: Record the virtual machine access address in the storage difference status information library to complete the data entry of the virtual machine storage difference status access address.

[0088] The determination of the host storage difference status access address is carried out according to the following steps:

[0089] Step S821: In the host system initialization, add and set an address query entry for each memory area indicated by the memory model characteristic status IS_MMS. The query entry is used to obtain the access address for this area.

[0090] Step S822: Enter the migration preparation stage, at this time the migration process has not actually started.

[0091] Step S823: Query the address of the specific memory area of the host system indicated by the memory model characteristic status IS_MMS on the target host.

[0092] Step S824: Record the host access addresses obtained in the previous step in the storage difference status information library to complete the data entry of the host storage difference status access address.

[0093] Figure 9 The flowchart of the virtual machine running state correction timing shows the occurrence timing of the correction of the cross-virtual machine running state in the present invention. As shown in the figure, the correction of the virtual machine running state is set during the migration process and is carried out in two stages:

[0094] Step S901: The first-stage correction. It occurs when the migration is nearly completed during the migration process. At this time, the virtualization management layer freezes the state of the migrating virtual machine, and then the target host starts a new execution thread to initiate the first correction of the running state of the target virtual machine, denoted as correction stage 1. It should be noted that this correction process and the final residual transfer process of the migration process are executed concurrently. In practice, the time consumed by the correction process is less than the time required for the migration process, which minimizes the impact on the migration performance. Since this stage is the approaching stage of the migration completion, the virtual machine freezing state is also close to the full state. Also, because the correction in stage 1 is the main correction, the remaining residual to be corrected is very small.

[0095] Step S902, Second-stage correction. When the final remaining migration of the virtual machine is completed, before reloading the virtual machine state, perform the second stage, that is, the correction of the final virtual machine state. Since most of the virtual machine state has been corrected in the previous step, the remaining amount to be corrected in this step is very small and will be completed in an interval with relatively light time consumption.

[0096] Figure 10 It is the schematic diagram of the virtual machine running state correction operation, which describes the working principle of the virtual machine running state correction operation. As described above, the occurrence stage is executed on the target host during the migration process. It should be noted that during migration preparation, the update flag of each record in the virtual machine corresponding state difference information library has been reset, that is, all return to the original state of not updated.

[0097] Step S1001, at this time, the first-stage or second-stage state correction has started. Using the main architecture of the current cluster and the current virtual machine as screening conditions, read the content of the difference state information library to obtain the instruction difference state set.

[0098] Step S1002, traverse the instruction difference state set to obtain the instruction state difference points.

[0099] At this time, judge whether this difference point has been updated. The purpose of judging the state of this difference point is: during the second-stage correction, the data that has been corrected can be skipped to achieve incremental correction. If this difference point has not been updated, then continue to judge the type indicated by this difference point.

[0100] Step S1011, if it is judged that it is not a memory model feature state point, it means an ordinary instruction state, and enter the instruction state correction process. According to the register identifier in the instruction state table, read the values of the virtual machine and target host registers.

[0101] Step S1012, if the virtual machine value is not equal to the target host register value, it means that the instruction state is inconsistent, then correct the virtual machine instruction state: write the target host register value into the corresponding register of the virtual machine to complete the state correction.

[0102] Step S1021, if it is judged that this difference point belongs to the memory model feature state point, it means a storage difference state, and enter the storage state correction process. Associate the current record with the storage state difference record and traverse it to obtain the memory state points.

[0103] Step S1022, traverse the memory state points again to obtain the memory area.

[0104] Step S1023, perform addressing access on the virtual machine access address and target host access address of the memory area to obtain the data in the memory area.

[0105] Step S1024. If the memory region values of the virtual machine and the target host are not equal, it indicates that the storage states are inconsistent. Then, correct the storage state of the virtual machine: write the memory region value of the target host into the corresponding memory region of the virtual machine to complete the state correction.

[0106] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0107] As Figure 11 shown is a schematic structural diagram of a virtual machine cross-host architecture migration correction device provided by an embodiment of the present application. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown. The device 100 includes:

[0108] A data acquisition module 101, configured to acquire the difference state points between the source host and the target host, and attach a flag to be updated to each state difference point;

[0109] A data analysis module 102, configured to determine whether each difference state point has been updated, and determine whether the state difference point is an instruction difference state point or a storage difference state point;

[0110] A data processing module 103, configured to correct the instruction difference state and the storage difference state of the virtual machine according to all the difference state points.

[0111] Specifically, the data processing module 103 further includes:

[0112] An instruction difference correction sub-module 1031, configured to correct the instruction difference state of the virtual machine;

[0113] A storage difference correction sub-module 1032, configured to correct the storage difference state of the virtual machine;

[0114] Specifically, the data analysis module 102 can be used to:

[0115] For each difference state point, determine whether the difference state point has been updated;

[0116] If the difference state point has not been updated, determine whether the difference state point is an instruction difference state point or a storage difference state point; if the difference state point has been updated, skip the difference state point and determine the next difference state point;

[0117] If the difference state point is an instruction difference state point, determine that the virtual machine is in an instruction difference state; if the difference state point is a storage difference state point, determine that the virtual machine is in a storage difference state.

[0118] Specifically, the instruction difference correction sub-module 1031 can be used to: write the register value of the target host into the corresponding register of the virtual machine to complete the correction of the instruction difference status; the storage difference correction sub-module 1032 can be used to: write the memory area value of the target host into the corresponding memory area of the virtual machine to complete the correction of the storage difference status.

[0119] Optionally, the data processing module 103 can also be used to:

[0120] During the execution of the virtual machine migration process, perform the first correction on the running state of the virtual machine;

[0121] After the execution of the virtual machine migration process is completed, perform the second correction on the running state of the virtual machine.

[0122] Optionally, the data acquisition module 101 can also acquire the amount of remaining untransmitted memory page data during the execution of the virtual machine migration process; the data analysis module 102 can also analyze and determine whether the virtual machine migration process has reached a condition close to completion according to the amount of remaining untransmitted memory page data and a preset threshold.

[0123] Optionally, the data acquisition module 101 can acquire the memory area access address of the virtual machine and the memory status area access address of the target host; the data analysis module 102 can analyze and determine the virtual machine storage difference memory area access address according to the memory status access address of the virtual machine and the memory status area access address of the target host.

[0124] Optionally, the data acquisition module 101, on the one hand, can obtain the memory status area access address of the virtual machine through the virtualization management layer by using the trap processing function of a specific memory area, and on the other hand, can obtain the memory status area access address of the target host through the address query entry of the specific memory area.

[0125] The virtual machine cross-host architecture migration correction device provided in this embodiment can be used to execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here in this embodiment.

[0126] See Figure 12 , Figure 12 is a schematic block diagram of an electronic device provided in an embodiment of the present invention. As Figure 12The electronic device 1200 in the present embodiment shown may include, but is not limited to, at least one of the following: one or more processors 1201, one or more input devices 1202, one or more output devices 1203, and one or more memories 1204. The above-mentioned processors 1201, input devices 1202, output devices 1203, and memories 1204 communicate with each other through a communication bus 1205. The memory 1204 is used to store computer programs, and the computer programs include program instructions. The processor 1201 is used to execute the program instructions stored in the memory 1204.

[0127] It should be understood that in the embodiment of the present invention, the so-called processor 1201 may be a central processing unit (CPU), and this processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or this processor may also be any conventional processor, etc.

[0128] The input device 1202 may include a touchpad, a fingerprint sensor (for collecting the fingerprint information and the direction information of the fingerprint) of a user, a microphone, etc., and the output device 1203 may include a display (such as an LCD), a speaker, etc.

[0129] The memory 1204 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1201. A part of the memory 1204 may also include a non-volatile random access memory. For example, the memory 1204 may also store information about the device type.

[0130] In specific implementation, the processors 1204, input devices 1202, and output devices 1203 described in the embodiment of the present invention may implement the implementation manners described in the method embodiments provided by the embodiment of the present invention, which will not be elaborated herein.

Claims

1. A method for correcting cross-host architecture migration of virtual machines, characterized in that The method includes: Obtaining the difference state points of the source host and the target host, where the difference state points include instruction difference state points and storage difference state points; Determining the instruction difference state and the storage difference state of the virtual machine according to the difference state points, where the virtual machine runs on the source host; According to the instruction difference state points, correcting the instruction difference state of the virtual machine, and at the same time, according to the storage difference state points, correcting the storage difference state of the virtual machine, where the storage difference is the access address of the storage difference memory area; The correcting the instruction difference state of the virtual machine according to the instruction difference state points and correcting the storage difference state of the virtual machine according to the storage difference state points includes: Writing the register value of the target host into the corresponding register of the virtual machine to complete the correction of the instruction difference state; Writing the memory area value of the target host into the corresponding memory area of the virtual machine to complete the correction of the storage difference state; If the architecture level of the target host is lower than that of the source host, then correct the running state of the virtual machine downward in level; if the architecture level of the target host is higher than that of the source host, then correct the running state of the virtual machine upward in level.

2. The virtual machine cross-host architecture migration correction method according to claim 1, wherein The correcting the instruction difference state of the virtual machine according to the instruction difference state points and correcting the storage difference state of the virtual machine according to the storage difference state points includes: During the execution of the migration process of the virtual machine, making a first correction to the running state of the virtual machine; After the execution of the migration process of the virtual machine is completed, making a second correction to the running state of the virtual machine; The correction of the running state of the virtual machine includes the correction of the instruction difference state and the correction of the storage difference state.

3. The virtual machine cross-host architecture migration correction method according to claim 2, wherein The making a first correction to the running state of the virtual machine during the execution of the migration process of the virtual machine includes: Obtaining the amount of memory page data that remains untransmitted during the execution of the migration process of the virtual machine; If the amount of memory page data reaches a preset threshold, then suspend the running state of the virtual machine and make a first correction to the running state of the virtual machine.

4. The virtual machine cross-host architecture migration correction method according to claim 1, wherein Before correcting the storage difference state of the virtual machine according to the storage difference state points, it further includes: The virtual machine enters the migration preparation state; Obtaining the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host; Determining the access address of the storage difference memory area of the virtual machine according to the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host; The storage difference state points include at least one memory state point, and the memory state point includes at least one access address of the storage difference memory area.

5. A method for correcting virtual machine cross-host architecture migration as described in claim 4, characterized in that, The obtaining the access address of the memory state area of the virtual machine and the access address of the memory state area of the target host includes: During the initialization process of the virtual machine, inputting the trap handling function of a specific memory area indicated by the memory model characteristic state; Through the virtualization management layer, use the trap handler function of the specific memory area to obtain the access address of the memory status area of the virtual machine; During the initialization process of the target host, input the address query entry of the specific memory area indicated by the memory model characteristic status; The target host obtains the access address of the memory status area of the target host through the address query entry to prepare for migration.

6. The method for correcting virtual machine cross-host architecture migration according to claim 1, characterized in that The determining the instruction difference status and storage difference status of the virtual machine according to the difference status points includes: For each difference status point, determine whether the difference status point has been updated, where each difference status point is attached with a to-be-updated flag; If the difference status point has not been updated, determine whether the difference status point is an instruction difference status point or a storage difference status point; if the difference status point has been updated, skip the difference status point and judge the next difference status point; If the difference status point is an instruction difference status point, determine that the virtual machine is in an instruction difference status; if the difference status point is a storage difference status point, determine that the virtual machine is in a storage difference status.

7. A virtual machine cross-host architecture migration correction device, characterized in that The device includes: A data acquisition module, configured to acquire the difference status points of the source host and the target host, and attach a to-be-updated flag to each status difference point; A data analysis module, configured to determine whether each difference status point has been updated, and determine whether the status difference point is an instruction difference status point or a storage difference status point; A data processing module, configured to perform instruction difference status correction and storage difference status correction on the virtual machine according to all the difference status points, where the storage difference is the access address of the storage difference memory area; The performing instruction difference status correction and storage difference status correction on the virtual machine according to all the difference status points includes: Write the register value of the target host into the corresponding register of the virtual machine to complete the instruction difference status correction; Write the memory area value of the target host into the corresponding memory area of the virtual machine to complete the storage difference status correction; If the architecture level of the target host is lower than that of the source host, correct the running status of the virtual machine downward in level; if the architecture level of the target host is higher than that of the source host, correct the running status of the virtual machine upward in level.

8. The virtual machine cross-host architecture migration correction device according to claim 7, characterized in that, The data processing module further includes: An instruction difference status correction sub-module, configured to perform instruction difference status correction on the virtual machine if the difference status point has not been updated and belongs to an instruction difference status point; A storage difference status correction sub-module, configured to perform storage difference status correction on the virtual machine if the difference status point has not been updated and belongs to a storage difference status point.

Citation Information

Patent Citations

  • Virtual machine migration method and device of heterogeneous CPUs

    CN107621970A

  • Virtual machine thermal migration method and device based on intelligent network card, equipment and medium

    CN111736945A