Data migration method and computing device
By migrating virtual machine data in parallel through multiple threads while the source virtual machine is running and predicting the shutdown duration, the problem of long business interruption during virtual machine migration is solved and migration efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202410647153.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-08-23
AI Technical Summary
Existing virtual machine migration methods take a long time to migrate the full amount of data, resulting in long business interruptions, and incremental data migration relies on the completion of the full amount of data, affecting efficiency.
When the source virtual machine is running, the original disk data is migrated to the target disk in parallel through multiple threads, and the target shutdown time is predicted based on the unmigrated data, and the virtual machine switching operation is controlled to ensure that shutdown conditions are met when the business is switched to the target virtual machine.
This shortens the business interruption duration, improves migration efficiency and shutdown duration accuracy, and avoids long interruptions caused by incremental data migration.
Smart Images

Figure CN118535284A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the server field, and in particular, to a data migration method and a computing device. Background Art
[0002] As virtual machines (VMs) are used in more and more application scenarios, when a host machine where a VM is located fails or has insufficient resources, the VM needs to be migrated.
[0003] A common VM migration method includes: migrating the metadata of the VM and the data stored in the disk (referred to as: full data) to the target host in a serial manner during the VM running phase, then shutting down the VM, and after the VM is shut down, migrating the newly added data in the disk (i.e., incremental data) during the process of migrating the above metadata and disk data to the target host, and after the incremental data is migrated to the target host, running the target VM after the VM migration on the target host.
[0004] However, since the amount of the full data is large, it takes a long time to migrate the full data, so that the amount of the incremental data is large. The migration method is to run the target VM after the incremental data is migrated to the target host, which causes a longer duration of business interruption on the VM. Summary of the invention
[0005] The embodiments of the present application provide a data migration method and a computing device, which can shorten the service interruption duration.
[0006] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0007] In a first aspect, an embodiment of the present application provides a data migration method, which includes: when a source virtual machine is in a running state, migrating data in an original disk to a target disk through multiple threads; the original disk is the disk of the source virtual machine, and the target disk is the disk of the target virtual machine; when any thread among the multiple threads completes the data migration, determining a target shutdown duration based on unmigrated data in other threads; when the target shutdown duration meets the shutdown condition, executing a virtual machine switching operation, and the virtual machine switching operation is used to indicate that the business running on the source virtual machine is switched to the target virtual machine.
[0008] In the above embodiment, when the source virtual machine is in operation, the data in the disk (original disk) of the source virtual machine is migrated to the disk (target disk) of the target virtual machine through multiple threads; when any of the multiple threads completes the data migration, the target shutdown duration is determined based on the unmigrated data in other threads, and the business running on the source virtual machine is switched to the above target virtual machine when the target shutdown duration meets the shutdown condition. Since the above method migrates the data in the above original disk to the target disk through multiple threads, the migration time of the data in the original disk is reduced, so that the incremental data in the original disk is reduced, thereby avoiding the problem of a long business interruption duration of the source virtual machine due to the migration of the incremental data after the source virtual machine is shut down, thereby shortening the business interruption duration.
[0009] In addition, in the above-mentioned embodiment, when any thread among multiple threads completes data migration, the target shutdown duration is determined based on the unmigrated data in other threads; and the business running on the source virtual machine will be switched to the above-mentioned target virtual machine only when the target shutdown duration meets the shutdown condition. Therefore, the user can control the shutdown duration of the source virtual machine by setting the shutdown condition, thereby solving the problem of a long business interruption duration of the source virtual machine due to a long shutdown time of the source virtual machine; therefore, the business interruption duration is shortened.
[0010] In a possible implementation, in the case where the original disk includes a first disk and a second disk, when any thread among multiple threads completes data migration, a target shutdown duration is determined based on the unmigrated data in other threads; including: when the data in the first disk completes migration, the incremental data of the first disk and the second disk are determined respectively, wherein the incremental data of a disk includes the newly added data of the disk; the newly added data is the data newly added to the disk during the process of migrating the data in the disk; based on the incremental data and unmigrated data in the above-mentioned second disk and the incremental data in the first disk, the target shutdown duration is determined; the target shutdown duration is the predicted time required to migrate the incremental data and unmigrated data in each disk to the target disk.
[0011] In the above embodiment, the target shutdown duration is determined based on the incremental data and unmigrated data in the second disk and the incremental data in the first disk; since the incremental data in the disk also needs to be migrated to the target disk, the target shutdown duration is determined based on the incremental data and unmigrated data to improve the accuracy of the target shutdown duration.
[0012] In one possible implementation, the incremental data of the above disk also includes predicted incremental data; the predicted incremental data is based on the rate of new data added to the disk, and predicts the new data in the disk within the time required to switch the source virtual machine from a running state to a shutdown state.
[0013] The incremental data in the above embodiment includes predicted incremental data on the basis of the newly added data; the predicted incremental data is based on the rate of newly added data on the disk, and predicts the newly added data on the disk within the time required to switch the source virtual machine from a running state to a shutdown state; thereby avoiding the problem of inaccurate shutdown duration of the disk determined due to the generation of new data during the shutdown process of the disk of the source virtual machine, thereby improving the accuracy of the target shutdown duration.
[0014] In a possible implementation, the target shutdown time is determined based on the incremental data and unmigrated data in the second disk and the incremental data in the first disk, including: determining a first shutdown time according to the amount of incremental data in the first disk and the data migration speed of the first disk, the first shutdown time being the time required to migrate the incremental data in the first disk to the target disk; determining a second shutdown time according to the amount of incremental data and unmigrated data in the second disk and the data migration speed of the second disk, the second shutdown time being the time required to migrate the incremental data and unmigrated data in the second disk to the target disk; and determining the maximum time between the first shutdown time and the second shutdown time as the target shutdown time.
[0015] The above embodiment determines the first shutdown duration according to the amount of incremental data in the first disk and the data migration speed of the first disk; and determines the second shutdown duration according to the amount of incremental data in the second disk and the amount of unmigrated data and the data migration speed of the second disk; finally, the maximum duration of the predicted durations of each disk (i.e., the first shutdown duration and the second shutdown duration) is determined as the target shutdown duration. Thus, the accuracy of the target shutdown duration is improved.
[0016] In one possible implementation, when the data in the first disk is migrated, determining the incremental data of the first disk includes: determining the difference data between the first full snapshot of the first disk and the second full snapshot of the first disk as the incremental data of the first disk; the first full snapshot is a snapshot of the full data in the first disk when the first disk last performed data migration; the second full snapshot is a snapshot of the full data in the current first disk.
[0017] In one possible implementation, when the original disk includes multiple disks, a virtual machine switching operation is performed, including: switching the source virtual machine from a running state to a shutdown state; when the source virtual machine is in the shutdown state, migrating the unmigrated data in each original disk to the target disk through different threads; when all threads complete data migration, starting the target virtual machine.
[0018] In the above embodiment, after the source virtual machine is shut down, the unmigrated data in each original disk is migrated to the target disk through different threads, thereby avoiding the problem of mutual dependence of the unmigrated data of each original disk, thereby improving the migration efficiency of the unmigrated data and, subsequently, shortening the service interruption duration.
[0019] In one possible implementation, when the data in the first disk is migrated, the unmigrated data in each disk is migrated to the target disk through different threads, including: migrating the incremental data in the first disk to the target disk through the first thread; migrating the unmigrated data in the second disk to the target disk through the second thread; migrating the incremental data in the second disk to the target disk through the second thread or the third thread.
[0020] The above embodiment migrates the unmigrated data and incremental data in the second disk through different threads, avoiding the problem that the incremental data in the second disk needs to wait until the migration of the unmigrated data is completed before migrating, thereby improving the migration efficiency of the incremental data in the second disk.
[0021] In a possible implementation, when the original disk includes a first disk and a second disk, data in the original disk is migrated to the target disk through multiple threads respectively, including: migrating data in the first disk and data in the second disk to the target disk through different threads.
[0022] In one possible implementation, before migrating the data in the original disk to the target disk through multiple threads, the method also includes: migrating the metadata of the source virtual machine to the target computing device so that the target computing device creates a target virtual machine based on the metadata; the metadata is data used to describe the source virtual machine.
[0023] In the second aspect, an embodiment of the present application provides a migration device, which includes: a migration unit, a determination unit and a switching unit; the migration unit is used to migrate the data in the original disk to the target disk through multiple threads when the source virtual machine is in a running state; the original disk is the disk of the source virtual machine, and the target disk is the disk of the target virtual machine; the determination unit is used to determine the target shutdown duration based on the unmigrated data in other threads when any thread among the multiple threads completes the data migration; the switching unit is used to perform a virtual machine switching operation when the target shutdown duration meets the shutdown condition, and the virtual machine switching operation is used to indicate that the business running on the source virtual machine is switched to the target virtual machine.
[0024] In one possible implementation, the determination unit is used to determine the incremental data of the first disk and the second disk respectively when the data in the first disk has completed migration, wherein the incremental data of one disk includes the newly added data of the disk; the newly added data is the data newly added to the disk during the process of migrating the data in the disk; the determination unit is also used to determine the target shutdown duration based on the incremental data and unmigrated data in the second disk and the incremental data in the first disk; the target shutdown duration is the predicted duration required to migrate the incremental data and unmigrated data in each disk to the target disk.
[0025] In one possible implementation, the determination unit is used to determine a first shutdown time according to the amount of incremental data in the first disk and the data migration speed of the first disk, the first shutdown time being the time required to migrate the incremental data in the first disk to the target disk; the determination unit is also used to determine a second shutdown time according to the amount of incremental data and the amount of unmigrated data in the second disk and the data migration speed of the second disk, the second shutdown time being the time required to migrate the incremental data and unmigrated data in the second disk to the target disk; and the maximum time between the first shutdown time and the second shutdown time is determined as the target shutdown time.
[0026] In one possible implementation, the determination unit is used to determine the difference data between the first full snapshot of the first disk and the second full snapshot of the first disk as incremental data of the first disk; the first full snapshot is a snapshot of the full data in the first disk when the first disk last performed data migration; the second full snapshot is a snapshot of the full data in the current first disk.
[0027] In one possible implementation, the switching unit is used to switch the source virtual machine from a running state to a shutdown state; the migration unit is used to migrate the unmigrated data in each original disk to the target disk through different threads when the source virtual machine is in the shutdown state; and the disconnection unit is used to start the target virtual machine when all threads complete the data migration.
[0028] In one possible implementation, the migration unit is used to migrate the incremental data in the first disk to the target disk through the first thread; the migration unit is also used to migrate the unmigrated data in the second disk to the target disk through the second thread; the migration unit is also used to migrate the incremental data in the second disk to the target disk through the second thread or the third thread.
[0029] In a possible implementation, the migration unit is used to migrate the data in the first disk and the data in the second disk to the target disk through different threads.
[0030] In a possible implementation, the migration unit is used to migrate metadata of the source virtual machine to the target computing device, so that the target computing device creates a target virtual machine based on the metadata; the metadata is data used to describe the source virtual machine.
[0031] In a third aspect, a computing device is provided, comprising a processor and a memory, wherein the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the method of the first aspect and its possible implementation methods are implemented.
[0032] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions. When the computer instructions in the computer-readable storage medium are executed by a computing device, the computing device executes the method of the first aspect and possible implementations thereof.
[0033] According to a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computing device, enables the computing device to execute the method of the first aspect and possible implementations thereof.
[0034] It should be understood that the beneficial effects achieved by the technical solutions of the second to fifth aspects of the embodiments of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of a migration system provided in an embodiment of the present application;
[0036] Figure 2 A schematic diagram of a cluster management system provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application;
[0038] Figure 4 A data migration method provided in this application embodiment Figure 1 ;
[0039] Figure 5 A data migration method provided in this application embodiment Figure 2 ;
[0040] Figure 6 A data migration method provided in this application embodiment Figure 3 ;
[0041] Figure 7 A data migration method provided in this application embodiment Figure 4 ;
[0042] Figure 8 A schematic diagram of the structure of the migration device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0044] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of the objects. For example, the first disk and the second disk are used to distinguish different disks rather than to describe a specific order of the disks.
[0045] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0046] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple disks refers to two or more than two disks.
[0047] First, some concepts involved in a data migration method and a computing device provided in an embodiment of the present application are explained as follows:
[0048] Data migration: refers to the action of copying data from one platform or computing device to another platform or computing device.
[0049] Snapshot: A snapshot is a mirror image of a data set at a specific moment, also known as an instant copy. It is a complete and available copy of the data set, containing all the information about the data at the moment the snapshot is generated.
[0050] An embodiment of the present application provides a data migration method, which includes: when a source virtual machine is in a running state, migrating the data in the disk (original disk) of the source virtual machine to the disk (target disk) of the target virtual machine through multiple threads; when any of the multiple threads completes the data migration, determining the target shutdown duration based on the unmigrated data in other threads, and switching the business running on the source virtual machine to the above-mentioned target virtual machine when the target shutdown duration meets the shutdown condition. Since the above-mentioned data in the above-mentioned original disk is migrated to the target disk through multiple threads, the migration time of the data in the original disk is reduced, so that the incremental data in the original disk is reduced, thereby avoiding the problem of a long service interruption duration of the source virtual machine due to the migration of the incremental data after the source virtual machine is shut down, thereby shortening the service interruption duration.
[0051] In addition, in the above-mentioned embodiment, when any thread among multiple threads completes data migration, the target shutdown duration is determined based on the unmigrated data in other threads; and the business running on the source virtual machine will be switched to the above-mentioned target virtual machine only when the target shutdown duration meets the shutdown condition. Therefore, the user can control the shutdown duration of the source virtual machine by setting the shutdown condition, thereby solving the problem of a long business interruption duration of the source virtual machine due to a long shutdown time of the source virtual machine; therefore, the business interruption duration is shortened.
[0052] The data migration method provided in the embodiment of the present application is applied to Figure 1 In the migration system shown, the migration system includes: a host machine 101, a host machine 102 and a management device 103; wherein the management device 103 is respectively connected to the host machine 101 and the host machine 102 through a network (referred to as: network connection); as an example, the network can be, for example, a public network, an intranet of a data center, an enterprise intranet, or a school intranet, etc., and the embodiments of the present application are not limited to this.
[0053] A virtual machine A to be migrated is running in the host machine 101, and the host machine 101 is used to migrate the virtual machine A running thereon to the host machine 102, so that the migrated virtual machine A (i.e., virtual machine A') runs in the host machine 102. The host machine 101 or the host machine 102 can be a computing device with processing capability, storage capability, and transceiver capability, such as a desktop computer, a laptop computer, and a server.
[0054] It should be noted that the host machine 101 and the host machine 102 may be host machines in the same virtualization platform or host machines in different virtualization platforms, which is not specifically limited in the embodiments of the present application.
[0055] It should be understood that the host machine 101 may include one virtual machine or multiple virtual machines, and the embodiment of the present application does not limit the number of virtual machines running in the host machine 101.
[0056] The management device 103 is used to read the metadata (such as memory size and number of processor cores 2) and disk data of the virtual machine A running on the host machine 101; wherein the metadata is the configuration data of the virtual machine A, that is, the metadata is the data used to describe the virtual machine A. The disk data is the data stored in the disk (such as the virtual machine hard disk) in the virtual machine A; the management device 103 is also used to write the metadata and disk data of the virtual machine A into the host machine 102. Finally, the management device 103 creates a virtual machine A' based on the metadata and disk data; thereby realizing the migration of the virtual machine A to the host machine 102. The management device 103 can be a computing device with processing power, storage power and transceiver power, such as a desktop computer, a laptop computer and a server.
[0057] It should be understood that the specific implementation of the above-mentioned management device 103 creating virtual machine A' based on the metadata and disk data includes: the management device 103 creates virtual machine A' in the host machine 102 based on the metadata of the virtual machine A; at this time, there is no data in the disk of the virtual machine A', and then, the management device 103 mounts the storage address of the above-mentioned disk data in the host machine 102 under the disk file of the virtual machine A', thereby realizing the creation of virtual machine A'.
[0058] The management device 103 includes a heterogeneous migration module 1031 and a migration optimization module 1032; wherein the migration optimization module 1032 is used to allocate at least one thread to each disk in the virtual machine A, and then the heterogeneous migration module 1031 is used to call the thread corresponding to each disk to migrate the data in each disk to the host machine 102; after a disk completes a data migration, the migration optimization module 1032 predicts the time required to migrate the unmigrated data in each disk to the host machine 102 (referred to as: the first shutdown time), and controls the virtual machine A to shut down when the first shutdown time is less than the preset time. After the virtual machine A completes the shutdown, the migration optimization module 1032 notifies the heterogeneous migration module 1031 to migrate the unmigrated data in each disk (referred to as: the second data) to the host machine 102. And after the second data migration is completed, the virtual machine A' in the host machine 102 is started.
[0059] Optionally, the management device 103 may be an independent computing device or a computing device integrated with the host machine 101 or the host machine 102. The embodiment of the present application takes the management device 103 as an independent device as an example for explanation and will not be repeated later.
[0060] The data migration method provided in the embodiment of the present application is applied to Figure 2 In the cluster management system shown, the cluster management system includes: a management device 201 and a computing device cluster 202; wherein the computing device cluster 202 includes computing devices 1 to N; the management device 201 is respectively connected to computing devices 1 to N through a network.
[0061] Management device 201 is used to manage computing devices 1 to N in computing device cluster 202. Specifically, when the physical resources of a computing device (such as computing device 1) in computing device cluster 202 are insufficient, management device 201 determines a target computing device (such as computing device N) based on business needs; then, management device 201 sends a migration instruction to computing device 1, and the migration instruction is used to instruct the migration of the virtual machine in computing device 1 to computing device N.
[0062] The management device 201 may be a computing device with processing, storage, and receiving capabilities, such as a desktop computer, a laptop computer, and a server.
[0063] The computing devices in the computing device cluster 202 are used to receive and respond to the management instructions sent by the management device 201, and perform response operations based on the management instructions; specifically, after the computing devices in the computing device cluster 202 (such as computing device 1) receive the migration instructions sent by the management device 201, computing device 1 migrates the virtual machine A running on it to computing device N, so that the migrated virtual machine A' runs in computing device N, wherein computing device 1 to computing device N can be computing devices with processing capabilities, storage capabilities, and receiving and sending capabilities, such as desktop computers, laptops, and servers.
[0064] It should be noted that the specific implementation process of migrating the virtual machine A to the computing device N is described in the following method embodiment and will not be repeated here.
[0065] It should be understood that the above-mentioned management device 201 can also determine the devices in other clusters other than the above-mentioned computing device cluster 202 as the target computing devices (such as: computing device N+X); at this time, the migration instruction sent by the management device 201 to the computing device 1 is used to instruct the migration of virtual machine A in the computing device 1 to the computing device N+X.
[0066] For example, Figure 3It is a schematic diagram of the hardware structure of a computing device of the host machine 101, the host machine 102 or the management device 103. Taking the computing device as a server as an example, the server can be a high-density server, a rack server or a whole cabinet server in terms of form; in terms of performance, it can be a general-purpose server, a GPU (graphics processing unit) server, etc. or an artificial intelligence (AI) server.
[0067] The hardware part of the computing device includes a processor CPU, an out-of-band controller and a memory, and the software part includes an out-of-band management module and an operating system (OS).
[0068] The above-mentioned out-of-band management module runs in the out-of-band controller, and the OS runs on the processor (such as Figure 3 As shown). The out-of-band management module may be a management unit of a non-business module. For example, the out-of-band management module may remotely maintain and manage the computing device through a dedicated data channel. The out-of-band management module is completely independent of the operating system of the computing device and may communicate with the OS through the out-of-band management interface of the computing device.
[0069] It should be understood that when the computing device is the above-mentioned host machine 101, a virtual machine A is running in the OS.
[0070] Exemplarily, the out-of-band management module may include a management unit for computing the running status of the device, a management system in a management chip outside the in-band controller, a system management module (system management mode, SMM), etc. It should be noted that the embodiments of the present application do not limit the specific form of the out-of-band management module, and the above is only an exemplary description.
[0071] Among them, the memory, also called internal memory or main memory, is installed in the memory slot on the motherboard of the computing device, and the memory communicates with the memory controller through a memory channel.
[0072] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0073] The present application provides a data migration method. Figure 1 The management device 103 (hereinafter referred to as management device) in the migration system shown in FIG. Figure 2 In the computing device in the cluster management system shown; for the convenience of describing the embodiment of the present application, the method is applied to Figure 1 The management device 103 shown in FIG. 1 is used as an example to illustrate; at this time, the method is as follows Figure 4 As shown, the method includes S110-S130.
[0074] S110 . When the source virtual machine is in a running state, migrate the data in the original disk to the target disk through multiple threads.
[0075] It should be understood that when the source virtual machine is in a running state, the source virtual machine is in a powered-on state.
[0076] The above-mentioned original disk is a disk in the source virtual machine; that is, when the source virtual machine includes one disk, the data volume of the original disk is one; when the source virtual machine includes multiple disks, the data volume of the original disk is multiple; the specific embodiment of the present application does not limit the data of the above-mentioned original disk.
[0077] The target disk is a disk of a target virtual machine; the target virtual machine is a virtual machine created based on metadata of a source virtual machine, and the target virtual machine and the source virtual machine are virtual machines on different computing devices or different platforms.
[0078] The above-mentioned S110 can be implemented by migrating the data in multiple original disks (referred to as: data to be migrated) to the target disk through multiple threads respectively; or the data to be migrated in multiple storage areas in the original disks can be migrated to the target disk respectively through multiple threads. For the sake of ease of description, the embodiment of the present application takes the migration of data to be migrated in multiple original disks to the target disk through multiple threads as an example, and will not be repeated later.
[0079] It should be understood that the data to be migrated includes the full amount of data (i.e., all data) in the original disk or the incremental data in the original disk; specifically, if the currently executed S110 is the first time to migrate the data in the original disk to the target disk, since the data in the original disk has not been migrated to the target disk, the data to be migrated in the original disk at this time is the full amount of data in the current original disk. If the currently executed S110 is not the first time to migrate the data in the original disk to the target disk, the data to be migrated on the disk is the incremental data of the original disk; wherein, the incremental data is the data newly added to the original disk during the last migration of the data in the original disk to the target disk; that is, the incremental data of the disk is the data newly added to the disk during the last migration of the data in the disk.
[0080] The above incremental data can be obtained by: obtaining a snapshot of the original disk at the current moment (referred to as: the first snapshot); then, comparing the first snapshot with the snapshot of the original disk before the last data migration (referred to as: the second snapshot), obtaining the difference data between the first snapshot and the second snapshot, and the difference data is the above incremental data. Alternatively, all data migrated from the original disk in the target disk can be compared with all data in the original disk at the current moment, obtaining the difference data, and the difference data is the above incremental data; the specific embodiment of the present application does not specifically limit the implementation method of obtaining incremental data.
[0081] For example, assume that disk A (i.e., original disk) in the source virtual machine includes data 1 and data 2. When the data in disk A is migrated to disk B in the target virtual machine for the first time, the data to be migrated includes data 1 and data 2. During the migration of the data in disk A, data 3 is newly added to disk A. When the data in disk A is migrated to disk B for the second time, the data to be migrated includes the newly added data 3.
[0082] It should be noted that when the data to be migrated in multiple original disks is migrated to the target disk through multiple threads, the number of target disks can be one or more; that is, the data to be migrated in the multiple original disks can be migrated to one target disk or to multiple target disks, and the specific embodiments of the present application do not specifically limit it.
[0083] The specific implementation of migrating the data to be migrated in multiple original disks to the target disk through multiple threads includes: in the case where the above-mentioned original disks include a first disk and a second disk, the specific implementation of the above-mentioned S110 includes: migrating the data to be migrated in the first disk to the target disk through the first thread, and at the same time, migrating the data to be migrated in the second disk to the target disk through the second thread; that is, migrating the data to be migrated in the first disk and the data to be migrated in the second disk to the target disk through different threads.
[0084] It should be understood that the specific implementation process of migrating the data in the original disk (i.e., the data to be migrated) to the target disk can be copying a snapshot of the data to be migrated in the original disk to the target disk; or it can be reading the data to be migrated in the original disk in the form of a character stream or a byte stream through an I / O stream, and writing the read data to be migrated to the target disk. The specific embodiments of the present application do not specifically limit this.
[0085] S120: When any thread among the multiple threads completes data migration, a target shutdown duration is determined based on unmigrated data in other threads.
[0086] The target shutdown time is the time required to migrate the unfinished data in the current original disk to the target disk. The target shutdown time is the predicted time required to migrate the unfinished data in the original disk to the target disk after shutting down the source virtual machine.
[0087] Among them, when the above-mentioned original disk includes the first disk and the second disk, when the thread corresponding to the first disk (such as: the first thread) completes data migration (that is: the first disk completes data migration), the above-mentioned target shutdown duration is determined based on the unmigrated data in the second disk.
[0088] There are at least two implementation methods for determining the target shutdown duration based on the unmigrated data in the second disk, which are as follows:
[0089] In a first implementation, the specific implementation of determining the target shutdown duration based on the unmigrated data in the second disk includes: determining the target shutdown duration based on the amount of unmigrated data in the second disk and the data migration speed of the second disk.
[0090] It should be noted that the data migration speed of the above-mentioned disk can be the historical average speed of migrating data in the disk, or it can be the historical minimum speed of migrating data in the disk, and the specific embodiments of the present application do not specifically limit it.
[0091] The above-mentioned target shutdown time is the quotient of the amount of unmigrated data in the above-mentioned second disk and the data migration speed of the second disk, that is, target shutdown time = amount of unmigrated data in the second disk ÷ data migration speed of the second disk; that is to say, the above-mentioned target shutdown time is the time required to migrate the unmigrated data in the second disk to the target disk at the data migration speed of the above-mentioned second disk.
[0092] Exemplarily, assuming that the amount of unmigrated data in the second disk is 512MB, and the data migration speed of the second disk is 1024MB / S; then the above target shutdown time = 512MB ÷ 1024MB / S, that is, the target shutdown time is 0.5S (seconds).
[0093] It should be noted that, in the case where the above-mentioned original disk also includes a third disk, the method for determining the above-mentioned target shutdown time includes: determining the first shutdown time based on the amount of unmigrated data in the second disk and the data migration speed of the second disk; determining the second shutdown time based on the amount of unmigrated data in the third disk and the data migration speed of the third disk; and then, determining the maximum shutdown time between the first shutdown time and the second shutdown time as the target shutdown time.
[0094] In a second implementation, the specific implementation of determining the target shutdown duration based on the unmigrated data in the second disk includes: determining the target shutdown duration based on the unmigrated data and incremental data in the second disk and the incremental data in the first disk.
[0095] The incremental data of the above disk (eg, the first disk and / or the second disk) includes the newly added data in the disk from the time when S110 is executed on the disk to the current moment.
[0096] The target shutdown duration is the duration required to migrate the unmigrated data and incremental data in the second disk and the incremental migrated data in the first disk to the target server (ie, the expected disk in the target server) through different threads;
[0097] It should be noted that the specific implementation method of determining the target shutdown duration based on the unmigrated data and incremental data in the second disk and the incremental data in the first disk is described in S230-S240 below and will not be repeated here.
[0098] S130: When the target shutdown duration satisfies the shutdown condition, executing a virtual machine switching operation.
[0099] The above shutdown conditions include: the target shutdown duration is less than the preset duration.
[0100] The above-mentioned virtual machine switching operation is used to indicate that the business running on the source virtual machine is switched to the target virtual machine, and its specific implementation includes: switching the source virtual machine from a running state to a shutdown state; when the source virtual machine is in the shutdown state, migrating the unmigrated data in each original disk to the target disk through different threads; and when all threads complete the data migration, starting the target virtual machine so that the target virtual machine can process the business of the source virtual machine.
[0101] In the above embodiment, after the source virtual machine is shut down, the unmigrated data in each original disk is migrated to the target disk through different threads, thereby avoiding the problem of mutual dependence of the unmigrated data of each original disk, thereby improving the migration efficiency of the unmigrated data and, subsequently, shortening the service interruption duration.
[0102] It should be noted that the above-mentioned method of switching the source virtual machine from the running state to the shutdown state can be to send a shutdown instruction to the source virtual machine, and the source virtual machine responds to the shutdown instruction and performs the shutdown operation; or the source virtual machine automatically triggers the shutdown operation when the above-mentioned target shutdown time meets the shutdown conditions; the specific embodiments of the present application do not specifically limit it.
[0103] In the above embodiment, when the source virtual machine is in operation, the data in the disk (original disk) of the source virtual machine is migrated to the disk (target disk) of the target virtual machine through multiple threads; when any of the multiple threads completes the data migration, the target shutdown duration is determined based on the unmigrated data in other threads, and the business running on the source virtual machine is switched to the above target virtual machine when the target shutdown duration meets the shutdown condition. Since the above method migrates the data in the above original disk to the target disk through multiple threads, the migration time of the data in the original disk is reduced, so that the incremental data in the original disk is reduced, thereby avoiding the problem of a long business interruption duration of the source virtual machine due to the migration of the incremental data after the source virtual machine is shut down, thereby shortening the business interruption duration.
[0104] In addition, in the above-mentioned embodiment, when any thread among multiple threads completes data migration, the target shutdown duration is determined based on the unmigrated data in other threads; and the business running on the source virtual machine will be switched to the above-mentioned target virtual machine only when the target shutdown duration meets the shutdown condition. Therefore, the user can control the shutdown duration of the source virtual machine by setting the shutdown condition, thereby solving the problem of a long business interruption duration of the source virtual machine due to a long shutdown time of the source virtual machine; therefore, the business interruption duration is shortened.
[0105] based on Figure 4 The data migration method shown in the embodiment of the present application provides a specific implementation method. For the convenience of description, the embodiment of the present application is described by taking the original disk including the first disk and the second disk as an example. Figure 5 As shown, the method includes: S210-S280.
[0106] S210: When the source virtual machine is in a running state, migrate the metadata of the source virtual machine to the target computing device, so that the target computing device creates a target virtual machine based on the metadata.
[0107] The above metadata is data used to describe the source virtual machine, wherein the metadata includes configuration information of the source virtual machine (such as: the memory size, number of disks, number of processor cores and image information of the operating system of the source virtual machine); that is, based on the metadata, a virtual machine with the same configuration as the source virtual machine can be created. At this time, there is no data in the disk of the virtual machine.
[0108] The target computing device may create a target virtual machine based on metadata by configuring the initial virtual machine in the target computing device with the metadata to obtain the target virtual machine; or the target virtual machine may be directly created in a virtual machine management application (such as VMware) based on the metadata; for its specific implementation, please refer to the relevant technology and will not be repeated here.
[0109] S220 , migrating the data in the first disk and the data in the second disk to the target disk through different threads.
[0110] The implementation method of the above S220 is similar to the implementation method of S120. For the specific description of S220, please refer to the above related description of S120, which will not be repeated here.
[0111] S230: When the data in the first disk is completely migrated, the incremental data of the first disk and the second disk are respectively determined.
[0112] In one implementation, the incremental data includes newly added data; wherein, the newly added data of a disk is the data newly added to the disk during the process of migrating the data in the disk.
[0113] Based on this, the above-mentioned implementation method of determining the incremental data of the first disk includes: determining the difference data between the first full snapshot of the first disk and the second full snapshot of the first disk as the incremental data of the first disk; wherein the above-mentioned first full snapshot is a snapshot of the full data in the first disk when the first disk last performed data migration; the second full data is a snapshot of the full data in the current first disk.
[0114] Similarly, the above-mentioned implementation method for determining the incremental data of the second disk includes: determining the difference data between the third full snapshot of the second disk and the fourth full snapshot of the second disk as the incremental data of the second disk; wherein the fourth full snapshot is a snapshot of the full data in the second disk at the current moment; when the above-mentioned second disk is currently performing data migration, the above-mentioned third full snapshot is a snapshot of the full data in the second disk before the current data migration is performed; when the above-mentioned second disk is not currently performing data migration, the third full snapshot is a snapshot of the full data in the second disk when the second disk last performed data migration.
[0115] It should be noted that, since the above-mentioned incremental data is used to determine the time required to migrate the data that has not been migrated in each disk of the source virtual machine to the target disk after the source virtual machine is shut down (i.e., the target shutdown duration), and during the shutdown process of the source virtual machine, the source virtual machine will also receive operation requests for the data in the original disk of the source virtual machine; therefore, during the shutdown process of the source virtual machine, new data will also be generated in the original disk of the source virtual machine.
[0116] Based on this, in another implementation method, the above-mentioned incremental data also includes predicted incremental data on the basis of the above-mentioned newly added data; wherein, the predicted incremental data is based on the rate of new data added to the original disk (i.e., the first disk and the second disk), and predicts the new data added to the original disk within the time required to switch the source virtual machine from a running state to a shutdown state.
[0117] The above-mentioned method for determining the incremental data of the first disk also includes: determining the implementation method of predicted incremental data, which is to determine the data volume of the predicted incremental data of each disk according to the rate of new data added to each disk; it specifically includes: determining the data volume of the predicted incremental data of the first disk according to the rate of new data added to the first disk; determining the data volume of the predicted incremental data of the second disk according to the rate of new data added to the second disk.
[0118] The rate of newly added data on the disk may be the maximum rate in the historical rate of newly added data on the disk, or the average rate in the historical rate of newly added data on the disk, which is not specifically limited in the embodiments of the present application.
[0119] The specific implementation process of determining the amount of predicted incremental data of each disk based on the rate of new data added to each disk includes: determining the amount of predicted incremental data in each disk based on the rate of new data added to each disk and the switching duration, wherein the switching duration is the time required to switch the source virtual machine from a running state to a shutdown state; specifically, the amount of predicted incremental data of a disk is the product of the rate of new data added to the disk and the switching duration; that is, the amount of predicted incremental data = the rate of new data added to the disk × the switching duration.
[0120] For example, assuming that the rate of new data added to the first disk is 256mb / s, and the rate of new data added to the second disk is 384mb / s; and assuming that the switching time is 2s. Then, the predicted incremental data volume of the first disk is 256mb / s×2s, that is, the predicted incremental data volume of the first disk is 512mb; the predicted incremental data volume of the second disk is 384mb / s×2s, that is, the predicted incremental data volume of the first disk is 768mb.
[0121] The above-mentioned switching duration can be the maximum time in the history of switching the source virtual machine to the shutdown state, or the average time in the history of switching the source virtual machine to the shutdown state, or the time taken to switch the source virtual machine to the shutdown state for the last time. The specific embodiments of the present application do not specifically limit it.
[0122] The incremental data in the above embodiment includes predicted incremental data on the basis of the newly added data; the predicted incremental data is based on the rate of newly added data on the disk, and predicts the newly added data on the disk within the time required to switch the source virtual machine from a running state to a shutdown state; thereby avoiding the problem of inaccurate shutdown duration of the disk determined due to the generation of new data during the shutdown process of the disk of the source virtual machine, thereby improving the accuracy of the target shutdown duration.
[0123] S240: Determine a target shutdown duration based on the incremental data and the unmigrated data in the second disk and the incremental data in the first disk.
[0124] The above-mentioned target shutdown time is the predicted time required to migrate the incremental data and unmigrated data in each disk to the target disk; specifically, the above-mentioned target shutdown time is the predicted time required to migrate the data to be migrated in the first disk and the second disk to the target disk through different threads after shutting down the current source virtual machine, and the data to be migrated currently needs to be migrated in the disk.
[0125] The specific implementation of the above S240 is as follows Figure 6 Shown include: S241-S243.
[0126] S241. Determine a first shutdown duration according to the amount of incremental data in the first disk and the data migration speed of the first disk.
[0127] The first shutdown duration is the duration required to migrate the incremental data in the first disk to the target disk; that is, the first shutdown duration is the quotient of the incremental data in the first disk and the data migration speed of the first disk.
[0128] Exemplarily, assuming that the amount of incremental data in the first disk is 512MB, and the data migration speed of the first disk is 1024MB / S; then, the first shutdown time is 512MB÷1024MB / S, that is, the first shutdown time is 2S.
[0129] S242: Determine a second shutdown duration according to the amount of incremental data and the amount of unmigrated data in the second disk and the data migration speed of the second disk.
[0130] The above-mentioned second shutdown time is the time required to migrate the incremental data and unmigrated data in the second disk to the target disk; that is, the second shutdown time is the quotient of the amount of data to be migrated (that is, incremental data and unmigrated data) in the second disk and the data migration speed of the second disk.
[0131] For example, assuming that the amount of unmigrated data in the second disk is 512MB, the incremental data of the second disk is 128MB, and the data migration speed of the second disk is 384MB / S; then, the second shutdown time is (512MB+128MB)÷384MB / S, that is, the second shutdown time is 1.7S.
[0132] S243: Determine the maximum duration of the first shutdown duration and the second shutdown duration as the target shutdown duration.
[0133] Exemplarily, based on the examples of S241 and S242, the first shutdown time length is 0.5S, and the second shutdown time length is 1.7S. Since 1.7S is greater than 0.5S, the target shutdown time length is determined to be 1.7S.
[0134] The above embodiment determines the first shutdown duration according to the amount of incremental data in the first disk and the data migration speed of the first disk; and determines the second shutdown duration according to the amount of incremental data in the second disk and the amount of unmigrated data and the data migration speed of the second disk; finally, the maximum duration of the predicted durations of each disk (i.e., the first shutdown duration and the second shutdown duration) is determined as the target shutdown duration. Thus, the accuracy of the target shutdown duration is improved.
[0135] In addition, in the above embodiment, the target shutdown duration is determined based on the incremental data and unmigrated data in the second disk and the incremental data in the first disk; since the incremental data in the disk also needs to be migrated to the target disk, the target shutdown duration is determined based on the incremental data and unmigrated data to improve the accuracy of the target shutdown duration.
[0136] S250: Determine whether the target shutdown duration satisfies the shutdown condition.
[0137] The shutdown conditions include: the target shutdown duration is less than a preset duration; the preset duration is the minimum duration (ie, service interruption duration) of the virtual machine that is unacceptable to stop business processing set by the user.
[0138] When the target shutdown duration does not meet the shutdown condition, the data to be migrated in each disk is migrated to the target disk through different threads based on S220. For its specific implementation, refer to S310-S360 below, which will not be repeated here.
[0139] When the target shutdown duration satisfies the shutdown condition, the following S260 is executed.
[0140] S260: Switch the source virtual machine from a running state to a shutdown state.
[0141] The specific implementation of the above S260 includes: sending a shutdown instruction to the source virtual machine, and the source virtual machine responds to the shutdown instruction and performs a shutdown operation; or the source virtual machine automatically triggers a shutdown action when the target shutdown duration meets the shutdown condition.
[0142] It should be noted that when the source virtual machine is switched to the shutdown state, since the source virtual machine no longer receives operation requests for data in the original disks (i.e., the first disk and the second disk), no new data will appear in the original disks of the source virtual machine after the source virtual machine is shut down.
[0143] S270: When the source virtual machine is in a shutdown state, migrate the unmigrated data and incremental data in the second disk and the incremental data in the first disk to the target disk through different threads.
[0144] In one implementation, the specific implementation of the above S270 includes: migrating the incremental data in the first disk to the target disk through the first thread, and migrating the unmigrated data and incremental data in the second disk to the target disk through the second thread.
[0145] In another implementation, the specific implementation of the above S270 includes: migrating the incremental data in the first disk to the target disk through the first thread; migrating the unmigrated data in the second disk to the target disk through the second thread; and migrating the incremental data in the second disk to the target disk through the third thread.
[0146] The above embodiment migrates the unmigrated data and incremental data in the second disk through different threads, avoiding the problem that the incremental data in the second disk needs to wait until the migration of the unmigrated data is completed before migrating, thereby improving the migration efficiency of the incremental data in the second disk.
[0147] S280: When the migration of the unmigrated data and incremental data in the second disk and the incremental data in the first disk is complete, start the target virtual machine.
[0148] The target virtual machine is the migrated source virtual machine; since the data in the disk of the source virtual machine has been migrated to the target virtual machine, the data in the disk of the target virtual machine is now completely the same as the data in the disk of the source virtual machine.
[0149] The specific implementation of the above S280 includes: sending a startup request to the target computing device where the target virtual machine is located, and the target computing device responds to the startup request and switches the target virtual machine from a shutdown state to a running state, so that the target virtual machine takes over the source virtual machine to process the business.
[0150] In the above embodiment, when the source virtual machine is in the running state, the data in the first disk and the second disk included in the source virtual machine are migrated to the target disk of the target virtual machine through different threads; when the first disk among the multiple disks completes the data migration, the target shutdown duration is determined based on the incremental data and the unmigrated data in the second disk and the incremental data in the first disk, and when the target shutdown duration meets the shutdown condition, the source virtual machine is switched from the running state to the shutdown state; and when the source virtual machine is in the shutdown state, the incremental data and the unmigrated data in the second disk and the incremental data in the first disk are migrated to the target disk through different threads. Since the above is to migrate the data in the first disk and the second disk to the target disk through different threads, the migration time of the data in the first disk and the second disk is reduced, so that the incremental data in the first disk and the second disk is reduced, thereby avoiding the problem of a long service interruption duration of the source virtual machine due to the migration of the incremental data after the source virtual machine is shut down, thereby shortening the service interruption duration.
[0151] In addition, since the above-mentioned shutdown conditions include the target shutdown duration being less than the preset duration, it can be seen that the embodiment of the present application compresses the time that the virtual machine is in the shutdown state (i.e., the target shutdown duration) to be within the preset duration, thereby avoiding the problem of a long duration of business interruption of the virtual machine due to the long time spent migrating the incremental data and non-migrated data in the second disk and the incremental data in the first disk after shutdown, thereby shortening the duration of the business interruption of the virtual machine.
[0152] based on Figure 5 or Figure 6 The data migration method shown in the figure, the embodiment of the present application provides another specific implementation method, such as Figure 7 As shown, when the target shutdown duration does not meet the shutdown condition, the method further includes: S310-S360.
[0153] S310 , migrating first data in the first disk and the second disk to a target disk through different threads.
[0154] The first data is data in the disk that has not been migrated to the target disk. Specifically, the first data in the first disk is incremental data in the first disk. The first data in the second disk includes: unmigrated data and incremental data in the second disk.
[0155] It should be noted that the implementation method of the above S310 is similar to the implementation method of S120. For the specific description of S310, please refer to the above related description of S120, which will not be repeated here.
[0156] S320: When the migration of the first data on the second disk is completed, a target shutdown duration is predicted based on the amount of second data on the first disk and the second disk and the data migration speed of each disk.
[0157] The above-mentioned second data is the data in the disk at the current moment that needs to be migrated to the target disk, that is, the second data of a disk includes the data that has not been migrated to the target disk of the disk when the migration of the first data of the second disk is completed; wherein, the second data is similar to the above-mentioned first data and will not be repeated here.
[0158] The above-mentioned target shutdown time is greater than or equal to the time required to migrate the second data in each disk to the target disk; wherein, the target shutdown time is similar to the target shutdown time in the above-mentioned S240. For a detailed description of the target shutdown time, please refer to the relevant description in the above-mentioned S240, which will not be repeated here.
[0159] It should be noted that the implementation method of the above S320 is similar to the implementation method of S240. For the specific description of S320, please refer to the above related description of S240, which will not be repeated here.
[0160] S330: Determine whether the target shutdown duration satisfies the shutdown condition.
[0161] The shutdown condition includes that the target shutdown duration is less than the preset duration.
[0162] When the target shutdown duration is greater than or equal to the preset duration, the second data is migrated to the target disk based on the method of S310 (ie, by different methods), and the process is repeated until the target shutdown duration is less than the preset duration.
[0163] When the target shutdown duration is less than the preset duration, the following S340 is executed.
[0164] S340: Switch the source virtual machine from a running state to a shutdown state.
[0165] S350: When the source virtual machine is in a shutdown state, migrate the second data in each disk to the target disk through different threads.
[0166] S360: After the second data migration in each disk is completed, start the target virtual machine on the target server.
[0167] It should be noted that the implementation method of the above S340-S360 is similar to the implementation method of S260-S280. For the specific description of S340-S360, please refer to the above related description of S260-S280, which will not be repeated here.
[0168] In the above embodiment, when the target shutdown duration does not meet the shutdown condition, the first data in each disk of the source virtual machine is migrated to the target disk through different threads, and when the migration of the first data is completed, the target shutdown duration is predicted based on the amount of unmigrated data (i.e., second data) in each disk at the current moment and the data migration speed of each disk; and when the target shutdown duration meets the shutdown condition, the source virtual machine is switched to the shutdown state, and the second data in each disk is migrated to the target disk through different threads. Since the target shutdown duration is the duration required to migrate the target data in each disk to the target disk, it can be seen that the above embodiment compresses the duration of the virtual machine being in the shutdown state within the preset duration, thereby avoiding the problem of a long service interruption of the virtual machine due to the long time spent migrating the second data after shutdown, thereby shortening the service interruption of the virtual machine.
[0169] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0170] The embodiment of the present application can divide the migration device according to the above method example, for example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0171] In the case of dividing each functional module into corresponding functional modules, Figure 8 A possible structural diagram of the migration device involved in the above embodiment is shown. Figure 8 As shown, the migration device 800 includes: a migration unit 801 , a determination unit 802 and a switching unit 803 .
[0172] The migration unit 801 is used to migrate the data in the original disk to the target disk through multiple threads when the source virtual machine is in operation; for example, execute step S110 in the above method embodiment.
[0173] The determining unit 802 is used to determine the target shutdown duration based on the unmigrated data in other threads when any thread among the multiple threads completes data migration; for example, executing step S120 in the above method embodiment.
[0174] The switching unit 803 is used to execute a virtual machine switching operation when the target shutdown duration satisfies the shutdown condition; for example, execute step S130 in the above method embodiment.
[0175] Optionally, the determining unit 802 is used to determine the incremental data of the first disk and the second disk respectively when the data in the first disk is migrated; for example, executing step S230 in the above method embodiment.
[0176] The determination unit 802 is also used to determine the target shutdown duration based on the incremental data and unmigrated data in the second disk and the incremental data in the first disk; for example, executing step S240 in the above method embodiment.
[0177] Optionally, the determination unit 802 is used to determine the first shutdown duration according to the amount of incremental data in the first disk and the data migration speed of the first disk; for example, executing step S241 in the above method embodiment.
[0178] The determination unit 802 is also used to determine the second shutdown duration according to the amount of incremental data and the amount of unmigrated data in the second disk and the data migration speed of the second disk; for example, executing step S242 in the above method embodiment.
[0179] The determining unit 802 is further configured to determine the maximum duration of the first shutdown duration and the second shutdown duration as the target shutdown duration; for example, executing step S243 in the above method embodiment.
[0180] Optionally, the determining unit 802 is configured to determine differential data between a first full snapshot of the first disk and a second full snapshot of the first disk as incremental data of the first disk.
[0181] Optionally, the switching unit 803 is used to switch the source virtual machine from a running state to a shutdown state; for example, executing step S260 in the above method embodiment.
[0182] The migration unit 801 is used to migrate the unmigrated data and incremental data in the second disk and the incremental data in the first disk to the target disk through different threads when the source virtual machine is in a shutdown state; for example, execute step S270 in the above method embodiment.
[0183] The switching unit 803 is used to start the target virtual machine when all threads complete data migration; for example, execute step S280 in the above method embodiment.
[0184] Optionally, the migration unit 801 is configured to migrate incremental data in the first disk to the target disk through the first thread.
[0185] The migration unit 801 is also used to migrate the unmigrated data in the second disk to the target disk through the second thread.
[0186] The migration unit 801 is further configured to migrate the incremental data in the second disk to the target disk through the second thread or the third thread.
[0187] Optionally, the migration unit 801 is used to migrate the data in the first disk and the data in the second disk to the target disk through different threads; for example, executing step S220 in the above method embodiment.
[0188] Optionally, the migration unit 801 is used to migrate the metadata of the source virtual machine to the target computing device, so that the target computing device creates a target virtual machine based on the metadata; for example, executing step S210 in the above method embodiment.
[0189] Each unit of the above migration device can also be used to execute other actions in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0190] An embodiment of the present application also provides a computing device, including a memory and a processor, wherein the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the above-mentioned data migration method is implemented.
[0191] The embodiment of the present application also provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed on a host machine, the above-mentioned data migration method is implemented.
[0192] For the explanation of the relevant contents and description of the beneficial effects in any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.
[0193] An embodiment of the present application provides a computer program product, which, when executed on a host machine, enables the host machine to execute the above-mentioned data migration method.
[0194] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0195] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0196] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.
[0200] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data migration method, characterized in that: The method comprises: When the source virtual machine is in a running state, the data in the original disk is migrated to the target disk through multiple threads; the original disk is the disk of the source virtual machine, and the target disk is the disk of the target virtual machine; When any thread among the multiple threads completes data migration, a target shutdown duration is determined based on unmigrated data in other threads; When the target shutdown duration satisfies the shutdown condition, a virtual machine switching operation is performed, where the virtual machine switching operation is used to indicate that the service running on the source virtual machine is switched to the target virtual machine.
2. The method according to claim 1, characterized in that In a case where the original disk includes a first disk and a second disk, when any thread among the multiple threads completes data migration, determining a target shutdown duration based on unmigrated data in other threads includes: When the data in the first disk is migrated, the incremental data of the first disk and the second disk are determined respectively, wherein the incremental data of one disk includes the newly added data of the disk; the newly added data is the data newly added to the disk during the process of migrating the data in the disk; The target shutdown duration is determined based on the incremental data and non-migrated data in the second disk and the incremental data in the first disk; the target shutdown duration is the predicted duration required to migrate the incremental data and non-migrated data in each of the disks to the target disk.
3. The method according to claim 2, characterized in that The incremental data of the disk also includes predicted incremental data; the predicted incremental data is the newly added data in the disk predicted within the time required to switch the source virtual machine from the running state to the shutdown state based on the rate of newly added data on the disk.
4. The method according to claim 2 or 3, characterized in that: The determining the target shutdown duration based on the incremental data and the unmigrated data in the second disk and the incremental data in the first disk includes: Determine a first shutdown duration according to the amount of incremental data in the first disk and the data migration speed of the first disk, wherein the first shutdown duration is the duration required to migrate the incremental data in the first disk to the target disk; Determine a second shutdown duration according to the amount of incremental data and the amount of unmigrated data in the second disk and the data migration speed of the second disk, wherein the second shutdown duration is the duration required to migrate the incremental data and the unmigrated data in the second disk to the target disk; The maximum duration of the first shutdown duration and the second shutdown duration is determined as the target shutdown duration.
5. The method according to any one of claims 2 to 4, characterized in that: When the data in the first disk is completely migrated, determining the incremental data of the first disk includes: The difference data between the first full snapshot of the first disk and the second full snapshot of the first disk is determined as the incremental data of the first disk; the first full snapshot is a snapshot of the full data in the first disk when the first disk last performed data migration; the second full snapshot is a snapshot of the full data in the current first disk.
6. The method according to any one of claims 1 to 5, characterized in that: In the case where the original disk includes multiple disks, the performing of the virtual machine switching operation includes: Switching the source virtual machine from a running state to a shutdown state; When the source virtual machine is in a shutdown state, migrating the unmigrated data in each of the original disks to the target disk through different threads; When all threads complete data migration, the target virtual machine is started.
7. The method according to claim 6, characterized in that When the data in the first disk is completely migrated, migrating the unmigrated data in each of the disks to the target disk through different threads includes: Migrating incremental data in the first disk to the target disk through a first thread; Migrating the unmigrated data in the second disk to the target disk through a second thread; The incremental data in the second disk is migrated to the target disk through the second thread or the third thread.
8. The method according to any one of claims 1 to 7, characterized in that: In the case where the original disk includes a first disk and a second disk, the step of migrating the data in the original disk to the target disk through a plurality of threads includes: The data in the first disk and the data in the second disk are migrated to the target disk through different threads.
9. The method according to any one of claims 1 to 8, characterized in that: Before migrating the data in the original disk to the target disk respectively through the multiple threads, the method further includes: The metadata of the source virtual machine is migrated to a target computing device so that the target computing device creates the target virtual machine based on the metadata; the metadata is data used to describe the source virtual machine.
10. A computing device, characterized in that It comprises a memory and a processor, wherein the memory is coupled to the processor; the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the processor executes the method as claimed in any one of claims 1 to 9.
