Virtual machine migration method and system
By providing virtual machine processing components and management components on the Kubernetes platform, virtual machine migration is realized, solving the problem of the Kubernetes platform lacking virtual machine migration capabilities, and improving management performance and system flexibility.
Patent Information
- Application Number
- CN202411782059.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-21
AI Technical Summary
The Kubernetes platform has not yet implemented virtual machine migration functions, which limits its application scenarios.
Provides a virtual machine migration method and system to receive migration requests through virtual machine processing components, determine source nodes and target nodes, and control the status of migration tasks to instruct the virtual machine management components to implement the migration of virtual machines on the Kubernetes platform.
The virtual machine migration function based on the Kubernetes platform is realized, which improves the unified management performance of the Kubernetes platform for containers and virtual machines, enhances the flexibility and scalability of the system, and simplifies the management complexity in heterogeneous environments.
Smart Images

Figure CN119668781A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of virtual machines, and in particular to a virtual machine migration method and system. Background Art
[0002] With the rapid development of cloud computing technology, Kubernetes, as a modern container orchestration system, has been increasingly widely used. In this context, the need to integrate virtual machine management into the Kubernetes platform for unified management has become increasingly urgent.
[0003] However, the Kubernetes platform has not yet implemented the virtual machine migration function, which to some extent limits its application scenarios. Summary of the invention
[0004] Based on this, it is necessary to provide a virtual machine migration method and system to address the above technical problems, which can realize the virtual machine migration function based on the Kubernetes platform.
[0005] In a first aspect, the present application provides a virtual machine migration method, which is applied to a control node in a target cluster, wherein a virtual machine processing component is deployed in the control node, and the method includes:
[0006] Receiving a virtual machine migration request through the virtual machine processing component;
[0007] Determine the source node and the target node of the virtual machine to be migrated respectively according to the virtual machine migration request through the virtual machine processing component; wherein the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component;
[0008] Through the virtual machine processing component, the migration task status of the virtual machine to be migrated is controlled according to the source node and the target node to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
[0009] In one embodiment, the virtual machine processing component includes a virtual machine interface service component, a virtual machine control component and a scheduling component, wherein the virtual machine interface service component is used to receive a virtual machine migration request, and the source node and the target node of the virtual machine to be migrated are determined by the virtual machine processing component according to the virtual machine migration request, including:
[0010] Determining the source node by the virtual machine control component according to the virtual machine identification information in the virtual machine migration request;
[0011] Determining, by the virtual machine control component, whether the target node information in the virtual machine migration request is valid;
[0012] By means of the virtual machine control component, when the target node information is valid, determining the target node according to the target node information;
[0013] By means of the virtual machine control component, when the target node information is invalid, the scheduling component is called to determine the target node from the remaining nodes of the target cluster.
[0014] In one embodiment, controlling the migration task status of the to-be-migrated virtual machine according to the source node and the target node by the virtual machine processing component includes:
[0015] Determining, by the virtual machine processing component, a migration type of the virtual machine migration request;
[0016] The migration task status of the virtual machine to be migrated is controlled through the virtual machine processing component according to the migration type, the source node and the target node.
[0017] In one embodiment, controlling the migration task status of the virtual machine to be migrated according to the migration type, the source node and the target node by the virtual machine processing component includes:
[0018] By means of the virtual machine processing component, when the migration type is virtual machine cold migration, the migration task state is set to the first cold operation state of the source node, so as to instruct the first virtual machine management component to obtain the virtual machine state information of the virtual machine to be migrated in the source node according to the first cold operation state, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task state to the second cold operation state of the target node;
[0019] By means of the virtual machine processing component, the virtual machine state information is obtained and the first cold operation state is updated to the second cold operation state, so as to instruct the second virtual machine management component to create and restore the virtual machine to be migrated at the target node according to the virtual machine state information and the second cold operation state, and to set the migration task state to the third cold operation state of the source node;
[0020] The second cold operation state is updated to the third cold operation state through the virtual machine processing component to instruct the first virtual machine management component to clean up the virtual machine to be migrated in the source node according to the third cold operation state.
[0021] In one embodiment, controlling the migration task status of the virtual machine to be migrated according to the migration type, the source node and the target node by the virtual machine processing component includes:
[0022] By means of the virtual machine processing component, when the migration type is virtual machine hot migration, the migration task state is set to the first hot operation state of the target node, so as to instruct the second virtual machine management component to create a migration environment of the virtual machine to be migrated in the target node according to the first hot operation state, and to set the migration task state to the second hot operation state of the source node;
[0023] Through the virtual machine processing component, the first hot operation state is updated to the second hot operation state to instruct the first virtual machine management component to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node according to the second hot operation state, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the state information.
[0024] In a second aspect, the present application provides a virtual machine migration method, which is applied to a source node and a target node in a target cluster, wherein the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component, and the method includes:
[0025] Obtaining, through the first virtual machine management component, the migration task status of the virtual machine to be migrated from the virtual machine processing component of the control node in the target cluster; wherein the virtual machine processing component is used to receive a virtual machine migration request, determine the source node and the target node of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task status of the virtual machine to be migrated according to the source node and the target node;
[0026] Obtaining, through the second virtual machine management component, a migration task status of the virtual machine to be migrated from the virtual machine processing component;
[0027] The first virtual machine management component and the second virtual machine management component are used to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
[0028] In one embodiment, the migrating the virtual machine to be migrated from the source node to the target node according to the migration task status by the first virtual machine management component and the second virtual machine management component respectively includes:
[0029] By means of the first virtual machine management component, when the migration task state obtained from the virtual machine processing component is a first cold operation state, obtaining virtual machine state information of the virtual machine to be migrated in the source node, controlling the virtual machine to be migrated to be in a shutdown state, and setting the migration task state to a second cold operation state of the target node;
[0030] By the second virtual machine management component, when the migration task state obtained from the virtual machine processing component is the second cold operation state, the virtual machine state information is obtained from the virtual machine processing component, and the to-be-migrated virtual machine is created and restored on the target node according to the virtual machine state information, and the migration task state is set to the third cold operation state of the source node;
[0031] By means of the first virtual machine management component, when the migration task state obtained from the virtual machine processing component is a third cold operation state, the virtual machine to be migrated in the source node is cleared.
[0032] In one embodiment, the migrating the virtual machine to be migrated from the source node to the target node according to the migration task status by the first virtual machine management component and the second virtual machine management component respectively includes:
[0033] By the second virtual machine management component, when the migration task state obtained from the virtual machine processing component is a first hot operation state, creating a migration environment of the virtual machine to be migrated in the target node, and setting the migration task state to a second hot operation state of the source node;
[0034] Through the first virtual machine management component, when the migration task status obtained from the virtual machine processing component is a second hot operation state, the virtual machine state information of the virtual machine to be migrated in the source node is sent to the target node, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the virtual machine state information.
[0035] In one embodiment, sending the virtual machine state information of the virtual machine to be migrated in the source node to the target node includes:
[0036] The data transmission component is called by calling the data transmission interface to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node.
[0037] In a third aspect, the present application provides a virtual machine migration system, wherein a target cluster of the virtual machine migration system includes a control node, a source node, and a target node, wherein the control node is deployed with a virtual machine processing component, the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component; wherein,
[0038] The virtual machine processing component is used to receive a virtual machine migration request, determine the source node and the target node of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task state of the virtual machine to be migrated according to the virtual machine migration request;
[0039] The first virtual machine management component and the second virtual machine management component are used together to migrate the virtual machine to be migrated from the source node to the target node.
[0040] The above-mentioned virtual machine migration method and system receive a virtual machine migration request through a virtual machine processing component, determine the source node and the target node in the target cluster respectively according to the virtual machine migration request through the virtual machine processing component, and control the migration task status of the virtual machine to be migrated according to the source node and the target node through the virtual machine processing component to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node respectively according to the migration task status, wherein the virtual machine processing component, the first virtual machine management component and the second virtual machine management component are respectively constructed based on the Kubernetes platform, and the method performs component expansion based on the Kubernetes platform, realizes efficient and reliable migration of virtual machines in the Kubernetes environment, provides a resource management solution for hybrid cloud scenarios of virtual machines and containers, improves the flexibility and scalability of the system, enhances resource utilization efficiency, and simplifies management complexity in heterogeneous environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic diagram of the structure of a virtual machine migration system in one embodiment;
[0042] Figure 2 This is one of the flowcharts of a virtual machine migration method in one embodiment;
[0043] Figure 3 A schematic diagram of the structure of a virtual machine migration system in another embodiment;
[0044] Figure 4 The second flowchart of the virtual machine migration method in one embodiment;
[0045] Figure 5 The third flowchart of a virtual machine migration method in one embodiment;
[0046] Figure 6 The fourth flowchart of the virtual machine migration method in one embodiment;
[0047] Figure 7 FIG5 is a flowchart of a virtual machine migration method according to an embodiment;
[0048] Figure 8 FIG6 is a sixth flow chart of a virtual machine migration method in an embodiment;
[0049] Fig. 9 FIG7 is a flowchart of a virtual machine migration method according to an embodiment;
[0050] Fig.10 FIG8 is a flowchart of a virtual machine migration method according to an embodiment of the present invention;
[0051] Fig.11 A flow chart of a virtual machine migration method in another embodiment Figure 9 ;
[0052] Fig.12 A flow chart of a virtual machine migration method in an embodiment Figure 10 ;
[0053] Fig.13 A schematic diagram of the structure of a virtual machine migration device in one embodiment;
[0054] Fig.14 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] As mentioned in the background technology, the Kubernetes platform does not yet have the virtual machine migration function. In this regard, the present application provides a virtual machine migration method and system, which can realize the virtual machine migration function based on the Kubernetes platform, so that the Kubernetes platform not only has the management function of containers, but also has the management function of virtual machines, thereby improving the performance of the Kubernetes platform in unified management of containers and virtual machines.
[0057] The virtual machine migration method provided in the embodiment of the present application can be applied to Figure 1In the target cluster shown. The target cluster includes a control node 10, a source node 20 and a target node 30. The control node 10 is deployed with a virtual machine processing component 11. The source node 20 is deployed with a first virtual machine management component 21. The target node 30 is deployed with a second virtual machine management component 22. The virtual machine processing component 11, the first virtual machine management component 21 and the second virtual machine management component 22 are respectively built based on the Kubernetes platform. In the application, the virtual machine migration request is received and the migration task status is managed through the virtual machine processing component 11, and the virtual machine to be migrated is migrated from the source node 20 to the target node 30 through the first virtual machine management component 21 and the second virtual machine management component 22, thereby realizing the virtual machine migration function based on the Kubernetes platform and improving the performance of the Kubernetes platform in unified management of containers and virtual machines.
[0058] In one embodiment, Figure 2 As shown, a virtual machine migration method is provided, which is applied to Figure 1 Taking the control node 10 in the example as an example, the control node 10 is deployed with a virtual machine processing component 11 based on the Kubernetes platform, and the virtual machine migration method includes the following steps S202 to S206.
[0059] S202: Receive a virtual machine migration request through a virtual machine processing component.
[0060] The virtual machine processing component 11 is deployed on the control node 10, and the virtual machine processing component 11 is built based on the Kubernetes platform. The virtual machine migration request is used to indicate the migration of the virtual machine to be migrated. The virtual machine migration request can come from a client, a WEB page, or other terminals or servers with virtual machine migration requirements, etc., which are not limited here.
[0061] In the application, the virtual machine processing component 11 can be constructed based on the Kubernetes platform and deployed on the control node 10 . Based on this, the control node 10 can receive a virtual machine migration request through the virtual machine processing component 11 .
[0062] S204: Determine the source node and the target node in the target cluster respectively according to the virtual machine migration request through the virtual machine processing component.
[0063] The source node 20 is deployed with a first virtual machine management component 21, and the target node 30 is deployed with a second virtual machine management component 22. The first virtual machine management component 21 and the second virtual machine management component 22 are respectively constructed based on the Kubernetes platform. In the application, the first virtual machine management component 21 and the second virtual machine management component 22 can be constructed based on the Kubernetes platform, and the first virtual machine management component 21 is deployed on the source node 20, and the second virtual machine management component 22 is deployed on the target node 30.
[0064] In the embodiment of the present application, the source node 20 refers to the node where the virtual machine to be migrated is located before migration, and the target node 30 refers to the destination node to which the virtual machine to be migrated needs to be migrated. Before the virtual machine to be migrated migrates, the source node 20 includes the virtual machine to be migrated.
[0065] Exemplarily, the virtual machine migration request includes virtual machine migration information, which is used to represent information related to the virtual machine to be migrated. Based on this, the control node 10 determines the source node 20 and the target node 30 of the virtual machine to be migrated from the target cluster respectively according to the virtual machine migration information through the virtual machine processing component 11.
[0066] S206: Control the migration task status of the virtual machine to be migrated according to the source node and the target node through the virtual machine processing component to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
[0067] The migration task status is used to indicate the progress status of the migration of the virtual machine to be migrated from the source node 20 to the target node 30. The virtual machine processing component 11 is used to initialize and store the migration task status, and obtain the migration task status from the first virtual machine management component 21 and the second virtual machine management component 22, and update the migration task status. The first virtual machine management component 21 and the second virtual machine management component 22 are connected to the virtual machine processing component 11, respectively. The first virtual machine management component 21 is used to obtain the migration task status from the virtual machine processing and components, and update the migration task status. The second virtual machine management component 22 is used to obtain the migration task status from the virtual machine processing and components, and update the migration task status.
[0068] In the application, after the control node 10 determines the source node 20 and the target node 30 through the virtual machine processing component 11, it initializes, stores, obtains and updates the migration task status of the virtual machine to be migrated, thereby instructing the first virtual machine management component 21 and the second virtual machine management component 22 to migrate the virtual machine to be migrated from the source node 20 to the target node 30 according to the migration task status.
[0069] The above-mentioned virtual machine migration method receives a virtual machine migration request through the virtual machine processing component 11, determines the source node 20 and the target node 30 in the target cluster according to the virtual machine migration request through the virtual machine processing component 11, controls the migration task status of the virtual machine to be migrated according to the source node 20 and the target node 30 through the virtual machine processing component 11, so as to instruct the first virtual machine management component 21 and the second virtual machine management component 22 to migrate the virtual machine to be migrated from the source node 20 to the target node 30 according to the migration task status, respectively, wherein the virtual machine processing component 11, the first virtual machine management component 21 and the second virtual machine management component 22 are respectively constructed based on the Kubernetes platform, and the method performs component expansion based on the Kubernetes platform, realizes efficient and reliable migration of virtual machines in the Kubernetes environment, provides a resource management solution for virtual machines and containers in a hybrid cloud scenario, improves the flexibility and scalability of the system, enhances resource utilization efficiency, and simplifies the management complexity in a heterogeneous environment.
[0070] In one embodiment, Figure 3 As shown, the virtual machine processing component 11 includes a virtual machine interface service component 111, a virtual machine control component 112 and a scheduling component 113 built on the Kubernetes platform. The virtual machine interface service component 111 and the scheduling component 113 are respectively connected to the virtual machine control component 112. The virtual machine interface service component 111 is used to receive a virtual machine migration request, for example, a virtual machine API (Application Programming Interface) service component.
[0071] like Figure 4 As shown, step S204, through the virtual machine processing component, respectively determining the source node and the target node of the virtual machine to be migrated according to the virtual machine migration request, includes the following steps S402 and S404.
[0072] S402: Determine the source node according to the virtual machine identification information in the virtual machine migration request through the virtual machine control component.
[0073] S404: Determine, through the virtual machine control component, whether the target node information in the virtual machine migration request is valid.
[0074] S406: Determine the target node according to the target node information through the virtual machine control component if the target node information is valid.
[0075] S408: When the target node information is invalid, the scheduling component is called to determine the target node from the remaining nodes of the target cluster through the virtual machine control component.
[0076] Exemplarily, the virtual machine migration request includes virtual machine identification information and target node information, wherein the virtual machine identification information is used to identify the virtual machine to be migrated, and the target node information is used to represent information related to the target node 30. The virtual machine control component 112 is connected to the virtual machine interface service component 111.
[0077] In the application, the control node 10 receives a virtual machine migration request through the virtual machine interface service component 111, and then determines the source node 20 through the virtual machine control component 112 according to the virtual machine identification information in the virtual machine migration request, and determines the target node 30 through the virtual machine control component 112 according to the target node information in the virtual machine migration request, thereby controlling the migration task status according to the source node 20 and the target node 30, and then instructing the first virtual machine management component 21 and the second virtual machine management component 22 to migrate the virtual machine to be migrated from the source node 20 to the target node 30 according to the migration task status.
[0078] Exemplarily, the virtual machine control component 112 is used to determine whether the target node information in the virtual machine migration request is valid, or in other words, whether the target node information specifies the target node 30 of the virtual machine to be migrated. If so, it indicates that the target node information is valid, and the virtual machine control component 112 determines the target node 30 according to the target node information; if not, it indicates that the target node 30 is invalid, and the scheduling component 113 is called by the virtual machine control component 112 to determine the target node 30 from the remaining nodes of the target cluster.
[0079] The remaining nodes of the target node 30 refer to other nodes except the source node 20. Exemplarily, the virtual machine control component 112 calls the component to obtain the resource usage information of the remaining nodes respectively, and the node with the most remaining resources is determined as the target node 30 according to the resource usage information of each remaining node. The resource usage information is used to indicate the resource usage of the node, such as CPU usage, memory usage, etc., which is not limited here.
[0080] It should be noted that the above is only an exemplary description. In actual applications, other scheduling methods may also be used to select the target node 30 from the remaining nodes, which is not limited here.
[0081] The above-mentioned virtual machine migration method receives a virtual machine migration request through a virtual machine interface service component 111, determines the source node 20 according to the virtual machine identification information in the virtual machine migration request through a virtual machine control component 112, and determines whether the target node information in the virtual machine migration request is valid through the virtual machine control component 112. When the target node information is valid, the target node 30 is determined according to the target node information through the virtual machine control component 112. When the target node information is invalid, the scheduling component 113 is called by the virtual machine control component 112 to determine the target node 30 from the remaining nodes in the target cluster. Through the combination of the virtual machine interface service component 111, the virtual machine control component 112 and the scheduling component 113, the reception of the virtual machine migration request from the outside is realized, and the management of the migration task status is realized, thereby realizing the effective control of the virtual machine migration task, ensuring that the virtual machine migration can be effectively migrated from the source node 20 to other nodes outside the source node 20. The method performs component expansion based on the Kubernetes platform, realizes the efficient and reliable migration of virtual machines in the Kubernetes environment, improves the flexibility and scalability of virtual machine migration, enhances the resource utilization efficiency, and simplifies the management complexity in a heterogeneous environment.
[0082] In one embodiment, Figure 5 As shown, step S206, through the virtual machine processing component 11, the migration task status of the virtual machine to be migrated is controlled according to the source node 20 and the target node 30, including the following steps S502 and S504.
[0083] S502: Determine the migration type of the virtual machine migration request through the virtual machine processing component.
[0084] S504: Control the migration task status of the virtual machine to be migrated according to the migration type, source node and target node through the virtual machine processing component.
[0085] Exemplarily, the virtual machine migration request includes a virtual machine cold migration request and a virtual machine hot migration request, and the migration type includes virtual machine cold migration and virtual machine hot migration. Exemplarily, the virtual machine processing component 11 determines the migration type as a cold migration request according to the virtual machine cold migration request; or, the virtual machine processing component 11 determines the migration type as a hot migration request according to the virtual machine hot migration request.
[0086] During the cold migration of the virtual machine, the virtual machine to be migrated remains in the shutdown state, and the service is temporarily interrupted, which helps to ensure the integrity and consistency of the data. During the hot migration of the virtual machine, the virtual machine to be migrated remains in the original state of the source node 20, and the service is not interrupted, which ensures the continuity and real-time nature of the service.
[0087] The above-mentioned virtual machine migration method determines the migration type of the virtual machine migration request through the virtual machine processing component 11, and controls the migration task status of the virtual machine to be migrated according to the migration type, the source node 20 and the target node 30, thereby ensuring that the virtual machine migration can be effectively migrated from the source node 20 to other nodes outside the source node 20, further improving the reliability of the virtual machine migration, and, through the combination of the virtual machine control component 112 and the scheduling component 113, that is, component expansion based on the Kubernetes platform, efficient and reliable migration of virtual machines in the Kubernetes environment is achieved, the flexibility and scalability of virtual machine migration are improved, the resource utilization efficiency is enhanced, and the management complexity in heterogeneous environments is simplified.
[0088] In one embodiment, Figure 6 As shown, step S504, through the virtual machine processing component 11, controls the migration task status of the virtual machine to be migrated according to the migration type, the source node 20 and the target node 30, including the following steps S602 to S606.
[0089] S602: Through the virtual machine processing component, when the migration type is virtual machine cold migration, the migration task state is set to the first cold operation state of the source node to instruct the first virtual machine management component to obtain the virtual machine state information of the virtual machine to be migrated in the source node according to the first cold operation state, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task state to the second cold operation state of the target node.
[0090] Exemplarily, the virtual machine processing component 11 includes a virtual machine interface service component 111 and a virtual machine control component 112. Based on this, the control node 10 records the migration task status of the virtual machine to be migrated through the virtual machine control component 112, and initializes the migration task status to the first cold operation status of the source node 20 when the migration type is a virtual machine cold migration, that is, the virtual machine migration request is a virtual machine cold migration request. The virtual machine interface service component 111 updates the migration task status to the first cold operation status. The first cold operation status is used to instruct the first virtual machine management component 21 to obtain the virtual machine status information of the virtual machine to be migrated in the source node 20, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task status to the second cold operation state of the target node 30. The virtual machine status information is used to represent the relevant information of the state of the virtual machine to be migrated in the source node 20. Exemplarily, the virtual machine status information includes a virtual machine snapshot.
[0091] In the application, the source node 20 obtains from the virtual machine interface service component 111 through the first virtual machine management component 21 that the migration task status is the first cold operation status, obtains the virtual machine status information of the virtual machine to be migrated in the source node 20, controls the virtual machine to be migrated to be in a shutdown state, and sets the migration task status to the second cold operation status of the target node 30.
[0092] Exemplarily, the virtual machine to be migrated is in a powered-on state in the source node 20. In this case, after the virtual machine state information of the virtual machine to be migrated is obtained through the first virtual machine management component 21, the virtual machine to be migrated is powered off, and the virtual machine to be migrated is controlled to remain powered off. In another exemplary case, the virtual machine to be migrated is in a powered-off state in the source node 20. In this case, after the virtual machine state information of the virtual machine to be migrated is obtained through the first virtual machine management component 21, the virtual machine to be migrated is controlled to remain powered off.
[0093] S604: Through the virtual machine processing component, obtain the virtual machine status information and update the first cold operation state to the second cold operation state, so as to instruct the second virtual machine management component to create and restore the virtual machine to be migrated on the target node according to the virtual machine status information and the second cold operation state, and set the migration task status to the third cold operation state of the source node.
[0094] Exemplarily, the virtual machine processing component 11 includes a virtual machine interface service component 111 and a virtual machine control component 112. Based on this, the control node 10 obtains the virtual machine state information and the second cold operation state from the first virtual machine management component 21 through the virtual machine interface service component 111, and updates the first cold operation state to the second cold operation state. The second cold operation state is used to instruct the second virtual machine management component 22 to create and restore the virtual machine to be migrated on the target node 30 according to the virtual machine state information, and set the migration task state to the third cold operation state of the source node 20.
[0095] In the application, the target node 30 obtains from the virtual machine interface service component 111 that the migration task state is the second cold operation state through the second virtual machine management component 22, creates and restores the virtual machine to be migrated in the target node 30 according to the obtained virtual machine state information, and sets the migration task state to the third cold operation state of the source node 20. The state of the virtual machine to be migrated in the target node 30 after migration is the same as the state of the virtual machine in the source node 20 before migration.
[0096] S606: Update the second cold operation state to a third cold operation state through the virtual machine processing component to instruct the first virtual machine management component to clean up the virtual machines to be migrated in the source node according to the third cold operation state.
[0097] Exemplarily, the virtual machine processing component 11 includes a virtual machine interface service component 111 and a virtual machine control component 112. Based on this, the control node 10 obtains the third cold operation state from the second virtual machine management component 22 through the virtual machine interface service component 111, and updates the second cold operation state to the third cold operation state. The third cold operation state is used to instruct the first virtual machine management component 21 to clean up the virtual machines to be migrated in the source node 20.
[0098] In the application, the source node 20 obtains from the virtual machine interface service component 111 through the first virtual machine management component 21 that the migration task state is the third cold operation state, and clears the virtual machines to be migrated in the source node 20.
[0099] During the migration process, the virtual machine control component 112 continuously monitors the progress of the migration and updates the migration task status. After the migration task is completed, that is, after the virtual machine to be migrated is cleaned up in the source node 20, the virtual machine control component 112 returns the final result of the migration operation to the virtual machine interface service component 111. If the virtual machine control component 112 monitors that there is an abnormality in the migration, the virtual machine migration task can be revoked through the virtual machine control component 112, and the virtual machine migration result can be marked as completed and failed. Among them, revoking the virtual machine migration task can be understood as stopping the virtual machine migration process and restoring the original state of the virtual machine to be migrated before the migration in the source node 20.
[0100] The above-mentioned virtual machine migration method, through the virtual machine processing component 11, when the virtual machine migration request is a virtual machine cold migration request, sets the migration task state to the first cold operation state of the source node 20, obtains the virtual machine state information through the virtual machine processing component 11 and updates the first cold operation state to the second cold operation state, and updates the second cold operation state to the third cold operation state through the virtual machine processing component 11, realizes the virtual machine cold migration function based on the Kubernetes platform, provides a more comprehensive virtualization management capability for the Kubernetes platform, makes full use of the scheduling mechanism based on the Kubernetes platform and the function of the virtual machine management component, realizes the reliable migration of the virtual machine, and ensures that the state of the virtual machine in the target node 30 after migration is completely consistent with the state of the virtual machine in the source node 20 through the virtual machine state information (complete snapshot), thereby ensuring data consistency; and allowing the reallocation of virtual machines between different physical nodes, thereby improving the overall resource utilization and optimizing cluster resources; in addition, it is convenient for hardware maintenance, upgrading or fault handling, thereby improving the convenience of maintenance. Although this method may cause a short service interruption, it ensures the integrity and consistency of the data and is suitable for scenarios that are not sensitive to downtime.
[0101] In one embodiment, Figure 7As shown, step S504, through the virtual machine processing component 11, the migration task status of the virtual machine to be migrated is controlled according to the migration type, the source node 20 and the target node 30, including the following steps S702 and S704.
[0102] S702: Through the virtual machine processing component, when the migration type is virtual machine hot migration, the migration task state is set to the first hot operation state of the target node to instruct the second virtual machine management component to create a migration environment for the virtual machine to be migrated in the target node according to the first hot operation state, and set the migration task state to the second hot operation state of the source node.
[0103] Exemplarily, the virtual machine processing component 11 includes a virtual machine interface service component 111 and a virtual machine control component 112. Based on this, the control node 10 records the migration task state of the virtual machine to be migrated through the virtual machine control component 112, and initializes the migration task state to the first hot operation state of the target node 30 when the migration type is virtual machine hot migration, that is, the virtual machine migration request is a virtual machine hot migration request. The virtual machine interface service component 111 updates the migration task state to the first hot operation state. The first hot operation state is used to instruct the second virtual machine management component 22 to create a migration environment for the virtual machine to be migrated in the target node 30, and set the migration task state to the second hot operation state of the source node 20.
[0104] In the application, the target node 30 obtains the migration task status as the first hot operation state from the virtual machine interface service component 111 through the second virtual machine management component 22, creates a migration environment for the virtual machine to be migrated in the target node 30, and sets the migration task status to the second hot operation state of the source node 20.
[0105] S704: Update the first hot operation state to the second hot operation state through the virtual machine interface service component to instruct the first virtual machine management component to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node according to the second hot operation state, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the state information.
[0106] Exemplarily, the virtual machine processing component 11 includes a virtual machine interface service component 111 and a virtual machine control component 112. Based on this, the control node 10 obtains the second hot operation state from the second virtual machine management component 22 through the virtual machine interface service component 111, and updates the first hot operation state to the second hot operation state. The second hot operation state is used to instruct the first virtual machine management component 21 to send the virtual machine state information of the virtual machine to be migrated in the source node 20 to the target node 30, so that the second virtual machine management component 22 creates and restores the virtual machine to be migrated according to the state information.
[0107] In the application, the source node 20 obtains the migration task status as the second hot operation status from the virtual machine interface service component 111 through the first virtual machine management component 21, and sends the virtual machine status information of the virtual machine to be migrated in the source node 20 to the target node 30, so that the second virtual machine management component 22 creates and restores the virtual machine to be migrated according to the status information. Exemplarily, after the source node 20 obtains the second hot operation status through the first virtual machine management component 21, it starts to migrate the virtual machine by calling the data transmission interface (such as the Libvrit interface), and waits for the data transmission component 114 (such as the Libvrit component) to transmit the relevant data of the virtual machine to be migrated, so as to create and restore the virtual machine to be migrated in the target node 30 through the second virtual machine management component 22. Among them, the data transmission component 114 is deployed on the control node 10, and the data transmission component 114 is built based on the Kubernetes platform. Exemplarily, the data transmission interface includes the Libvrit interface, and the data transmission component 114 includes the Libvrit component.
[0108] During the migration process, the virtual machine control component 112 continuously monitors the migration progress and updates the migration task status. After the migration task is completed, that is, after the virtual machine to be migrated is cleaned up in the source node 20, the virtual machine control component 112 returns the final result of the migration operation to the virtual machine interface service component 111. If the virtual machine control component 112 monitors that the migration is abnormal, the virtual machine migration task can be revoked through the virtual machine control component 112, and the virtual machine migration result can be marked as completed and failed.
[0109] The above-mentioned virtual machine migration method, through the virtual machine processing component 11, when the virtual machine migration request is a virtual machine cold migration request, sets the migration task state to the first cold operation state of the source node 20, obtains the virtual machine state information and updates the first cold operation state to the second cold operation state through the virtual machine processing component 11, and updates the second cold operation state to the third cold operation state through the virtual machine processing component 11, realizes the virtual machine cold migration function based on the Kubernetes platform, provides a more comprehensive virtualization management capability for the Kubernetes platform, makes full use of the scheduling mechanism based on the Kubernetes platform and the function of the virtual machine management component, and realizes the reliable migration of the virtual machine. In the hot migration process of the method, the service of the virtual machine is almost not interrupted, which greatly reduces the impact of the migration on the business and ensures the continuity of the service; and, through the incremental synchronization of the memory state, the hot migration can complete the migration process more quickly and ensure the real-time performance; in addition, it supports the dynamic adjustment of the virtual machine distribution between different physical nodes, improves the overall resource utilization, and has high resource management flexibility; in addition, it provides a technical basis for realizing failover and load balancing, and has high availability; and, based on the Kubernetes platform, the method makes full use of the scheduling and resource management capabilities of the Kubernetes platform and provides a resource management solution in the hybrid cloud scenario of virtual machines and containers.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a virtual machine migration method applied to the source node 20 and the target node 30. The implementation scheme for solving the problem provided by the method is similar to the implementation scheme recorded in the virtual machine migration method applied to the control node 10, so the specific limitations in one or more virtual machine migration method embodiments provided below can refer to the limitations above, and will not be repeated here.
[0111] In one embodiment, Figure 8 As shown, a virtual machine migration method is provided, which is applied to Figure 1 Taking the source node 20 and the target node 30 in FIG. 1 as an example, the method includes the following steps S802 to S806.
[0112] S802: Obtaining the migration task status of the to-be-migrated virtual machine from the virtual machine processing component of the control node in the target cluster through the first virtual machine management component.
[0113] The virtual machine processing component 11 is used to receive a virtual machine migration request, determine the source node 20 and the target node 30 of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task status of the virtual machine to be migrated according to the source node 20 and the target node 30.
[0114] S804: Obtaining the migration task status of the to-be-migrated virtual machine from the virtual machine processing component through the second virtual machine management component.
[0115] S806: Migrate the virtual machine to be migrated from the source node to the target node according to the migration task status through the first virtual machine management component and the second virtual machine management component.
[0116] The above-mentioned virtual machine migration method receives a virtual machine migration request through a virtual machine processing component 11, determines the source node 20 and the target node 30 in the target cluster according to the virtual machine migration request through the virtual machine processing component 11, controls the migration task status of the virtual machine to be migrated according to the source node 20 and the target node 30 through the virtual machine processing component 11, and obtains the migration task status of the virtual machine to be migrated from the virtual machine processing component 11 of the control node 10 in the target cluster through the first virtual machine management component 21 and the second virtual machine management component 22, and migrates the virtual machine to be migrated from the source node 20 to the target node 30 according to the migration task status, wherein the virtual machine processing component 11, the first virtual machine management component 21 and the second virtual machine management component 22 are respectively constructed based on the Kubernetes platform, and the method performs component expansion based on the Kubernetes platform, realizes efficient and reliable migration of virtual machines in the Kubernetes environment, provides a resource management solution for hybrid cloud scenarios of virtual machines and containers, improves the flexibility and scalability of the system, enhances resource utilization efficiency, and simplifies management complexity in heterogeneous environments.
[0117] In one embodiment, Fig. 9 As shown, step S806, through the first virtual machine management component 21 and the second virtual machine management component 22, the virtual machine to be migrated is migrated from the source node 20 to the target node 30 according to the migration task status, including the following steps S902 to S906.
[0118] S902: Through the first virtual machine management component, when the migration task status obtained from the virtual machine processing component is the first cold operation state, obtain the virtual machine status information of the virtual machine to be migrated in the source node, control the virtual machine to be migrated to be in a shutdown state, and set the migration task status to the second cold operation state of the target node.
[0119] S904: Through the second virtual machine management component, when the migration task status obtained from the virtual machine processing component is the second cold operation state, obtain the virtual machine status information from the virtual machine processing component, and create and restore the virtual machine to be migrated on the target node according to the virtual machine status information, and set the migration task status to the third cold operation state of the source node.
[0120] S906: Using the first virtual machine management component, when the migration task status obtained from the virtual machine processing component is the third cold operation status, clear the virtual machines to be migrated in the source node.
[0121] In one embodiment, Fig.10 As shown, step S806, through the first virtual machine management component and the second virtual machine management component, migrate the virtual machine to be migrated from the source node to the target node according to the migration task status, including the following steps S1002 and S1004.
[0122] S1002: Through the second virtual machine management component, when the migration task state obtained from the virtual machine processing component is the first hot operation state, a migration environment of the virtual machine to be migrated is created in the target node, and the migration task state is set to the second hot operation state of the source node.
[0123] S1004: Through the first virtual machine management component, when the migration task status obtained from the virtual machine processing component is the second hot operation status, the virtual machine status information of the virtual machine to be migrated in the source node is sent to the target node, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the status information.
[0124] In one embodiment, step S1004, sending the virtual machine state information of the virtual machine to be migrated in the source node to the target node, includes: calling the data transmission interface to call the data transmission component to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node.
[0125] The data transmission component 114 is deployed on the control node 10, and the data transmission component 114 is built based on the Kubernetes platform. Exemplarily, the data transmission interface includes a Libvrit interface, and the data transmission component 114 includes a Libvrit component.
[0126] In one embodiment, Fig.11 and Fig.12 As shown, a virtual machine migration method is provided, and the method is applied to Figure 3 The target cluster is used as an example to illustrate.
[0127] The control node 10 is deployed with a virtual machine interface service component, a virtual machine control component 112, a scheduling component 113 and a data transmission component 114 built on the Kubernetes platform. The virtual machine interface service component 111 includes a virtual machine API service component, and the data transmission component 114 includes a Libvrit component. The target cluster also includes a source node 20 and a target node 30, wherein the source node 20 is deployed with a first virtual machine management component 21 built on the Kubernetes platform, and the target node 30 is deployed with a second virtual machine management component 22 built on the Kubernetes platform.
[0128] like Fig.11 As shown, taking the virtual machine migration method applied to a virtual machine cold migration scenario as an example, the method includes the following steps S1102 to S1120.
[0129] S1102: The virtual machine API service component receives a virtual machine cold migration request, which includes the virtual machine identification information and target node information to be migrated.
[0130] S1104: The virtual machine control component determines the source node according to the virtual machine identification information, and determines whether to specify the target node according to the target node information. If not, execute step S1106; if yes, execute step S1108.
[0131] S1106: The virtual machine control component calls the scheduling component to determine the target node from the remaining nodes of the target cluster.
[0132] S1108: The virtual machine control component determines the target node according to the target node information.
[0133] S1110: The virtual machine control component records the migration task status of the virtual machine cold migration according to the virtual machine cold migration request, the source node and the target node, initializes the migration task status to the first cold operation state of the source node, and synchronizes it to the virtual machine API service component.
[0134] S1112: The first virtual machine management component obtains from the virtual machine API service component that the migration task status is the first cold operation status, records the current virtual machine status information of the virtual machine to be migrated, then controls the virtual machine to be migrated to remain in the shutdown state, and sets the migration task status to the second cold operation status of the target node.
[0135] S1114: The virtual machine API service component updates the first cold operation state to a second cold operation state.
[0136] S1116: The second virtual machine management component obtains from the virtual machine API service component that the migration task state is the second cold operation state, creates and restores the virtual machine to be migrated according to the virtual machine state information, and sets the migration task state to the third cold operation state of the source node.
[0137] S1118: The virtual machine API service component updates the second cold operation state to a third cold operation state.
[0138] S1120: The first virtual machine management component obtains from the virtual machine API service component that the migration task status is a third cold operation status, and cleans up the virtual machines to be migrated in the source node.
[0139] During the migration process, the virtual machine control component 112 continuously monitors the migration progress and updates the migration task status. After the migration virtual machine is cleaned up, the virtual machine control component 112 returns the final result of the migration operation to the API service component. If the virtual machine control component 112 monitors that the migration is abnormal, the virtual machine migration task can be revoked through the virtual machine control component 112, and the virtual machine migration result can be marked as completed and failed.
[0140] The above-mentioned virtual machine migration method is based on multiple components built on the Kubernetes platform: a virtual machine API service component, a virtual machine control component 112, a scheduling component 113, a first virtual machine management component 21 and a second virtual machine management component 22. It utilizes the scheduling mechanism, virtual machine management function, migration status management and error handling mechanism of Kubernetes to realize the virtual machine cold migration function on the Kubernetes platform. Although this method will cause a brief interruption of service, it ensures the integrity and consistency of the data, is suitable for scenarios that are not sensitive to downtime, and provides a more comprehensive virtualization management capability for the Kubernetes platform.
[0141] like Fig.12 As shown, taking the virtual machine migration method applied to a virtual machine hot migration scenario as an example, the method includes the following steps S1202 to S1218.
[0142] S1202: The virtual machine API service component receives a virtual machine hot migration request, which includes the virtual machine identification information and target node information to be migrated.
[0143] S1204: The virtual machine control component determines the source node according to the virtual machine identification information, and determines whether to specify the target node according to the target node information. If not, execute step S1206; if yes, execute step S1208.
[0144] S1206: The virtual machine control component calls the scheduling component to determine the target node from the remaining nodes of the target cluster.
[0145] S1208: The virtual machine control component determines the target node according to the target node information.
[0146] S1210: The virtual machine control component records the migration task status of the virtual machine cold migration according to the virtual machine hot migration request, the source node and the target node, initializes the migration task status to the first hot operation state of the target node 30, and synchronizes it to the virtual machine API service component.
[0147] S1212: The second virtual machine management component obtains from the virtual machine API service component that the migration task state is the first hot operation state, prepares to receive the migration environment of the virtual machine to be migrated, and sets the migration task state to the second hot operation state of the source node.
[0148] S1214: The virtual machine API service component updates the first hot operation state to a second hot operation state.
[0149] S1216: The first virtual machine management component obtains from the virtual machine API service component that the migration task status is the second hot operation status of the source node, calls the Libvrit interface to start migrating the virtual machine, and waits for the Libvirt component to transmit data to the target node.
[0150] S1218: The second virtual machine management component creates and restores the virtual machine to be migrated according to the data transmitted by the Libvirt component.
[0151] During the migration process, the virtual machine control component 112 continuously monitors the migration progress and updates the migration status. After the hot migration of the virtual machine is completed, the virtual machine control component 112 returns the final result of the migration operation to the API service component. If the virtual machine control component 112 monitors that the migration is abnormal, the virtual machine migration task can be canceled through the virtual machine control component 112, and the virtual machine migration result is marked as completed and failed.
[0152] The above-mentioned virtual machine migration method is based on multiple components built on the Kubernetes platform: a virtual machine API service component, a virtual machine control component 112, a scheduling component 113, a first virtual machine management component 21 and a second virtual machine management component 22, and a Libvirt component. It utilizes the scheduling mechanism of Kubernetes, the advanced virtual machine management capabilities of Libvirt, the migration state management and the error handling mechanism, and realizes the virtual machine hot migration function on the Kubernetes platform. The method fully realizes the migration of virtual machines with almost no service interruption, which not only improves the availability and flexibility of the system, but also provides the Kubernetes platform with more advanced virtual machine management capabilities, so that it can better meet the needs of complex cloud computing environments.
[0153] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0154] Based on the same inventive concept, the embodiment of the present application also provides a virtual machine migration device for implementing the virtual machine migration method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more virtual machine migration device embodiments provided below can refer to the limitations of the virtual machine migration method above, and will not be repeated here.
[0155] In one embodiment, Fig.13 As shown, a virtual machine migration device is provided, which is applied to the control node in the target cluster, and the virtual machine migration device includes: a receiving module 1301, a determining module 1302 and a control module 1303. Among them, the receiving module 1301 is used to receive a virtual machine migration request through a virtual machine processing component. The determining module 1302 is used to determine the source node and the target node of the virtual machine to be migrated respectively according to the virtual machine migration request through the virtual machine processing component; wherein the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component. The control module 1303 is used to control the migration task status of the virtual machine to be migrated according to the source node and the target node through the virtual machine processing component, so as to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
[0156] In the above-mentioned virtual machine migration device, the receiving module 1301 receives the virtual machine migration request through the virtual machine processing component, the determining module 1302 determines the source node and the target node in the target cluster respectively according to the virtual machine migration request through the virtual machine processing component, and the control module 1303 controls the migration task status of the virtual machine to be migrated according to the source node and the target node through the virtual machine processing component to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node respectively according to the migration task status, wherein the virtual machine processing component, the first virtual machine management component and the second virtual machine management component are respectively constructed based on the Kubernetes platform, and the method performs component expansion based on the Kubernetes platform, realizes efficient and reliable migration of virtual machines in the Kubernetes environment, and provides a resource management solution for virtual machines and containers in a hybrid cloud scenario, which improves the flexibility and scalability of the system, enhances resource utilization efficiency, and simplifies management complexity in heterogeneous environments.
[0157] In one embodiment, the virtual machine processing component includes a virtual machine interface service component, a virtual machine control component and a scheduling component, wherein the receiving module is further used to receive a virtual machine migration request through the virtual machine interface service component. The determination module is further used to determine the source node through the virtual machine control component according to the virtual machine identification information in the virtual machine migration request; determine whether the target node information in the virtual machine migration request is valid through the virtual machine control component; determine the target node according to the target node information through the virtual machine control component if the target node information is valid; and call the scheduling component to determine the target node from the remaining nodes of the target cluster through the virtual machine control component if the target node information is invalid.
[0158] In one embodiment, the control module is further used to determine the migration type of the virtual machine migration request through the virtual machine processing component; and control the migration task status of the virtual machine to be migrated according to the migration type, source node and target node through the virtual machine processing component.
[0159] In one embodiment, the control module is also used to set the migration task state to the first cold operation state of the source node through the virtual machine processing component when the migration type is a virtual machine cold migration, so as to instruct the first virtual machine management component to obtain the virtual machine state information of the virtual machine to be migrated in the source node according to the first cold operation state, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task state to the second cold operation state of the target node. The control module is also used to obtain the virtual machine state information and update the first cold operation state to the second cold operation state through the virtual machine processing component, so as to instruct the second virtual machine management component to create and restore the virtual machine to be migrated in the target node according to the virtual machine state information and the second cold operation state, and set the migration task state to the third cold operation state of the source node. The control module is also used to update the second cold operation state to the third cold operation state through the virtual machine processing component, so as to instruct the first virtual machine management component to clean up the virtual machine to be migrated in the source node according to the third cold operation state.
[0160] In one embodiment, the control module is also used to set the migration task state to the first hot operation state of the target node through the virtual machine processing component when the migration type is hot migration of the virtual machine, so as to instruct the second virtual machine management component to create a migration environment for the virtual machine to be migrated in the target node according to the first hot operation state, and set the migration task state to the second hot operation state of the source node. The control module is also used to update the first hot operation state to the second hot operation state through the virtual machine processing component, so as to instruct the first virtual machine management component to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node according to the second hot operation state, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the state information.
[0161] Each module in the above-mentioned virtual machine migration device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0162] Based on the same inventive concept, the embodiment of the present application also provides a virtual machine migration system for implementing the virtual machine migration method involved above. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more virtual machine migration system embodiments provided below can refer to the limitations on the virtual machine migration method above, and will not be repeated here.
[0163] Please continue reading Figure 1 and Figure 3In one embodiment, a virtual machine migration system is provided. The target cluster of the virtual machine migration system includes a control node 10, a source node 20 and a target node 30, the control node 10 is deployed with a virtual machine processing component 11, the source node 20 is deployed with a first virtual machine management component 21, the target node 30 is deployed with a second virtual machine management component 22, and the source node 20 includes a virtual machine to be migrated.
[0164] The virtual machine processing component 11 is used to receive a virtual machine migration request, determine the source node 20 and the target node 30 of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task state of the virtual machine to be migrated according to the virtual machine migration request;
[0165] The first virtual machine management component 21 and the second virtual machine management component 22 are used together to migrate the virtual machine to be migrated from the source node 20 to the target node 30 .
[0166] In one embodiment, the virtual machine processing component 11 includes a virtual machine interface service component 111, a virtual machine control component 112 and a scheduling component 113, wherein the virtual machine interface service component 111 is used to receive a virtual machine migration request, and the virtual machine processing component 11 is used to determine the source node 20 according to the virtual machine identification information in the virtual machine migration request, determine whether the target node information in the virtual machine migration request is valid, determine the target node 30 according to the target node information when the target node information is valid, and call the scheduling component 113 to determine the target node 30 from the remaining nodes in the target cluster when the target node information is invalid.
[0167] In one embodiment, the virtual machine processing component 11 is also used to determine the migration type of the virtual machine migration request through the virtual machine processing component 11, and control the migration task status of the virtual machine to be migrated according to the migration type, source node 20 and target node 30 through the virtual machine processing component 11.
[0168] In one embodiment, the virtual machine processing component 11 is further configured to set the migration task state to the first cold operation state of the source node 20 when the migration type is a virtual machine cold migration.
[0169] The first virtual machine management component 21 is also used to obtain a first cold operation state from the virtual machine processing component 11, and obtain virtual machine state information of the virtual machine to be migrated in the source node 20 according to the first cold operation state, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task state to the second cold operation state of the target node 30.
[0170] The virtual machine processing component 11 is further used to obtain virtual machine state information and a second cold operation state from the virtual machine processing component 11, and update the first cold operation state to the second cold operation state.
[0171] The second virtual machine management component 22 is also used to obtain virtual machine status information and a second cold operation state from the virtual machine processing component 11, and create and restore the virtual machine to be migrated on the target node 30 according to the virtual machine status information and the second cold operation state, and set the migration task state to the third cold operation state of the source node 20.
[0172] The virtual machine processing component 11 is further configured to obtain a third cold operation state from the second virtual machine management component 22, and update the second cold operation state to the third cold operation state.
[0173] The first virtual machine management component 21 is further configured to obtain a third cold operation state from the virtual machine processing component 11, and clean up the virtual machines to be migrated in the source node 20 according to the third cold operation state.
[0174] In one embodiment, the virtual machine processing component 11 is further configured to set the migration task state to the first hot operation state of the target node 30 when the migration type is hot migration of the virtual machine.
[0175] The second virtual machine management component 22 is also used to obtain the first hot operation state from the virtual machine processing component 11, and create a migration environment for the virtual machine to be migrated in the target node 30 according to the first hot operation state, and set the migration task state to the second hot operation state of the source node 20.
[0176] The virtual machine processing component 11 is further configured to obtain a second hot operation state from the second virtual machine management component 22 and update the first hot operation state to the second hot operation state.
[0177] The first virtual machine management component 21 is further configured to obtain a second hot operation state from the virtual machine processing component 11 , and send virtual machine state information of the virtual machine to be migrated in the source node 20 to the target node 30 according to the second hot operation state.
[0178] The second virtual machine management component 22 is further configured to create and restore the virtual machine to be migrated according to the virtual machine state information.
[0179] In one embodiment, the first virtual machine management component 21 is further configured to call the data transmission component 114 to send the virtual machine state information of the virtual machine to be migrated in the source node 20 to the target node 30 by calling the data transmission interface.
[0180] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the migration task status. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a virtual machine migration method is implemented.
[0181] Those skilled in the art will understand that Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0182] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the aforementioned virtual machine migration method when executing the computer program.
[0183] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the aforementioned virtual machine migration method are implemented.
[0184] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the aforementioned virtual machine migration method when executed by a processor.
[0185] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0186] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0187] The technical features of the above embodiments may be combined arbitrarily. To make 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.
[0188] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A virtual machine migration method, characterized in that: Applied to a control node in a target cluster, wherein a virtual machine processing component is deployed in the control node, the method comprising: Receiving a virtual machine migration request through the virtual machine processing component; Determine the source node and the target node of the virtual machine to be migrated respectively according to the virtual machine migration request through the virtual machine processing component; wherein the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component; Through the virtual machine processing component, the migration task status of the virtual machine to be migrated is controlled according to the source node and the target node to instruct the first virtual machine management component and the second virtual machine management component to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
2. The method according to claim 1, characterized in that The virtual machine processing component includes a virtual machine interface service component, a virtual machine control component and a scheduling component, wherein the virtual machine interface service component is used to receive a virtual machine migration request, and the source node and the target node of the virtual machine to be migrated are determined by the virtual machine processing component according to the virtual machine migration request, including: Determining the source node by the virtual machine control component according to the virtual machine identification information in the virtual machine migration request; Determining, by the virtual machine control component, whether the target node information in the virtual machine migration request is valid; By means of the virtual machine control component, when the target node information is valid, determining the target node according to the target node information; By means of the virtual machine control component, when the target node information is invalid, the scheduling component is called to determine the target node from the remaining nodes of the target cluster.
3. The method according to claim 1 or 2, characterized in that: The controlling the migration task state of the to-be-migrated virtual machine according to the source node and the target node by the virtual machine processing component includes: Determining, by the virtual machine processing component, a migration type of the virtual machine migration request; The migration task status of the virtual machine to be migrated is controlled through the virtual machine processing component according to the migration type, the source node and the target node.
4. The method according to claim 3, characterized in that The controlling, by the virtual machine processing component, the migration task state of the virtual machine to be migrated according to the migration type, the source node, and the target node includes: By means of the virtual machine processing component, when the migration type is virtual machine cold migration, the migration task state is set to the first cold operation state of the source node, so as to instruct the first virtual machine management component to obtain the virtual machine state information of the virtual machine to be migrated in the source node according to the first cold operation state, and control the virtual machine to be migrated to be in a shutdown state, and set the migration task state to the second cold operation state of the target node; By means of the virtual machine processing component, the virtual machine state information is obtained and the first cold operation state is updated to the second cold operation state, so as to instruct the second virtual machine management component to create and restore the virtual machine to be migrated at the target node according to the virtual machine state information and the second cold operation state, and to set the migration task state to the third cold operation state of the source node; The second cold operation state is updated to the third cold operation state through the virtual machine processing component to instruct the first virtual machine management component to clean up the virtual machine to be migrated in the source node according to the third cold operation state.
5. The method according to claim 3, characterized in that: The controlling, by the virtual machine processing component, the migration task state of the virtual machine to be migrated according to the migration type, the source node, and the target node includes: By means of the virtual machine processing component, when the migration type is virtual machine hot migration, the migration task state is set to the first hot operation state of the target node, so as to instruct the second virtual machine management component to create a migration environment of the virtual machine to be migrated in the target node according to the first hot operation state, and to set the migration task state to the second hot operation state of the source node; Through the virtual machine processing component, the first hot operation state is updated to the second hot operation state to instruct the first virtual machine management component to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node according to the second hot operation state, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the state information.
6. A virtual machine migration method, characterized in that: Applied to a source node and a target node in a target cluster, the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component, the method includes: Obtaining, through the first virtual machine management component, the migration task status of the virtual machine to be migrated from the virtual machine processing component of the control node in the target cluster; wherein the virtual machine processing component is used to receive a virtual machine migration request, determine the source node and the target node of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task status of the virtual machine to be migrated according to the source node and the target node; Obtaining, through the second virtual machine management component, a migration task status of the virtual machine to be migrated from the virtual machine processing component; The first virtual machine management component and the second virtual machine management component are used to migrate the virtual machine to be migrated from the source node to the target node according to the migration task status.
7. The method according to claim 6, characterized in that The migrating the virtual machine to be migrated from the source node to the target node according to the migration task status respectively by the first virtual machine management component and the second virtual machine management component includes: By means of the first virtual machine management component, when the migration task state obtained from the virtual machine processing component is a first cold operation state, obtaining virtual machine state information of the virtual machine to be migrated in the source node, controlling the virtual machine to be migrated to be in a shutdown state, and setting the migration task state to a second cold operation state of the target node; By the second virtual machine management component, when the migration task state obtained from the virtual machine processing component is the second cold operation state, the virtual machine state information is obtained from the virtual machine processing component, and the to-be-migrated virtual machine is created and restored on the target node according to the virtual machine state information, and the migration task state is set to the third cold operation state of the source node; By means of the first virtual machine management component, when the migration task state obtained from the virtual machine processing component is a third cold operation state, the virtual machine to be migrated in the source node is cleared.
8. The method according to claim 6, characterized in that The migrating the virtual machine to be migrated from the source node to the target node according to the migration task status respectively by the first virtual machine management component and the second virtual machine management component includes: By the second virtual machine management component, when the migration task state obtained from the virtual machine processing component is a first hot operation state, creating a migration environment of the virtual machine to be migrated in the target node, and setting the migration task state to a second hot operation state of the source node; Through the first virtual machine management component, when the migration task status obtained from the virtual machine processing component is a second hot operation state, the virtual machine state information of the virtual machine to be migrated in the source node is sent to the target node, so that the second virtual machine management component creates and restores the virtual machine to be migrated according to the virtual machine state information.
9. The method according to claim 8, characterized in that The step of sending the virtual machine state information of the virtual machine to be migrated in the source node to the target node includes: The data transmission component is called by calling the data transmission interface to send the virtual machine state information of the virtual machine to be migrated in the source node to the target node.
10. A virtual machine migration system, characterized in that: The target cluster of the virtual machine migration system includes a control node, a source node and a target node, the control node is deployed with a virtual machine processing component, the source node is deployed with a first virtual machine management component, and the target node is deployed with a second virtual machine management component; wherein, The virtual machine processing component is used to receive a virtual machine migration request, determine the source node and the target node of the virtual machine to be migrated according to the virtual machine migration request, and control the migration task state of the virtual machine to be migrated according to the virtual machine migration request; The first virtual machine management component and the second virtual machine management component are used together to migrate the virtual machine to be migrated from the source node to the target node.