Data migration method and computing device
By using multi-threading to perform VM migration and format conversion while the source virtual machine is running, the long-term interruption problem caused by disk format mismatch in VM migration is solved, and faster data migration and business recovery are achieved.
Patent Information
- Application Number
- CN202410825421.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-15
AI Technical Summary
When the disk formats of the source virtual machine and the target virtual machine are different in the existing VM migration method, it takes a long time to convert the data migration format and results in a long business interruption.
While the source virtual machine is running, multiple original disk data are migrated to the target server through multiple threads, and format conversion is performed during the migration process. This avoids data format conversion after the source virtual machine is shut down and shortens business interruption time.
This effectively shortens the length of business interruption, improves data migration efficiency, and avoids long interruptions caused by format conversion.
Smart Images

Figure CN118779063A_ABST
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 scenarios, when a host machine where a VM is located fails or has insufficient resources, the VM needs to be migrated to ensure the reliability of business operations.
[0003] However, in the current VM migration method, when the disk format of the source virtual machine is different from that of the target host machine, the migration data is usually format converted after the source virtual machine is shut down to complete the data migration. If the amount of migrated data is large, the format conversion time of the migration data will be long, resulting in a longer business interruption time. Summary of the invention
[0004] The embodiments of the present application provide a data migration method and a computing device, which can shorten the service interruption duration.
[0005] In order to achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a data migration method, which includes: when a source virtual machine on a first server is in a running state, migrating data in multiple original disks to a second server through multiple threads; the original disk is the disk of the above-mentioned source virtual machine, and the above-mentioned second server includes a target disk, the target disk is the disk of the target virtual machine, and the disk format of the original disk is different from the disk format of the target disk; when there is a target thread that completes the data migration among the above-mentioned multiple threads, and there is no first incremental data in the first original disk corresponding to the target thread, a format conversion operation is performed on the migration data of the first original disk migrated by the above-mentioned target thread, and the format conversion operation is used to indicate that the format of the migration data is converted to be compatible with the disk format of the target disk, and the first incremental data is the newly added data in the first original disk during the data migration process of the first original disk; when the shutdown condition is met, the source virtual machine is shut down, and a disk migration operation is performed on the second original disk, wherein the second original disk is the original disk corresponding to the thread that has not completed the data migration and / or the original disk with incremental data, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and a format conversion operation is performed, and the unmigrated data includes the data and / or incremental data that have not completed the migration.
[0007] In the above embodiment, the data in multiple original disks of the source virtual machine running on the first server are migrated to the second server through multiple threads; and when there is a target thread that completes the data migration among the multiple threads, and there is no incremental data in the first original disk corresponding to the target thread, when the source virtual machine is in the running state, the migration data migrated from the first original disk in the second server (i.e., the migration data of the first original disk migrated by the target thread) is format converted, so that the data format of the migration data is adapted to the disk format of the target disk included in the second server; finally, when the shutdown condition is met, the source virtual machine is shut down, and the original disk corresponding to the thread that has not completed the data migration and / or the original disk with incremental data (i.e., the second original disk) is subjected to a disk migration operation, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and the format conversion operation is performed, and the unmigrated data includes the data and / or incremental data that have not completed the migration. It can be seen that the above embodiment has begun to perform the format conversion operation on the migration data in the running state stage of the source virtual machine, thereby avoiding the problem of taking a long time to convert the data format of the migration data after the source virtual machine is shut down, thereby shortening the service interruption duration of the source virtual machine.
[0008] In one possible implementation, before performing a format conversion operation on the migration data of the first original disk where the target thread is migrated, the method also includes: monitoring whether second incremental data is generated in the first original disk within a first preset time length; the above-mentioned format conversion operation on the migration data of the first original disk where the target thread is migrated includes: if no second incremental data is generated in the first original disk within the first preset time length, then performing a format conversion operation on the migration data corresponding to the first original disk on the second server.
[0009] In the above embodiment, when it is determined that the first incremental data does not exist in the first original disk, whether the second incremental data is generated in the first original disk within a first preset time period is monitored. If the second incremental data is not generated, the data format of the migration data corresponding to the first original disk in the second server is converted, thereby avoiding the problem of subsequent frequent rollback operations resulting in a long time consumption.
[0010] In a possible implementation, if second incremental data is generated in the first original disk within a first preset time period, the second incremental data is determined to be the first incremental data.
[0011] In one possible implementation, the method further includes: after triggering a format conversion operation on the migration data of the first original disk for target thread migration, monitoring whether third incremental data is generated in the first original disk; when it is monitored that the third incremental data is generated in the first original disk, performing a rollback operation on the migration data corresponding to the first original disk on the second server, and the rollback operation is used to restore the migration data that has undergone the format conversion operation to the migration data that has not undergone the format conversion operation.
[0012] In the above embodiment, after triggering the format conversion operation on the migration data corresponding to the first original disk on the second server, the management device monitors whether the third incremental data is generated in the first original disk. When the third incremental data is generated, the migration data that has undergone the format conversion operation is restored to the migration data that has not undergone the format conversion operation, thereby avoiding the problem of dirty data in the migration data that has undergone the format conversion operation on the second server, and therefore improving the accuracy of the migration data on the second server.
[0013] In a possible implementation, the method further includes: when it is monitored that third incremental data is generated in the first original disk, determining the third incremental data as the first incremental data.
[0014] In a possible implementation, the method includes: when there is first incremental data in the first original disk, determining whether a shutdown condition is met; if the shutdown condition is met, shutting down the source virtual machine and performing a disk migration operation on multiple original disks.
[0015] In one possible implementation, the above-mentioned disk migration operation on multiple original disks includes: migrating the unmigrated data of multiple original disks to the second server through multiple different threads; performing format conversion operations on the migration data corresponding to each original disk on the second server through different threads; and starting the target virtual machine after completing the disk migration operation on the original disks.
[0016] In a possible implementation, the method further includes: if the shutdown condition is not met, migrating the unmigrated data in the multiple original disks to the second server through multiple threads.
[0017] The above embodiment migrates the data in the multiple original disks included in the source virtual machine to the second server through multiple threads. When the data in any disk (i.e., the first original disk) among the multiple original disks is migrated, it is determined whether the first original disk has the first incremental data. If the first original disk does not have the first incremental data, it is determined whether the management device meets the shutdown condition. When the shutdown condition is met, the source virtual machine is shut down, and the unmigrated data in the second original disk in the source virtual machine is cold migrated. Finally, the format conversion operation is performed on the migrated data corresponding to each original disk in the second server. When the shutdown condition is not met, the first incremental data is determined as unmigrated data, and the above method is looped until the shutdown condition is met. Since the above-mentioned shutdown condition includes the presence of data in the second server that is undergoing data format conversion (referred to as: conversion data), when there is conversion data in the second server, it is determined that the above-mentioned shutdown condition is not met, that is, the source virtual machine is not shut down, but the source virtual machine is shut down after waiting for the conversion of the conversion data to be completed, that is, when there is no conversion data in the above-mentioned second server, thereby avoiding the problem of a long business interruption due to a large amount of conversion data in the shutdown state, which results in a long time spent on converting the conversion data.
[0018] In one possible implementation, the shutdown conditions include: there is no migration data corresponding to the original disk that is undergoing data format conversion on the second server; and / or the predicted business interruption duration is less than a second preset duration; the business interruption duration is the predicted time required to migrate the unmigrated data in each original disk to the second server through different threads, and to convert the data format of the migration data corresponding to each original disk in the second server through different threads.
[0019] In the above embodiment, when there is migration data (referred to as conversion data) in the process of data format conversion in the second server, it is determined that the above shutdown condition is not met, that is, the source virtual machine is not shut down, but the source virtual machine is shut down after waiting for the conversion of the conversion data to be completed, that is, when there is no conversion data in the above second server, thereby avoiding the problem that the conversion of the conversion data is time-consuming due to the large amount of data in the shutdown state, thereby causing a long service interruption of the above source virtual machine.
[0020] In the above embodiment, when the predicted business interruption duration is greater than or equal to the second preset duration, it is determined that the above shutdown condition is not met, and the source virtual machine is not shut down; instead, when the business interruption duration is less than the above second preset duration, it is determined that the above shutdown condition is met, and the source virtual machine is shut down; because the above predicted business interruption duration is the predicted time required for cold migration of the unmigrated data in each original disk to the second server through different threads, and for data format conversion of the migration data corresponding to each original disk in the second server through the different threads; it can be seen that the above embodiment compresses the duration of the business interruption of the source virtual machine within the second preset duration, thereby avoiding the problem of a long business interruption duration of the source virtual machine due to the long time-consuming migration of the unmigrated data in each original disk and the data format conversion of the migration data corresponding to each disk in the second server after shutdown, thereby shortening the business interruption duration of the source virtual machine.
[0021] In a second aspect, an embodiment of the present application provides a data migration device, which includes: a migration unit, a data processing unit and a virtual machine processing unit; the migration unit is used to migrate data in multiple original disks to a second server through multiple threads when a source virtual machine on a first server is in a running state; the original disk is a disk of the source virtual machine, the second server includes a target disk, the target disk is a disk of the target virtual machine, and the disk format of the original disk is different from the disk format of the target disk; the data processing unit is used to migrate the target thread when there is a target thread that completes the data migration among the multiple threads and the first incremental data does not exist in the first original disk corresponding to the target thread The migration data of the first original disk is subjected to a format conversion operation, and the format conversion operation is used to indicate that the format of the migration data is converted into a disk format compatible with the target disk, and the first incremental data is the newly added data in the first original disk during the data migration process of the first original disk; the virtual machine processing unit is used to shut down the source virtual machine when the shutdown conditions are met; the data processing unit performs a disk migration operation on the second original disk, wherein the second original disk is the original disk corresponding to the thread that has not completed data migration and / or the original disk with incremental data, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and a format conversion operation is performed, and the unmigrated data includes the data that has not completed migration and / or the incremental data.
[0022] In one possible implementation, the data processing unit is used to monitor whether second incremental data is generated in the first original disk within a first preset time period; the data processing unit is used to perform format conversion operations on the migration data corresponding to the first original disk on the second server if no second incremental data is generated in the first original disk within the first preset time period.
[0023] In a possible implementation, the data processing unit is configured to determine that the second incremental data is the first incremental data if the second incremental data is generated in the first original disk within a first preset time period.
[0024] In one possible implementation, the data processing unit is used to monitor whether third incremental data is generated in the first original disk after triggering a format conversion operation on the migration data of the first original disk for target thread migration; the data processing unit is also used to perform a rollback operation on the migration data corresponding to the first original disk on the second server when it is monitored that the third incremental data is generated in the first original disk, and the rollback operation is used to restore the migration data that has undergone the format conversion operation to the migration data that has not undergone the format conversion operation.
[0025] In a possible implementation, the data processing unit is configured to determine the third incremental data as the first incremental data when it is detected that the third incremental data is generated in the first original disk.
[0026] In one possible implementation, the data processing unit is used to determine whether the shutdown condition is met when the first incremental data exists in the first original disk; the data processing unit is also used to shut down the source virtual machine and perform disk migration operations on multiple original disks if the shutdown condition is met.
[0027] In one possible implementation, the migration unit is used to migrate the unmigrated data of multiple original disks to the second server through multiple different threads; the data processing unit is used to perform format conversion operations on the migration data corresponding to each original disk on the second server through different threads; and the virtual machine processing unit is used to start the target virtual machine after completing the disk migration operation on the original disk.
[0028] In a possible implementation, the data processing unit is configured to migrate the unmigrated data in the multiple original disks to the second server through multiple threads if the shutdown condition is not met.
[0029] In one possible implementation, the shutdown conditions include: there is no migration data corresponding to the original disk that is undergoing data format conversion on the second server; and / or the predicted business interruption duration is less than a second preset duration; the business interruption duration is the predicted time required to migrate the unmigrated data in each original disk to the second server through different threads, and to convert the data format of the migration data corresponding to each original disk in the second server through different threads.
[0030] 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.
[0031] 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.
[0032] 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.
[0033] 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
[0034] Figure 1 A migration system usage diagram provided in an embodiment of the present application;
[0035] Figure 2 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application;
[0036] Figure 3 A schematic diagram of a data migration method provided in an embodiment of the present application;
[0037] Figure 4 A schematic diagram of another data migration method provided in an embodiment of the present application;
[0038] Figure 5 A schematic diagram of a method flow for predicting service interruption duration provided in an embodiment of the present application;
[0039] Figure 6 A schematic diagram of another data migration method provided in an embodiment of the present application;
[0040] Figure 7 A schematic diagram of original disk data migration provided in an embodiment of the present application;
[0041] Figure 8 A schematic diagram of a data migration device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] 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.
[0043] 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, a first server and a second server are used to distinguish different servers rather than to describe a specific order of the servers.
[0044] 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.
[0045] 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 original disks refer to two or more disks.
[0046] 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:
[0047] Data migration: refers to the action of copying data from one platform or computing device to another platform or computing device.
[0048] Cold migration: Cold migration is a type of data migration that is performed while the virtual machine is powered off.
[0049] Live migration: Live migration, also known as dynamic migration or real-time migration, is a method of migrating the data of a virtual machine while it is running. It usually preserves the running status of the entire virtual machine and can quickly restore it to the original hardware platform or even a different hardware platform.
[0050] 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.
[0051] Full data: refers to all data in the data warehouse.
[0052] An embodiment of the present application provides a data migration method, which, when the source virtual machine is in a running state, performs data hot migration on the disk of the source virtual machine as a unit, rather than on the virtual machine as a unit, that is, implements parallel migration of multiple original disks of the source virtual machine, and then, in the process of hot migration of data on each disk, under specific circumstances (such as: any disk among the multiple original disks completes a data migration, and there is no incremental data in the disk after the completion of the data migration), performs data format conversion on the migration data of the disk to the target host machine during the startup phase of the VM, thereby avoiding the problem of a long shutdown time of the VM (i.e., the time length during which the VM is in the shutdown state) due to the time-consuming data format conversion of the migration data during the shutdown phase of the VM, thereby reducing the duration of business interruption on the VM.
[0053] In some embodiments, a data migration method provided by an embodiment of the present application may specifically include: when a source virtual machine on a first server is in a running state, migrating data in multiple original disks to a second server through multiple threads; the original disk is the disk of the above-mentioned source virtual machine, and the second server includes a target disk, the target disk is the disk of the target virtual machine, and the disk format of the original disk is different from the disk format of the target disk; when there is a target thread that completes data migration among the above-mentioned multiple threads, and there is no first incremental data in the first original disk corresponding to the target thread, performing a format conversion operation on the migration data of the first original disk migrated by the target thread, and the format conversion operation is used to indicate that the format of the migration data is converted to be compatible with the disk format of the above-mentioned target disk, and the first incremental data is the newly added data in the first original disk during the data migration process of the above-mentioned first original disk; when the shutdown condition is met, shutting down the above-mentioned source virtual machine, and performing a disk migration operation on the second original disk, wherein the second original disk is the original disk corresponding to the thread that has not completed data migration and / or the original disk with incremental data, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and the format conversion operation is performed, and the unmigrated data includes the data and / or incremental data that have not completed migration.
[0054] In the above embodiment, the data in multiple original disks of the source virtual machine running on the first server are migrated to the second server through multiple threads; and when there is a target thread that completes the data migration among the multiple threads, and there is no incremental data in the first original disk corresponding to the target thread, when the source virtual machine is in the running state, the migration data migrated from the first original disk in the second server (i.e., the migration data of the first original disk migrated by the target thread) is format converted, so that the data format of the migration data is adapted to the disk format of the target disk included in the second server; finally, when the shutdown condition is met, the source virtual machine is shut down, and the original disk corresponding to the thread that has not completed the data migration and / or the original disk with incremental data (i.e., the second original disk) is subjected to a disk migration operation, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and the format conversion operation is performed, and the unmigrated data includes the data and / or incremental data that have not completed the migration. It can be seen that the above embodiment has begun to perform the format conversion operation on the migration data in the running state stage of the source virtual machine, thereby avoiding the problem of taking a long time to convert the data format of the migration data after the source virtual machine is shut down, thereby shortening the service interruption duration of the source virtual machine.
[0055] 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 example can be 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.
[0056] A virtual machine A to be migrated (i.e., source virtual machine) 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 notebook computer, and a server.
[0057] 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.
[0058] 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.
[0059] The management device 103 is used to read the metadata (such as memory size and number of processor cores) 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; then, the management device 103 writes the metadata and disk data of the virtual machine A into the host machine 102. Thereafter, the management device converts the data format of the disk data migrated to the host machine 102 so that the disk data after the data format conversion is adapted to the disk format of the disk in the host machine 102. Finally, the management device 103 creates a virtual machine A' based on the metadata and the disk data after the data format conversion; thereby realizing the migration of the virtual machine A to the host machine 102. Among them, 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.
[0060] It should be understood that the specific implementation of the management device 103 creating the virtual machine A' based on the metadata and the disk data after data format conversion includes: the management device 103 creates the 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 disk data after the data format conversion in the host machine 102 to the disk file of the virtual machine A', thereby realizing the creation of the virtual machine A'.
[0061] The above-mentioned management device 103 includes a heterogeneous migration module 1031 and a processing module 1032; wherein, the processing 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 (such as: the first original disk) completes a data migration, the processing module 1032 calls the thread corresponding to the first original disk to determine whether there is new data (that is, the first incremental data) in the first original disk during the last data migration process; when the first incremental data does not exist in the first original disk, the processing module 1032 is used to convert the data format of all data migrated from the first original disk in the host machine 102, so that the data format of all the converted data is adapted to the disk format of the disk in the second server; finally, the processing module 1032 starts the virtual machine A' in the host machine 102.
[0062] In a specific implementation, the processing module 1032 further includes: a pre-conversion algorithm module, a disk monitoring module, and a task execution module; wherein the pre-conversion algorithm module is used to determine whether to perform a format conversion operation on the migration data corresponding to the first original disk migrated to the host machine 102; and monitor whether there is incremental data on the first original disk through the disk monitoring module. The disk monitoring module is used to monitor whether incremental data appears on the first original disk when triggering a format conversion operation on the migration data corresponding to the first original disk; if incremental data appears on the first original disk of the source virtual machine (i.e., the above-mentioned virtual machine A), it triggers the data format of the migration data corresponding to the first original disk after format conversion to be rolled back to the migration data before format conversion. The task execution module is used to migrate the disk data of virtual machine A to the host machine 102, and perform a format conversion operation on the migrated disk data, as well as the above-mentioned rollback operation.
[0063] 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.
[0064] For example, Figure 2 It 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.
[0065] 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).
[0066] 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 2 As shown). The out-of-band management module may be a management unit of a non-business module. The out-of-band management module is completely independent of the operating system of the computing device and can communicate with the OS through the out-of-band management interface of the computing device.
[0067] 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.
[0068] 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.
[0069] 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.
[0070] 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.
[0071] 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 3 As shown, the method includes S110-S140.
[0072] S110: When the source virtual machine on the first server is in a running state, the management device migrates data in multiple original disks to the second server through multiple threads.
[0073] The above-mentioned second server includes a target disk, which is the disk of the target virtual machine in the second server; the target virtual machine is the virtual machine after the above-mentioned source virtual machine is migrated to the second server, that is, the target virtual machine is the virtual machine migrated from the source virtual machine to the second server; that is, the target virtual machine is a virtual machine generated based on the metadata of the source virtual machine.
[0074] The original disk is a disk in the source virtual machine; the disk format of the original disk is different from the disk format of the target disk.
[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 implementation method of migrating the data in the multiple original disks to the second server through the multiple threads is: migrating the first data in the multiple original disks included in the source virtual machine to the second server through different threads.
[0077] Exemplarily, when the multiple original disks in the above-mentioned source virtual machine include a first disk and a second disk, the specific implementation method of the above-mentioned S110 includes: migrating the first data in the first disk to the second server through the first thread, and at the same time, migrating the first data in the second disk to the second server through the second thread.
[0078] Among them, the above-mentioned first data is at least a part of the data in the above-mentioned original disk, and the at least a part of the data is the data in the original disk that has not been migrated to the second server; wherein, the first data includes: the full data in the original disk (that is, all data) or the fourth incremental data in the original disk.
[0079] Specifically, if the currently executed S110 is the first time to migrate the data in the original disk to the second server, since the data in the original disk has not been migrated to the second server, the first data 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 second server, the first data is the fourth incremental data of the original disk; wherein the fourth incremental data is the newly added data in the original disk during the last migration of the data in the original disk to the second server; that is, the fourth incremental data is the newly added data in the original disk during the last migration of the data in the original disk.
[0080] It should be understood that the fourth incremental data can be obtained by: obtaining a snapshot of the original disk A at the current moment (referred to as: the first snapshot); then, comparing the first snapshot with the snapshot of the original disk A 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 fourth incremental data. It can also be obtained by comparing all the data of the original disk A migrated in the second server with all the data of the original disk A in the source virtual machine at the current moment, obtaining the difference data, and the difference data is the fourth incremental data; the embodiment of the present application does not specifically limit the implementation method of obtaining the fourth incremental data.
[0081] Exemplarily, assume that the original disk A in the source virtual machine includes: data 1 and data 2; when the data in the original disk A is migrated to the second server for the first time, the first data includes: the data 1 and data 2; wherein, in the process of migrating the data in the original disk A, data 3 is newly added to the original disk A. When the data in the original disk A is migrated to the second server for the second time, the first data includes: the newly added data 3.
[0082] It should be noted that the specific implementation of the above-mentioned migration of data in the original disk to the second server can be to copy a snapshot of the data to be migrated (such as the first data) in the original disk to the second server; or it can be to read the first data in the original disk in the form of a character stream or a byte stream through an I / O stream, and write the read first data to the second server. The specific embodiments of the present application do not specifically limit this.
[0083] S120: When there is a target thread that completes data migration among multiple threads, the management device determines whether there is first incremental data on a first original disk corresponding to the target thread.
[0084] It should be understood that when there is a target thread among the above-mentioned multiple threads, the data (i.e., the first data) in the original disk (i.e., the first original disk) migrated by the target thread has been migrated; for example, assuming that the first thread is used to migrate the data in the original disk A, when the data migration in the original disk A is completed, the target thread among the multiple threads is the first thread.
[0085] The first original disk corresponding to the above-mentioned target thread is the original disk among multiple original disks, on which data migration is performed based on the target thread; when the source virtual machine includes a first disk and a second disk, the first original disk can be the first disk or the second disk. The specific embodiment of the present application is explained by taking the first original disk as the first disk as an example, and will not be repeated later.
[0086] The first incremental data is the newly added data in the first original disk during the process of the target thread performing data migration on the first original disk.
[0087] The implementation method of the above S120 includes: the management device determines whether there is any difference data between the data in the first original disk at the current moment and the data in the first original disk before data migration (that is, before executing the above S110); when there is difference data, there is first incremental data in the first original disk; when there is no difference data, there is no first incremental data in the first original disk.
[0088] For example: compare the snapshot of the first original disk at the current moment (referred to as the third snapshot) and the snapshot of the first original disk before data migration (referred to as the fourth snapshot). When the third snapshot is exactly the same as the fourth snapshot, it is determined that the first original disk does not have the first incremental data; when the third snapshot is different from the fourth snapshot, it is determined that the first original disk has the first incremental data.
[0089] S130: When the first incremental data does not exist in the first original disk, the management device performs a format conversion operation on the migration data of the first original disk migrated by the target thread.
[0090] The above-mentioned migration data is data in the first original disk migrated to the second server.
[0091] The above-mentioned format conversion operation is used to indicate that the data format of the above-mentioned migration data is converted into a disk format that is compatible with the disk format of the target disk in the above-mentioned second server; that is, the above-mentioned format conversion operation is an operation of converting the format of the above-mentioned migration data into a format that matches the disk format of the above-mentioned target disk; wherein, the specific implementation of converting the data format of the migration data refers to the prior art and will not be repeated here.
[0092] S140: When the shutdown condition is met, the management device shuts down the source virtual machine and performs a disk migration operation on the second original disk.
[0093] It should be noted that the specific implementation of the above-mentioned determination of whether the shutdown condition is met is referred to in the following S240, which will not be repeated here.
[0094] The implementation method of the management device shutting down the source virtual machine includes: the management device sends a shutdown instruction to the source virtual machine, and the source virtual machine responds to the shutdown instruction and performs a shutdown operation.
[0095] 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 disk, no new data will appear in the original disk of the source virtual machine after the source virtual machine is shut down.
[0096] The second original disk is the original disk corresponding to the thread that has not completed data migration (i.e., the original disk that has not completed data migration) and / or the original disk with incremental data. That is to say, if the original disk A in the current source virtual machine has not completed data migration, the original disk A is the second original disk; or if the original disk A has completed data migration, but there is incremental data (such as the first incremental data) in the original disk A, the original disk A is also the second original disk; if the original disk A has completed data migration and there is no incremental data, the original disk A is not the second original disk (i.e., the first original disk).
[0097] The above disk migration operation is used to indicate that the unmigrated data is migrated and format conversion is performed, and the unmigrated data includes data and / or incremental data that have not been migrated. Specifically, the disk migration operation includes: migrating the unmigrated data in the second original disk to the second server, and performing format conversion on the migrated data corresponding to the second original disk in the second server. For details, refer to S260-S270 below, which will not be repeated here.
[0098] For example, Figure 7As shown, it is assumed that the above-mentioned original disk includes original disk A and original disk B; the data in original disk A is migrated from time T1 by the first thread, and the data in original disk B (such as incremental data) is migrated from time T2 by the second thread. At time T2, the first thread (i.e., the target thread) completes the migration of the data of original disk A, and there is no incremental data in original disk A (i.e., the first original disk); so the first thread performs a format conversion operation on the migrated data of original disk A after migration; and completes the format conversion operation at time T3. Next, the first thread determines that no new data is generated in original disk A from time T3 to time TN; the first thread executes the shutdown operation of the source virtual machine. At time TN, original disk B has not completed the data migration, so when the first thread shuts down the source virtual machine, the second thread continues to perform the data migration operation on original disk B; at time TN+1, the second thread completes the data migration of original disk B, and the second thread performs a format conversion operation on the migrated data of original disk B after migration from time TN+1 to time TN+2.
[0099] In the above embodiment, the data in multiple original disks of the source virtual machine running on the first server are migrated to the second server through multiple threads; and when there is a target thread that completes the data migration among the multiple threads, and there is no incremental data in the first original disk corresponding to the target thread, when the source virtual machine is in the running state, the migration data migrated from the first original disk in the second server (i.e., the migration data of the first original disk migrated by the target thread) is format converted, so that the data format of the migration data is adapted to the disk format of the target disk included in the second server; finally, when the shutdown condition is met, the source virtual machine is shut down, and the original disk corresponding to the thread that has not completed the data migration and / or the original disk with incremental data (i.e., the second original disk) is subjected to a disk migration operation, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and the format conversion operation is performed, and the unmigrated data includes the data and / or incremental data that have not completed the migration. It can be seen that the above embodiment has begun to perform the format conversion operation on the migration data in the running state stage of the source virtual machine, thereby avoiding the problem of taking a long time to convert the data format of the migration data after the source virtual machine is shut down, thereby shortening the service interruption duration of the source virtual machine.
[0100] based on Figure 3 The data migration method shown in the present application provides a specific implementation method, such as Figure 4 As shown, the method includes: S210-S280.
[0101] S210: When the source virtual machine on the first server is in a running state, the management device migrates data in multiple original disks to the second server through multiple threads.
[0102] S220: When there is a target thread that completes data migration among multiple threads, the management device determines whether there is first incremental data on a first original disk corresponding to the target thread.
[0103] It should be noted that the implementation method of the above S210-S220 is consistent with the implementation method of S110-S120. For the specific description of S210-S220, please refer to the above related description of S110-S120, which will not be repeated here.
[0104] When the first incremental data does not exist in the first original disk, the management device executes the following S230.
[0105] When the first incremental data exists in the first original disk, the management device executes the following S240.
[0106] S230: The management device performs a format conversion operation on the migration data of the first original disk.
[0107] In one implementation, the implementation of S230 is consistent with that of S130. For the specific description of S230, reference may be made to the above description of S130, which will not be repeated here.
[0108] In another implementation, the implementation of the above S230 is specifically referred to the following S310-S350, which will not be repeated here.
[0109] S240: The management device determines whether the shutdown condition is met.
[0110] The above shutdown conditions include: a first condition and / or a second condition, which are as follows:
[0111] The first condition is that there is no migration data corresponding to the original disk on the second server that is undergoing data format conversion (i.e., format conversion operation); that is, the above-mentioned first condition is that when a thread corresponding to an original disk is executing S240, there is no thread corresponding to other original disks that is performing format conversion operation on the migration data corresponding to the other disks on the second server.
[0112] It should be understood that the migration data corresponding to an original disk is the data migrated from the original disk on the first server, that is, the migration data corresponding to the original disk A in the second server is the data migrated from the original disk A of the source virtual machine in the second server. For example, after the full data of disk 1 of virtual machine A (such as: the full data is data A) is migrated to the second server, the migration data corresponding to disk 1 in the second server is data A in the second server.
[0113] Exemplarily, assuming that the multiple original disks of the source virtual machine include a first disk and a second disk; when the thread corresponding to the first disk (hereinafter referred to as the first thread) executes S240, if at this time, the second thread corresponding to the second disk performs data format conversion (i.e., performs a format conversion operation) on the migration data corresponding to the second disk on the second server, the management device determines that the first condition is not satisfied. If at this time, the second thread does not perform data format conversion on the migration data corresponding to the second disk on the second server, the management device determines that the first condition is satisfied.
[0114] In the above embodiment, when there is migration data (referred to as conversion data) in the process of data format conversion in the second server, it is determined that the above shutdown condition is not met, that is, the source virtual machine is not shut down, but the source virtual machine is shut down after waiting for the conversion of the conversion data to be completed, that is, when there is no conversion data in the above second server, thereby avoiding the problem that the conversion of the conversion data is time-consuming due to the large amount of data in the shutdown state, thereby causing a long service interruption of the above source virtual machine.
[0115] The second condition is that the predicted business interruption duration is less than the second preset duration; the business interruption duration is the predicted time required to migrate the unmigrated data in each original disk to the second server through different threads, and to perform format conversion operations on the migrated data corresponding to each original disk in the second server through different threads.
[0116] The unmigrated data in an original disk is the data in the original disk that has not been migrated to the second server at the current moment; that is, the unmigrated data includes: data that has not been migrated and / or incremental data. The incremental data is the newly added data in the original disk when the data was migrated last time.
[0117] Specifically, for example, when the migration of the first data in an original disk is completed (such as: the original disk is the first original disk), the unmigrated data in the original disk is the above-mentioned first incremental data (that is, the newly added data in the original disk during the process of migrating the first data in the original disk). When the migration of the first data in an original disk is not completed, the unmigrated data in the original disk includes: the unfinished migrated data in the original disk and the first incremental data of the original disk; when the migration of the first data in an original disk is not completed, and the original disk does not have the first incremental data, the unmigrated data in the original disk includes: the unfinished migrated data in the original disk; wherein the unfinished migrated data is the data that currently needs to be migrated (such as: the first data) of the original disk that has not been migrated.
[0118] Exemplarily, assuming that the multiple original disks of the source virtual machine include a first disk and a second disk, the management device calls the first thread to migrate the first data in the first disk, and calls the second thread to migrate the first data in the second disk; and assuming that after the migration of the first data in the first disk is completed, the data A in the first data (including data A and data B) of the second disk is migrated. Then, at this time, the unmigrated data of the first disk is the newly added data (i.e., the first incremental data) in the first disk during the process of migrating the first data of the first disk. The unmigrated data of the second disk includes the data B in the first data of the second disk, and the first incremental data of the second disk during the process of migrating the data A in the first data of the second disk. If there is no newly added data, the data A of the second disk includes the above-mentioned data B.
[0119] The above-mentioned method for predicting the duration of the above-mentioned business interruption is as follows: Figure 5 As shown, the method includes: S240a-240d.
[0120] S240a: The management device predicts the migration duration of each original disk based on the amount of unmigrated data on each original disk and the data migration speed of each original disk.
[0121] The data migration speed of the above-mentioned original disk can be the average migration speed among the historical data migration speeds of the original disk, or the minimum migration speed among the historical data migration speeds of the original disk, or the preset migration speed of the original disk. The specific embodiments of the present application do not specifically limit it.
[0122] The specific implementation of the above S240a includes: determining the quotient of the amount of unmigrated data on each original disk and the data migration speed of each original disk as the migration duration of each original disk; wherein the migration duration of an original disk is the time required to migrate the unmigrated data in the original disk to the second server.
[0123] Exemplarily, assume that the multiple original disks in the source virtual machine include a first disk and a second disk; wherein the amount of unmigrated data in the first disk is 512mb, and the data migration speed of the first disk is 256mb / s; the amount of unmigrated data in the second disk is 640mb, and the data migration speed of the second disk is 384mb / s; then, the migration time of the first disk is 512mb÷256mb / s, that is, the migration time of the first disk is 2s; the migration time of the second disk is 640mb÷384mb / s, that is, the migration time of the second disk is 1.7s.
[0124] S240b: The management device predicts the conversion time of each original disk based on the amount of migration data corresponding to each original disk in the second server and the data conversion speed of each original disk.
[0125] It should be noted that the data conversion speed of the above-mentioned original disk is the speed of converting the data format of the migration data corresponding to the original disk; wherein, the data conversion speed of the original disk can be the average conversion speed of the conversion speed of the historical data of the original disk, or the minimum conversion speed of the conversion speed of the historical data of the original disk, or the preset conversion speed corresponding to the original disk, and the specific embodiments of the present application do not specifically limit it.
[0126] The specific implementation of the above S240b includes: determining the conversion time of each original disk as the quotient of the data volume of the migration data corresponding to each original disk in the second server and the data conversion speed of each original disk; wherein, the conversion time of an original disk is the time required to perform the format conversion operation on the migration data corresponding to the original disk in the second server.
[0127] Exemplarily, assume that the multiple original disks in the source virtual machine include a first disk and a second disk; wherein, the data volume of the migrated data corresponding to the first disk in the second server is 768mb, and the data conversion speed of the first disk is 512mb / s; the data volume of the migrated data corresponding to the second disk in the second server is 1024mb, and the data conversion speed of the second disk is 640mb / s; then, the conversion time of the first disk is 768mb÷512mb / s, that is, the conversion time of the first disk is 1.5s; the conversion time of the second disk is 1024mb÷640mb / s, that is, the conversion time of the second disk is 1.6s.
[0128] S240c: The management device determines the predicted duration of each original disk by summing the migration duration of each original disk and the conversion duration of each original disk.
[0129] The predicted duration of the original disk is the sum of the migration duration of the original disk and the conversion duration of the original disk.
[0130] Exemplarily, based on the examples in S240a and S240b, the migration duration of the first disk is 2s, and the conversion duration of the first disk is 1.5s; the migration duration of the second disk is 1.7s, and the conversion duration of the second disk is 1.6s. Then, the predicted duration of the first disk is 2s+1.5s, that is, the predicted duration of the first disk is 3.5s; the predicted duration of the second disk is 1.7s+1.6s, that is, the predicted duration of the second disk is 3.3s.
[0131] S240d. The management device determines the service interruption duration by taking the maximum duration among the predicted durations of the original disks.
[0132] Based on the example in S240c above, the predicted duration of the first disk is 3.5s, and the predicted duration of the second disk is 3.3s. Since the predicted duration of the first disk is greater than that of the second disk, the service interruption duration determined above is 3.5s.
[0133] In the above embodiment, when the predicted business interruption duration is greater than or equal to the second preset duration, it is determined that the above shutdown condition is not met, and the source virtual machine is not shut down; instead, when the business interruption duration is less than the above second preset duration, it is determined that the above shutdown condition is met, and the source virtual machine is shut down; because the above predicted business interruption duration is the predicted time required for cold migration of the unmigrated data in each original disk to the second server through different threads, and for data format conversion of the migration data corresponding to each original disk in the second server through the different threads; it can be seen that the above embodiment compresses the duration of the business interruption of the source virtual machine within the second preset duration, thereby avoiding the problem of a long business interruption duration of the source virtual machine due to the long time-consuming migration of the unmigrated data in each original disk and the data format conversion of the migration data corresponding to each disk in the second server after shutdown, thereby shortening the business interruption duration of the source virtual machine.
[0134] When the above-mentioned shutdown condition is not met, the management device determines the above-mentioned first incremental data as the above-mentioned first data (that is, unmigrated data), and executes the above-mentioned S110 on the new first data; that is, the management device migrates the unmigrated data in the above-mentioned multiple original disks to the above-mentioned second server through multiple threads, and repeats this process until the above-mentioned shutdown condition is met.
[0135] When the above shutdown conditions are met, the following S250 is executed.
[0136] S250: The management device shuts down the source virtual machine.
[0137] The above-mentioned shutting down of the source virtual machine is actually switching the state of the source virtual machine from the running state to the shutting down state; the specific implementation includes: the management device sends a shutdown instruction to the source virtual machine, and the source virtual machine responds to the shutdown instruction and executes the shutdown operation.
[0138] 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 disk, no new data will appear in the original disk of the source virtual machine after the source virtual machine is shut down.
[0139] S260: The management device migrates the unmigrated data of the original disk to the second server through different threads.
[0140] In one implementation, when the original disk includes a first disk and a second disk, the specific implementation of S260 includes: the management device cold migrates the unmigrated data in the first disk to the second server through a first thread, and at the same time, the management device cold migrates the unmigrated data in the second disk to the second server through a second thread.
[0141] In another implementation, when the above-mentioned original disk includes a first disk and a second disk, and the above-mentioned first original disk is the first disk, the specific implementation of the above-mentioned S260 includes: the management device cold migrates the unmigrated data in the first disk to the second server through the first thread; the management device cold migrates the incompletely migrated data in the unmigrated data of the second disk to the second server through the second thread, and at the same time, cold migrates the incremental data (such as: the first incremental data) in the unmigrated data of the second disk to the second server through the third thread.
[0142] It should be noted that, when the data in the first disk has been migrated, the unmigrated data in the first disk is the incremental data in the first disk.
[0143] The above embodiment cold migrates the unfinished migrated data and incremental data in the unmigrated data of the second disk through different threads, avoiding the problem that the incremental data needs to wait until the migration of the unfinished migrated data is completed before migrating, thereby improving the migration efficiency of the unmigrated data in the second disk.
[0144] S270: The management device performs format conversion operations on the migration data corresponding to each original disk on the second server through different threads.
[0145] The specific implementation of the above S270 includes: in the case where the multiple original disks in the source virtual machine include a first disk and a second disk, the specific implementation of the above S270 includes: the management device performs a format conversion operation on the migration data corresponding to the first disk on the second server through a first thread, and at the same time, the management device performs a format conversion operation on the migration data corresponding to the second disk on the second server through a second thread.
[0146] It should be understood that, when the first incremental data exists in the above-mentioned first original disk, the above-mentioned S260-S270 performs disk migration operations on multiple original disks included in the source virtual machine; when the first incremental data does not exist in the above-mentioned first original disk, the above-mentioned S260-S270 performs disk migration operations on the second original disk in the source virtual machine.
[0147] S280: The management device starts the target virtual machine on the second server.
[0148] The above-mentioned target virtual machine is the source virtual machine migrated to the second server, that is, the target virtual machine is the source virtual machine after migration; since the data in the original disk of the source virtual machine has been migrated to the second server, and the data format of the migration data corresponding to each original disk on the second server has been converted, the migration data corresponding to each original disk can be operated based on the target disk of the target virtual machine.
[0149] The specific implementation of the above S280 includes: the management device sends a start request to the second server, and the second server responds to the start 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 service.
[0150] The above embodiment migrates the data in the multiple original disks included in the source virtual machine to the second server through multiple threads. When the data in any disk (i.e., the first original disk) among the multiple original disks is migrated, it is determined whether the first original disk has the first incremental data. If the first original disk does not have the first incremental data, it is determined whether the management device meets the shutdown condition. When the shutdown condition is met, the source virtual machine is shut down, and the unmigrated data in the second original disk in the source virtual machine is cold migrated. Finally, the format conversion operation is performed on the migrated data corresponding to each original disk in the second server. When the shutdown condition is not met, the first incremental data is determined as unmigrated data, and the above method is looped until the shutdown condition is met. Since the above-mentioned shutdown condition includes the presence of data in the second server that is undergoing data format conversion (referred to as: conversion data), when there is conversion data in the second server, it is determined that the above-mentioned shutdown condition is not met, that is, the source virtual machine is not shut down, but the source virtual machine is shut down after waiting for the conversion of the conversion data to be completed, that is, when there is no conversion data in the above-mentioned second server, thereby avoiding the problem of a long business interruption due to a large amount of conversion data in the shutdown state, which results in a long time spent on converting the conversion data.
[0151] based on Figure 4 The data migration method shown in the present application provides a specific implementation method, such as Figure 6 As shown, the specific implementation of the above S230 includes: S310-S350.
[0152] S310. The management device monitors whether second incremental data is generated in the first original disk within a first preset time period.
[0153] The implementation method of the above S310 includes: the management device periodically monitors whether the second incremental data is generated in the first original disk within a first preset time period; its specific implementation includes: when it is determined that the above first incremental data does not exist in the first original disk, the thread corresponding to the first original disk (such as: the first thread) is put to sleep for a predetermined time, and after the predetermined time, a snapshot of the current first original disk is obtained and compared with the snapshot of the first original disk before sleeping. If there is difference data between the two snapshots, it is determined that the first original disk has generated the second incremental data within the first preset time period. If there is no difference data between the above two snapshots, the first thread sleeps again for a predetermined time, and so on. When the first thread sleeps for a number of times equal to the preset number of times, if no incremental data is detected in the first original disk, it is determined that the second incremental data is not generated within the first preset time period.
[0154] When the first original disk generates second incremental data within the first preset time period, the management device determines the second incremental data as the first incremental data, and the management device executes the above-mentioned operation process of S240.
[0155] When the first original disk does not generate the second incremental data within the first preset time period, the management device simultaneously executes the following S320 and S330.
[0156] In the above embodiment, when it is determined that the first incremental data does not exist in the first original disk, whether the second incremental data is generated in the first original disk within a first preset time period is monitored. If the second incremental data is not generated, the data format of the migration data corresponding to the first original disk in the second server is converted, thereby avoiding the problem of subsequent frequent rollback operations resulting in a long time consumption.
[0157] S320: The management device performs a format conversion operation on the migration data corresponding to the first original disk on the second server.
[0158] It should be noted that the implementation method of the above S320 is consistent with the implementation method of S130. For the specific description of S320, please refer to the above related description of S130, which will not be repeated here.
[0159] S330. The management device monitors whether third incremental data is generated in the first original disk through a fourth thread.
[0160] The third incremental data is the newly added data generated by the first original disk after the above S320 is triggered.
[0161] It should be noted that the specific implementation method of the above S330 includes: after triggering the above S320, the management device periodically monitors whether a third incremental number is generated in the first original disk based on a fourth thread; wherein the fourth thread is not the same thread as the thread executing the above S320.
[0162] When the management device does not detect the generation of the third incremental data in the first original disk, the management device executes the following S340.
[0163] When the management device detects that the third incremental data is generated in the first original disk, the management device executes the following S350.
[0164] S340: The management device determines whether the source virtual machine is in a shutdown state.
[0165] When the source virtual machine is in a shutdown state, the management device releases the fourth thread and releases the thread corresponding to the first original disk.
[0166] When the source virtual machine is in the powered-on state, the management device continues to periodically execute the above S330, and repeats this process until the management device is powered off or detects that the first target virtual machine generates the third incremental data.
[0167] S350: The management device performs a rollback operation on the migration data corresponding to the first original disk on the second server.
[0168] The roll operation is used to restore the migrated data that has undergone the format conversion operation to the migrated data that has not undergone the format conversion operation.
[0169] In the above embodiment, after triggering the format conversion operation on the migration data corresponding to the first original disk on the second server, the management device monitors whether the third incremental data is generated in the first original disk. When the third incremental data is generated, the migration data that has undergone the format conversion operation is restored to the migration data that has not undergone the format conversion operation, thereby avoiding the problem of dirty data in the migration data that has undergone the format conversion operation on the second server, and therefore improving the accuracy of the migration data on the second server.
[0170] It should be noted that after the above rollback operation is completed, the management device determines the third incremental data as the first incremental data, and the management device executes the above operation process of S240.
[0171] 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.
[0172] The embodiment of the present application can divide the data 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.
[0173] In the case of dividing each functional module into corresponding functional modules, Figure 8 A possible structural diagram of the data migration device involved in the above embodiment is shown. Figure 8 As shown, the data migration device 800 includes: a migration unit 801 , a data processing unit 802 and a virtual machine processing unit 803 .
[0174] The migration unit 801 is used to migrate data in multiple original disks to the second server through multiple threads when the source virtual machine on the first server is in operation; for example, execute step S110 or S210 in the above method embodiment.
[0175] The data processing unit 802 is used to perform format conversion operations on the migration data of the first original disk migrated by the target thread when there is a target thread that completes data migration among multiple threads and the first incremental data does not exist in the first original disk corresponding to the target thread; for example, execute steps S120-S130 in the above method embodiment.
[0176] The virtual machine processing unit 803 is used to shut down the source virtual machine when the shutdown condition is met; for example, executing step S140 or S250 in the above method embodiment.
[0177] The data processing unit 802 is used to perform a disk migration operation on the second original disk; for example, to perform step S140 in the above method embodiment.
[0178] Optionally, the data processing unit 802 is used to monitor whether the second incremental data is generated in the first original disk within a first preset time period; for example, executing step S310 in the above method embodiment.
[0179] The data processing unit 802 is used to perform a format conversion operation on the migration data corresponding to the first original disk on the second server if no second incremental data is generated in the first original disk within the first preset time period; for example, execute step S320 in the above method embodiment.
[0180] Optionally, the data processing unit 802 is configured to determine that the second incremental data is the first incremental data if second incremental data is generated in the first original disk within a first preset time period.
[0181] Optionally, the data processing unit 802 is used to monitor whether third incremental data is generated in the first original disk after triggering the format conversion operation on the migration data of the first original disk of the target thread migration; for example, executing step S330 in the above method embodiment.
[0182] The data processing unit 802 is used to perform a rollback operation on the migration data corresponding to the first original disk on the second server when monitoring that the third incremental data is generated in the first original disk; for example, execute step S350 in the above method embodiment.
[0183] Optionally, the data processing unit 802 is configured to determine the third incremental data as the first incremental data when it is detected that the third incremental data is generated in the first original disk.
[0184] Optionally, the data processing unit 802 is used to determine whether the shutdown condition is met when the first incremental data exists in the first original disk; for example, execute step S240 in the above method embodiment.
[0185] The virtual machine processing unit 803 is used to shut down the source virtual machine if the shutdown condition is met; for example, executing step S250 in the above method embodiment.
[0186] The virtual machine processing unit 803 is used to perform disk migration operations on multiple original disks; for example, perform steps S260-S270 in the above method embodiment.
[0187] Optionally, the migration unit 801 is configured to migrate the unmigrated data of multiple original disks to the second server through multiple different threads.
[0188] The data processing unit 802 is used to perform format conversion operations on the migration data corresponding to each original disk on the second server through different threads.
[0189] The virtual machine processing unit 803 is used to start the target virtual machine after completing the disk migration operation on the original disk.
[0190] Optionally, the migration unit 801 is configured to migrate the unmigrated data in the multiple original disks to the second server through multiple threads if the shutdown condition is not met.
[0191] Optionally, the above-mentioned shutdown conditions include: there is no migration data corresponding to the original disk that is undergoing data format conversion on the second server; and / or the predicted business interruption duration is less than a second preset duration; the business interruption duration is the predicted time required to migrate the unmigrated data in each original disk to the second server through different threads, and to convert the data format of the migration data corresponding to each original disk in the second server through different threads.
[0192] Each unit of the above-mentioned data migration device can also be used to execute other actions in the above-mentioned method embodiment. All relevant contents of each step involved in the above-mentioned method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0193] 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.
[0194] 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.
[0195] For the explanation of the relevant contents and description of the beneficial effects of 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.
[0196] 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.
[0197] 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)).
[0198] 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.
[0199] 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.
[0200] 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.
[0201] 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.
[0202] 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.
[0203] 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, It is characterized in that include: When the source virtual machine on the first server is in a running state, data in the multiple original disks are migrated to the second server through multiple threads; The original disk is a disk of the source virtual machine, the second server includes a target disk, the target disk is a disk of the target virtual machine, and a disk format of the original disk is different from a disk format of the target disk; When there is a target thread that completes data migration among the multiple threads, and there is no first incremental data in the first original disk corresponding to the target thread, a format conversion operation is performed on the migration data of the first original disk migrated by the target thread, wherein the format conversion operation is used to indicate that the format of the migration data is converted to be compatible with the disk format of the target disk, and the first incremental data is the newly added data in the first original disk during the data migration process on the first original disk; When the shutdown conditions are met, the source virtual machine is shut down and a disk migration operation is performed on the second original disk, wherein the second original disk is the original disk corresponding to the thread that has not completed data migration and / or the original disk with incremental data, and the disk migration operation is used to indicate that the migration of the unmigrated data is completed and a format conversion operation is performed, and the unmigrated data includes the data that has not completed migration and / or the incremental data.
2. The data migration method according to claim 1, It is characterized in that Before performing a format conversion operation on the migration data of the first original disk migrated by the target thread, the method further includes: Monitoring whether second incremental data is generated in the first original disk within a first preset time period; The performing a format conversion operation on the migration data of the first original disk migrated by the target thread includes: If the second incremental data is not generated in the first original disk within the first preset time period, a format conversion operation is performed on the migration data corresponding to the first original disk on the second server.
3. The data migration method according to claim 2, It is characterized in that If the second incremental data is generated in the first original disk within the first preset time period, the second incremental data is determined to be the first incremental data.
4. The data migration method according to any one of claims 1 to 3, It is characterized in that The method further comprises: After triggering the format conversion operation on the migration data of the first original disk for the target thread migration, monitoring whether third incremental data is generated in the first original disk; When it is monitored that the third incremental data is generated in the first original disk, a rollback operation is performed on the migration data corresponding to the first original disk on the second server, and the rollback operation is used to restore the migration data that has undergone the format conversion operation to the migration data that has not undergone the format conversion operation.
5. The data migration method according to claim 4, It is characterized in that The method further comprises: When it is monitored that the third incremental data is generated in the first original disk, the third incremental data is determined as the first incremental data.
6. The data migration method according to any one of claims 1 to 5, It is characterized in that The method comprises: In the case where the first incremental data exists in the first original disk, determining whether the shutdown condition is met; If the shutdown condition is met, the source virtual machine is shut down, and the disk migration operation is performed on the multiple original disks.
7. The data migration method according to claim 6, It is characterized in that The performing the disk migration operation on the multiple original disks includes: Migrating the unmigrated data of the multiple original disks to the second server through multiple different threads; Performing format conversion operations on the migration data corresponding to each original disk on the second server through different threads; After completing the disk migration operation on the original disk, the target virtual machine is started.
8. The data migration method according to claim 6 or 7, It is characterized in that The method further comprises: If the shutdown condition is not met, the unmigrated data in the multiple original disks is migrated to the second server through multiple threads.
9. The data migration method according to any one of claims 1 to 8, It is characterized in that The shutdown condition includes: there is no migration data corresponding to the original disk undergoing data format conversion on the second server; and / or, The predicted business interruption duration is less than the second preset duration; the business interruption duration is the predicted time required to migrate the unmigrated data in each of the original disks to the second server through different threads, and to convert the data format of the migrated data corresponding to each of the original disks in the second server through the different threads.
10. A computing device, It is 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.
