Virtual machine batch migration method and device, equipment, storage medium and program product

By obtaining virtual machine demand information, screening target hosts and generating weighted migration plans, the problems of limited host resources and migration order dependence in virtual machine migration are solved, and efficient and automated virtual machine batch migration is achieved.

CN120832201APending Publication Date: 2025-10-24CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410488652.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-22
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Existing virtual machine migration technology cannot effectively handle the problem of limited host resources and migration order dependency in scenarios with multiple virtual machines and multiple hosts, resulting in low manual processing efficiency and high costs.

Method used

By obtaining the demand information of the virtual machine to be migrated, the target host is screened from the existing host resource library, a path planning strategy is used to generate a migration plan, and it is sorted based on weighted rules to provide automated migration plan selection, reducing manual deployment and trial and error.

Benefits of technology

It implements automatic migration solution recommendations under multiple constraints and migration order-dependent scenarios, improving operation and maintenance efficiency and reducing manual processing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832201A_ABST
    Figure CN120832201A_ABST
Patent Text Reader

Abstract

The invention provides a virtual machine batch migration method and device, equipment, a storage medium and a program product. The method comprises the steps of obtaining demand information of a to-be-migrated virtual machine, and screening a target host machine from an existing host machine resource library according to the demand information; determining a target path planning strategy from a preset path planning strategy set according to the number of the target host machines; generating at least one migration scheme based on the target path planning strategy, carrying out weighted sorting on the migration schemes according to a preset weighting rule, and pushing the weighted migration schemes with a first preset number to a client; in response to the target migration scheme selected by the client, the target migration scheme is executed, the current optimal limiting condition is updated based on the target migration scheme, a virtual machine batch migration scheme is given according to multiple limiting factors, operation and maintenance personnel can select the optimal migration scheme according to migration limiting conditions with different emphasis, and the migration efficiency is improved. Manual allocation of migration resources for trial and error is not needed any more, and efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer application, and in particular, to a virtual machine batch migration method, device, equipment, storage medium and program product. BACKGROUND

[0002] With the increasing growth of cloud computing services, more and more product design forms are no longer limited to the provision of basic single resources, but are based on the combination of multiple types of resources and the service of characteristic functions stacked thereon, so that the management of cloud resources also increases the challenge of multiple dimensions. The efficiency of resource scheduling is an important factor restricting the development of cloud computing, and how to efficiently allocate the cloud resources owned by oneself to tenants is a key problem that needs to be considered by the cloud platform. Virtualization technology realizes the scheduling of virtual resources through time division multiplexing principle, periodically allocates time slices to each virtual kernel under the condition that the overall resource utilization rate of the physical host is not high, and accounts for the running time, so as to control the proportion of physical computing resources obtained by the virtual machine. At the same time, virtualization technology also brings the basic problem of virtual machine allocation. The allocation of virtual machines is a non-deterministic polynomial problem, therefore, it is necessary to combine the actual situation to dynamically schedule and migrate the virtual machines, so as to constantly maintain the best allocation state.

[0003] The existing virtual machine migration technology mainly manually specifies or randomly allocates and then manually adjusts. This method is suitable when a small number of virtual machines are migrated and anti-affinity is not considered, because it only needs to consider whether the remaining available virtual resources of the same type are sufficient. However, if there is a large batch of virtual machine migration and the target resources are not sufficient, there may be a solution that depends on the order of migration. At this time, manual processing often cannot timely adjust the migration scheme that meets all the limitation conditions for multiple dependencies. That is, for the use scenario of multiple virtual machines and multiple target host computers, a many-to-many combination scheme will appear, and only a flat check is performed. Subsequent manual trial and error will face a large amount of migration schemes, so when the available target host resources are few, once there is a dependency on the order of migration, the cost of manually debugging the migration scheme will increase dramatically. SUMMARY

[0004] The present application provides a virtual machine batch migration method, device, equipment, storage medium and program product, to solve the problem that the existing virtual machine migration technology is only applicable to the scenario of a small number of virtual machine migration and does not consider anti-affinity, and cannot be applied to the scenario of few host resources and migration order dependency. The efficiency of manual processing is low and the cost is high.

[0005] In a first aspect, the present application provides a virtual machine batch migration method, comprising:

[0006] Obtaining demand information of the virtual machine to be migrated, and selecting a target host from an existing host resource library based on the demand information;

[0007] Determining a target path planning strategy from a preset path planning strategy set according to the number of target host machines, wherein the path planning strategy set includes a plurality of path planning strategies, each path planning strategy corresponds to a different number of target host machines, and each path planning strategy adopts different restriction conditions;

[0008] generating at least one migration plan based on the target path planning strategy, performing weighted sorting on the migration plans according to a preset weighting rule, and pushing a preset number of weighted migration plans to the client;

[0009] In response to the target migration plan selected by the client, the target migration plan is executed, and the current optimal constraint condition is updated based on the target migration plan.

[0010] Optionally, in the above method, the requirement information includes a virtual machine specification family, anti-affinity conditions, and total vCPU and memory resources. The step of selecting a target host from an existing host resource library based on the requirement information includes:

[0011] Determine the required number of processor cores based on the virtual machine specification family;

[0012] The host machine in the existing host machine resource library that meets the following conditions at the same time is used as the target host machine: the number of host machine processor cores is not less than the required number of processor cores, the affinity between the host machine and the virtual machine meets the anti-affinity condition, and the total amount of host machine vCPU and memory resources is not less than the total amount of vCPU and memory resources described in the demand information.

[0013] Optionally, in the above method, the updating of the current optimal constraint condition based on the target migration solution includes:

[0014] Obtaining the constraints in the target migration plan as optimization constraints;

[0015] Adjust the weight of the optimization constraint among the constraints according to a preset weight optimization rule, wherein the weight optimization rule is to adjust the weight of the constraint according to the number of times the optimization constraint is selected;

[0016] The constraint with the largest weight after adjustment is taken as the current optimal constraint.

[0017] Optionally, in the above method, determining the target path planning strategy from a preset path planning strategy set according to the number of the target host machines includes:

[0018] When the number of the target host machines is 1, it is determined that the target path planning strategy is a path planning strategy using repulsion as a constraint condition.

[0019] When the number of the target host machines is greater than 1, it is determined that the target path planning strategy is a path planning strategy using a current optimal constraint condition.

[0020] Optionally, the method as described above, the generating at least one migration scheme based on the target path planning strategy comprises:

[0021] constructing a graph model between the host machines and the virtual machines, the graph model including a source node where the virtual machine is located and nodes where the host machines are located;

[0022] calculating a shortest path from each node to the source node according to a distance and a weight of the node updated using the Dijkstra algorithm according to the constraint condition of the target path planning strategy;

[0023] generating a migration scheme based on the shortest path from each node to the source node and the weight of the node.

[0024] Optionally, the method as described above, the determining the target path planning strategy from the preset path planning strategy set according to the number of the target host machines further comprises:

[0025] when the number of the target host machines is 0, sending a migration result without target host machine to the client;

[0026] in response to a target constraint condition selection instruction fed back by the client, judging whether there is a potential target host machine, the potential target host machine being a host machine that satisfies the target constraint condition after the current virtual machine is migrated out;

[0027] if yes, it is determined that the target path planning strategy is a multi-level path planning strategy.

[0028] Optionally, the method as described above, the generating at least one migration scheme based on the target path planning strategy comprises:

[0029] determining a preset migration order level;

[0030] adding the migration order level to the target constraint condition, and calculating a migration scheme between the potential target host machine and the virtual machine using the Dijkstra algorithm.

[0031] In a second aspect, the present application provides a virtual machine batch migration device, comprising:

[0032] a host machine screening module configured to acquire demand information of a virtual machine to be migrated, and screen target host machines from an existing host machine resource library according to the demand information;

[0033] The path planning strategy obtaining module is configured to determine a target path planning strategy from a preset path planning strategy set according to the number of target host computers, wherein the path planning strategy set includes a plurality of path planning strategies, each path planning strategy corresponds to a different number of target host computers, and each path planning strategy adopts different restriction conditions.

[0034] The migration scheme generating module is configured to generate at least one migration scheme based on the target path planning strategy, to weight and sort the migration schemes according to a preset weighting rule, and to push the first preset number of migration schemes after weighting to the client.

[0035] The migration module is configured to execute the target migration scheme in response to the selected target migration scheme of the client, and to update the current optimal restriction condition based on the target migration scheme.

[0036] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and computer-executable instructions stored in the memory and executable on the processor, wherein the processor executes the computer-executable instructions to implement the virtual machine batch migration method of any one of the first aspect.

[0037] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the virtual machine batch migration method of any one of the first aspect.

[0038] In a fifth aspect, the present application provides a computer program product, when the computer program product is executed on a terminal device, the terminal device executes the virtual machine batch migration method of any one of the first aspect.

[0039] The virtual machine batch migration method, device, equipment, storage medium and program product provided by the application, by obtaining the demand information of the virtual machine to be migrated, the target host is selected from the existing host resource library according to the demand information; the target path planning strategy is determined from the preset path planning strategy set according to the number of the target host, the path planning strategy set includes a plurality of path planning strategies, each path planning strategy corresponds to a different number of target hosts, and each path planning strategy adopts different limit conditions; at least one migration scheme is generated based on the target path planning strategy, the migration scheme is weighted and sorted according to the preset weighting rule, the first preset number of migration schemes after weighting is pushed to the client; in response to the selected target migration scheme of the client, the target migration scheme is executed, and the current optimal limit condition is updated based on the target migration scheme, the scheme of batch migration of the virtual machine with split specification family and anti-affinity is given according to multiple limit factors, the automatic generation function of the migration scheme is provided for the operation and maintenance personnel, the operation and maintenance personnel can select the optimal migration scheme according to different migration limit conditions, and manual migration resource allocation is no longer needed to try and error. BRIEF DESCRIPTION OF DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application.

[0041] Figure 1 The application scenario diagram of the virtual machine batch migration method provided by the embodiment of the application.

[0042] Figure 2 The flowchart of the virtual machine batch migration method provided by the embodiment of the application.

[0043] Figure 3 The schematic diagram of the virtual machine batch migration device provided by the embodiment of the application.

[0044] Figure 4 The structural schematic diagram of the electronic equipment based on the virtual machine batch migration device provided by the embodiment of the application.

[0045] Through the above drawings, the specific embodiments of the application have been shown, and will be described in more detail hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the application by any means, but to illustrate the concept of the application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0046] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0047] In related technologies, virtual machine migration is initially randomly assigned, then individually evaluated based on constraints. Only after manual adjustments are made to ensure all conditions are met will the migration plan be allowed to proceed. For scenarios with multiple virtual machines and multiple target hosts, many-to-many combinations emerge. Only parity verification is performed, and subsequent manual trial and error is required for migration solutions involving very large data volumes. Therefore, when there are limited target host resources, the cost of manually debugging the migration solution increases dramatically if a migration order is required.

[0048] In response to the above technical problems, the embodiments of the present application aim to propose a method, apparatus, device, storage medium and program product for batch migration of virtual machines. The core concept of this method is: for scenarios with multiple constraints and execution order dependencies, a path planning algorithm is introduced to automatically calculate multiple recommended feasible migration plans, which are then manually selected. There is no need to manually allocate migration resources for trial and error. This not only avoids the risk of manually finding feasible solutions for complex scenarios, but also allows the weights of different constraints and the optimized screening order to be trained through case accumulation.

[0049] In order to better understand the solution of the embodiment of the present application, an application scenario involved in the embodiment of the present application is first introduced below.

[0050] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of the method for batch migration of virtual machines provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, it includes a client 100 and a server 200, wherein the client 100 can be used to confirm the demand information of the virtual machine to be migrated, such as the virtual machine specification family, anti-affinity conditions, the total amount of vCPU and memory resources, etc. The client 100 sends the demand information to the server 200 and sends relevant virtual machine migration plan generation instructions. The server 200 screens the target host from the existing host resource library according to the demand information, and determines the target path planning strategy, automatically generates a migration plan, and then pushes the migration plan to the client 100. The operation and maintenance personnel can select the target migration plan for execution from the client 100, and the server 200 executes the target migration plan and adjusts the restriction conditions related to the path planning strategy according to the selection of the operation and maintenance personnel.

[0051] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0052] Figure 2 Flowchart of the method for batch migration of virtual machines provided in the embodiment of the present application. Figure 2 As shown, the method of this embodiment includes:

[0053] S201: Obtain demand information of a virtual machine to be migrated, and select a target host from an existing host resource library according to the demand information.

[0054] The execution subject of the embodiment of the present application can be a server, or a virtual machine batch migration system in the server, wherein the virtual machine batch migration system can be implemented through software.

[0055] It's understood that virtual machine migration refers to the process of migrating a virtual machine instance running on one physical server to another. A "host" refers to the physical server, i.e., the physical hardware device running the virtual machine. Virtual machines can be migrated from one host to another for purposes such as resource load balancing, fault recovery, and resource optimization. The "host resource pool" refers to the collection of host resources managed and allocated within a virtualized environment. Through the host resource pool, administrators can manage and schedule host resources, dynamically allocating and adjusting them to meet virtual machine migration needs and optimize resource utilization.

[0056] In this embodiment, the physical server where the virtual machine is located can be dynamically adjusted according to actual needs, and a target host machine that can meet the migration needs can be screened from the existing host machine resource library to achieve optimal resource configuration.

[0057] S202: Determine a target path planning strategy from a preset path planning strategy set according to the number of target host machines, wherein the path planning strategy set includes a plurality of path planning strategies, each path planning strategy corresponds to a different number of target host machines, and each path planning strategy adopts different restriction conditions.

[0058] It can be understood that path planning refers to determining the best path and method for migrating a virtual machine from a source host (original physical server) to a target host (target physical server). The goal of path planning is to ensure performance, reliability, and efficiency during the virtual machine migration process.

[0059] Further, the number of host machines also affects the path selection of virtual machine migration. In a multi-host machine environment, the best path for virtual machine migration can be selected according to the constraints between host machines to ensure the performance and efficiency of the migration process.

[0060] S203: At least one migration scheme is generated based on the target path planning strategy, the migration scheme is weighted and sorted according to the preset weighting rule, the first preset number of migration schemes after weighting is pushed to the client.

[0061] In this step, the selection of the planned path directly affects the formulation of the migration scheme. Different path selections may require different migration schemes, such as network-based migration methods (such as vMotion) and storage-based migration methods (such as Storage vMotion). In addition, according to the different proportions of different constraints, the same target path planning strategy also has multiple selectable migration schemes, for example, if data transmission needs to be encrypted, a safer migration scheme may be selected; if the continuity of the virtual machine needs to be maintained during the migration process, a scheme that supports real-time migration may be selected. Therefore, these influencing factors can be weighted according to different weighting rules, and the migration schemes are sorted and the first few migration schemes are pushed to the client for selection by the operation and maintenance personnel.

[0062] S204: In response to the selected target migration scheme of the client, the target migration scheme is executed, and the current optimal constraint condition is updated based on the target migration scheme.

[0063] It can be understood that the selection of the target migration scheme by the operation and maintenance personnel can also be used as a case for analysis and accumulation, so as to adjust the optimal constraint condition, and apply it in the next path planning and migration scheme generation, so that the generated migration scheme is more reasonable.

[0064] The virtual machine batch migration method provided in this embodiment, by obtaining the demand information of the virtual machine to be migrated, selecting the target host machine from the existing host machine resource library according to the demand information; determine the target path planning strategy from the preset path planning strategy set according to the number of target host machines; at least one migration scheme is generated based on the target path planning strategy, the migration scheme is weighted and sorted according to the preset weighting rule, the first preset number of migration schemes after weighting is pushed to the client; in response to the selected target migration scheme of the client, the target migration scheme is executed, and the current optimal constraint condition is updated based on the target migration scheme, by giving the virtual machine batch migration scheme according to multiple constraint factors, the operation and maintenance personnel can select the optimal migration scheme according to different migration constraint conditions, and no longer need to manually allocate migration resources to try and error, improving the efficiency.

[0065] The technical solution of the virtual machine batch migration method is described below in detail.

[0066] In a possible implementation, the requirement information includes a virtual machine specification family, an anti-affinity condition, and a total amount of vCPU and memory resources. The virtual machine batch migration method provided in this embodiment filters target host computers from an existing host computer resource library according to each specific piece of information in the requirement information.

[0067] Specifically, filtering the target host computers from the existing host computer resource library according to the requirement information includes: confirming a required processor core number according to the virtual machine specification family; and regarding a host computer that meets the following conditions simultaneously as a target host computer: the number of processor cores of the host computer is not less than the required processor core number, the affinity between the host computer and the virtual machine meets the anti-affinity condition, and the total amount of vCPU and memory resources of the host computer is not less than the total amount of vCPU and memory resources in the requirement information.

[0068] It can be understood that through the host computer resource library, an operation and maintenance personnel or the virtual machine batch migration system provided in this application can manage and schedule host computer resources, realize dynamic allocation and adjustment of resources, and meet the requirements of virtual machine migration and optimize resource utilization.

[0069] In this embodiment, first, the corresponding resource requirement and performance requirement of a virtual machine are determined according to the specification family (for example, small, medium, or large) of the virtual machine. Virtual machines of different specification families may require different numbers of processor cores, memory sizes, and other resources. Second, the anti-affinity between a target host computer and a currently running virtual machine is considered, and a host computer with relatively low affinity with the current host computer is selected to avoid resource contention and performance degradation. Then, whether a target host computer has sufficient processor core numbers and memory capacity to support normal operation of a virtual machine can also be evaluated according to the total amount of vCPU and memory resources required by the virtual machine.

[0070] In this embodiment, by filtering target host computers from an existing host computer resource library according to each specific piece of information in requirement information, information of the target host computers is quickly determined, and the efficiency of subsequent migration is improved.

[0071] In a possible implementation, the virtual machine batch migration method provided in this embodiment realizes updating of the currently optimal restriction condition in path planning by adjusting the weights of the restriction conditions in the target migration scheme.

[0072] Specifically, the current optimal constraint condition is updated based on the target migration plan, including: obtaining the constraint condition in the target migration plan as the optimization constraint condition; adjusting the weight of the optimization constraint condition in each constraint condition according to a preset weight optimization rule, and the weight optimization rule is to adjust the weight of the constraint condition according to the number of times the optimization constraint condition is selected; and taking the constraint condition with the largest weight after adjustment as the current optimal constraint condition.

[0073] Understandably, during the path planning process for VM migration, there are constraints, including but not limited to available remaining resources, anti-affinity, and size family. These constraints can affect the efficiency and success rate of migration. Selecting appropriate constraints requires comprehensive consideration of various factors involved in VM migration, such as the network environment, resource utilization, and security requirements. Based on the specific situation and migration goals, you can flexibly adjust and select appropriate constraints to ensure a smooth migration process and achieve the desired results.

[0074] Different constraints may be required for different scenarios and migration requirements. Weights can be assigned to these constraints, which influence their impact on the path planning strategy. By weighting the constraints in the target migration plan, operators can effectively identify the constraints that are currently prioritized, enabling more effective path planning and migration plan recommendations in subsequent migration cases.

[0075] In a possible implementation, the virtual machine batch migration method provided in this embodiment generates a migration plan by adopting path planning strategies with different restriction conditions for different numbers of target host machines.

[0076] Specifically, the target path planning strategy is determined from a preset path planning strategy set according to the number of the target host machines, including: when the number of the target host machines is 1, confirming that the target path planning strategy is a path planning strategy that adopts anti-affinity as a restriction condition; when the number of the target host machines is greater than 1, confirming that the target path planning strategy is a path planning strategy that adopts the current optimal restriction condition.

[0077] It can be understood that the anti-affinity refers to that in the migration process, the system will try to select a host with lower affinity with the host currently running the virtual machine. The anti-affinity is an optimization strategy that can help the system better allocate resources and avoid performance bottlenecks during virtual machine migration. In this embodiment, the processor affinity index can consider the load of the processor on the target host, the number of cores and other factors to evaluate whether the target host is suitable for migrating the virtual machine. The memory affinity index can consider the use of memory on the target host, the size of available memory and other factors. The network affinity index can consider the network connection between the target host and other hosts to evaluate the impact of migration on network performance. By adopting the anti-affinity as a limiting condition in the path planning strategy, it can be avoided that the same resource contention situation as the current source host occurs on the target host, thereby improving the performance and stability of the entire virtual machine system.

[0078] Further, at least one migration scheme is generated based on the target path planning strategy, including: constructing a graph model between the host and the virtual machine, the graph model including the source node where the virtual machine is located and the node where each host is located; according to the limiting condition of the target path planning strategy, the distance and weight of the node are updated according to the Dijkstra algorithm, and the shortest path of each node to the source node is calculated; based on the shortest path of each node to the source node and the weight of the node, a migration scheme is generated.

[0079] In this embodiment, the Dijkstra algorithm is used to help determine the best migration scheme. After representing the relationship between the physical servers and the virtual machines in the data center as a graph model, the nodes in the graph model represent the physical servers and the virtual machines, and the edges represent the connections or relationships between them. For each node, its distance to the source node can be initialized as infinity, and the distance of the source node is 0. Then the distance or cost between nodes is represented according to the weight of the limiting condition. Starting from the source node, the distance and weight of the node are updated step by step according to the steps of the Dijkstra algorithm until the shortest path of all nodes to the source node is calculated. According to the calculated shortest path and weight, the best virtual machine migration scheme is determined. Using the Dijkstra algorithm to calculate the virtual machine migration scheme can help optimize the utilization of data center resources and system performance.

[0080] In this embodiment, by using different limiting conditions of the path planning strategy for different numbers of target hosts, the migration scheme is generated, which can more reasonably generate the migration scheme under different numbers of target hosts, thereby optimizing the utilization of data center resources and system performance.

[0081] In a possible implementation, the number of target host machines can be 0, that is, there can be no target host machine meeting the condition, and the virtual machine batch migration method provided in this embodiment changes the target limit condition by requesting the client to determine the possibility of existence of a potential target host machine, and generates a migration scheme based on a multi-level path planning strategy.

[0082] Specifically, determining the target path planning strategy from the preset path planning strategy set according to the number of target host machines further includes: when the number of target host machines is 0, sending a migration result without target host machine to the client; in response to a target limit condition selection instruction fed back by the client, determining whether there is a potential target host machine, the potential target host machine being a host machine meeting the target limit condition after the current virtual machine is migrated out; if yes, confirming that the target path planning strategy is a multi-level path planning strategy.

[0083] Further, generating at least one migration scheme based on the target path planning strategy includes: confirming a preset migration order level; adding the migration order level to the target limit condition, and using the Dijkstra algorithm to calculate a migration scheme between the potential target host machine and the virtual machine.

[0084] It can be understood that if there is a potential target host machine, there can be a migration dependent scheme, that is, a scenario in which the A host machine is first migrated to the B host machine, and then the to-be-migrated virtual machine is migrated to the A host machine.

[0085] The preset migration order level can be 3 layers, that is, before the to-be-migrated virtual machine is finally migrated to the final target host machine, virtual machine migration involving three target host machines needs to be completed first. For example, there is a to-be-migrated virtual machine a, the target host machine is A, and two virtual machines b and c are originally located on the host machines A and B, the c virtual machine is first migrated from the B host machine to the C host machine, then the b virtual machine is migrated from the A host machine to the B host machine, and finally the to-be-migrated virtual machine a is migrated to the A host machine.

[0086] In this embodiment, the possibility of existence of a potential target host machine is determined by changing the target limit condition by requesting the client, and a migration scheme is generated based on a multi-level path planning strategy, which can increase the optional range of migration of a to-be-migrated virtual machine with anti-affinity. In particular, for a smaller scale area, the scenario in which the remaining available resources of the host machine are insufficient.

[0087] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0088] Further, it should be noted that, although each step in the flowchart is displayed in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or sub-steps or stages of other steps.

[0089] Figure 3 A schematic diagram of a virtual machine batch migration device provided by an embodiment of the present application is shown in FIG. 1. As shown in the figure, the virtual machine batch migration device includes: Figure 3

[0090] A host machine screening module 31 is configured to obtain demand information of a virtual machine to be migrated, and screen a target host machine from an existing host machine resource library according to the demand information.

[0091] A path planning strategy acquisition module 32 is configured to determine a target path planning strategy from a preset path planning strategy set according to the number of target host machines, the path planning strategy set including a plurality of path planning strategies, each path planning strategy corresponding to a different number of target host machines, and each path planning strategy using different limiting conditions.

[0092] A migration scheme generation module 33 is configured to generate at least one migration scheme based on the target path planning strategy, weight and sort the migration schemes according to a preset weighting rule, and push the top pre-set number of weighted migration schemes to a client.

[0093] A migration module 34 is configured to execute a target migration scheme in response to a selected target migration scheme of the client, and update a current optimal limiting condition based on the target migration scheme.

[0094] In a possible design, the demand information includes a virtual machine specification family, an anti-affinity condition, a total amount of vCPU and memory resources, and the host machine screening module 31 is specifically configured to:​

[0095] confirming the number of processor cores according to the virtual machine specification family;

[0096] selecting, as a target host, a host in the existing host resource library that satisfies the following conditions: the number of processor cores of the host is not less than the number of required processor cores, the affinity between the host and the virtual machine satisfies the anti-affinity condition, and the total amount of vCPU and memory resources of the host is not less than the total amount of vCPU and memory resources in the requirement information.

[0097] In a possible design, the migration module 34 is specifically configured to:

[0098] obtain the constraint condition in the target migration scheme as an optimization constraint condition;

[0099] adjust the weight of the optimization constraint condition in each constraint condition according to a preset weight optimization rule, and the weight optimization rule is to adjust the weight of the constraint condition according to the number of times the constraint condition is selected;

[0100] select the constraint condition with the largest adjusted weight as the current optimal constraint condition.

[0101] In a possible design, the path planning strategy obtaining module 32 is specifically configured to:

[0102] when the number of target hosts is 1, confirm that the target path planning strategy is a path planning strategy that uses anti-affinity as a constraint condition;

[0103] when the number of target hosts is greater than 1, confirm that the target path planning strategy is a path planning strategy that uses the current optimal constraint condition.

[0104] In a possible design, the migration module 34 is specifically configured to:

[0105] construct a graph model between the hosts and the virtual machine, and the graph model includes a source node in which the virtual machine is located and nodes in which the hosts are located;

[0106] according to the constraint condition of the target path planning strategy, update the distance and weight of each node by using Dijkstra algorithm, and calculate the shortest path from each node to the source node;

[0107] generate a migration scheme based on the shortest path from each node to the source node and the weight of the node.

[0108] In a possible design, the path planning strategy obtaining module 32 is specifically configured to:

[0109] when the number of target hosts is 0, send a migration result without a target host to the client;

[0110] in response to the target restriction condition selection instruction of the client feedback, judging whether there is a potential target host satisfying the target restriction condition after migration out of the current virtual machine;

[0111] if yes, confirming that the target path planning strategy is a multi-level path planning strategy.

[0112] In a possible design, the migration module 34 is further specifically configured to:

[0113] confirm the preset migration order level;

[0114] add the migration order level to the target restriction condition, and calculate the migration scheme between the potential target host and the virtual machine by using the Dijkstra algorithm.

[0115] It should be understood that the above-described apparatus embodiments are only illustrative, and the apparatus of the present application can also be implemented in other manners. For example, the division of the units / modules in the above-described embodiments is only a logical function division, and actual implementation can have another division manner. For example, a plurality of units / modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0116] In addition, unless specifically described, each functional unit / module in each embodiment of the present application can be integrated in one unit / module, or each unit / module can exist physically, or two or more units / modules can be integrated together. The above-mentioned integrated unit / module can be realized in the form of hardware or in the form of a software program module.

[0117] Figure 4 The structure schematic diagram of the electronic device based on the virtual machine batch migration apparatus provided by the embodiments of the present application is shown in FIG. 4. As shown in the figure, the electronic device of the embodiments includes at least one processor 40 (only one processor is shown in the figure), a memory 41, and a computer program stored in the memory 41 and executable on the at least one processor 40, and the processor 40 implements the steps in any of the above-described method embodiments when executing the computer program. Figure 4 Figure 4 The electronic device can include, but is not limited to, the processor 40, the memory 41. Those skilled in the art can understand that the electronic device is only an example, and does not constitute a limitation on the electronic device, and can include more or fewer components than the figure, or combine certain components, or different components, for example, can also include an input / output device, a network access device, etc.

[0118] The electronic device can include, but is not limited to, the processor 40, the memory 41. Those skilled in the art can understand that the electronic device is only an example, and does not constitute a limitation on the electronic device, and can include more or fewer components than the figure, or combine certain components, or different components, for example, can also include an input / output device, a network access device, etc. Figure 4 The electronic device can include, but is not limited to, the processor 40, the memory 41. Those skilled in the art can understand that the electronic device is only an example, and does not constitute a limitation on the electronic device, and can include more or fewer components than the figure, or combine certain components, or different components, for example, can also include an input / output device, a network access device, etc.

[0119] ​The processor 40 can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0120] The processor 401 can be implemented by the method embodiments described above, and has similar implementation principles and technical effects. Details are not described here again.

[0121] The storage 41 can be an internal storage unit of the electronic device in some embodiments, such as a memory of the electronic device. The storage 41 can also be an external storage device of the electronic device in other embodiments, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. Further, the storage 41 can include both the internal storage unit and the external storage device of the electronic device. The storage 41 is used to store an operating system, an application program, a boot loader, data, and other programs, such as program codes of computer programs, etc. The storage 41 can also be used to temporarily store data that has been output or will be output.

[0122] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in the above-mentioned various method embodiments.

[0123] The above-mentioned computer readable storage medium can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0124] An exemplary readable storage medium is coupled to the processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the above-mentioned electronic device.

[0125] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0126] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a particular embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined in any way. To keep the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0127] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0128] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A virtual machine batch migration method, characterized in that, obtaining demand information of a virtual machine to be migrated, and screening target host computers from an existing host computer resource library according to the demand information; determining a target path planning strategy from a preset path planning strategy set according to the number of target host computers, the path planning strategy set including a plurality of path planning strategies, each path planning strategy corresponding to a different number of target host computers, and each path planning strategy using different restriction conditions; generating at least one migration scheme based on the target path planning strategy, weighting and sorting the migration schemes according to a preset weighting rule, and pushing the top preset number of migration schemes after weighting to a client; in response to a selected target migration scheme of the client, executing the target migration scheme, and updating a current optimal restriction condition based on the target migration scheme.

2. The method of claim 1, wherein, The demand information includes a virtual machine specification family, an anti-affinity condition, vCPU and memory resource total amount, and the screening of target host computers from the existing host computer resource library according to the demand information includes: confirming the number of required processor cores according to the virtual machine specification family; host computers in the existing host computer resource library that meet the following conditions at the same time are selected as target host computers: the number of host computer processor cores is not less than the number of required processor cores, the affinity between the host computer and the virtual machine meets the anti-affinity condition, and the total amount of vCPU and memory resources of the host computer is not less than the total amount of vCPU and memory resources in the demand information.

3. The method of claim 1, wherein, The updating of the current optimal restriction condition based on the target migration scheme includes: obtaining the restriction condition in the target migration scheme as an optimized restriction condition; adjusting the weight of the optimized restriction condition in each restriction condition according to a preset weight optimization rule, the weight optimization rule being to adjust the weight of the restriction condition according to the number of times the optimized restriction condition is selected; the restriction condition with the largest adjusted weight is selected as the current optimal restriction condition.

4. The method of claim 1, wherein, The determination of the target path planning strategy from the preset path planning strategy set according to the number of target host computers includes: when the number of target host computers is 1, confirming that the target path planning strategy is a path planning strategy that uses anti-affinity as a restriction condition; when the number of target host computers is greater than 1, confirming that the target path planning strategy is a path planning strategy that uses the current optimal restriction condition.

5. The method of claim 4, wherein, The generation of at least one migration scheme based on the target path planning strategy includes: building a graph model between host computers and virtual machines, the graph model including a source node where the virtual machine is located and nodes where the host computers are located; updating the distance and weight of the nodes according to the restriction condition of the target path planning strategy, and calculating the shortest path of each node to the source node; generating a migration scheme based on the shortest path of each node to the source node and the weight of the node.

6. The method of claim 4, wherein, The determination of the target path planning strategy from the preset path planning strategy set according to the number of target host computers also includes: when the number of target host computers is 0, sending a migration result without target host computers to the client; In response to the target restriction condition selection instruction of the client feedback, it is judged whether there is a potential target host, which is a host satisfying the target restriction condition after migration out of the current virtual machine; If yes, it is confirmed that the target path planning strategy is a multi-level path planning strategy.

7. The method of claim 6, wherein, The generation of at least one migration scheme based on the target path planning strategy includes: Confirming a preset migration order level; Adding the migration order level to the target restriction condition, and using Dijkstra algorithm to calculate the migration scheme between the potential target host and the virtual machine.

8. A virtual machine bulk migration apparatus, characterized by comprising: It includes: A host screening module for obtaining demand information of a virtual machine to be migrated, and screening a target host from an existing host resource library according to the demand information; A path planning strategy acquisition module for determining a target path planning strategy from a preset path planning strategy set according to the number of target hosts, the path planning strategy set including a plurality of path planning strategies, each path planning strategy corresponding to a different number of target hosts, and each path planning strategy using different restriction conditions; A migration scheme generation module for generating at least one migration scheme based on the target path planning strategy, weighting and sorting the migration scheme according to a preset weighting rule, and pushing the first preset number of migration schemes after weighting to the client; A migration module for executing the target migration scheme in response to the selection of the target migration scheme by the client, and updating the current optimal restriction condition based on the target migration scheme.

9. An electronic device, comprising: It includes: A processor and a memory connected in communication with the processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to realize the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to realize the method of any one of claims 1 to 7.