Virtual machine live migration method and device, electronic equipment and storage medium
By determining the load of the source host, selecting the appropriate target host, and performing architectural compatibility correction, the problem of performance affecting architecture differences during virtual machine migration is solved, and efficient virtual machine migration and resource optimization is achieved.
Patent Information
- Application Number
- CN202411246885.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In a cloud computing environment, the architecture differences caused by inconsistent CPU models during virtual machines are affected by migration, and the existing technology is difficult to ensure that virtual machines are migrated to the nodes that are most suitable for their operation.
By determining the current load of the source host corresponding to the virtual machine to be migrated, calculating the remaining execution time, selecting the appropriate target host, and performing architectural compatibility checks and corrections, ensuring that the virtual machine is seamlessly transferred during the migration process.
Improves virtual machine migration performance, ensures that virtual machines run on the most suitable nodes, optimizes resource allocation, reduces operation and maintenance costs and risks, and improves system availability and flexibility.
Smart Images

Figure CN119127399A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtual machine technology, and in particular to a virtual machine hot migration method, device, electronic equipment and storage medium. Background Art
[0002] Cloud host (hot) migration technology in a cloud computing environment is an important technical means for cloud computing server integration. It is widely used in production. In actual production, the production cluster may not be able to achieve completely consistent CPU (Central Processing Unit) models due to different purchasing manufacturers and different purchasing batches. In this case, the architecture of the physical host will be different in the migration cluster. Ensuring that the virtual machine is migrated to the node that is most suitable for its operation is of great significance to improving the overall migration performance. Summary of the invention
[0003] The present invention provides a virtual machine hot migration method, device, electronic device and storage medium to ensure that the virtual machine is migrated to a node that is most suitable for its operation, thereby improving the migration performance.
[0004] According to one aspect of the present invention, a method for hot migration of a virtual machine is provided, the method comprising:
[0005] Determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load;
[0006] Determine a target host corresponding to the current migration task according to the remaining execution time;
[0007] Obtaining the architecture compatibility check results of the source host and the target host, and performing compatibility correction on the virtual machine to be migrated according to the architecture compatibility check results;
[0008] Based on the corrected running state of the virtual machine to be migrated, hot migration of the virtual machine to be migrated from the source host to the target host is completed.
[0009] According to another aspect of the present invention, a virtual machine hot migration device is provided, the device comprising:
[0010] The remaining execution time determination module is used to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load;
[0011] A target host determination module, used to determine the target host corresponding to the current migration task according to the remaining execution time;
[0012] A compatibility correction module, used to obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result;
[0013] The hot migration implementation module is used to complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the virtual machine hot migration method described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the virtual machine hot migration method described in any embodiment of the present invention when executed.
[0019] The technical solution of the embodiment of the present invention is to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load; determine the target host corresponding to the current migration task according to the remaining execution time; obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result; complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated, and provide a virtual machine hot migration method to ensure that the virtual machine is migrated to the node that is most suitable for its operation, thereby improving the migration performance.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A flowchart of a virtual machine hot migration method provided in Embodiment 1 of the present invention;
[0023] Figure 2 A flowchart of a virtual machine hot migration method provided in Embodiment 2 of the present invention;
[0024] Figure 3 A schematic diagram of the structure of a virtual machine hot migration device provided in Embodiment 3 of the present invention;
[0025] Figure 4 It is a structural schematic diagram of an electronic device for implementing the virtual machine hot migration method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Embodiment 1
[0029] Figure 1A flowchart of a virtual machine hot migration method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation where a virtual machine is migrated from one physical server to another physical server. The method can be executed by a virtual machine hot migration device. The virtual machine hot migration device can be implemented in the form of hardware and / or software. The virtual machine hot migration device can be configured in a computing service device or electronic device with data processing, network communication and program running functions, such as a tablet computer, personal computer, mobile phone, etc.
[0030] Among them, virtual machine hot migration can refer to the process of migrating a virtual machine from one physical server to another without interrupting the operation of the virtual machine. During the virtual machine hot migration process, the virtual machine's computing state, memory data, and network connection will be seamlessly migrated to the new physical server, and users can continue to use the virtual machine during the migration process without shutting down or re-logging in.
[0031] It should be noted that during the hot migration process, the running status of the virtual machine needs to be synchronized to the target physical server. This process requires establishing a network connection between the source physical server (i.e., source host) and the target physical server (i.e., target host), and transmitting information such as the virtual machine's memory status, CPU status, and device status through the network.
[0032] like Figure 1 As shown, the virtual machine hot migration method includes:
[0033] S110: Determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load.
[0034] The source host may refer to the migration source of the virtual machine to be migrated. The current load may refer to the possible load of the source host for the current migration task of the virtual machine to be migrated at the current moment. The remaining execution time may refer to the remaining time for the source host to complete the current migration task.
[0035] In an optional implementation, determining the current load of the source host corresponding to the virtual machine to be migrated, and determining the remaining execution time of the source host for the current migration task based on the current load, can include: obtaining the historical load usage of the source host; predicting the current load of the source host based on the historical load usage; calculating the average load of the source host in the remaining execution time based on the current load and the collection period of the historical load usage; and calculating the remaining execution time of the source host for the current migration task based on the average load.
[0036] The historical load usage may refer to the load usage of the source host at each historical moment in a certain historical time period. The collection period of the historical load usage may refer to the time interval for collecting the historical load usage in a certain historical time period.
[0037] During the execution of the actual migration task, the possible load at the current moment can be predicted based on the historical load usage. The prediction model can be as follows:
[0038] Z(m)={Z0,Z T , Z 2T , Z 3T , …, Z now-mT , Z now ,};
[0039] Among them, Z(m) represents the current load; now is calculated by m*T, T represents the collection period of historical load usage, which can generally be set to 5s, and m represents the number of times the historical load usage is collected. The average load in the remaining execution time can be calculated as follows:
[0040]
[0041] The meaning of k can be the same as that of m, and the value of k can be set to 5; Indicates historical load usage; Indicates the current load.
[0042] Optionally, the remaining resources of the source host for the current migration task can be calculated as:
[0043]
[0044] Among them, R_left(t) represents the remaining resources of the source host where the migration task i is located at time t; R_total represents the total resources of the source host; R_used(t i ) represents the amount of resources allocated to migration task i at time t; u(t i )-u(t i,0 ) represents a unit time pulse; R_used(t i )×[u(t i )-u(t i,0 )] indicates that task i is in [t i,0 , t i ] time period; n represents the total number of migration tasks allocated to the source host.
[0045] In order to reasonably allocate the remaining resources of the source host, the Hadoop controller needs to select the task with the highest priority to be assigned first, and the priority of the task is determined by the execution time of the current task. Since calculating the speed of the source host processing the migration task at the current moment will delay the calculation of the task execution time, the average speed of the source host is used instead of the current speed to estimate the remaining execution time of the migration task, as shown below:
[0046]
[0047] Where Data[i] represents the amount of data for migration task i; R apply Indicates the remaining resources obtained by the migration task from the source host; Indicates a dynamic parameter. In this embodiment, the average load of the source host in the remaining execution time is used as an important calculation parameter, which can make the calculation of the remaining execution time of the migration task more accurate.
[0048] S120: Determine a target host corresponding to the current migration task according to the remaining execution time.
[0049] In an optional implementation, determining the target host corresponding to the current migration task based on the remaining execution time may include: calculating the migration task processing capabilities of the source host and each candidate host based on the remaining execution time; determining the node type of the source host and each candidate host based on the migration task processing capabilities, the node types including first-class nodes and second-class nodes, the migration task processing capabilities of the first-class nodes being higher than or equal to a preset processing capability threshold, and the migration task processing capabilities of the second-class nodes being lower than the preset processing capability threshold; based on the node type, determining the candidate host with the highest average resource utilization as the target host, and the node type of the target host is consistent with that of the source host.
[0050] It should be noted that the time it takes for a task (Map task or Reduce task) to be completed normally on a source host is the execution time of the task. If a migration task of the same type has been executed on the source host or candidate host before, and the computing capacity of the source host or candidate host to process the migration task of this type is expressed as precap, the capacity of the source host or candidate host to process the migration task at the current moment can be calculated as follows:
[0051]
[0052] Among them, θ represents the attenuation effect of each execution of the migration task on the node migration task processing capacity, θ is between 0 and 1, for example, it can be set to 0.3; Data total Indicates the total data volume of the migration task.
[0053] If the source host or candidate host has not performed the same type of migration task before, the task processing capacity of the source host or candidate host can be calculated as follows:
[0054]
[0055] Among them, time cost Indicates the actual time spent on the migration task, and exe_time indicates the estimated remaining execution time.
[0056] By calculating the processing capabilities of the source host and the candidate host for different types of tasks, the capabilities of the source host and the candidate host to process the migration task are determined, and based on this information, it is determined whether the source host and the candidate host are fast nodes (i.e., first-type nodes) or slow nodes (i.e., second-type nodes). The judgment standard can be to compare the capabilities of the source host and the candidate host to process this type of task with a preset processing capability threshold (e.g., the average processing capability of all host nodes). If it is not less than the preset processing capability threshold, the host node is considered to be a fast node for running this type of task, otherwise it is a slow node, so that the candidate host with the same type as the source host and the highest average resource utilization is selected from the candidate hosts as the target host, so as to ensure that the virtual machine to be migrated is migrated to the host node that is most suitable for its operation, thereby optimizing resource allocation and improving overall performance.
[0057] S130: Obtain the architecture compatibility check results of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check results.
[0058] In this embodiment, during the migration setup, the wizard for migrating the virtual machine may check the compatibility of the source host and the target host, the target resource pool, the data storage, and the network.
[0059] In practice, cross-architecture migration needs to be completed under certain hardware conditions. The source host and the target host need to maintain basic consistency in the hardware physical architecture, that is, if the architecture difference is too large or completely heterogeneous. Then the migration will definitely not be successful. In practice, the degree of architectural difference allowed by the hardware of the source host and the target host needs to be controlled within a certain range, and no fundamental architectural difference is allowed. Specifically, the following needs to be met: the main architecture (main architecture) needs to be completely consistent. It is allowed that there are architectural level differences between hosts, for example, some hosts are version 1.0 under the main architecture, and some other hosts are also version 1.1 or 1.2 under the main architecture. However, their main architectures are the same. This kind of architectural difference is local and can be corrected for compatibility through software methods, such as setting up a difference state information library, comparing inconsistent states, tracking differences, classifying difference states, storing difference states, and implementing storage state difference correction.
[0060] S140: Complete hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated.
[0061] In this embodiment, the following steps may be followed to complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated:
[0062] 1. Establish a migration connection: Establish a migration connection between the source host and the target host and prepare the resources required for the migration.
[0063] 2. Memory replication: Start the memory replication process and gradually copy the virtual machine's memory data to the target host. After the initial replication, incremental replication is performed to synchronize subsequent memory changes.
[0064] 3. Migration switch preparation: When memory replication is nearly completed and the memory change rate drops to an acceptable level, prepare to perform migration switch.
[0065] 4. Execute migration switch: When the migration switch is triggered, the source host will suspend the operation of the virtual machine to be migrated, complete the final memory synchronization, and transfer control to the target host.
[0066] 5. Target host takes over: After receiving all migration data, the target host restores the running status of the virtual machine to be migrated.
[0067] 6. Status verification: Verify the running status of the virtual machine to be migrated on the target host to ensure that the services and applications of the virtual machine to be migrated are running normally.
[0068] 7. Resource adjustment: Adjust the resource allocation of the virtual machine to be migrated, such as CPU, memory, and network settings, based on the resource usage of the target host.
[0069] 8. Migration completion confirmation: Confirm that the virtual machine to be migrated is running stably on the target host and that its performance meets expectations.
[0070] 9. Source host resource recovery: After the migration is completed, the resources related to the virtual machine to be migrated are released on the source host.
[0071] 10. Documentation: Record key information and any issues during the migration process for future reference and improvement.
[0072] 11. Monitoring and optimization: During a period of time after the migration, the performance of the virtual machine to be migrated should be continuously monitored and optimized as needed.
[0073] Through these steps, you can ensure that the hot migration process of the virtual machine to be migrated from the source host to the target host proceeds smoothly while minimizing the impact on business operations.
[0074] The technical solution of the embodiment of the present invention is to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load; determine the target host corresponding to the current migration task according to the remaining execution time; obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result; complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated, and provide a virtual machine hot migration method to ensure that the virtual machine is migrated to the node that is most suitable for its operation, thereby improving the migration performance.
[0075] Embodiment 2
[0076] Figure 2 This is a flow chart of a virtual machine hot migration method provided in the second embodiment of the present invention. This embodiment refines S130 based on the above embodiment. Figure 2 As shown, the method includes:
[0077] S210: Determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load.
[0078] S220. Determine a target host corresponding to the current migration task according to the remaining execution time.
[0079] S230: Obtain an architecture compatibility check result of the source host and the target host, where the architecture compatibility check result indicates that there are local architecture differences.
[0080] S240: When migrating the virtual machine to be migrated based on the target migration path, determine whether the current time is close to the correction timing.
[0081] In this embodiment, the target migration path may be the optimal migration path between the source host and the target that matches the virtual machine to be migrated. The target migration path may be determined in the following manner:
[0082] S2401, determining a migration target from a source host to a target host, wherein the migration target may include minimizing migration time, network bandwidth, and migration cost;
[0083] S2402, defining a migration path from a source host to a target host;
[0084] S2403, design a chromosome encoding scheme, and map the path selection scheme into a chromosome;
[0085] S2404, randomly generating a group of chromosomes as an initial population, wherein each chromosome represents a migration path;
[0086] S2405, determining a fitness function based on the migration time, the network bandwidth, and the migration cost, wherein the fitness function is used to evaluate the performance of each migration path;
[0087] S2406. Select a target chromosome from the current population according to the fitness evaluation result;
[0088] S2407, exchanging path parts between selected chromosomes through crossover operation to generate new migration paths; performing mutation operation on chromosomes to randomly change certain parts of the path to introduce new path selection schemes;
[0089] S2408. Repeat the selection, crossover and mutation operations to gradually optimize the migration path, and after the termination condition is met, select the chromosome with the highest fitness as the optimal migration path.
[0090] It should be noted that the process of using genetic algorithms to optimize migration paths in data migration involves treating the path selection problem as a search problem, and finding the optimal or approximately optimal data migration path by simulating natural selection and genetic mechanisms. The following are the specific steps to achieve migration path optimization:
[0091] 1. Problem definition: Clarify the goals of data migration, such as minimizing migration time, network bandwidth usage, and migration costs.
[0092] 2. Path representation: Define the representation method of the data migration path. The path can be represented as a series of nodes (data source, intermediate nodes, target node) and edges (data transmission links).
[0093] 3. Chromosome encoding: Design a chromosome encoding scheme to map the path selection scheme to a chromosome. For example, you can use permutation encoding, where each gene of the chromosome represents a node and the order of the genes represents the order of data migration.
[0094] 4. Initialize the population: Randomly generate a set of chromosomes as the initial population, each chromosome represents a possible migration path.
[0095] 5. Fitness function: Define a fitness function to evaluate the performance of each chromosome (i.e., each path). The fitness function can reflect the cost or efficiency of the migration path. For example, it can be designed based on the migration time of the path, the required network bandwidth, and the migration cost.
[0096] 6. Selection operation: According to the fitness evaluation results, chromosomes with better performance are selected from the current population for crossover and mutation operations.
[0097] 7. Crossover operation: The crossover operation exchanges path parts between selected chromosomes to generate new migration paths. This can simulate the combination of different paths and explore possible better solutions.
[0098] 8. Mutation operation: Perform mutation operation on chromosomes, randomly change certain parts of the path to introduce new path selection schemes and increase the diversity of the population.
[0099] 9. Iterative optimization: Repeat the selection, crossover and mutation operations to gradually optimize the migration path. Each generation of population is an improvement on the optimal solution of the previous generation.
[0100] 10. Path evaluation: In each iteration, actual migration simulation or theoretical evaluation is performed on the newly generated path to verify its performance.
[0101] 11. Termination conditions: Set termination conditions, such as reaching the maximum number of iterations, fitness no longer significantly improving, or finding a satisfactory migration path.
[0102] 12. Output the optimal solution: When the termination condition is met, select the chromosome with the highest fitness as the optimal migration path and use it as the output.
[0103] It should be noted that the application of genetic algorithms in data migration path optimization can handle complex network topologies and multiple constraints and find efficient data migration solutions. By simulating natural selection and genetic mechanisms, the algorithm can search in a large-scale solution space, avoid falling into local optimality, and eventually converge to the global optimal or approximate global optimal solution.
[0104] In this embodiment, the correction timing may refer to the timing of correcting the running state of the virtual machine to be migrated. The correction timing is to ensure that the correction operation of the virtual machine state has the minimum impact on the performance of the target host.
[0105] S250: When it is determined that the current time is approaching a correction opportunity, a compatibility correction is performed on the running state of the virtual machine to be migrated, wherein the compatibility correction includes a memory state correction and an instruction state correction.
[0106] In an optional implementation, determining that the current moment is approaching the time for correction may include: obtaining the amount of untransmitted memory page data of the virtual machine to be migrated at the current moment; when the amount of untransmitted memory page data is less than a preset data amount threshold, determining that the current moment is approaching the time for correction.
[0107] It should be noted that the memory state of the virtual machine is the core of hot migration. During hot migration, the memory state of the virtual machine needs to be transferred from the source host to the target host. Since the size of the memory state may be very large, an efficient data transfer algorithm needs to be adopted. The network connection of the virtual machine needs to be preserved during hot migration.
[0108] In this embodiment, during the migration phase, the synchronous memory page data is first transmitted continuously while the virtual machine to be migrated is kept running, and a state close to the completion of the migration is determined, that is, the amount of remaining untransmitted memory page data is very small and reaches a certain threshold. If it is determined that the migration is close to the completion of the migration (i.e., the correction timing), the state of the virtual machine on the source host can be suspended, and the last remaining data synchronous transmission is performed. Finally, the operation of the migrated virtual machine is resumed on the target host.
[0109] In an optional implementation, when the compatibility correction is a memory state correction, performing a compatibility correction on the running state of the virtual machine to be migrated may include: reading the state point to be determined from a pre-built migration difference state information library, and traversing the state point to be determined to obtain the current instruction state point; when it is determined that the current instruction state point belongs to the storage difference state, associating the current instruction state point to the storage difference state record; determining a first comparison result between the memory area value of the virtual machine and the memory area value of the target host according to the storage difference state record; and determining to perform a memory state correction on the running state of the virtual machine according to the first comparison result.
[0110] The first comparison result may be consistent or inconsistent. When the first comparison result is inconsistent, it is necessary to correct the memory state of the running state of the virtual machine to be migrated.
[0111] In this embodiment, all the status points to be determined can be read from the migration difference state information library; these status points are checked one by one; during the traversal process, the instruction status point currently being processed is determined; if the status point has been updated, it means that the state has been processed, and the processing of the status point can be terminated at this time; if the status point has not been updated, it can be determined whether the status point belongs to the storage characteristic state; if the status point belongs to the storage characteristic state, it means that it is related to data storage and requires special processing; for the storage characteristic state, the state is corrected according to the requirements and rules of the storage to ensure the consistency and integrity of the data; if the status point does not belong to the storage characteristic state, then the instruction status correction process is entered. This may involve re-evaluation, scheduling or other related operations of the instructions to ensure that the system runs as expected; after completing the above steps, the processing of the current status point is completed, and then the next status point in the list is processed.
[0112] In this embodiment, starting from the current instruction state point, the storage difference state record associated with it can be found; the storage difference state records can be checked one by one to determine the memory area that needs to be corrected; the memory area point that needs to be processed currently is determined; addressing access is performed according to the virtual machine access address and the host access address of the memory area recorded in the information library; through addressing access, the data of the corresponding memory areas on the virtual machine and the host are obtained; the data of the virtual machine memory area is compared with the data of the host memory area to determine whether they are consistent; if the data is inconsistent (that is, the comparison result shows that the status is inconsistent), the value of the target host memory area can be copied to the corresponding memory area of the virtual machine, which is done to ensure that the internal state of the virtual machine is synchronized with the state of the external host; after completing the data synchronization, the processing of the current memory area point is ended, and the processing of the next memory area point in the list continues.
[0113] In an optional implementation, when the compatibility correction is an instruction state correction, a compatibility correction is performed on the running state of the virtual machine to be migrated, which may include: obtaining a first register value of the virtual machine to be migrated and a second register value of the target host; determining a second comparison result of the first register value and the second register value; when the second comparison result is inconsistent, writing the register value of the target host into the register corresponding to the virtual machine to be migrated to achieve instruction state correction of the virtual machine to be migrated.
[0114] The implementation of virtual machine hot migration requires comprehensive synchronization and control of the virtual machine's status, memory, network connection, and storage to ensure the normal operation of the virtual machine during the migration process. Virtual machine hot migration is widely used in cloud computing, data centers, and server maintenance.
[0115] It should be noted that starting from improving production availability, based on comprehensive management of possible differences in the running status of virtual machines in cross-architecture migration scenarios, a dynamic and adaptive correction method for the running status of virtual machines is provided. The so-called dynamicity here specifically refers to two aspects:
[0116] On the one hand, the virtual machine running status level is not limited. If it is migrated from a high-level host to a low-level host, it will be corrected downward. If it is migrated from a low-level host to a high-level host, it will be corrected upward.
[0117] On the other hand, the modification of the running status of the virtual machine occurs during the migration process and is completed in stages and cumulatively. It is not limited to a certain stage, for example, the modification of the status of the virtual machine is completed before the migration. Because the modification can be made upward or downward, the computing power of the physical machine can be utilized to the maximum extent; because the modification is made during the migration process, the negative impact of the status modification on the downtime of the virtual machine migration is minimized, which is an optimization of the migration performance for this scenario.
[0118] S260: Complete hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated.
[0119] Optionally, before completing the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated, the method may further include:
[0120] After starting the virtual machine to be migrated on the target host, the function verification and performance verification of the virtual machine to be migrated are performed to obtain the performance indicators and operation status of the virtual machine before and after the migration;
[0121] Evaluate the migration effect of the virtual machine to be migrated based on the virtual machine performance indicators and operating status;
[0122] Diagnose and optimize problems that occur during the migration process of the virtual machine to be migrated based on the migration results.
[0123] It should be noted that after completing the migration of the virtual machine, you can start the virtual machine on the target host to evaluate the hot migration of the virtual machine. Finally, based on the evaluation results, you can diagnose and optimize the problems that occurred during the migration of the virtual machine, which can effectively ensure that the next hot migration of the virtual machine is carried out effectively.
[0124] The virtual machine hot migration technology provided by the present invention realizes dynamic adjustment and optimization of resources without affecting business operations through real-time monitoring of the load status of virtual machines, intelligent resource allocation strategies, data consistency and integrity assurance, and a complete monitoring and log recording system. This technology not only improves the availability and flexibility of the system, but also reduces operation and maintenance costs and risks, providing strong support for business development. In addition, the virtual machine hot migration technology is also highly scalable and flexible. With the continuous development and changes of the business, the number and performance requirements of virtual machines will also change continuously. The hot migration technology provided by the present invention can be flexibly expanded and adjusted according to actual needs. Whether it is to increase the number of virtual machines or improve the performance of virtual machines, the system can quickly respond and perform corresponding resource allocation and migration operations to ensure the continuity and stability of the business.
[0125] Embodiment 3
[0126] Figure 3 This is a schematic diagram of the structure of a virtual machine hot migration device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a remaining execution time determination module 310, a target host determination module 320, a compatibility correction module 330 and a hot migration implementation module 340. Among them:
[0127] The remaining execution time determination module 310 is used to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load;
[0128] A target host determination module 320 is used to determine a target host corresponding to the current migration task according to the remaining execution time;
[0129] A compatibility correction module 330 is used to obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result;
[0130] The hot migration implementation module 340 is used to complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated.
[0131] The technical solution of the embodiment of the present invention is to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load; determine the target host corresponding to the current migration task according to the remaining execution time; obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result; complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated, and provide a virtual machine hot migration method to ensure that the virtual machine is migrated to the node that is most suitable for its operation, thereby improving the migration performance.
[0132] Optionally, the remaining execution time determination module 310 may be specifically used for:
[0133] Obtaining historical load usage of the source host;
[0134] Predicting the current load of the source host according to the historical load usage;
[0135] Calculating the average load of the source host in the remaining execution time according to the current load and the collection period of the historical load usage;
[0136] The remaining execution time of the source host for the current migration task is calculated according to the average load.
[0137] Optionally, the target host determination module 320 may be specifically configured to:
[0138] Calculating the migration task processing capabilities of the source host and each candidate host according to the remaining execution time;
[0139] Determining the node types of the source host and the candidate hosts according to the migration task processing capability, the node types including first-type nodes and second-type nodes, the migration task processing capability of the first-type nodes being higher than or equal to a preset processing capability threshold, and the migration task processing capability of the second-type nodes being lower than the preset processing capability threshold;
[0140] According to the node type, a candidate host with the highest average resource utilization is determined as the target host, and the node type of the target host is consistent with that of the source host.
[0141] Optionally, the architecture compatibility check result is that there are local architecture differences;
[0142] Accordingly, the compatibility correction module 330 may include:
[0143] A correction timing approaching judgment unit, used to judge whether the current moment is close to the correction timing when migrating the virtual machine to be migrated based on the target migration path;
[0144] A compatibility correction unit is used to perform compatibility correction on the running state of the virtual machine to be migrated when it is determined that the current moment is close to the correction opportunity, wherein the compatibility correction includes memory state correction and instruction state correction.
[0145] Optional, compatibility correction unit, specifically can be used for:
[0146] Obtaining the amount of memory page data not transferred by the to-be-migrated virtual machine at the current moment;
[0147] When the amount of the untransmitted memory page data is less than a preset data amount threshold, it is determined that the current moment is close to the correction opportunity.
[0148] Optionally, the compatibility modification is the memory state modification;
[0149] Accordingly, the compatibility correction unit can also be used for:
[0150] Reading the state point to be determined from the pre-built migration difference state information library, and traversing the state point to be determined to obtain the current instruction state point;
[0151] When it is determined that the current instruction state point belongs to the storage difference state, associating the current instruction state point with the storage difference state record;
[0152] Determine a first comparison result between the memory area value of the virtual machine and the memory area value of the target host according to the storage difference state record;
[0153] Determine, according to the first comparison result, to perform memory state correction on the running state of the virtual machine.
[0154] Optionally, the compatibility modification is instruction status modification;
[0155] Accordingly, the compatibility correction unit can also be used for:
[0156] Obtaining a first register value of the virtual machine to be migrated and a second register value of the target host;
[0157] determining a second comparison result of the first register value and the second register value;
[0158] When the second comparison result is inconsistent, the register value of the target host is written into the register corresponding to the virtual machine to be migrated to modify the instruction state of the virtual machine to be migrated.
[0159] The virtual machine hot migration device provided in the embodiment of the present invention can execute the virtual machine hot migration method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0160] Embodiment 4
[0161] Figure 4 A schematic diagram of an electronic device 400 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers or various forms of mobile devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0162] like Figure 4 As shown, the electronic device 400 includes at least one processor 401, and a memory connected to the at least one processor 401 in communication, such as a read-only memory (ROM) 402, a random access memory (RAM) 403, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 401 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 402 or the computer program loaded from the storage unit 408 to the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0163] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0164] Processor 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 401 executes the various methods and processes described above, such as a virtual machine hot migration method.
[0165] In some embodiments, the virtual machine hot migration method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the processor 401, one or more steps of the virtual machine hot migration method described above may be performed. Alternatively, in other embodiments, the processor 401 may be configured to perform the virtual machine hot migration method in any other appropriate manner (e.g., by means of firmware).
[0166] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0167] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0168] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0169] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0170] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0171] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0172] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0173] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A virtual machine hot migration method, characterized in that: include: Determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load; Determine the target host corresponding to the current migration task according to the remaining execution time; Obtaining the architecture compatibility check results of the source host and the target host, and performing compatibility correction on the virtual machine to be migrated according to the architecture compatibility check results; Based on the corrected running state of the virtual machine to be migrated, hot migration of the virtual machine to be migrated from the source host to the target host is completed.
2. The method according to claim 1, characterized in that: Determining the current load of the source host corresponding to the virtual machine to be migrated, and determining the remaining execution time of the source host for the current migration task according to the current load, including: Obtaining historical load usage of the source host; Predicting the current load of the source host according to the historical load usage; Calculating the average load of the source host in the remaining execution time according to the current load and the collection period of the historical load usage; The remaining execution time of the source host for the current migration task is calculated according to the average load.
3. The method according to claim 1, characterized in that Determining a target host corresponding to the current migration task according to the remaining execution time includes: Calculating the migration task processing capabilities of the source host and each candidate host according to the remaining execution time; Determining the node types of the source host and the candidate hosts according to the migration task processing capability, the node types including first-type nodes and second-type nodes, the migration task processing capability of the first-type nodes being higher than or equal to a preset processing capability threshold, and the migration task processing capability of the second-type nodes being lower than the preset processing capability threshold; According to the node type, a candidate host with the highest average resource utilization is determined as the target host, and the node type of the target host is consistent with that of the source host.
4. The method according to claim 1, characterized in that The result of the architecture compatibility check is that there are local architecture differences; Performing compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result includes: When migrating the virtual machine to be migrated based on the target migration path, determining whether the current time is close to the correction time; When it is determined that the current moment is close to the correction opportunity, a compatibility correction is performed on the running state of the to-be-migrated virtual machine, wherein the compatibility correction includes a memory state correction and an instruction state correction.
5. The method according to claim 4, characterized in that Determining that the current moment is close to the correction opportunity includes: Obtaining the amount of memory page data not transferred by the to-be-migrated virtual machine at the current moment; When the amount of the untransmitted memory page data is less than a preset data amount threshold, it is determined that the current moment is close to the correction opportunity.
6. The method according to claim 4, characterized in that The compatibility modification is the memory state modification; The compatibility correction is performed on the running state of the virtual machine to be migrated, including: Reading the state point to be determined from the pre-built migration difference state information library, and traversing the state point to be determined to obtain the current instruction state point; When it is determined that the current instruction state point belongs to the storage difference state, associating the current instruction state point with the storage difference state record; Determine a first comparison result between the memory area value of the virtual machine and the memory area value of the target host according to the storage difference state record; Determine, according to the first comparison result, to perform memory state correction on the running state of the virtual machine.
7. The method according to claim 4, characterized in that The compatibility correction is instruction status correction; The compatibility correction is performed on the running state of the virtual machine to be migrated, including: Obtaining a first register value of the virtual machine to be migrated and a second register value of the target host; determining a second comparison result of the first register value and the second register value; When the second comparison result is inconsistent, the register value of the target host is written into the register corresponding to the virtual machine to be migrated to modify the instruction state of the virtual machine to be migrated.
8. A virtual machine hot migration device, characterized in that: include: The remaining execution time determination module is used to determine the current load of the source host corresponding to the virtual machine to be migrated, and determine the remaining execution time of the source host for the current migration task according to the current load; A target host determination module, used to determine the target host corresponding to the current migration task according to the remaining execution time; A compatibility correction module, used to obtain the architecture compatibility check result of the source host and the target host, and perform compatibility correction on the virtual machine to be migrated according to the architecture compatibility check result; The hot migration implementation module is used to complete the hot migration of the virtual machine to be migrated from the source host to the target host based on the corrected running state of the virtual machine to be migrated.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the virtual machine hot migration method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the virtual machine hot migration method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Virtual machine migration processing method and device
CN105528234A
Method and system for live migration of virtual machines
CN107967164A
Virtual machine cross-host architecture migration correction method and device
CN113760451A
Virtual machine migration method and device, scheduler and computer system
CN118585283A
Virtual machines management apparatus, virtual machines management method, and computer readable storage medium
US20150007178A1
