Virtual machine migration method and apparatus, and computing device

By maintaining the continuity of USB protocol data during the migration process, the problem of business interruption caused by virtual machine migration in existing technologies is solved, achieving seamless switching and business continuity, and improving user experience and data security.

WO2026091875A1PCT designated stage Publication Date: 2026-05-07XFUSION DIGITAL TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
XFUSION DIGITAL TECH CO LTD
Filing Date
2025-09-04
Publication Date
2026-05-07

Smart Images

  • Figure CN2025119060_07052026_PF_FP_ABST
    Figure CN2025119060_07052026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a virtual machine migration method and apparatus, and a computing device. A first computing device is connected to a universal serial bus (USB) device. The method comprises: the first computing device acquires an identifier of a third computing device sent by a second computing device, wherein a target virtual machine running on the second computing device accesses, on the basis of USB protocol data between the first computing device and the second computing device, the USB device connected to the first computing device; and when the target virtual machine is migrated from the second computing device to the third computing device, the first computing device determines, on the basis of the identifier of the third computing device, that the USB protocol data is USB protocol data between the first computing device and the third computing device, so that the migrated target virtual machine on the third computing device accesses, on the basis of the USB protocol data, the USB device connected to the first computing device. The method in the embodiments of the present application can ensure normal operation of a service during virtual machine migration.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus, and computing device for migrating virtual machines.

[0001] This application claims priority to Chinese Patent Application No. 202411547889.5, filed on October 31, 2024, entitled "A Method, Apparatus and Computing Device for Migrating a Virtual Machine", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of computing device technology, and in particular to a virtual machine migration method, apparatus and computing device. Background Technology

[0003] Universal Serial Bus (USB) cross-node mapping is a technology for sharing USB devices in a virtualization environment. Based on this technology, a USB device plugged into a first computing device can be mapped to a second computing device, allowing virtual machines running on the second computing device to use the USB device for business processing.

[0004] However, in related technologies, when it is necessary to migrate a virtual machine running on a second computing device to a third computing device, the second computing device needs to first unmount the USB device and interrupt its services. Then, after the virtual machine is migrated to the third computing device, the third computing device needs to renegotiate with the first computing device to mount the USB device and continue service processing. In other words, the methods in related technologies cannot achieve virtual machine migration while maintaining normal service operation.

[0005] Therefore, there is an urgent need for a method that can migrate virtual machines while maintaining normal business operations. Summary of the Invention

[0006] This application provides a method, apparatus, and computing device for migrating virtual machines. The method of this application can migrate virtual machines while maintaining normal business operations.

[0007] In a first aspect, embodiments of this application provide a virtual machine migration method, applied to a first computing device, the first computing device being connected to a Universal Serial Bus (USB) device, the method comprising:

[0008] Obtain the identifier of the third computing device sent by the second computing device; the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device;

[0009] When the target virtual machine is migrated from the second computing device to the third computing device, the USB protocol data is determined to be the USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0010] In this scheme, during the migration of the target virtual machine, the target virtual machine running on the second computing device can access the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices. The first computing device can accurately parse the service requests of the target virtual machine on the second computing device based on the USB protocol data between the first and second computing devices. In other words, during the migration of the target virtual machine, the target virtual machine running on the second computing device can maintain normal business operations. After the target virtual machine is migrated to the third computing device, the first computing device can determine that the USB protocol data is the USB protocol data between the first and third computing devices based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data. In other words, after the target virtual machine is migrated to the third computing device, the first computing device can accurately parse the service requests of the target virtual machine on the third computing device based on the USB protocol data between the first and third computing devices. In other words, after the target virtual machine migration is completed, the target virtual machine running on the third computing device can maintain normal business operations. In summary, the method based on the embodiments of this application eliminates the need to first unmount and then remount the USB device during the migration of the target virtual machine, and also eliminates the need to spend time controlling the communication negotiation between the first computing device and the third computing device running the target virtual machine. This allows the target virtual machine on the third computing device to access the USB device connected to the first computing device, thereby achieving seamless switching of the USB device (from being used by the target virtual machine on the second computing device to being used by the target virtual machine on the third computing device), ensuring business continuity, and improving the user experience during the process of the target virtual machine providing services to the outside world.

[0011] In one implementation, determining the USB protocol data as USB protocol data between the first and third computing devices based on the identifier of the third computing device includes:

[0012] Obtain the business request;

[0013] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0014] In this scheme, if the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the first computing device can determine that the computing device corresponding to the service request is the destination device (third computing device) in the virtual machine migration process. The first computing device can identify the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data, thereby maintaining service continuity.

[0015] In one implementation, the identifier of the third computing device is its Internet Protocol (IP) address.

[0016] In this scheme, the identifier of the third computing device can be its Internet Protocol (IP) address, so that the identifier of the third computing device can accurately reflect the identity of the third computing device.

[0017] In one implementation, the method further includes:

[0018] Based on the identifier of the third computing device, the third computing device is marked as being in a hot migration state.

[0019] In this scheme, the first computing device can record the mark of the third computing device as a hot migration state based on the identifier of the third computing device, so that the mark of the third computing device can reflect that the third computing device is currently the destination device of the hot migration process.

[0020] In one implementation, if it is determined that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the USB protocol data between the first computing device and the second computing device is determined as the USB protocol data between the first computing device and the third computing device, including:

[0021] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot-migrating state, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0022] In this solution, after verifying the connection once using the identifier of the computing device corresponding to the service request, a second verification is performed using the hot migration state, thereby improving the security of the connection and the security of the data in the USB device.

[0023] One implementation also includes:

[0024] In response to the successful migration message of the target virtual machine, disconnect the connection between the first computing device and the second computing device.

[0025] In this scheme, the first computing device can disconnect from the second computing device in response to the successful migration information of the target virtual machine. This ensures that after a successful migration, USB protocol data corresponds to one computing device, preventing multiple virtual machines on multiple computing devices from using the USB device of the first computing device and causing data errors during non-migration processes. In other words, this method improves the security of USB device usage and enhances data consistency.

[0026] One implementation also includes:

[0027] In response to a migration failure message for the target virtual machine, the connection between the first computing device and the second computing device is maintained.

[0028] In this scheme, the first computing device can maintain the connection between itself and the second computing device in response to migration failure information of the target virtual machine. This ensures that even after a migration failure, the second computing device can still use the USB devices on the first computing device, maintaining business continuity.

[0029] Secondly, embodiments of this application provide a method for migrating a virtual machine, the method comprising:

[0030] Get the hot migration request;

[0031] Based on the hot migration request, the identifier of the third computing device is sent to the first computing device. The identifier of the third computing device is used by the first computing device to determine that the USB protocol data is the USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data. The target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device.

[0032] Based on the live migration request, the target virtual machine is migrated from the second computing device to the third computing device; the target virtual machine includes USB protocol data.

[0033] In this scheme, upon receiving a hot migration request, the identifier of the third computing device can be sent to the first computing device based on the hot migration request. The target virtual machine is then migrated from the second computing device to the third computing device according to the hot migration request. The target virtual machine includes USB protocol data. The identifier of the third computing device is used by the first computing device to determine that the USB protocol data is the USB protocol data between the first and third computing devices when the target virtual machine is migrated from the second to the third computing device. This allows the migrated target virtual machine on the third computing device to access the USB device connected to the first computing device based on the USB protocol data. The target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices. Through this method, during the target virtual machine migration process, the target virtual machine on the second computing device connected to the first computing device performs business processing; after the target virtual machine is migrated to the third computing device, the target virtual machine on the third computing device connected to the first computing device performs business processing, ensuring business continuity.

[0034] In one implementation, obtaining a hot migration request includes:

[0035] Based on the fault information corresponding to the second computing device, determine the hot migration request; and / or,

[0036] The hot migration request is determined based on the load of each virtual machine corresponding to the second computing device.

[0037] In this scheme, the hot migration request can be triggered by fault information of the second computing device or by the load of each virtual machine corresponding to the second computing device. This improves the timing of the target virtual machine migration and its alignment with the actual situation of the second computing device.

[0038] In one implementation, determining the hot migration request based on the fault information corresponding to the second computing device includes:

[0039] When the fault information indicates that the second computing device is faulty, obtain the service level corresponding to each virtual machine;

[0040] Determine the hot migration request based on the service level corresponding to each virtual machine.

[0041] In this solution, when fault information indicates a failure in the second computing device, the service level corresponding to each virtual machine can be obtained, and then a hot migration request can be determined based on the service level of each virtual machine. This method ensures that virtual machines with higher service levels are migrated to the third computing device first, improving the service continuity of these higher-level virtual machines.

[0042] In one implementation, the method further includes:

[0043] When the target virtual machine is migrated from the second computing device to the third computing device, a service request is sent to the first computing device. The service request is used by the first computing device to determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

[0044] In this scheme, when the target virtual machine is migrated from the second computing device to the third computing device, a service request can be sent to the first computing device. This allows the first computing device to determine the USB protocol data between the first and second computing devices as the USB protocol data between the first and third computing devices if the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

[0045] Thirdly, embodiments of this application provide a virtual machine migration apparatus, applied to a first computing device, the first computing device being connected to a Universal Serial Bus (USB) device, the apparatus comprising:

[0046] The acquisition module is used to acquire the identifier of the third computing device sent by the second computing device; the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device;

[0047] The processing module is configured to, when a target virtual machine is migrated from a second computing device to a third computing device, determine the USB protocol data as USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0048] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0049] In one implementation, the processing module is specifically used for:

[0050] Obtain the business request;

[0051] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0052] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0053] In one implementation, the identifier of the third computing device is its Internet Protocol (IP) address.

[0054] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0055] In one implementation, the processing module is also used for:

[0056] Based on the identifier of the third computing device, the third computing device is marked as being in a hot migration state.

[0057] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0058] In one implementation, the processing module is specifically used for:

[0059] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot-migrating state, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0060] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0061] In one implementation, the communication module is also used for:

[0062] In response to the successful migration message of the target virtual machine, disconnect the connection between the first computing device and the second computing device.

[0063] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0064] In one implementation, the communication module is also used for:

[0065] In response to a migration failure message for the target virtual machine, the connection between the first computing device and the second computing device is maintained.

[0066] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0067] Fourthly, embodiments of this application provide a virtual machine migration apparatus, the apparatus comprising:

[0068] The acquisition module is used to acquire hot migration requests;

[0069] The first sending module is configured to send the identifier of the third computing device to the first computing device according to the hot migration request. The identifier of the third computing device is used by the first computing device to determine that the USB protocol data is USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data. The target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device.

[0070] The processing module is used to migrate the target virtual machine from the second computing device to the third computing device according to the hot migration request; the target virtual machine includes USB protocol data.

[0071] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0072] In one implementation, the acquisition module is specifically used for:

[0073] Based on the fault information corresponding to the second computing device, determine the hot migration request; and / or,

[0074] The hot migration request is determined based on the load of each virtual machine corresponding to the second computing device.

[0075] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0076] In one implementation, the acquisition module is specifically used for:

[0077] When the fault information indicates that the second computing device is faulty, obtain the service level corresponding to each virtual machine;

[0078] Determine the hot migration request based on the service level corresponding to each virtual machine.

[0079] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0080] In one implementation, the apparatus further includes:

[0081] The second sending module is used to send a service request to the first computing device when the target virtual machine is migrated from the second computing device to the third computing device. The service request is used by the first computing device to determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

[0082] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0083] In one implementation,

[0084] The acquisition module, the first sending module, and the processing module are applied to the second computing device;

[0085] The second sending module is used in the third computing device.

[0086] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0087] Fifthly, embodiments of this application provide a computing device, which includes a memory and a processor;

[0088] The memory is coupled to the processor;

[0089] Memory is used to store computer instructions;

[0090] The processor is used to execute computer instructions to enable the computing device to implement the method of the first aspect.

[0091] The computing device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0092] Sixthly, embodiments of this application provide a computing device, which includes a memory and a processor;

[0093] The memory is coupled to the processor;

[0094] Memory is used to store computer instructions;

[0095] The processor is used to execute computer instructions to enable the computing device to implement the method of the second aspect.

[0096] The computing device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0097] In a seventh aspect, embodiments of this application provide a computing system, which includes a first computing device, a second computing device, and a third computing device;

[0098] The first computing device is used to execute the method of the first aspect;

[0099] The second and third computing devices are used to execute the method of the second aspect.

[0100] The computing system provided in this application embodiment can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0101] Eighthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method of the first aspect or the second aspect.

[0102] When the computer-executable instructions in the computer-readable storage medium provided in this application are executed by a processor, the technical solutions shown in the above method embodiments can be implemented. The implementation principle and beneficial effects are similar, and will not be repeated here.

[0103] Ninthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, is used to implement the method of the first aspect or the second aspect.

[0104] When the computer program in the computer program product provided in this application is executed by a processor, it can implement the technical solution shown in the above method embodiments. The implementation principle and beneficial effects are similar, and will not be repeated here. Attached Figure Description

[0105] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0106] Figure 1 is a schematic diagram of a virtual machine migration method provided in an embodiment of this application;

[0107] Figure 2a is a flowchart illustrating a virtual machine migration method according to an embodiment of this application.

[0108] Figure 2b is a schematic diagram of a scenario where a first computing device and a second computing device negotiate communication according to an embodiment of this application;

[0109] Figure 2c is a schematic diagram of a virtual machine migration scenario provided by an embodiment of this application;

[0110] Figure 3 is a flowchart illustrating a second embodiment of a virtual machine migration method provided in this application.

[0111] Figure 4 is a flowchart illustrating a fourth embodiment of a virtual machine migration method provided in this application.

[0112] Figure 5 is a flowchart illustrating a fifth embodiment of a virtual machine migration method provided in this application.

[0113] Figure 6 is a schematic diagram of the structure of a virtual machine migration device provided in an embodiment of this application;

[0114] Figure 7 is a schematic diagram of another virtual machine migration device provided in an embodiment of this application;

[0115] Figure 8 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0116] Figure 9 is a schematic diagram of another computing device provided in an embodiment of this application. Detailed Implementation

[0117] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments made by those skilled in the art under the guidance of these embodiments are within the scope of protection of this application.

[0118] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0119] Definitions:

[0120] Virtual machine (VM): A virtual machine is a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computing device can also be performed in a VM. When creating a VM on a computing device, a portion of the computing device's hard drive and memory capacity is allocated as the VM's hard drive and memory capacity. Each VM has its own independent hard drive and operating system, and can be operated just like a physical computing device.

[0121] Qemu (Quick EMUlator) is an open-source virtualization and emulation software used to create and manage virtual machines. Additionally, Qemu supports virtual machine snapshots and live migration, allowing the state of virtual machines to be saved, restored, or migrated between different computing devices (physical hosts).

[0122] Usbredir: usbredir is a protocol and toolset for redirecting Universal Serial Bus (USB) devices, used to share USB devices in virtualized environments.

[0123] Hot migration, also known as dynamic migration or real-time migration, involves moving a virtual machine from a source computing device to a target computing device without affecting its normal operation. During hot migration, there is a brief overlap between the source and target computing devices. During this overlap, the virtual machine's memory information and state are copied to the target computing device. Once the copying is complete, the virtual machine's operation switches to the target computing device. At this point, the virtual machine on the source computing device is stopped and its resources are released.

[0124] This application provides a virtual machine migration method. A first computing device can determine the USB protocol data between the first computing device and the third computing device without communicating and negotiating with the third computing device. This allows the migrated target virtual machine on the third computing device to access the USB device connected to the first computing device based on the USB protocol data, thereby maintaining normal business operations during the virtual machine migration process.

[0125] The virtual machine migration method of this application embodiment will be described in detail below.

[0126] Figure 1 is a schematic diagram of a virtual machine migration method provided in an embodiment of this application. As shown in Figure 1, the scenario includes a computing system and a USB device 40. The computing system includes a first computing device 10, a second computing device 20, and a third computing device 30.

[0127] The first computing device 10 is connected to the USB device 40. The first computing device 10 is also connected to the second computing device 20.

[0128] The target virtual machine runs on the second computing device 20.

[0129] It should be noted that the first computing device 10 can be a terminal device or a server. When the first computing device 10 is a terminal device, the terminal device can be, but is not limited to, a laptop, a desktop computer, etc. Exemplary embodiments of the terminal devices involved in this application include, but are not limited to, terminal devices running iOS, Android, Windows, Harmony OS, or other operating systems. This application does not specifically limit the type of terminal device. When the first computing device 10 is a server, from an architectural perspective, the server can be a rack server, a high-density server, a tower server, or a full-rack server; from a functional perspective, the server can be a general-purpose server or an artificial intelligence server (AI server), etc. For example, an artificial intelligence server can be an image processing server (GPU server).

[0130] The second computing device 20 and the third computing device 30 can be terminal devices or servers.

[0131] USB device 40 is an external device that connects to a computing device via a Universal Serial Bus (USB) interface. USB device 40 can be a keyboard, mouse, storage device, etc.

[0132] In the scenario shown in Figure 1:

[0133] The second computing device 20 can obtain hot migration requests.

[0134] The second computing device 20 can send the identifier of the third computing device 30 to the first computing device 10 according to a hot migration request. In addition, the second computing device 20 can also migrate the target virtual machine from the second computing device 20 to the third computing device 30 according to a hot migration request.

[0135] The first computing device 10 can obtain the identifier of the third computing device 30 sent by the second computing device 20. The target virtual machine running on the second computing device 20 accesses the USB device 40 connected to the first computing device 10 based on the USB protocol data between the first computing device 10 and the second computing device 20.

[0136] When the target virtual machine is migrated from the second computing device 20 to the third computing device 30, the first computing device 10 can determine the USB protocol data as USB protocol data between the first computing device 10 and the third computing device 30 based on the identifier of the third computing device 30, so that the migrated target virtual machine on the third computing device 30 can access the USB device 40 connected to the first computing device 10 based on the USB protocol data.

[0137] It should be noted that Figure 1 is a schematic diagram of the scenario provided by the embodiment of this application. The embodiment of this application does not limit the actual form of the various devices included in Figure 1, nor does it limit the interaction method between the devices in Figure 1. In the application of the solution, it can be set according to actual needs.

[0138] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0139] Figure 2a is a flowchart illustrating a virtual machine migration method according to an embodiment of this application. Referring to Figure 2a, the method specifically includes the following steps:

[0140] S201: The second computing device obtains a hot migration request.

[0141] In this embodiment, the second computing device can obtain a hot migration request.

[0142] The hot migration request is used to request the migration of the target virtual machine in the second computing device to the third computing device.

[0143] In one implementation:

[0144] A cloud platform (or management tool) runs on the second computing device. The second computing device can obtain a hot migration request input by the administrator through the cloud platform (or management tool). In one implementation, the hot migration request may include the identifier of the target virtual machine.

[0145] In one implementation:

[0146] The second computing device can determine the hot migration request based on the fault information corresponding to the second computing device.

[0147] In one implementation, the second computing device runs multiple virtual machines, each corresponding to a service level. For example, a higher service level indicates greater service importance. The second computing device can obtain the service level of each virtual machine when fault information indicates a fault in the second computing device. The second computing device can determine a hot migration request based on the service level of each virtual machine. Understandably, in one implementation, the second computing device can identify virtual machines with service levels higher than a preset level as target virtual machines. In another implementation, the second computing device can identify the virtual machine with the highest service level among the multiple virtual machines as the target virtual machine.

[0148] In one implementation:

[0149] Multiple virtual machines run on the second computing device. The second computing device can determine the hot migration request based on the load of each virtual machine corresponding to the second computing device.

[0150] In one implementation, the second computing device can determine the total load based on the load of each virtual machine. If the computing device determines that the total load exceeds a preset total load, it can then determine a target virtual machine from among multiple virtual machines based on the load of each virtual machine. Understandably, in one implementation, the target virtual machine can be the virtual machine with the highest load among the multiple virtual machines.

[0151] It should be noted that load refers to the number of tasks that the virtual machine is processing. The higher the virtual machine's load, the more tasks the virtual machine is handling.

[0152] S202: The second computing device sends the identifier of the third computing device to the first computing device according to the hot migration request.

[0153] In this embodiment, after obtaining a hot migration request, the second computing device can send the identifier of the third computing device to the first computing device according to the hot migration request.

[0154] In other words, the first computing device can obtain the identifier of the third computing device sent by the second computing device.

[0155] In one implementation, the identifier of the third computing device can be its Internet Protocol (IP) address. In another implementation, the identifier of the third computing device can be its serial number. The identifier of the third computing device can also be other information that reflects the identity of the third computing device; this application does not limit this specific information.

[0156] The following describes the process by which the second computing device sends the identifier of the third computing device to the first computing device in response to a hot migration request.

[0157] In one implementation, the hot migration request may include an identifier of a third computing device. The second computing device can then send the identifier of the third computing device to the first computing device based on the identifier in the hot migration request.

[0158] In one implementation, the second computing device may store an identifier of the third computing device. In response to receiving a hot-swap request, the second computing device may send the identifier of the third computing device to the first computing device.

[0159] It should be noted that the first computing device can store USB protocol data between itself and the second computing device. The second computing device can also store USB protocol data between itself and the second computing device. The target virtual machine running on the second computing device accesses the USB devices connected to the first computing device based on the USB protocol data between the first and second computing devices.

[0160] For example, when a target virtual machine running on a second computing device performs a write operation on a USB device, the service request sent from the second computing device to the first computing device can be a write request. The first computing device can then perform the write operation on the USB device based on the write request. As another example, when a target virtual machine running on a second computing device performs a read operation on a USB device, the service request sent from the second computing device to the first computing device can be a read request. The first computing device can then perform the read operation on the USB device based on the read request and send the read result back to the second computing device.

[0161] It should also be noted that the USB protocol data between the first computing device and the second computing device is obtained through communication negotiation between the first computing device and the second computing device.

[0162] Figure 2b is a schematic diagram of a communication negotiation scenario between a first computing device and a second computing device according to an embodiment of this application. As shown in Figure 2b:

[0163] The usbredir server runs on the first computing device 10.

[0164] The second computing device 20 runs qemu 1 and the target virtual machine.

[0165] The following section, with reference to Figure 2b, describes the communication negotiation process between the usbredir server running on the first computing device and the qemu 1 running on the second computing device.

[0166] The qemu 1 running on the second computing device can send connection requests to the usbredir server running on the first computing device.

[0167] Upon receiving a connection request, the usbredir server running on the first computing device accepts the connection and establishes a communication channel. The qemu 1 running on the second computing device and the usbredir server running on the first computing device exchange initial handshake messages to confirm the validity of the connection and the basic capabilities of both parties.

[0168] The QEMU 1 running on the second computing device can communicate and negotiate with the usbredir server running on the first computing device to obtain USB protocol data. It should be noted that both the usbredir server on the first computing device and the QEMU 1 running on the second computing device can store the USB protocol data. Furthermore, the USB protocol data includes, but is not limited to, the USB version, transfer type (such as control transfer, bulk transfer, interrupt transfer, or synchronous transfer), and maximum packet size.

[0169] After detecting a USB device connected to the first computing device, the usbredir server running on the first computing device can send the USB device's descriptor information to qemu 1 running on the second computing device. This descriptor information can include a device descriptor, configuration descriptor, interface descriptor, and / or endpoint descriptor. Based on this descriptor information, qemu 1 running on the second computing device can create a virtual USB device within the virtual machine, enabling the virtual machine to recognize and use it, thus allowing the virtual machine to use the USB device connected to the first computing device.

[0170] S203: The second computing device migrates the target virtual machine from the second computing device to the third computing device according to the hot migration request.

[0171] In this embodiment, the second computing device can also migrate the target virtual machine to the third computing device according to a hot migration request.

[0172] It should be noted that the process of the second computing device migrating the target virtual machine to the third computing device includes the process of the second computing device sending USB protocol data to the third computing device. In other words, the target virtual machine may include USB protocol data. It should also be noted that this USB protocol data is obtained through communication negotiation between the second computing device and the first computing device.

[0173] It should also be noted that the second computing device may execute S202 first and then S203, or it may execute S202 during the execution of S203. This application embodiment does not limit this.

[0174] Figure 2c is a schematic diagram of a virtual machine migration scenario provided by an embodiment of this application. As shown in Figure 2c:

[0175] The usbredir server runs on the first computing device 10.

[0176] The second computing device 20 runs qemu 1 and the target virtual machine.

[0177] The third computing device 30 runs qemu 2.

[0178] The process of migrating the target virtual machine from the second computing device to the third computing device will be described below with reference to Figure 2c.

[0179] The second computing device runs QEMU 1 and sends data corresponding to the target virtual machine to the third computing device. This data may include data in memory and the CPU state. Understandably, the data may include USB protocol data; in other words, the target virtual machine migrated to the third computing device may include USB protocol data. In one implementation, where the second and third computing devices do not use shared storage technology and share storage data, the data corresponding to the target virtual machine may also include data from the hard drive. It should be noted that the process of the second computing device running QEMU 1 and sending data corresponding to the target virtual machine to the third computing device occurs while the target virtual machine is running on the second computing device.

[0180] The third computing device runs QEMU 2 to obtain data corresponding to the target virtual machine sent by the first computing device. This data includes USB protocol data; in other words, the target virtual machine migrated to the third computing device may include USB protocol data.

[0181] The third computing device runs qemu 2, which can create a new virtual machine on the third computing device when receiving data corresponding to the target virtual machine.

[0182] The third computing device runs QEMU 2 and can start the new virtual machine after receiving all the data corresponding to the target virtual machine. It should be noted that this new virtual machine can be regarded as the target virtual machine that has been migrated to the third computing device.

[0183] After the new virtual machine starts, the second computing device runs qemu 1, which can control the target virtual machine on the second computing device to stop running and delete the target virtual machine on the second computing device.

[0184] S204: When the target virtual machine is migrated from the second computing device to the third computing device, the first computing device determines the USB protocol data as USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0185] In this embodiment, when the target virtual machine is migrated from the second computing device to the third computing device, that is, when the target virtual machine is successfully migrated, the first computing device can determine that the USB protocol data is the USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device.

[0186] In one implementation:

[0187] The first computing device can receive service requests. In one implementation, if the target virtual machine is running on a third computing device, the service request can be sent by the third computing device (the target virtual machine on the third computing device).

[0188] The first computing device can determine whether the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

[0189] If so, the first computing device can directly identify the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device.

[0190] If not, then the process ends.

[0191] Furthermore, if the first computing device determines the USB protocol data between the first computing device and the third computing device, the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0192] In other words, if the first computing device stores the USB protocol data between the first computing device and the third computing device, and the third computing device stores the USB protocol data between the first computing device and the third computing device, the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0193] It should also be noted that the USB protocol data between the first computing device and the third computing device stored on the first computing device is determined by the first computing device based on the USB protocol data between the first computing device and the second computing device. The USB protocol data between the first computing device and the third computing device stored on the third computing device includes the target virtual machine migrated from the second computing device to the third computing device.

[0194] It should be noted that when the first computing device is connected to multiple USB devices, the USB protocol data between the first and third computing devices includes the USB protocol data corresponding to each of the multiple USB devices. For each USB device, the migrated target virtual machine on the third computing device can access that USB device based on the corresponding USB protocol data.

[0195] Alternatively, in one implementation:

[0196] If the target virtual machine is successfully migrated, the first computing device can obtain the migration success information of the target virtual machine.

[0197] In one implementation, the second computing device can send migration success information of the target virtual machine to the first computing device upon recognizing that the target virtual machine has been successfully migrated. It should be noted that, in one implementation, the second computing device can determine whether the target virtual machine migration was successful by checking logs. The second computing device can also determine whether the target virtual machine migration was successful through other methods, and this application embodiment does not limit this method.

[0198] In one implementation, the third computing device can send migration success information of the target virtual machine to the first computing device upon recognizing that the target virtual machine has been successfully migrated. It should be noted that, in one implementation, the third computing device can determine whether the target virtual machine migration was successful by checking logs. The third computing device can also determine whether the target virtual machine migration was successful through other methods, and this application embodiment does not limit this method.

[0199] In one implementation, the first computing device can determine that the computing device sending the service request is the third computing device if the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device. The first computing device can then determine that the target virtual machine has been migrated to the third computing device. The first computing device can generate migration success information for the target virtual machine.

[0200] In one implementation, the first computing device can determine that the computing device sending the service request is the third computing device if the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot migration state. The first computing device can then determine that the target virtual machine has migrated to the third computing device. The first computing device can then obtain migration success information for the target virtual machine.

[0201] The first computing device can disconnect from the second computing device in response to a successful migration message. It should be noted that disconnecting the first and second computing devices means that the target virtual machine on the second computing device cannot access the USB device connected to the first computing device.

[0202] In one implementation, the first computing device can disconnect from the second computing device by terminating the thread corresponding to the second computing device. The thread corresponding to the second computing device is the thread used to maintain the connection between the first and second computing devices.

[0203] By employing the above method, after a successful migration, the first computing device is disconnected from the second computing device and connected to the third computing device. This prevents multiple virtual machines on multiple computing devices from using the USB device of the first computing device during non-migration processes, which could lead to data errors. In other words, this method improves the security of USB device usage and enhances data consistency.

[0204] Additionally, it should be noted that in one implementation:

[0205] In the event that the target virtual machine migration fails, the first computing device can obtain the migration failure information of the target virtual machine.

[0206] In one implementation, the second computing device can send migration failure information of the target virtual machine to the first computing device if it detects that the migration of the target virtual machine has failed. It should be noted that, in one implementation, the second computing device can determine whether the migration of the target virtual machine has failed by checking the logs.

[0207] In one implementation, the third computing device can send migration failure information of the target virtual machine to the first computing device if it detects that the migration of the target virtual machine has failed. It should be noted that, in one implementation, the third computing device can determine whether the migration of the target virtual machine has failed by checking the logs.

[0208] In one implementation, the first computing device can start timing after obtaining the identifier of the third computing device sent by the second computing device. After the timing duration reaches a preset duration, it can determine whether a service request has been received, and whether the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device. If not, it is determined that the target virtual machine migration has failed, and the first computing device can obtain the migration failure information of the target virtual machine.

[0209] In one implementation, the first computing device can start timing after obtaining the identifier of the third computing device sent by the second computing device. After the timing duration reaches a preset duration, it can determine whether a service request has been received, provided that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the identifier corresponding to the third computing device is a hot migration identifier. If not, it is determined that the target virtual machine migration has failed, and the first computing device can obtain the migration failure information of the target virtual machine.

[0210] In response to a migration failure message from the target virtual machine, the first computing device can maintain the connection between itself and the second computing device. It should be noted that maintaining the connection means that the target virtual machine running on the second computing device can continue to access the USB devices connected to the first computing device.

[0211] In the event of a migration failure, the target virtual machine continues to run on the second computing device to provide business capabilities and ensure business continuity.

[0212] Additionally, it should be noted that in one implementation:

[0213] The first computing device can delete the mark on the third computing device in response to the migration completion information of the target virtual machine. The migration completion information can be migration success information, migration failure information, or other information; this embodiment does not limit this.

[0214] The beneficial effects of this embodiment are as follows: In this embodiment, the second computing device can obtain a hot migration request. Based on the hot migration request, the second computing device sends the identifier of the third computing device to the first computing device. The second computing device can also migrate the target virtual machine from the second computing device to the third computing device based on the hot migration request. When the target virtual machine is migrated from the second computing device to the third computing device, the first computing device can determine that the USB protocol data is USB protocol data between the first and third computing devices based on the identifier of the third computing device. Through the above method, during the migration of the target virtual machine, the target virtual machine running on the second computing device can access the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices. The first computing device can accurately parse the service requests of the target virtual machine in the second computing device based on the USB protocol data between the first and second computing devices. In other words, during the migration of the target virtual machine, the target virtual machine running on the second computing device can maintain normal business operations. When the first computing device can determine that the USB protocol data is USB protocol data between the first and third computing devices based on the identifier of the third computing device, after the target virtual machine is migrated to the third computing device, the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data between the first and third computing devices. The first computing device can accurately parse the service requests of the target virtual machine on the third computing device based on the USB protocol data between the first and third computing devices. In other words, after the target virtual machine migration is completed, the target virtual machine running on the third computing device can maintain normal business operations. In summary, the method based on the embodiments of this application eliminates the need to unmount and remount the USB device during the migration process of the target virtual machine, and also eliminates the need to spend time controlling the communication negotiation between the first computing device and the third computing device running the target virtual machine. This allows the migrated target virtual machine on the third computing device to access the USB device connected to the first computing device, thereby achieving seamless switching of the USB device (from being used by the target virtual machine on the second computing device to being used by the target virtual machine on the third computing device), ensuring business continuity, and improving the user experience during the process of the target virtual machine providing services to the outside world.

[0215] Below, through method embodiment two, based on method embodiment one, the process of the first computing device determining the USB protocol data between the first computing device and the third computing device will be further described.

[0216] Figure 3 is a flowchart illustrating a second embodiment of a virtual machine migration method provided in this application. Referring to Figure 3, the method specifically includes the following steps:

[0217] S301: The second computing device obtains a hot migration request.

[0218] In this embodiment, the second computing device can obtain a hot migration request.

[0219] The hot migration request is used to request the migration of the target virtual machine in the second computing device to the third computing device.

[0220] The specific implementation process is the same as that of S201, and will not be described in detail here.

[0221] S302: The second computing device sends the identifier of the third computing device to the first computing device according to the hot migration request.

[0222] In this embodiment, the second computing device can send the identifier of the third computing device to the first computing device according to the hot migration request. In one implementation, the identifier of the third computing device can be the IP address of the third computing device.

[0223] In one implementation, the second computing device can send migration information to the first computing device based on a hot migration request. The migration information includes the identifier and verification code of the third computing device.

[0224] In one implementation, the second computing device can encrypt the identifier of the third computing device based on a hot migration request, obtaining an encrypted identifier for the third computing device. The second computing device can then send the encrypted identifier of the third computing device to the first computing device.

[0225] S303: The first computing device records the third computing device's mark as a hot migration state based on the identifier of the third computing device.

[0226] In this embodiment, the first computing device can record the third computing device as being in a hot migration state based on the identifier of the third computing device. The fact that the third computing device is marked as being in a hot migration state indicates that the third computing device is the destination device for the target virtual machine in the migration process.

[0227] In one implementation, after obtaining the migration information, the first computing device can verify the verification code, and after confirming that the verification code has been verified, record the third computing device as a hot migration state according to the identifier of the third computing device in the migration information.

[0228] In one implementation, after obtaining the encrypted identifier of the third computing device, the first computing device can decode the encrypted identifier of the third computing device to obtain the identifier of the third computing device. The first computing device can then record the third computing device as a hot-migrating state based on the identifier of the third computing device.

[0229] S304: The second computing device migrates the target virtual machine from the second computing device to the third computing device according to the hot migration request.

[0230] In this embodiment, the second computing device can migrate the target virtual machine to the third computing device according to a hot migration request. The target virtual machine includes USB protocol data.

[0231] The specific implementation process is the same as that of S203, and will not be described in detail here.

[0232] It should also be noted that the second computing device may execute S302 and S303 first and then execute S304, or it may execute S302 and S303 during the execution of S304. This application embodiment does not limit this.

[0233] S305: When the target virtual machine is migrated from the second computing device to the third computing device, the first computing device obtains the service request.

[0234] In this embodiment, when the target virtual machine is migrated from the second computing device to the third computing device, the first computing device can obtain a service request. This service request is the service request corresponding to the third computing device, and it is sent by the target virtual machine running on the third computing device.

[0235] S306: When the first computing device determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot migration state, the first computing device determines the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0236] In this embodiment, the first computing device can determine whether the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot migration state.

[0237] If not, then the process ends.

[0238] If so, the first computing device can determine that the service request is sent by the third computing device running the target virtual machine.

[0239] The first computing device can determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0240] In one implementation, the USB protocol data between the first computing device and the second computing device is stored in the storage device (such as memory or hard disk) of the first computing device. The first computing device can retrieve the USB protocol data stored in the storage device and identify this USB protocol data as the USB protocol data between the first and third computing devices if it determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and that the third computing device is in a hot-migrating state.

[0241] The beneficial effects of this embodiment are as follows: In this embodiment, the second computing device can obtain a hot migration request. Based on the hot migration request, the second computing device sends the identifier of the third computing device to the first computing device. The first computing device can record the third computing device as being in a hot migration state based on its identifier. The second computing device can also migrate the target virtual machine to the third computing device based on the hot migration request. When the target virtual machine is migrated from the second computing device to the third computing device, the first computing device can obtain a service request. If it determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is in a hot migration state, the first computing device determines the USB protocol data between the first and second computing devices as the USB protocol data between the first and third computing devices, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data. Through the above method, after performing a first verification using the identifier of the computing device corresponding to the service request, a second verification is performed using the hot migration state, improving the security of the communication connection and thus improving the security of the data in the USB device.

[0242] The following describes the virtual machine migration process from the perspectives of qemu 1, qemu 2, and usbredir server through method embodiment three.

[0243] In this embodiment, qemu 1 runs on the second computing device and qemu 2 runs on the third computing device.

[0244] QEMU 1 includes three hot migration callback functions: a migration start function, a migration success function, and a migration failure function. QEMU 2 includes three hot migration callback functions: a migration start function, a migration success function, and a migration failure function.

[0245] The following section explains the virtual machine migration process from the perspectives of QEMU 1 and QEMU 2.

[0246] In one implementation:

[0247] The migration startup function of QEMU 1 can, upon receiving a hot migration request, send the identifier of the third computing device to the usbredir server running on the first computing device, based on the hot migration request. It should be noted that the usbredir server running on the first computing device connects to QEMU 1 running on the second computing device via USB protocol data between the first and second computing devices.

[0248] The migration startup function of qemu 1 can migrate the target virtual machine to a third computing device based on a hot migration request.

[0249] When the target virtual machine is migrated from the second computing device to the third computing device, the usbredir server running on the first computing device can receive business requests. It should be noted that the business requests can be sent by the target virtual machine running on the third computing device through qemu 2 running on the third computing device.

[0250] The usbredir server running on the first computing device can, if it determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, identify the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device.

[0251] The usbredir server running on the first computing device can establish a connection with qemu 2 running on the third computing device through USB protocol data between the first and third computing devices.

[0252] The usbredir server running on the first computing device can obtain migration success information. In one implementation, the migration success function of qemu 1 can send migration success information of the target virtual machine to the usbredir server running on the first computing device upon recognizing that the target virtual machine has been successfully migrated. In another implementation, the migration success function of qemu 2 can send migration success information of the target virtual machine to the usbredir server running on the first computing device upon recognizing that the target virtual machine has been successfully migrated.

[0253] In response to a successful migration message from the target virtual machine, the usbredir server running on the first computing device disconnects from the qemu 1 running on the second computing device. Alternatively, in one implementation, the usbredir server running on the first computing device may delete the marker (hot migration status) on the third computing device in response to a migration completion message from the target virtual machine. In one implementation, the migration completion message may be a migration success message.

[0254] Additionally, it should be noted that in one implementation, the usbredir server running on the first computing device can obtain migration failure information for the target virtual machine. In another implementation, the migration failure function of qemu 1 can send migration failure information for the target virtual machine to the usbredir server running on the first computing device upon detecting a migration failure. In yet another implementation, the migration failure function of qemu 2 can also send migration failure information for the target virtual machine to the usbredir server running on the first computing device upon detecting a migration failure.

[0255] In response to a migration failure message from the target virtual machine, the usbredir server running on the first computing device maintains the connection between the usbredir server running on the first computing device and the qemu 1 running on the second computing device. Alternatively, in one implementation, the usbredir server running on the first computing device can delete the marker (hot migration status) on the third computing device in response to a migration completion message from the target virtual machine. In one implementation, the migration completion message can be a migration failure message.

[0256] The beneficial effects of this embodiment are as follows: By adding a hot migration callback function in the qemu 1 of the second computing device and the qemu 2 of the third computing device, after the target virtual machine is migrated, the USB protocol data between the first computing device and the second computing device can be identified as the USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device. This automatically restores the target virtual machine on the third computing device's access to the USB device on the first computing device, thereby achieving business continuity.

[0257] The following describes the virtual machine migration process from the perspective of the first computing device through method embodiment four.

[0258] Figure 4 is a flowchart illustrating a fourth embodiment of a virtual machine migration method provided in this application. Referring to Figure 4, the method specifically includes the following steps:

[0259] S401: The first computing device obtains the identifier of the third computing device sent by the second computing device.

[0260] In this embodiment, the first computing device can obtain the identifier of the third computing device sent by the second computing device.

[0261] In one implementation, the identifier of the third computing device can be the IP address of the third computing device.

[0262] In one implementation, after obtaining the identifier of the third computing device, the first computing device may record the third computing device's mark as a hot migration state based on the identifier of the third computing device.

[0263] It should be noted that the target virtual machine running on the second computing device can access the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices.

[0264] S402: When the target virtual machine is migrated from the second computing device to the third computing device, the first computing device determines the USB protocol data as USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0265] In this embodiment, when the target virtual machine is migrated from the second computing device to the third computing device, that is, when the target virtual machine is successfully migrated, the first computing device can determine the USB protocol data as the USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0266] In one implementation:

[0267] The first computing device can obtain business requests when the target virtual machine is migrated from the second computing device to the third computing device.

[0268] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the first computing device may determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device.

[0269] In one implementation, the first computing device may determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device if it determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device and the third computing device is marked as being in a hot-migrating state.

[0270] In another implementation, the first computing device may disconnect from the second computing device in response to a successful migration message from the target virtual machine.

[0271] Additionally, it should be noted that in one implementation, the first computing device may maintain the connection between the first computing device and the second computing device in response to the migration failure information of the target virtual machine.

[0272] In one implementation, the first computing device may delete the mark on the third computing device in response to migration completion information of the target virtual machine.

[0273] The beneficial effects of this embodiment are as follows: During the migration of the target virtual machine, the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices. The first computing device can accurately parse the service requests of the target virtual machine on the second computing device based on the USB protocol data between the first and second computing devices. In other words, during the migration of the target virtual machine, the target virtual machine running on the second computing device can maintain normal business operations. After the target virtual machine is migrated to the third computing device, the first computing device can determine that the USB protocol data is the USB protocol data between the first and third computing devices based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data. In other words, after the target virtual machine is migrated to the third computing device, the first computing device can accurately parse the service requests of the target virtual machine on the third computing device based on the USB protocol data between the first and third computing devices. In other words, after the target virtual machine migration is completed, the target virtual machine running on the third computing device can maintain normal business operations. In summary, the method based on the embodiments of this application eliminates the need to first unmount and then remount the USB device during the migration of the target virtual machine, and also eliminates the need to spend time controlling the communication negotiation between the first computing device and the third computing device running the target virtual machine. This allows the target virtual machine on the third computing device to access the USB device connected to the first computing device, thereby achieving seamless switching of the USB device (from being used by the target virtual machine on the second computing device to being used by the target virtual machine on the third computing device), ensuring business continuity, and improving the user experience during the process of the target virtual machine providing services to the outside world.

[0274] Figure 5 is a flowchart illustrating a fifth embodiment of a virtual machine migration method provided in this application. Referring to Figure 5, the method specifically includes the following steps:

[0275] S501: Get hot migration request.

[0276] In this embodiment, in one implementation, where a target virtual machine needs to be migrated from a second computing device to a third computing device, the second computing device is the source device of the target virtual machine. The second computing device can obtain a hot migration request.

[0277] In one implementation,

[0278] The second computing device can determine the hot migration request based on the fault information corresponding to the second computing device.

[0279] In one implementation, when the fault information indicates that the second computing device is faulty, the second computing device can obtain the service level corresponding to each virtual machine and determine the hot migration request based on the service level corresponding to each virtual machine.

[0280] In one implementation,

[0281] The second computing device can determine the hot migration request based on the load of each virtual machine corresponding to the second computing device.

[0282] S502: Based on the hot migration request, send the identifier of the third computing device to the first computing device.

[0283] In this embodiment, in one implementation, when it is necessary to migrate the target virtual machine from the second computing device to the third computing device, the second computing device can send the identifier of the third computing device to the first computing device according to the hot migration request.

[0284] The identifier of the third computing device is used by the first computing device to determine that the USB protocol data is USB protocol data between the first and third computing devices when the target virtual machine is migrated from the second computing device to the third computing device. This allows the migrated target virtual machine on the third computing device to access the USB devices connected to the first computing device based on the USB protocol data. The target virtual machine running on the second computing device accesses the USB devices connected to the first computing device based on the USB protocol data between the first and second computing devices.

[0285] S503: Based on the hot migration request, migrate the target virtual machine from the second computing device to the third computing device.

[0286] In this embodiment, in one implementation, when it is necessary to migrate the target virtual machine from the second computing device to the third computing device, the second computing device can migrate the target virtual machine from the second computing device to the third computing device according to a hot migration request. The target virtual machine includes USB protocol data.

[0287] In another implementation, where a target virtual machine needs to be migrated from a second computing device to a third computing device, the third computing device is the destination device for the target virtual machine. The third computing device can send a service request to the first computing device. This service request is used by the first computing device, if it determines that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, to identify the USB protocol data between the first and second computing devices as the USB protocol data between the first and third computing devices.

[0288] The beneficial effects of this embodiment are as follows: Upon receiving a hot migration request, the identifier of the third computing device can be sent to the first computing device according to the hot migration request, and the target virtual machine can be migrated from the second computing device to the third computing device according to the hot migration request; the target virtual machine includes USB protocol data. The identifier of the third computing device is used by the first computing device to determine that the USB protocol data is USB protocol data between the first and third computing devices when the target virtual machine is migrated from the second to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data; while the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices. Through the above method, during the target virtual machine migration process, the target virtual machine running on the second computing device can access the USB device connected to the first computing device based on the USB protocol data between the first and second computing devices; after the target virtual machine is migrated to the third computing device, the migrated target virtual machine on the third computing device accesses the USB device connected to the first computing device based on the USB protocol data, ensuring business continuity.

[0289] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0290] Figure 6 is a schematic diagram of a virtual machine migration device provided in an embodiment of this application. The virtual machine migration device 60 is applied to a first computing device, which is connected to a Universal Serial Bus (USB) device.

[0291] As shown in Figure 6, the virtual machine migration device 60 includes an acquisition module 61 and a processing module 62.

[0292] The acquisition module 61 is used to acquire the identifier of the third computing device sent by the second computing device; the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device;

[0293] The processing module 62 is configured to determine, based on the identifier of the third computing device, that the USB protocol data is USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

[0294] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0295] In one implementation, processing module 62 is specifically used for:

[0296] Obtain the business request;

[0297] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0298] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0299] In one implementation, the identifier of the third computing device is its Internet Protocol (IP) address.

[0300] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0301] In one implementation, the processing module 62 is further configured to:

[0302] Based on the identifier of the third computing device, the third computing device is marked as being in a hot migration state.

[0303] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0304] In one implementation, processing module 62 is specifically used for:

[0305] If the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as being in a hot-migrating state, the USB protocol data between the first computing device and the second computing device is determined to be the USB protocol data between the first computing device and the third computing device.

[0306] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0307] In one implementation, the communication module 63 is further used for:

[0308] In response to the successful migration message of the target virtual machine, disconnect the connection between the first computing device and the second computing device.

[0309] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0310] In one implementation, the communication module 63 is further used for:

[0311] In response to a migration failure message for the target virtual machine, the connection between the first computing device and the second computing device is maintained.

[0312] The virtual machine migration device provided in this application embodiment can execute the technical solution in the above method embodiment where the execution subject is the first computing device. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0313] Figure 7 is a schematic diagram of another virtual machine migration device provided in an embodiment of this application.

[0314] As shown in Figure 7, the virtual machine migration device 70 includes: an acquisition module 71, a first sending module 72, a processing module 73, and a second sending module 74.

[0315] Module 71 is used to obtain hot migration requests;

[0316] The first sending module 72 is configured to send the identifier of the third computing device to the first computing device according to the hot migration request; the identifier of the third computing device is used by the first computing device to determine that the USB protocol data is the USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data; wherein, the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device;

[0317] Processing module 73 is used to migrate the target virtual machine from the second computing device to the third computing device according to the hot migration request; the target virtual machine includes USB protocol data.

[0318] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0319] In one implementation, module 71 is specifically used for:

[0320] Based on the fault information corresponding to the second computing device, determine the hot migration request; and / or,

[0321] The hot migration request is determined based on the load of each virtual machine corresponding to the second computing device.

[0322] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0323] In one implementation, module 71 is specifically used for:

[0324] When the fault information indicates that the second computing device is faulty, obtain the service level corresponding to each virtual machine;

[0325] Determine the hot migration request based on the service level corresponding to each virtual machine.

[0326] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0327] In one implementation, the apparatus further includes:

[0328] The second sending module 74 is used to send a service request to the first computing device when the target virtual machine is migrated from the second computing device to the third computing device. The service request is used by the first computing device to determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

[0329] The virtual machine migration device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0330] In one implementation,

[0331] The acquisition module 71, the first sending module 72, and the processing module 73 are applied to the second computing device;

[0332] The second transmitting module 74 is applied to the third computing device.

[0333] The virtual machine migration device provided in this application embodiment has an acquisition module, a first sending module, and a processing module that can execute the technical solution in the above method embodiment where the execution subject is a second computing device. The virtual machine migration device provided in this application embodiment has a second sending module that can execute the technical solution in the above method embodiment where the execution subject is a third computing device. Their implementation principles and beneficial effects are similar, and will not be described again here.

[0334] Figure 8 is a schematic diagram of the structure of a computing device provided in an embodiment of this application. As shown in Figure 8, the computing device 80 includes: a processor 81 and a memory 82; wherein, the processor 81 is coupled to the memory 82, and the memory 82 is used to store computer instructions; the processor 81 is used to execute the computer instructions to make the computing device 80 execute the technical solution of the first computing device in the aforementioned method embodiment.

[0335] Optionally, the memory 82 can be either standalone or integrated with the processor 81. Optionally, when the memory 82 is a device independent of the processor 81, the first computing device 80 may further include a bus 83 for connecting the aforementioned devices.

[0336] The processor is used to execute the technical solution of the first computing device in the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0337] Figure 9 is a schematic diagram of another computing device provided in an embodiment of this application. As shown in Figure 9, the computing device 90 includes a processor 91 and a memory 92; wherein the processor 91 is coupled to the memory 92, and the memory 92 is used to store computer instructions; the processor 91 is used to execute the computer instructions to cause the computing device 90 to perform the technical solutions in the aforementioned method embodiments.

[0338] Optionally, the memory 92 can be either standalone or integrated with the processor 91. Optionally, when the memory 92 is a device independent of the processor 91, the computing device 90 may further include a bus 93 for connecting the aforementioned devices.

[0339] The processor is used to execute the technical solutions of the first computing device and the second computing device in the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0340] The computing device 90 can be a first computing device or a second computing device.

[0341] This application embodiment also provides a computing system, which includes a first computing device, a second computing device, and a third computing device;

[0342] The first computing device is used to execute the technical solution of the first computing device in the foregoing method embodiments;

[0343] The second computing device is used to execute the technical solution of the second computing device in the foregoing method embodiments;

[0344] The third computing device is used to execute the technical solution of the third computing device in the aforementioned method embodiments.

[0345] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the technical solutions provided in the aforementioned method embodiments.

[0346] This application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the technical solutions provided in the aforementioned method embodiments.

[0347] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as volatile memory and non-volatile memory.

[0348] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for migrating virtual machines, characterized in that, Applied to a first computing device, the first computing device being connected to a Universal Serial Bus (USB) device, the method includes: Obtain the identifier of the third computing device sent by the second computing device; the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device; In the case where the target virtual machine is migrated from the second computing device to the third computing device, the USB protocol data is determined to be USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

2. The method according to claim 1, characterized in that, The step of determining that the USB protocol data is USB protocol data between the first computing device and the third computing device based on the identifier of the third computing device includes: Obtain the business request; If it is determined that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, the USB protocol data between the first computing device and the second computing device is determined as the USB protocol data between the first computing device and the third computing device.

3. The method according to claim 2, characterized in that, The identifier of the third computing device is its Internet Protocol (IP) address.

4. The method according to claim 2, characterized in that, The method further includes: Based on the identifier of the third computing device, the mark of the third computing device is recorded as a hot migration state.

5. The method according to claim 4, characterized in that, The step of determining the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when it is determined that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device includes: If it is determined that the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device, and the third computing device is marked as the hot migration state, the USB protocol data between the first computing device and the second computing device is determined as the USB protocol data between the first computing device and the third computing device.

6. The method according to any one of claims 1-5, characterized in that, Also includes: In response to the successful migration information of the target virtual machine, the connection between the first computing device and the second computing device is disconnected.

7. The method according to any one of claims 1-5, characterized in that, Also includes: In response to the migration failure information of the target virtual machine, the connection between the first computing device and the second computing device is maintained.

8. A method for migrating virtual machines, characterized in that, The method includes: Get the hot migration request; According to the hot migration request, the identifier of the third computing device is sent to the first computing device; the identifier of the third computing device is used by the first computing device to determine that the USB protocol data is the USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data; wherein, the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device; According to the hot migration request, the target virtual machine is migrated from the second computing device to the third computing device; the target virtual machine includes the USB protocol data.

9. The method according to claim 8, characterized in that, The method further includes: When the target virtual machine is migrated from the second computing device to the third computing device, a service request is sent to the first computing device; the service request is used by the first computing device to determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

10. A virtual machine migration device, characterized in that, Applied to a first computing device, the first computing device being connected to a Universal Serial Bus (USB) device, the apparatus includes: The acquisition module is used to acquire the identifier of the third computing device sent by the second computing device; the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device; The processing module is configured to, when the target virtual machine is migrated from the second computing device to the third computing device, determine, based on the identifier of the third computing device, that the USB protocol data is USB protocol data between the first computing device and the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data.

11. A virtual machine migration device, characterized in that, The device includes: The acquisition module is used to acquire hot migration requests; A first sending module is configured to send an identifier of a third computing device to a first computing device according to the hot migration request; the identifier of the third computing device is used by the first computing device to determine that the USB protocol data is USB protocol data between the first computing device and the third computing device when the target virtual machine is migrated from the second computing device to the third computing device, so that the migrated target virtual machine on the third computing device can access the USB device connected to the first computing device based on the USB protocol data; wherein, the target virtual machine running on the second computing device accesses the USB device connected to the first computing device based on the USB protocol data between the first computing device and the second computing device; The processing module is configured to migrate the target virtual machine from the second computing device to the third computing device according to the hot migration request; the target virtual machine includes the USB protocol data.

12. The apparatus according to claim 11, characterized in that, The device further includes: The second sending module is configured to send a service request to the first computing device when the target virtual machine is migrated from the second computing device to the third computing device; the service request is used by the first computing device to determine the USB protocol data between the first computing device and the second computing device as the USB protocol data between the first computing device and the third computing device when the identifier of the computing device corresponding to the service request is the same as the identifier of the third computing device.

13. The apparatus according to claim 12, characterized in that, The acquisition module, the first sending module, and the processing module are applied to the second computing device; The second sending module is applied to the third computing device.

14. A computing device, characterized in that, The computing device includes a memory and a processor; The memory is coupled to the processor; The memory is used to store computer instructions; The processor is configured to execute the computer instructions to cause the computing device to implement the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Virtual machine access method and apparatus for USB device

    CN105740180A

  • USB equipment management method and device

    CN114153552A

  • Data migration method and device and electronic equipment

    CN116185553A

  • Virtual machine migration method and device and computing equipment

    CN119440730A

  • Managing virtual machine security resources

    US20190250937A1