Virtual machine migration method, device and related equipment

By obtaining and generating structural information to optimize the deployment of virtual machines on target nodes, the problem of uneven resource occupation during virtual machine migration is solved, and the migration effect and resource utilization are improved.

CN118170498BActive Publication Date: 2024-09-06CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410579146.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2024-09-06
Estimated Expiration
2044-05-11

AI Technical Summary

Technical Problem

In the cloud platform, when virtual machines are migrated, due to the different processing order of computing nodes, resource occupancy is uneven, resulting in resource waste and poor migration effects.

Method used

By obtaining migration requests, NUMA information and resource information, structure information is generated to indicate the deployment of virtual machines on the target node, and based on this information, the virtual machine is migrated to the target node to ensure optimal utilization of resources.

Benefits of technology

It improves the effect of virtual machine migration, reduces resource waste, improves the migration success rate, and ensures the computing resource utilization of the target node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118170498B
    Figure CN118170498B
Patent Text Reader

Abstract

The present application provides a virtual machine migration method, device and related equipment, which are applied to a server, wherein the server includes a first node and a second node, and the method includes: obtaining a first migration request; obtaining first NUMA information, second NUMA information and first resource information according to the migration request; generating structure information according to the first NUMA information, the second NUMA information and the first resource information; and migrating the M virtual machines from the first node to the second node based on the structure information. The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machine to be migrated according to the obtained migration request, thereby calculating the deployment status of the virtual machine placed in the second node, and migrating the virtual machine from the first node to the second node accordingly, thereby improving the migration effect of the virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of cloud computing, and in particular to a virtual machine migration method, apparatus, and related equipment. Background Art

[0002] With the development of cloud platform technology, cloud platforms are being applied to more and more fields. Among them, multiple virtual machines are generally deployed in cloud platforms, mainly to provide users with computing resource management, scheduling and virtualization. At present, when multiple virtual machines are migrated from one node to another, due to the different order of processing by the computing nodes when each virtual machine is concurrent, the final arrangement of the resources occupied by the virtual machines will be different, resulting in a large waste of computing resources in another node after the migration of multiple virtual machines, resulting in poor virtual machine migration effect. Summary of the invention

[0003] The embodiments of the present application provide a virtual machine migration method, apparatus and related equipment to solve the problem of poor virtual machine migration effect in the prior art.

[0004] To solve the above problems, this application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a virtual machine migration method, which is applied to a server, wherein the server includes a first node and a second node, and the method includes:

[0006] Obtain a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to the second node, where N is a positive integer;

[0007] Acquire first NUMA information, second NUMA information, and first resource information according to the migration request, wherein the first NUMA information is a NUMA structure in the first node, the second NUMA information is a NUMA structure in the second node, and the first resource information is computing resources required to be occupied by the N virtual machines in the server;

[0008] Generate structure information according to the first NUMA information, the second NUMA information and the first resource information, where the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N;

[0009] Based on the structure information, the M virtual machines are migrated from the first node to the second node.

[0010] Optionally, the second node includes a first child node and a second child node, and generating structure information according to the first NUMA information, the second NUMA information and the first resource information includes:

[0011] Acquire second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first sub-node, and the third resource information is the available resource capacity of the second sub-node;

[0012] Determine the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information, wherein computing resources occupied by the M virtual machines are less than or equal to available resource capacity of the second node;

[0013] The structure information is generated according to the computing resources required to be occupied by the M virtual machines.

[0014] Optionally, determining the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information includes:

[0015] Determine N first resources according to the first resource information, where the N first resources correspond one-to-one to the N virtual machines, and the first resources are computing resources required to be occupied by the corresponding virtual machines in the server;

[0016] Scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information and the N first resources to obtain N scoring values, wherein the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rates of the computing resources occupied by the corresponding virtual machines in the server;

[0017] The N scoring values ​​are screened according to a preset rule to determine M scoring values, wherein the preset rule is that the M virtual machines screened have the highest computing resource utilization rate for the second node during operation;

[0018] The M virtual machines are determined based on the M scoring values.

[0019] Optionally, scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information, and the N first resources to obtain N scoring values ​​includes:

[0020] Generate N third-order arrays according to the second resource information, the third resource information and the numbers corresponding to the N virtual machines, wherein the N third-order arrays correspond one-to-one to the N virtual machines, and each virtual machine corresponds to a different number;

[0021] The N third-order arrays are calculated according to the deployment information and the N first resources to obtain the N scoring values, wherein the deployment information includes N sub-deployment information corresponding one-to-one to the N virtual machines, and the sub-deployment information is used to indicate the deployment location of the corresponding virtual machine, and the deployment location includes: deployed on the first sub-node, or deployed on the second sub-node, or deployed on the first sub-node and the second sub-node at the same time, or not deployed on the first sub-node and the second sub-node at the same time.

[0022] Optionally, generating the structure information according to the computing resources required to be occupied by the M virtual machines includes:

[0023] Generate a target array, the target array including M first data values, the M first data values ​​correspond one-to-one to the M virtual machines, and the first data values ​​are used to indicate a deployment location of the virtual machine;

[0024] Calculate the M third-order arrays corresponding to the M virtual machines according to the target array to obtain M second data values;

[0025] The structure information is generated according to M second data values.

[0026] Optionally, migrating the M virtual machines from the first node to the second node based on the structure information includes:

[0027] Generate M second migration requests according to the structure information, wherein the M second migration requests correspond to the M virtual machines respectively;

[0028] In a case where the security verification of the M second migration requests is passed, the M virtual machines are migrated from the first node to the second node in sequence based on the M second migration requests.

[0029] In a second aspect, an embodiment of the present application further provides a virtual machine migration device, which is applied to a server, wherein the server includes a first node and a second node, and the device includes:

[0030] A first acquisition module, used to acquire a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to a second node, where N is a positive integer;

[0031] A second acquisition module is used to acquire first NUMA information, second NUMA information and first resource information according to the migration request, wherein the first NUMA information is the NUMA structure in the first node, the second NUMA information is the NUMA structure in the second node, and the first resource information is the computing resources required to be occupied by the N virtual machines in the server;

[0032] a generating module, configured to generate structure information according to the first NUMA information, the second NUMA information, and the first resource information, wherein the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N;

[0033] A migration module is used to migrate the M virtual machines from the first node to the second node based on the structural information.

[0034] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps of the method described in the first aspect above.

[0035] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.

[0036] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps in the method described in the first aspect.

[0037] The present application provides a virtual machine migration method, apparatus and related equipment, which are applied to a server, wherein the server includes a first node and a second node, and the method includes: obtaining a first migration request, wherein the first migration request is used to request that N virtual machines located in the first node be migrated to the second node, wherein N is a positive integer; obtaining first NUMA information, second NUMA information and first resource information according to the migration request, wherein the first NUMA information is a NUMA structure in the first node, the second NUMA information is a NUMA structure in the second node, and the first resource information is computing resources required to be occupied by the N virtual machines in the server; generating structure information according to the first NUMA information, the second NUMA information and the first resource information, wherein the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, wherein M is a positive integer less than or equal to N; and migrating the M virtual machines from the first node to the second node based on the structure information. The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machine to be migrated based on the obtained migration request, thereby calculating the deployment status of the virtual machine in the second node, and migrating the virtual machine from the first node to the second node accordingly, thereby improving the migration effect of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0039] Figure 1 It is a flowchart of a virtual machine migration method provided in an embodiment of the present application;

[0040] Figure 2 This is one of the NUMA structure diagrams provided in the embodiments of the present application;

[0041] Figure 3 This is the second NUMA structure diagram provided by the embodiment of the present application;

[0042] Figure 4 This is the third NUMA structure diagram provided by the embodiment of the present application;

[0043] Figure 5 This is the fourth NUMA structure diagram provided by the embodiment of the present application;

[0044] Figure 6 This is the fifth NUMA structure diagram provided by the embodiment of the present application;

[0045] Figure 7 It is a structural diagram of a virtual machine migration device provided in an embodiment of the present application;

[0046] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.

[0049] See also Figure 1 , Figure 1 It is a flowchart of a virtual machine migration method provided in an embodiment of the present application. Figure 1 The virtual machine migration method shown may be executed by a server.

[0050] like Figure 1 As shown, the migration method of a virtual machine is applied to a server, the server includes a first node and a second node, and the method may include the following steps:

[0051] Step 101: Obtain a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to the second node, where N is a positive integer.

[0052] In this embodiment, after receiving the first migration request, the server migrates the N virtual machines located in the first node to the second node according to the first migration request. It should be noted that the first node and the second node can be host machines. When a failure occurs in the first node, such as the business network is unreachable, the storage network is unreachable, etc., the virtual machines on this host machine will be unavailable due to the failure. In this scenario, it is necessary to migrate all the virtual machines on the entire node to the second node as soon as possible. Generally, in daily use, there is usually a faulty spare host machine node for use, and the N virtual machines are migrated to the host machine.

[0053] Step 102: Obtain first NUMA information, second NUMA information and first resource information according to the migration request, wherein the first NUMA information is the NUMA structure in the first node, the second NUMA information is the NUMA structure in the second node, and the first resource information is the computing resources required to be occupied by the N virtual machines in the server.

[0054] In this embodiment, the first NUMA information and the second NUMA information are respectively the non-uniform memory access (NUMA) structures of the first node and the second node, wherein NUMA is a computer memory design for multiple processors, and the memory access time depends on the memory location of the processor. The design principle of the NUMA architecture is mainly to solve the memory access bottleneck problem in multi-processor systems. As the number of processors increases, the memory bandwidth demand will also increase accordingly. However, in the traditional uniform memory access (UMA) architecture, all processors share the same block of memory, resulting in increased memory access latency and memory bandwidth becoming a bottleneck for system performance. The NUMA architecture allocates memory to each node, allowing the processor to access local memory first, reducing memory access latency and improving the performance of the multi-processor system. Multi-processor servers are designed according to the NUMA architecture, and are generally divided into multiple NUMAs, with a certain amount of CPU and memory distributed on each NUMA.

[0055] For example, Figure 2 and Figure 3 The following is a diagram of the deployment of virtual machines on the NUMA structure: Figure 2 As shown in the figure, a 12c240g (i.e. 12 CPUs, 240G memory) virtual machine has a constraint requirement in the specification that it occupies resources on one NUMA (hw:numa_nodes=1 is set in the metadata of the specification). Figure 3As shown in the figure, a 12c240g (i.e. 12 CPUs, 240G memory) virtual machine needs to occupy resources on two NUMAs (hw:numa_nodes=2 is set in the metadata of the specification), and the default requirement is to share them equally. Note that this refers to the number of NUMAs required, and the NUMA numbers do not have to be consistent. For example, a 12c240g virtual machine needs to occupy resources on one NUMA. It occupies 12 CPUs on NUMA0 on the source node, and after migration, it can occupy 12 CPUs on NUMA1 on the second node.

[0056] It should be noted that during the migration of the virtual machine, it is necessary to ensure that the target host node meets the requirements for creating virtual machine resources. For the CPU requirements, in addition to maintaining the same number, the distribution of NUMAs must also be consistent. That is, if the virtual machine's resource requirements are on one NUMA, then even if the resources of the two NUMAs on the target host node are sufficient, the resources are considered insufficient. When the virtual machine migrates, the default rule for NUMA resource occupancy is to occupy them in order of NUMA numbers, that is, if NUMA0 resources are sufficient, NUMA0 is selected, otherwise NUMA1 is determined, and so on.

[0057] In this embodiment, the first resource information is the computing resources required to be occupied by each of the N virtual machines in the server, wherein the computing resources occupied by different virtual machines may be the same or different, which is not specifically limited in this embodiment.

[0058] Step 103: Generate structural information based on the first NUMA information, the second NUMA information and the first resource information, wherein the structural information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N.

[0059] In this embodiment, the deployment status of multiple virtual machines on the second node, i.e., structural information, is generated based on the first NUMA information, the second NUMA information, and the first resource information, wherein the structural information includes the deployment status of M virtual machines on the second node, specifically, the deployment location of each virtual machine, occupied computing resources, etc.

[0060] It should be noted that, in this embodiment, the N virtual machines in the first node may not all be migrated to the second node, because the computing resources included in the second node may be smaller than those of the first node, or the NUMA structure of the second node is different from the NUMA structure of the first node, etc., so the number of virtual machines migrated to the second node is M, where M is a positive integer less than or equal to N. When M is less than N, all N virtual machines cannot be migrated, and only M virtual machines can be migrated. When M is equal to N, all N virtual machines can be migrated to the second node.

[0061] Step 104: Based on the structure information, migrate the M virtual machines from the first node to the second node.

[0062] In this embodiment, according to the generated structure information, M virtual machines are migrated from the first node to the second node. It should be noted that the M virtual machines need to be migrated one by one, and cannot be migrated all at once.

[0063] The present application provides a virtual machine migration method, which is applied to a server, wherein the server includes a first node and a second node, and the method includes: obtaining a first migration request, wherein the first migration request is used to request that N virtual machines located in the first node be migrated to the second node, wherein N is a positive integer; obtaining first NUMA information, second NUMA information, and first resource information according to the migration request, wherein the first NUMA information is the NUMA structure in the first node, the second NUMA information is the NUMA structure in the second node, and the first resource information is the computing resources required to be occupied by the N virtual machines in the server; generating structure information according to the first NUMA information, the second NUMA information, and the first resource information, wherein the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, wherein M is a positive integer less than or equal to N; and migrating the M virtual machines from the first node to the second node based on the structure information. The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machines to be migrated according to the obtained migration request, thereby calculating the deployment status of the virtual machines placed in the second node, and migrating the virtual machines from the first node to the second node accordingly, thereby improving the migration effect of the virtual machines.

[0064] In some feasible implementations, optionally, the second node includes a first child node and a second child node, and generating structure information according to the first NUMA information, the second NUMA information and the first resource information includes:

[0065] Acquire second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first sub-node, and the third resource information is the available resource capacity of the second sub-node;

[0066] Determine the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information, wherein computing resources occupied by the M virtual machines are less than or equal to available resource capacity of the second node;

[0067] The structure information is generated according to the computing resources required to be occupied by the M virtual machines.

[0068] In this embodiment, the available resource capacity of different sub-nodes in the second node is obtained through the first NUMA information and the second NUMA information, specifically including the second resource information and the third resource information, wherein the second resource information is the available resource capacity of the first sub-node, and the third resource information is the available resource capacity of the second sub-node. In this embodiment, the second node includes two sub-nodes for explanation. In other embodiments, the second node may also include multiple sub-nodes, which is not specifically limited in this embodiment.

[0069] The optimal migration situation can be calculated among N virtual machines through the first resource information, the second resource information and the third resource information, wherein the optimal migration situation is that the computing resources occupied by the M virtual machines are less than or equal to the available resource capacity of the second node. Specifically, when the remaining resources of the second node are fewer, the migration situation is best. Thus, the structural information is generated through the computing resources required to be occupied by the M virtual machines.

[0070] Optionally, determining the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information includes:

[0071] Determine N first resources according to the first resource information, where the N first resources correspond one-to-one to the N virtual machines, and the first resources are computing resources required to be occupied by the corresponding virtual machines in the server;

[0072] Scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information and the N first resources to obtain N scoring values, wherein the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rates of the computing resources occupied by the corresponding virtual machines in the server;

[0073] The N scoring values ​​are screened according to a preset rule to determine M scoring values, wherein the preset rule is that the M virtual machines screened have the highest computing resource utilization rate for the second node during operation;

[0074] The M virtual machines are determined based on the M scoring values.

[0075] In this embodiment, N first resources are first determined, wherein each first resource corresponds to a virtual machine, and the first resources corresponding to different virtual machines may be the same or different, but are in a one-to-one correspondence.

[0076] Secondly, the resource occupancy rate of each virtual machine is scored using the second resource information, the third resource information and the N first resources to obtain N scoring values, where the N scoring values ​​correspond one-to-one to the N virtual machines, where the resource occupancy rate is the value of the virtual machine, and the maximum value here means the most occupied total resources. Specifically, the higher the resource occupancy rate, the higher the resource utilization rate of the second node.

[0077] Therefore, N scoring values ​​are screened by preset rules to determine M scoring values, wherein the preset rule is the case where the resource utilization of the second node is the highest. At this time, M virtual machines corresponding to the M scoring values ​​can be determined, thereby completing the screening of N virtual machines.

[0078] Optionally, scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information, and the N first resources to obtain N scoring values ​​includes:

[0079] Generate N third-order arrays according to the second resource information, the third resource information and the numbers corresponding to the N virtual machines, wherein the N third-order arrays correspond one-to-one to the N virtual machines, and each virtual machine corresponds to a different number;

[0080] The N third-order arrays are calculated according to the deployment information and the N first resources to obtain the N scoring values, wherein the deployment information includes N sub-deployment information corresponding one-to-one to the N virtual machines, and the sub-deployment information is used to indicate the deployment location of the corresponding virtual machine, and the deployment location includes: deployed on the first sub-node, or deployed on the second sub-node, or deployed on the first sub-node and the second sub-node at the same time, or not deployed on the first sub-node and the second sub-node at the same time.

[0081] In this embodiment, a third-order array dp[i][j][k] is defined to indicate that when the available resource capacity of the second node numa0 is i and the available resource capacity of the second node numa1 is j, the optional virtual machine subscript is between 0-k with the maximum value, where the maximum value means that the total resources occupied are the largest.

[0082] weight represents the resources that the virtual machine needs to occupy, abbreviated as w, and w[k] represents the total resources that the k-th virtual machine needs to occupy. value represents the value of this virtual machine, abbreviated as v, and v[k] represents the value of the k-th virtual machine.

[0083] For the k-th virtual machine, due to different sub-deployment information, two cases need to be considered:

[0084] Case 1: When the virtual machine needs resources on one numa, there are three scenarios:

[0085] Place the virtual machine on numa0. Note that after placing the k-th virtual machine, it needs to occupy the resources on numa0. When i > w[k], dp[i][j][k] = dp[i - w[k]][j][k - 1] + v[k]; when i < w[k], dp[i][j][k] = dp[i][j][k - 1]

[0086] Place the virtual machine on numa1. Note that after placing the k-th virtual machine, it needs to occupy the resources on numa0. When j > w[k], dp[i][j][k] = dp[i][j - w[k]][k - 1] + v[k]; when i < w[k], dp[i][j][k] = dp[i][j][k - 1]

[0087] Do not place it on either of the two numas, then: d[i][j][k] = dp[i][j][k - 1]

[0088] The recurrence formula can be derived as: when i > w[k], dp[i][j][k] = max(dp[i][j][k - 1], dp[i - w[k]][j] + w[k]) (Formula 1)

[0089] When j > w[k], dp[i][j][k] = max(dp[i][j][k - 1], dp[i][j - w[k]] + w[k]) (Formula 2)

[0090] When both are satisfied, dp[i][j][k] = max(dp[i][j][k - 1], dp[i - w[k]][j] + w[k], dp[i][j - w[k]] + w[k]) (Formula 3)

[0091] Case 2: When the virtual machine needs resources on both numas, there are two scenarios:

[0092] Do not place it on either of the two numas, d[i][j][k] = dp[i][j][k - 1]

[0093] Put it on both NUMAs. Note that the resources required on each NUMA are w[k] / 2. When i>w[k] / 2, j>w[k] / 2: dp[i][j][k] = dp[iw[k] / 2][jw[k] / 2][k-1]+v[k], otherwise: dp[i][j][k] = dp[i][j][k-1]

[0094] The recursive formula can be derived as follows: When i>w[k] / 2, j>w[k] / 2:

[0095] dp[i][j][k] = max(dp[i][j][k-1], dp[iw[k] / 2][jw[k] / 2]+w[k]) (Formula 4)

[0096] otherwise:

[0097] dp[i][j][k] = dp[i][j][k-1] (Formula 5)

[0098] For a given virtual machine list L (the number of virtual machines is n), the resources required by each virtual machine are w[1], w[2].......w[n], and the value they bring is v[1], v[2].......v[n]. In the current business scenario, w[k]=v[k], that is, the resources occupied by the virtual machine and the value it brings are equal.

[0099] Given the capacity a of numa0 and the capacity b of numa1, based on the above formulas 1 to 5, and the initial value of the array dp[0][0][0]=0, we can calculate each value of the 3rd-order array d[1][1][1] to dp[a][b][n] in turn. The value dp[a][b][n] is the optimal solution (that is, the one that occupies the most total resources). Since it is necessary to calculate each value of the 3rd-order array, the time complexity is O(a*b*n).

[0100] The final optimal solution required is: dp[a][b][n], so the optimal solution can be determined by N scoring values.

[0101] By obtaining the global NUMA topology data of the source host and the target host, and using a unified pre-allocation algorithm for batch virtual machines, we aggregate and pre-allocate resources for highly homogeneous virtual machines, solving the problem of resource waste caused by uncertainty in NUMA resource occupancy on the target host. This algorithm achieves the global optimal solution with the maximum resource occupancy on the target migration node in various scenarios, improving the overall migration success rate.

[0102] Optionally, generating the structure information according to the computing resources required to be occupied by the M virtual machines includes:

[0103] Generate a target array, the target array including M first data values, the M first data values ​​correspond one-to-one to the M virtual machines, and the first data values ​​are used to indicate a deployment location of the virtual machine;

[0104] Calculate the M third-order arrays corresponding to the M virtual machines according to the target array to obtain M second data values;

[0105] The structure information is generated according to M second data values.

[0106] In this embodiment, after determining the optimal solution, it is also necessary to determine the optimal solution path through the optimal solution, that is, how to place each virtual machine to obtain the optimal solution. Specifically, an array X[k] is defined to store the path, and the length of the virtual machine list is k.

[0107] The value of X[k] in the list indicates whether the kth virtual machine is placed on two numas. The agreed value is 0, indicating that there is no virtual machine; the value is 1, indicating that the virtual machine is placed on numa0; the value is 2, indicating that the virtual machine is placed on numa1; and the value is 3, indicating that the virtual machine resources are placed on two numas.

[0108] There may be multiple optimal solution paths. The path calculation method in this application is: judge according to the definition of the third-order array dp[i][j][k]. w[k] represents the total resources required by the Kth virtual machine. v[k] represents the value of the Kth virtual machine. For the Kth virtual machine, if dp[i][j][k] = dp[i][j][k-1], it means that virtual machine k has been added, but the value of the dp array has not changed, which means that virtual machine K has not been placed in two numas. That is, X[k]=0. If dp[i][j][k] = dp[iw[k]][j][k-1] +v[k], it means that virtual machine K is placed in numa0, that is, X[k] = 1. If dp[i][j][k] = dp[i][jw[k]][k-1] +v[k], it means that virtual machine K is placed in numa1, that is, X[k] = 2. If dp[i][j][k] = dp[iw[k] / 2][jw[k] / 2][k-1]+v[k], it means that virtual machine K is placed on numa0 and numa1, that is, X[k] = 3.

[0109] Similarly, each value of the array X[k] can be calculated, and then the numa distribution of each virtual machine in the virtual machine list can be determined based on the value.

[0110] The following is an example of migration. Assume that there are two 12C virtual machines, vm1 and vm2, and three 8C virtual machines, vm3, vm4, and vm5. There are two optimal solutions: Figure 3 As shown in the figure, for the optimal solution 1: vm1 and vm2 are pre-allocated and bound to NUMA0 of the target host, and vm3, vm4, and vm5 are pre-allocated and bound to NUMA1 of the target host. After the request is sent to the server of the second node, the resource occupation is carried out according to the pre-allocated NUMA binding policy. Therefore, no matter what the time order of the migration request from vm1 to vm5 arriving at the server for processing is, the final arrangement will become Figure 3 The situation shown.

[0111] For optimal solution 2: vm1 and vm2 are pre-allocated and bound to NUMA1 of the target host, and vm3, vm4, and vm5 are pre-allocated and bound to NUMA0 of the target host. After the request is sent to the server of the second node, the resource occupation is performed according to the pre-allocated NUMA binding policy. Therefore, no matter what the time order of the migration request from vm1 to vm5 arriving at the server for processing is, the final arrangement will become Figure 4 The situation shown.

[0112] In addition, when the total available resources of the second node are insufficient, the optimal solution is to occupy the most resources of the target node. The optimal solution is arranged as follows: Figure 5 As shown, it can be seen that in the scenario where the target physical machine resources are sufficient, it can be guaranteed that all virtual machines can be placed, such as Figure 6 As shown, in the scenario where the resources of the target physical machine are insufficient, the resources on the target physical machine can be used to the maximum extent.

[0113] Optionally, migrating the M virtual machines from the first node to the second node based on the structure information includes:

[0114] Generate M second migration requests according to the structure information, wherein the M second migration requests correspond to the M virtual machines respectively;

[0115] In a case where the security verification of the M second migration requests is passed, the M virtual machines are migrated from the first node to the second node in sequence based on the M second migration requests.

[0116] In this embodiment, after the server receives the first migration request sent externally, the first migration request is an API request, and the parameters carried include source node information and second node information. The API request is received by the API service. Among them, after the API service receives the request for parallel migration of the entire machine carrying the source node and second node parameters, it first performs a parameter validity check, and after the check passes, it sends the request to the server for further processing.

[0117] In addition, M second migration requests are generated through structural information, and each second migration request corresponds to a different virtual machine, wherein the security of each migration request needs to be verified, and after the verification is passed, parallel RPC requests are sent to the source node server. Each virtual machine corresponds to a request, thereby migrating the virtual machines in the first node to the second node in turn, wherein each second migration request carries the pre-allocation relationship between the NUMA of the virtual machine and the NUMA on the second node.

[0118] The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machine to be migrated based on the obtained migration request, thereby calculating the deployment status of the virtual machine in the second node, and migrating the virtual machine from the first node to the second node accordingly, thereby improving the migration effect of the virtual machine.

[0119] See also Figure 7 , Figure 7 is a structural diagram of a virtual machine migration device provided in an embodiment of the present application. Figure 7 As shown, a virtual machine migration device 700 is applied to a server, the server includes a first node and a second node, and the device includes:

[0120] A first acquisition module 710 is used to acquire a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to the second node, where N is a positive integer;

[0121] A second acquisition module 720 is configured to acquire first NUMA information, second NUMA information, and first resource information according to the migration request, wherein the first NUMA information is a NUMA structure in the first node, the second NUMA information is a NUMA structure in the second node, and the first resource information is computing resources required to be occupied by the N virtual machines in the server;

[0122] A generating module 730, configured to generate structure information according to the first NUMA information, the second NUMA information and the first resource information, wherein the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N;

[0123] The migration module 740 is configured to migrate the M virtual machines from the first node to the second node based on the structure information.

[0124] Optionally, the second acquisition module 720 includes:

[0125] an acquisition submodule, configured to acquire second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first subnode, and the third resource information is the available resource capacity of the second subnode;

[0126] a determination submodule, configured to determine the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information, wherein the computing resources occupied by the M virtual machines are less than or equal to the available resource capacity of the second node;

[0127] The first generating submodule is used to generate the structure information according to the computing resources required to be occupied by the M virtual machines.

[0128] Optionally, determine that the submodules include:

[0129] A first determining unit, configured to determine N first resources according to the first resource information, wherein the N first resources correspond one-to-one to the N virtual machines, and the first resources are computing resources required to be occupied by the corresponding virtual machines in the server;

[0130] a scoring unit, configured to score the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information, and the N first resources, to obtain N scoring values, wherein the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rates of the computing resources occupied by the corresponding virtual machines in the server;

[0131] A second determining unit is used to screen the N scoring values ​​according to a preset rule to determine M scoring values, wherein the preset rule is that the M virtual machines screened out have the highest computing resource utilization rate for the second node during operation;

[0132] A third determining unit is configured to determine the M virtual machines based on the M scoring values.

[0133] Optional scoring units include:

[0134] a generating subunit, configured to generate N third-order arrays according to the second resource information, the third resource information and the numbers corresponding to the N virtual machines, wherein the N third-order arrays correspond one-to-one to the N virtual machines, and each of the virtual machines corresponds to a different number;

[0135] The N third-order arrays are calculated according to the deployment information and the N first resources to obtain the N scoring values, wherein the deployment information includes N sub-deployment information corresponding one-to-one to the N virtual machines, and the sub-deployment information is used to indicate the deployment location of the corresponding virtual machine, and the deployment location includes: deployed on the first sub-node, or deployed on the second sub-node, or deployed on the first sub-node and the second sub-node at the same time, or not deployed on the first sub-node and the second sub-node at the same time.

[0136] Optionally, generate submodules including:

[0137] A first generating unit is used to generate a target array, wherein the target array includes M first data values, the M first data values ​​correspond to the M virtual machines one by one, and the first data values ​​are used to indicate a deployment location of the virtual machine;

[0138] a computing unit, configured to compute the M third-order arrays corresponding to the M virtual machines according to the target array to obtain M second data values;

[0139] The second generating unit is used to generate the structure information according to M second data values.

[0140] Optionally, the migration module 740 includes:

[0141] A second generating submodule, configured to generate M second migration requests according to the structure information, wherein the M second migration requests correspond to the M virtual machines respectively;

[0142] A migration submodule is used to migrate the M virtual machines from the first node to the second node in sequence based on the M second migration requests when the security verification of the M second migration requests passes.

[0143] The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machine to be migrated based on the obtained migration request, thereby calculating the deployment status of the virtual machine in the second node, and migrating the virtual machine from the first node to the second node accordingly, thereby improving the migration effect of the virtual machine.

[0144] The present application also provides an electronic device. Figure 8 , the electronic device may include a processor 801, a memory 802, and a program 8021 stored in the memory 802 and executable on the processor 801.

[0145] When the program 8021 is executed by the processor 801, it can achieve Figure 1Any step in the corresponding method embodiment:

[0146] Obtain a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to the second node, where N is a positive integer;

[0147] Acquire first NUMA information, second NUMA information, and first resource information according to the migration request, wherein the first NUMA information is a NUMA structure in the first node, the second NUMA information is a NUMA structure in the second node, and the first resource information is computing resources required to be occupied by the N virtual machines in the server;

[0148] Generate structure information according to the first NUMA information, the second NUMA information and the first resource information, where the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N;

[0149] Based on the structure information, the M virtual machines are migrated from the first node to the second node.

[0150] Optionally, the second node includes a first child node and a second child node, and generating structure information according to the first NUMA information, the second NUMA information and the first resource information includes:

[0151] Acquire second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first sub-node, and the third resource information is the available resource capacity of the second sub-node;

[0152] Determine the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information, wherein computing resources occupied by the M virtual machines are less than or equal to available resource capacity of the second node;

[0153] The structure information is generated according to the computing resources required to be occupied by the M virtual machines.

[0154] Optionally, determining the M virtual machines from the N virtual machines according to the first resource information, the second resource information, and the third resource information includes:

[0155] Determine N first resources according to the first resource information, where the N first resources correspond one-to-one to the N virtual machines, and the first resources are computing resources required to be occupied by the corresponding virtual machines in the server;

[0156] Scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information and the N first resources to obtain N scoring values, wherein the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rates of the computing resources occupied by the corresponding virtual machines in the server;

[0157] The N scoring values ​​are screened according to a preset rule to determine M scoring values, wherein the preset rule is that the M virtual machines screened have the highest computing resource utilization rate for the second node during operation;

[0158] The M virtual machines are determined based on the M scoring values.

[0159] Optionally, scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information, and the N first resources to obtain N scoring values ​​includes:

[0160] Generate N third-order arrays according to the second resource information, the third resource information and the numbers corresponding to the N virtual machines, wherein the N third-order arrays correspond one-to-one to the N virtual machines, and each virtual machine corresponds to a different number;

[0161] The N third-order arrays are calculated according to the deployment information and the N first resources to obtain the N scoring values, wherein the deployment information includes N sub-deployment information corresponding one-to-one to the N virtual machines, and the sub-deployment information is used to indicate the deployment location of the corresponding virtual machine, and the deployment location includes: deployed on the first sub-node, or deployed on the second sub-node, or deployed on the first sub-node and the second sub-node at the same time, or not deployed on the first sub-node and the second sub-node at the same time.

[0162] Optionally, generating the structure information according to the computing resources required to be occupied by the M virtual machines includes:

[0163] Generate a target array, the target array including M first data values, the M first data values ​​correspond one-to-one to the M virtual machines, and the first data values ​​are used to indicate a deployment location of the virtual machine;

[0164] Calculate the M third-order arrays corresponding to the M virtual machines according to the target array to obtain M second data values;

[0165] The structure information is generated according to M second data values.

[0166] Optionally, migrating the M virtual machines from the first node to the second node based on the structure information includes:

[0167] Generate M second migration requests according to the structure information, wherein the M second migration requests correspond to the M virtual machines respectively;

[0168] In a case where the security verification of the M second migration requests is passed, the M virtual machines are migrated from the first node to the second node in sequence based on the M second migration requests.

[0169] The present application determines the MUMA structure of the first node and the MUMA structure of the second node and the computing resources occupied by the virtual machine to be migrated based on the obtained migration request, thereby calculating the deployment status of the virtual machine in the second node, and migrating the virtual machine from the first node to the second node accordingly, thereby improving the migration effect of the virtual machine.

[0170] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned virtual machine migration method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0171] An embodiment of the present application further provides a computer program product, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the various processes of the above-mentioned virtual machine migration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0172] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0173] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0174] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for migrating a virtual machine, characterized in that: Applied to a server, the server comprising a first node and a second node, the method comprising: Obtain a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to the second node, where N is a positive integer; Acquire first NUMA information, second NUMA information, and first resource information according to the migration request, wherein the first NUMA information is a NUMA structure in the first node, the second NUMA information is a NUMA structure in the second node, and the first resource information is computing resources required to be occupied by the N virtual machines in the server; Generate structural information according to the first NUMA information, the second NUMA information and the first resource information, wherein the structural information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, where M is a positive integer less than or equal to N, and the second node includes a first child node and a second child node, and the generating structural information according to the first NUMA information, the second NUMA information and the first resource information includes: acquiring second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first child node, and the third resource information is the available resource capacity of the second child node; determining the M virtual machines among the N virtual machines according to the first resource information, the second resource information and the third resource information, wherein the computing resources occupied by the M virtual machines are less than or equal to the available resource capacity of the second node; and determining the number of virtual machines to be deployed in the second node according to the computing resources occupied by the M virtual machines. The computing resources to be occupied are generated, and the structure information is generated. The M virtual machines are determined from the N virtual machines according to the first resource information, the second resource information, and the third resource information, including: determining N first resources according to the first resource information, the N first resources correspond one-to-one to the N virtual machines, and the first resource is the computing resource required to be occupied by the corresponding virtual machine in the server; scoring the resource occupancy rate of the N virtual machines according to the second resource information, the third resource information, and the N first resources to obtain N scoring values, the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rate of the computing resources occupied by the corresponding virtual machine in the server; screening the N scoring values ​​according to a preset rule to determine M scoring values, and the preset rule is that the screened M virtual machines have the highest computing resource utilization rate of the second node during operation; determining the M virtual machines based on the M scoring values; Based on the structural information, the M virtual machines are migrated from the first node to the second node.

2. The method according to claim 1, characterized in that Scoring the resource occupancy rates of the N virtual machines according to the second resource information, the third resource information and the N first resources to obtain N scoring values ​​includes: Generate N third-order arrays according to the second resource information, the third resource information and the numbers corresponding to the N virtual machines, wherein the N third-order arrays correspond one-to-one to the N virtual machines, and each virtual machine corresponds to a different number; The N third-order arrays are calculated according to the deployment information and the N first resources to obtain the N scoring values, wherein the deployment information includes N sub-deployment information corresponding one-to-one to the N virtual machines, and the sub-deployment information is used to indicate the deployment location of the corresponding virtual machine, and the deployment location includes: deployed on the first sub-node, or deployed on the second sub-node, or deployed on the first sub-node and the second sub-node at the same time, or not deployed on the first sub-node and the second sub-node at the same time.

3. The method according to claim 2, characterized in that The generating the structure information according to the computing resources required to be occupied by the M virtual machines includes: Generate a target array, the target array including M first data values, the M first data values ​​correspond one-to-one to the M virtual machines, and the first data values ​​are used to indicate a deployment location of the virtual machine; Calculate the M third-order arrays corresponding to the M virtual machines according to the target array to obtain M second data values; The structure information is generated according to M second data values.

4. The method according to claim 1, characterized in that: The migrating the M virtual machines from the first node to the second node based on the structure information includes: Generate M second migration requests according to the structure information, wherein the M second migration requests correspond to the M virtual machines respectively; In a case where the security verification of the M second migration requests is passed, the M virtual machines are migrated from the first node to the second node in sequence based on the M second migration requests.

5. A virtual machine migration device, characterized in that: Applied to a server, the server includes a first node and a second node, and the device includes: A first acquisition module, used to acquire a first migration request, where the first migration request is used to request to migrate N virtual machines located in the first node to a second node, where N is a positive integer; A second acquisition module is used to acquire first NUMA information, second NUMA information and first resource information according to the migration request, wherein the first NUMA information is the NUMA structure in the first node, the second NUMA information is the NUMA structure in the second node, and the first resource information is the computing resources required to be occupied by the N virtual machines in the server; a generating module, configured to generate structure information according to the first NUMA information, the second NUMA information and the first resource information, wherein the structure information is used to indicate the deployment status of M virtual machines among the N virtual machines in the second node, wherein M is a positive integer less than or equal to N, and the generating module comprises: an acquiring submodule, configured to acquire second resource information and third resource information according to the first NUMA information and the second NUMA information, wherein the second resource information is the available resource capacity of the first child node, and the third resource information is the available resource capacity of the second child node; a determining submodule, configured to determine the M virtual machines among the N virtual machines according to the first resource information, the second resource information and the third resource information, wherein the computing resources occupied by the M virtual machines are less than or equal to the available resource capacity of the second node; a first generating submodule, configured to determine the computing resources required to be occupied by the M virtual machines according to the computing resources required to be occupied by the M virtual machines source, generating the structural information; the determination submodule includes: a first determination unit, used to determine N first resources according to the first resource information, the N first resources correspond one-to-one to the N virtual machines, and the first resource is the computing resource required to be occupied by the corresponding virtual machine in the server; a scoring unit, used to score the resource occupancy rate of the N virtual machines according to the second resource information, the third resource information and the N first resources, and obtain N scoring values, the N scoring values ​​correspond one-to-one to the N virtual machines, and the scoring values ​​are used to indicate the resource occupancy rate of the computing resources occupied by the corresponding virtual machine in the server; a second determination unit, used to screen the N scoring values ​​according to a preset rule, and determine M scoring values, the preset rule being that the screened M virtual machines have the highest computing resource utilization rate of the second node during operation; a third determination unit, used to determine the M virtual machines based on the M scoring values; A migration module is used to migrate the M virtual machines from the first node to the second node based on the structural information.

6. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the virtual machine migration method as described in any one of claims 1 to 4.

7. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the virtual machine migration method according to any one of claims 1 to 4 are implemented.

8. A computer program product, characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the virtual machine migration method according to any one of claims 1 to 4.