Method, device, system and computer-readable storage medium for hot migration of virtual machines

By performing full and incremental backups during virtual machine live migration, and utilizing the mapping relationship of the distributed storage system, the amount of data transmission during virtual machine migration is reduced, the problem of long virtual machine live migration is solved, and the migration efficiency is improved. efficiency and resource utilization.

CN111857944BActive Publication Date: 2024-10-01BEIJING DIDI INFINITY TECH & DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910365413.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-04-30
Publication Date
2024-10-01
Estimated Expiration
2040-04-01

AI Technical Summary

Technical Problem

Existing virtual machine live migration technology takes a long time, mainly due to the large amount of image data of the virtual machine, which causes the migration process to take a long time and consumes a high amount of bandwidth and resources on the source host.

Method used

By fully backing up the virtual machine image to a distributed storage system, and periodically recording and backing up incremental data, we can reduce the amount of image data directly transferred from the source host during migration, and use distributed object storage block devices and network blocks. Device mapping relationships enable rapid migration of virtual machines.

Benefits of technology

It significantly reduces the time-consuming process of live migration, reduces the read and write operations and bandwidth consumption of the source host, improves resource scheduling efficiency, and quickly completes the migration of virtual machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111857944B_ABST
    Figure CN111857944B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, system and computer-readable storage medium for hot migration of a virtual machine, the method comprising: backing up the image of the virtual machine in the source host machine to a distributed storage system; when the virtual machine meets the preset conditions for hot migration, migrating the virtual machine from the source host machine to the target host machine, wherein the target image of the migrated virtual machine in the target host machine includes the backup image copied from the distributed storage system. Compared with the existing solution of migrating all images of the virtual machine from the source host machine, most or all of the data of the image of the virtual machine in the target host machine in the present application comes from the backup image, which reduces the amount of image data transmitted directly from the source host machine to the target host machine, thereby reducing the total time consumption of the hot migration process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual machine technology, and in particular to a method, device, system and computer-readable storage medium for hot migration of a virtual machine. Background Art

[0002] Hot migration, also known as dynamic migration or real-time migration, refers to moving a virtual machine from one physical server to another without interrupting business. During hot migration, the virtual machine can be used normally, so users are unaware of the migration process.

[0003] Most of the current hot migration technologies migrate the image and memory of the virtual machine stored in the source host to the target host. However, due to the large amount of hot migration data of the virtual machine, the overall hot migration process takes a long time.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] In view of this, the purpose of the present application is to provide a method, device, system and computer-readable storage medium for hot migration of a virtual machine, so as to reduce the time consumption of the overall hot migration process.

[0006] In view of this, on the first aspect, the present application provides a method for hot migration of a virtual machine, which is applied to a virtual machine system, wherein the virtual machine system includes a source host machine of the virtual machine, a distributed storage system and a target host machine of the virtual machine, and the method includes: backing up the image of the virtual machine in the source host machine to the distributed storage system; when the virtual machine meets the preset conditions for hot migration, migrating the virtual machine from the source host machine to the target host machine, wherein the target image of the migrated virtual machine in the target host machine includes the backup image copied from the distributed storage system.

[0007] Therefore, compared with the existing solution of migrating all images of the virtual machine from the source host machine, in the present application, most or all of the data of the image of the virtual machine in the target host machine comes from the backup image, which reduces the amount of image data transmitted directly from the source host machine to the target host machine, thereby reducing the total time consumption of the hot migration process.

[0008] In a possible implementation, the image of the virtual machine in the source host machine is backed up to a distributed storage system, including: when the virtual machine is initially created in the source host machine, all the image data of the virtual machine is backed up to the distributed storage system; after the virtual machine is created, the incremental data of the image of the virtual machine is periodically recorded, and the incremental data is periodically backed up to the distributed storage system, wherein the incremental data of the image of the virtual machine is the difference data between the current image and the image after the last backup.

[0009] Therefore, the present application improves the backup efficiency by combining full backup and incremental backup.

[0010] In a possible implementation, a first network block device NBD is created in the source host machine, a reliable autonomous distributed object storage block device RBD is created in the distributed storage system, and the first NBD and the RBD have a first mapping relationship; wherein, all the image data of the virtual machine is backed up to the distributed storage system, including: backing up all the image data to the RBD in the distributed storage system through the first NBD; periodically backing up the incremental data to the distributed storage system, including backing up the incremental data to the RBD in the distributed storage system through the first NBD.

[0011] In a possible implementation, periodically recording the incremental data of the image of the virtual machine includes: periodically recording the incremental data of the image of the virtual machine through a bitmap in the image of the virtual machine.

[0012] In one possible implementation, migrating a virtual machine from a source host machine to a target host machine includes: determining the incremental data to be migrated of the virtual machine's image, wherein the incremental data to be migrated is the difference data between the current image and the image after the last backup, and the incremental data to be migrated is the image data that has not been uploaded to the distributed storage system; migrating the incremental data to be migrated and the backup image in the distributed storage system to the target image in the target host machine.

[0013] Therefore, most or all of the image data of the virtual machine in this application is copied from the distributed storage system and does not need to be migrated from the source host machine, thereby reducing the read and write operations of the source host machine and saving the bandwidth consumption of the source host machine during the hot migration process.

[0014] In one possible implementation, an RBD is created in a distributed storage system, a second network block device NBD is created in a target host machine, and the second NBD has a second mapping relationship with the RBD; wherein, the incremental data to be migrated and the backup image in the distributed storage system are migrated to the target image in the target host machine, including: migrating the incremental data to be migrated to the target image in the target host machine through the network, and migrating the backup image in the distributed storage system to the target image in the target host machine through the second NBD and RBD.

[0015] In the second aspect, the present application provides a management device for hot migration of a virtual machine, which is applied to a virtual machine system, wherein the virtual machine system includes a source host machine of the virtual machine, a distributed storage system and a target host machine of the virtual machine, and includes: a backup module, used to back up the image of the virtual machine in the source host machine to the distributed storage system; a migration module, used to migrate the virtual machine from the source host machine to the target host machine when the virtual machine meets the preset conditions for hot migration, wherein the target image of the migrated virtual machine in the target host machine includes the backup image copied from the distributed storage system.

[0016] In one possible implementation, the backup module includes: a backup unit, which is used to back up all image data of the virtual machine to a distributed storage system when the virtual machine is initially created in a source host machine; a recording backup unit, which is used to periodically record incremental data of the virtual machine's image after the virtual machine is created, and periodically back up the incremental data to the distributed storage system, wherein the incremental data of the virtual machine's image is the difference data between the current image and the image after the last backup.

[0017] In a possible implementation, a first NBD is created in the source host machine, an RBD is created in the distributed storage system, and the first NBD and the RBD have a first mapping relationship; wherein the backup unit is further used to back up all mirror data to the RBD in the distributed storage system through the first NBD; and the record backup unit is further used to back up incremental data to the RBD in the distributed storage system through the first NBD.

[0018] In a possible implementation manner, the recording backup unit is further configured to periodically record incremental data of the image of the virtual machine through a bitmap in the image of the virtual machine.

[0019] In one possible implementation, the migration module includes: a determination unit, used to determine the incremental data to be migrated of the virtual machine's image, wherein the incremental data to be migrated is the difference data between the current image and the image after the last backup, and the incremental data to be migrated is the image data that has not been uploaded to the distributed storage system; a migration unit, used to migrate the incremental data to be migrated and the backup image in the distributed storage system to the target image in the target host machine.

[0020] In one possible implementation, an RBD is created in a distributed storage system, a second NBD is created in a target host machine, and the second NBD has a second mapping relationship with the RBD; wherein the migration unit is also used to migrate the incremental data to be migrated to the target image in the target host machine through the network, and to migrate the backup image in the distributed storage system to the target image in the target host machine through the second NBD and RBD.

[0021] In a third aspect, the present application provides a system for implementing hot migration of virtual machines, the system comprising: a source host machine, a target host machine, a distributed storage system, and a management device for hot migration of virtual machines according to any one of the second aspects; the source host machine is used to back up the image of the virtual machine to the distributed storage system according to the backup instruction sent by the management device; the target host machine is used to create a target image of the virtual machine according to the migration instruction sent by the management device, wherein the target image includes a backup image copied from the distributed storage system.

[0022] In a fourth aspect, the present application provides an electronic device, which may include: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of any method in the first aspect.

[0023] In a fifth aspect, the present application provides a computer-readable storage medium, which may store a computer program, and when the computer program is executed by a processor, the steps of any method in the first aspect are executed.

[0024] In order to make the above-mentioned objectives, features and advantages to be achieved by the embodiments of the present application more obvious and understandable, the following specifically cites preferred embodiments and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 A schematic diagram of a scenario of an existing method for hot migration of a virtual machine is shown;

[0027] Figure 2 A schematic diagram of a scenario of an optional method for hot migration of a virtual machine provided in an embodiment of the present application is shown;

[0028] Figure 3 A flowchart of a method for hot migration of a virtual machine provided in an embodiment of the present application is shown;

[0029] Figure 4 A flowchart of step S310 in a method for hot migration of a virtual machine provided in an embodiment of the present application is shown;

[0030] Figure 5A flowchart of step S320 in a method for hot migration of a virtual machine provided in an embodiment of the present application is shown;

[0031] Figure 6 and Figure 7 A schematic diagram of performing a full backup of an image in a source host machine provided by an embodiment of the present application is shown;

[0032] Figure 8 A schematic diagram of performing incremental backup of an image in a source host machine provided by an embodiment of the present application is shown;

[0033] Fig. 9 A schematic diagram showing a first NBD and RBD disconnection mapping and a second NBD and RBD establishment mapping provided in an embodiment of the present application is shown;

[0034] Fig.10 A schematic diagram of creating a target image on a target host provided by an embodiment of the present application is shown;

[0035] Fig.11 A schematic diagram of migrating incremental data and memory of an image from a source host machine provided by an embodiment of the present application is shown;

[0036] Fig.12 A schematic diagram of copying a backup image from a ceph distributed file system provided by an embodiment of the present application is shown;

[0037] Fig.13 A schematic diagram of the structure of a virtual machine hot migration management device provided in an embodiment of the present application is shown;

[0038] Fig.14 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0039] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0040] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] In order to facilitate understanding of the technical solution of the present application, the execution steps of the existing hot migration solution are described below.

[0043] Please refer to Figure 1 , Figure 1 A schematic diagram of a scenario of an existing method for hot migration of a virtual machine is shown. Figure 1 As shown, the source host machine 110 and the target host machine 120 are connected to each other through a network, wherein virtual machine VM1 and its image, as well as virtual machine VM2 and its image are created in the source host machine 110, and virtual machine VM3 and its image are created in the target host machine 120. When the virtual machines in the source host machine 110 meet the preset conditions for hot migration, virtual machine 1 in the source host machine 110 can be migrated to the target host machine 120. Of course, it can be understood that multiple virtual machines in the source host machine 110 can also be migrated in parallel.

[0044] In addition, the above-mentioned step of migrating the virtual machine VM1 in the source host machine 110 to the target host machine 120 includes:

[0045] Step 1: Use block-mirror technology to start copying the virtual machine image.

[0046] Step 2: After the first image copy is completed, start migrating the virtual machine memory and continue to iterate the copy image.

[0047] Step 3: When the remaining virtual machine memory and image data are small enough, the virtual machine VM1 in the source host machine 110 is suspended, and the remaining memory and image data are migrated to the target host machine 120 .

[0048] Step 4: The virtual machine in the target host machine 120 is started and continues to run. Meanwhile, since the virtual machine is suspended for a very short time, the user operating the virtual machine is unaware of it.

[0049] In the above existing hot migration scheme, step 1 is to copy the image of the virtual machine VM1 by block-mirror technology, and the time of the first image copy depends on the size of the image. For example, when the image size of the virtual machine VM1 copied for the first time is 480GB, the bandwidth used for hot migration is 2.4GB (300MB), so the time consumed for the first copy is about 1600 seconds. However, during the hot migration of the virtual machine, if the bandwidth utilization rate of the source host machine 110 has reached the bottleneck, compared with the available bandwidth resources at this time, the bandwidth resources of the source host machine 110 will be very tight if the bandwidth of 2.4GB is used for hot migration. In addition, if the bandwidth that can be used for hot migration is smaller, this situation will cause the first copy time to be longer, and then during the first copy period, the user will write more data, and then the time of the second copy data will be longer, and so on, which is a vicious circle, so that the existing hot migration scheme will cause the time consumed to migrate the virtual machine VM1 from the source host machine 110 to be very long. In addition, the resources occupied by the virtual machine on the source host machine 110 for migration will take a long time to be released, so it will also reduce the resource scheduling efficiency of the source host machine 110.

[0050] Therefore, in order to solve some of the above problems or issues, the present application performs a full backup of the image of the virtual machine initially created in the source host machine 110, and backs up all the image data of the image to the cloud distributed storage system 130. After the virtual machine is running, the image of the virtual machine is periodically backed up incrementally, and the incremental data is stored in the distributed storage system 130. When the source host machine 110 fails or the resource utilization reaches a bottleneck, hot migration will be triggered. When hot migration is performed on the specified virtual machine in the source host machine 110, only the incremental data of the virtual machine in the source host machine 110 that has not been uploaded to the distributed storage system 130 can be migrated to the target host machine 120. Since the incremental data at this time is very small, the above step 1 can be completed quickly, so that the hot migration process can quickly enter step 2. After the memory migration of the virtual machine is completed, the other image data of the specified virtual machine is copied from the distributed storage system 130 to ensure that the specified virtual machine can run normally. Therefore, compared with step 1 in the existing hot migration solution, the present application can at least reduce the amount of mirrored data migrated from the source host machine 110, thereby reducing the bandwidth consumption of the source host machine 110 during the hot migration process.

[0051] Please refer to Figure 2 , Figure 2 A schematic diagram of a scenario of an optional method for hot migration of a virtual machine provided in an embodiment of the present application. Figure 2 As shown, the source host machine 110 is connected to the target host machine 120 via a network 140. The source host machine 110 and the target host machine 120 include but are not limited to: supercomputers, mainframes, minicomputers, microcomputers or other physical devices capable of running virtual machines.

[0052] In addition, multiple virtual machines and multiple virtual machine images may be created in the source host machine 110, and correspondingly, multiple virtual machines and multiple virtual machine images may also be created in the target host machine 120. It should be noted that the present application does not limit the type of virtual machine. For example, the virtual machine may be a Xen virtual machine, a KVM (Kernel Virtual Machine), a HyperV virtual machine (Microsoft's virtualization technology), etc., all of which should be within the scope of protection of the present application.

[0053] In addition, the source host machine 110 is also connected to the distributed storage system 130 via the network 140, and correspondingly, the target host machine 120 is also connected to the distributed storage system 130 via the network 140. It should be noted that the present application does not limit the type of the distributed storage system 130. For example, in addition to being a server cluster, the distributed storage system 130 can also be a cloud storage system such as Baidu Cloud and Huawei Cloud, which should all be within the scope of protection of the present application.

[0054] In addition, the source host machine 110, the target host machine 120 and the distributed storage system 130 are all connected to the control node 150 via the network 140. The control node 150 may be a management device for hot migration of virtual machines, which can control the hot migration process of virtual machines.

[0055] It should be pointed out that although Figure 1 An example of a management device for hot migration of a virtual machine is given in the specification, but those skilled in the art should understand that the management device for hot migration of a virtual machine can be integrated into the source host machine 110 or the target host machine 120 in addition to being a separate control node 150, and the present application does not limit this.

[0056] In addition, it should be noted that in the implementation of the present application, the above-mentioned network 140 includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and each device in the system is connected through the network 140 via a corresponding interface.

[0057] According to the above Figure 2 The contents described in the scenario of the method of hot migration of virtual machines are combined with Figure 3 The method for hot migration of a virtual machine provided in an embodiment of the present application is described in detail.

[0058] In order to facilitate understanding of the embodiments of the present application, several elements introduced in the description of the embodiments of the present application are first introduced here:

[0059] VM (virtual machine): It means that one or more virtual computers can be simulated on a physical computer through virtual machine software, and these virtual machines work like real computers. Operating systems and applications can be installed on virtual machines. Virtual machines can also access network 140 resources. For applications running in virtual machines, the virtual machines are like working in real computers.

[0060] Host machine: It is the physical machine that runs the virtual machines.

[0061] qemu-kvm (virtual machine process): it is set on the host machine (including the source host machine 110 and the target host machine 120). Each virtual machine corresponds to a qemu-kvm process.

[0062] Image: It is a storage file of a virtual machine. The virtual machine system and the data of the virtual machine are stored in the storage file. The storage file can be stored locally on the host machine or in the distributed storage system 130. In addition, a virtual machine can have multiple images, each of which can be stored locally or in the distributed storage system 130.

[0063] Block-backup (online backup): It includes full block backup and incremental block backup modes. Full backup mode refers to a complete copy of all data or applications at a certain point in time; incremental backup is for the last backup (regardless of the backup mode), backing up all the data that has changed since the last backup. At the same time, the incremental mode is not affected by virtual machine startup and shutdown and hot migration.

[0064] Bitmap: It is used when a bitmap is added to a file. The bitmap can record the data written since its existence. And, after each backup of the file, the bitmap can re-record the data written in the file, so that each subsequent backup only needs to back up the changed data or differential data compared with the previous one.

[0065] Block-mirror (online copy): It is used for online copy. Since online copy is an iterative process and new data will be written during the copy process, all data will be copied for the first time, and then the difference data from the last copy process will be copied each time.

[0066] RBD (RADOS (Reliable Autonomic Distributed Object Store) BLOCK DEVICE, also known as RADOS block device): multiple RBDs can be configured. Multiple RBDs can be mapped one-to-one with multiple corresponding NBDs.

[0067] NBD (Network Block Device): It is used to map a remote host's disk space or a RADOS block device on the distributed storage system 130 to a local NBD through a network protocol. In the present application scenario, each backup image in the distributed storage system 130 has a corresponding NBD in the host machine.

[0068] In the present application, NBD (including the first NBD and the second NBD) establishes a network connection with the RBD in the distributed system 130 through a network address to form a logical one-to-one mapping.

[0069] map (establish mapping): it means to establish a mapping between two devices.

[0070] unmap (disconnect mapping): It means to cancel the mapping between two devices.

[0071] qcow2: It is a format of image. If a backing file is specified when a qcow2 file is created, all read operations will penetrate the underlying image, and all write operations will act on the newly created image. In addition, the newly created image can be backed up to the underlying image, and the underlying image can be pulled into the newly created image. In this application, the subsequent Figures 6 to 12 The image of the virtual machine in the specific embodiment may be qcow2.

[0072] Reference Figure 3 As shown, Figure 3 A flowchart of a method for hot migration of a virtual machine provided in an embodiment of the present application is shown, and the method comprises the following steps:

[0073] Step S310 , backing up the image of the virtual machine in the source host machine 110 to the distributed storage system 130 .

[0074] It should be understood that the source host machine 110 can also be called a source end or a source physical machine. Correspondingly, the target host machine 120 can also be a target end or a target source host. This application does not limit this.

[0075] The step S310 may include a step S311 , in which when a virtual machine is initially created in the source host machine 110 , all image data of the virtual machine is backed up to the distributed storage system 130 .

[0076] In step S311, when the virtual machine and the image of the virtual machine are initially created in the source host machine 110, one or more first devices can also be created in the source host machine 110, and the first devices can be mapped one-to-one with the image of the virtual machine, wherein the first devices can be used to send the backup data (including all the image data and incremental data) of the image of the virtual machine in the source host machine 110 to the distributed storage system 130.

[0077] The management device of virtual machine hot migration can configure the mapping relationship between the image of the initially created virtual machine and the first device, and send the configured mapping relationship to the source host machine 110 by issuing instructions. The source host machine 110 configures the mapping between the image of the virtual machine and the first device according to the received instructions.

[0078] In addition, it is of course understandable that the mapping relationship between the above-mentioned image and the first device can also be configured by the source host machine 110 itself, and then the source host machine 110 will upload the mapping relationship between the configured virtual machine's image and the first device to the virtual machine hot migration management device, so that the virtual machine's hot migration management device can control the subsequent hot migration process.

[0079] In addition, a target device having a one-to-one mapping relationship with the first device may also be provided in the distributed storage system 130, that is, a first device is associated with a target device. The target device may be used to back up the image data of the virtual machine, and the target device may store an index path of the image data backed up by the first device to facilitate rapid search for related image data. Of course, it can be understood that the configuration process of the first mapping relationship between the first device and the target device (the first mapping relationship may be a one-to-one mapping) is similar to the process of the mapping relationship between the image and the first device, and will not be repeated here.

[0080] In addition, the management device of the virtual machine hot migration will also control the virtual machine's image to perform a full backup so as to back up all the image data of the virtual machine's image to the distributed storage system 130. The specific process is as follows: through the first mapping relationship between the first device and the target device, all the image data of the virtual machine's image is backed up to the corresponding target device in the distributed storage system 130.

[0081] It should also be understood that the specific device types of the first device and the target device can be set according to actual needs. For example, the first device can be a first NBD, and the target device can be an RBD, but the implementation of this application is not limited thereto.

[0082] This step S310 may further include step S312 , which is to periodically record incremental data of the virtual machine's image after the virtual machine is created, and back up the incremental data to the distributed storage system 130 .

[0083] Optionally, a bitmap is provided in the image of the virtual machine in the source host machine 110 , and the bitmap can record difference data between the image at the current time and the image after the last backup, wherein the difference data includes newly added data and deleted data.

[0084] It should also be understood that although the embodiments of the present application give examples of methods for recording incremental data, technicians with this skill should understand that the incremental data of the virtual machine can also be recorded in other ways, as long as the incremental data can be determined, and the implementation of the present application is not limited to this.

[0085] In step S312, after determining the difference data between the image of the virtual machine currently backed up and the image after the last backup, the determined incremental data can be backed up to the corresponding block device in the distributed storage system 130 through the first mapping relationship between the first device and the target device, thereby realizing the incremental backup of the image of the virtual machine. In addition, it should be understood that for the same image, the target device storing all the image data of the full backup and the target device storing the incremental data of the incremental backup are the same target device.

[0086] In addition, the incremental data backup process can also be understood as the process of updating the full image data in the distributed storage system 130. Correspondingly, the subsequent process of copying the backup image from the distributed storage system 130 can also be understood as the process of copying the full image data in the distributed storage system 130.

[0087] Optionally, in a case where a predetermined time period is used as a preset periodic time, incremental data recording the image of the virtual machine may be periodically acquired, and the incremental data may be periodically backed up to the distributed storage system 130 .

[0088] For example, in a case where the cycle time is 5 minutes, the incremental data of the image 5 minutes after the virtual machine is created is recorded through a bitmap, and when the time is 5 minutes after the virtual machine is created, the incremental data is backed up to the RBD in the distributed storage system 130 through the first mapping relationship between the first NBD and the RBD, and the above steps are repeated subsequently and will not be repeated here.

[0089] It should also be understood that although the cycle time is exemplified above, technicians in this field can also set the cycle time according to actual needs, as long as it is guaranteed that incremental data can be uploaded, and the embodiments of the present application are not limited to this.

[0090] Step S320, when the virtual machine meets the preset conditions for hot migration, migrate the virtual machine from the source host machine 110 to the target host machine 120, wherein the target image of the migrated virtual machine in the target host machine 120 includes a backup image copied from the distributed storage system 130, and the backup image is the image backup data stored in the block device in the distributed storage system 130.

[0091] It should be understood that the preset conditions for the above-mentioned hot migration may be a failure of the source host machine 110, or a failure of the RAID card of the source host machine 110 causing a sharp drop in the read / write performance of the virtual machine, or the load of the source host machine 110 reaching a bottleneck, and this application does not limit this.

[0092] Reference Figure 4 As shown, Figure 4 The specific steps of step S320 in a method for hot migration of a virtual machine are shown. Step S320 may include step S321, when a second device is created in the target host machine 120, disconnecting the first mapping relationship between the first device and the target device, and establishing a second mapping relationship between the target device and the second device.

[0093] In step S321, the management device for hot migration of virtual machines determines whether the virtual machines in the source host machine 110 meet the preset conditions for hot migration. When the management device for hot migration of virtual machines determines that the virtual machines meet the preset conditions for hot migration, the management device for hot migration of virtual machines may migrate at least one virtual machine in the source host machine 110 according to the operating status of the virtual machines.

[0094] In addition, the virtual machine hot migration management device can also send an instruction containing a second mapping relationship between the second device and the target device to the target host machine 120 according to the information of the at least one designated virtual machine determined. According to the above instruction, the target host machine 120 creates a second device having a second mapping relationship with the target device in the target host machine 120. In addition, the second device can be mapped one-to-one with the target device.

[0095] In addition, after the second device in the target host machine 120 is created, the target host machine 120 can feed back the creation completion to the hot migration management device of the virtual machine. After the hot migration management device of the virtual machine determines that the second device is created, the hot migration management device of the virtual machine can send an instruction to disconnect or unbind the first mapping relationship between the first device and the target device to the source host machine 110, so that the source host machine 110 disconnects the mapping between the first device and the target device according to the above instruction.

[0096] In addition, the hot migration management device of the virtual machine can also send an instruction to establish a second mapping relationship or binding between the second device and the target device to the target host machine 120, so that the target host machine 120 establishes a mapping association between the second device and the target device according to the above instruction.

[0097] In addition, it is of course understandable that the settings of the above-mentioned second device can also be set by the target host machine 120 itself, and then the source host machine 110 uploads the situation of the second device to the virtual machine hot migration management device, so that the virtual machine hot migration management device can control the subsequent hot migration process.

[0098] The step S320 may include a step S322 of creating an empty target image on the target host machine 120 , where a mapping relationship exists between the empty target image and the second device.

[0099] In step S322, the hot migration management device of the virtual machine creates an empty target image on the target host machine 120, and the empty target image is an empty target image, and the empty target image has the same specifications as the image of the virtual machine on the source end, wherein the empty target image is used to receive the backup image copied from the distributed storage system 130 and the incremental data copied from the source host machine 110 that has not been uploaded to the distributed storage system 130 or the incremental data to be migrated.

[0100] In addition, the above-mentioned target image may have a one-to-one correspondence with the second device, and may also have a one-to-one correspondence with the image of the specified migrated virtual machine in the source host machine 110 (that is, the structure of the specified migrated virtual machine in the source host machine 110 is the same as the structure of the target image of the virtual machine in the target host machine 120).

[0101] In addition, the image of the virtual machine in the source host machine 110 has the same specifications as the target image of the virtual machine in the target host machine 120. For example, the size of the image of the virtual machine in the source host machine 110 may be consistent with the size of the target image of the virtual machine in the target host machine 120. For another example, the name of the image of the virtual machine in the source host machine 110 may be consistent with the name of the target image of the virtual machine in the target host machine 120, which is not limited in this application.

[0102] The step S320 may further include a step S323 of migrating the incremental data of the image of the virtual machine and the memory of the virtual machine on the source host machine 110 to the target host machine 120 .

[0103] In step S323, optionally, when the time point when the mapping between the first device corresponding to the virtual machine and the target device is disconnected is the time point when the image of the virtual machine has just uploaded incremental data (that is, there is no incremental data in the image of the virtual machine), the memory of the virtual machine can be subsequently migrated to the target host machine 120 only through the network 140.

[0104] Optionally, when the mapping between the first device corresponding to the virtual machine and the target device is disconnected at a time when the image of the virtual machine in the source host machine 110 has incremental data, the hot migration management device of the virtual machine controls the source host machine 110 to migrate the incremental data of the image of the virtual machine to the corresponding target image in the target host machine 120 through the network 140. Subsequently, after the incremental data migration of the image of the virtual machine is completed, the hot migration management device of the virtual machine controls the source host machine 110 to migrate the memory of the virtual machine to the target host machine 120.

[0105] The step S320 may further include a step S324 of migrating the backup image stored in the target device in the distributed storage system 130 to the target host machine 120 .

[0106] In step S320, when the target device in the distributed storage system 130 and the second device in the target host machine 120 have a second mapping relationship (the second mapping relationship may be a one-to-one mapping), the backup image stored in the target device in the distributed storage system 130 may be migrated to the target image in the target host machine 120 through the second device, thereby restoring the virtual machine to the state before the hot migration.

[0107] The method provided in the embodiment of the present application backs up the image of the virtual machine in the source host machine 110 to the distributed storage system 130, and subsequently migrates the backup image in the distributed storage system 130 to the target image in the target host machine 120. Compared with the existing hot migration scheme in which the data amount of the first copy of the image when copying the image from the source host machine 110 is large, since most or all of the data of the image of the virtual machine on the target host machine 120 in the present application comes from the backup image in the distributed storage system 130, this reduces the amount of image data transmitted directly from the source host machine 110 to the target host machine 120, thereby reducing the time consumption of the hot migration process.

[0108] In addition, for most of the mirrored data copied for the first time in the traditional hot migration process, in the scenario of the present application, it is not necessary to read from the source host machine 110, thereby reducing the read and write operations of the source host machine 110.

[0109] In addition, since most of the image data is copied from the distributed storage system 130, only a small part of the image data is copied locally from the source host machine 110, compared with the existing solution in which all the image data is migrated from the source host machine 110, it can reduce the total time consumption of hot migration and quickly complete the hot migration process of the virtual machine. In addition, the resources occupied by the virtual machine migration on the source host machine 110 can also be released more quickly.

[0110] In order to facilitate understanding of the technical solution of the present application, the technical solution of the present application is described below by taking the first device as the first NBD, the target device as the RBD, the second device as the second NBD, and the distributed storage system 130 as the ceph distributed file system 131 as an example. In addition, it should be understood that other first devices, target devices, second devices, and other distributed storage systems are also applicable, and the embodiments of the present application are not limited thereto.

[0111] 1. When a virtual machine is created, a full backup of the virtual machine's image is performed.

[0112] A) Figure 6 As shown, an RBD is created in the ceph distributed file system 131 , and there is a one-to-one mapping relationship between the RBD and a first NBD in the source host machine 110 .

[0113] Among them, the first NBD is first connected to the RBD through the network 140, and then the virtual machine process qemu-kvm writes data to the first NBD, and the first NBD stores the written data in the RBD. In addition, when the virtual machine corresponding to the virtual machine process qemu-kvm reads data from the first NBD, the RBD will send the corresponding data to the first NBD. In addition, qemu-kvm can also perform read and write operations (r / w) on the image.

[0114] B) Figure 7 As shown, based on the block-backup mechanism, all the image data of the image in the source host machine 110 are stored in the RBD in the ceph distributed file system 131 through the first mapping relationship between the first NBD and the RBD.

[0115] 2. After the virtual machine is created, periodically perform incremental backups of the virtual machine's image.

[0116] like Figure 8 As shown, the management device of virtual machine hot migration drives the virtual machine process qemu-kvm to perform a backup increment every 5 minutes. In the backup increment, a bitmap is set in the image, which is a disk status bitmap created during the incremental backup process. It records the image data updated between two incremental backup operations, wherein the image data can be a disk image block.

[0117] In addition, based on the block-backup mechanism, the incremental data of the image of the virtual machine in the source host machine 110 is stored in the corresponding RBD in the ceph distributed file system 131 through the first mapping relationship between the first NBD and the RBD.

[0118] 3. Thermal migration process

[0119] A) When the virtual machine in the source host machine 110 meets the preset hot migration conditions, the mapping between the RBD in the ceph distributed file system 131 and the first NBD in the source host machine 110 is disconnected, that is, the unmap operation is performed.

[0120] In addition, a mapping is established between the RBD in the ceph distributed file system 131 and the second NBD in the target host 120, that is, a map operation is performed.

[0121] B) Fig.10 As shown, the management device for hot migration of virtual machines creates a target image in the target host machine 120, and uses the second NBD as the underlying image to make the target image on the target host machine 120. The newly generated empty target image has the same specifications as the image in the source host machine 110, wherein the specifications include name, size, etc., and the underlying image is a part of the image in the target image. The target image is used to receive the image data sent by the source host machine 110 during the disk migration process in step C).

[0122] Furthermore, it should be understood that Fig.10In order to distinguish the image in the source host machine 110 from the image in the target host machine 120, the image in the source host machine 110 is represented as an image, and the image in the target host machine 120 is represented as a target image. The names and sizes of these two images are the same, and they are only described here for distinction.

[0123] C) Fig.11 As shown, the virtual machine process qemu-kvm migrates the incremental data to be migrated marked in the bitmap or the disk image block data corresponding to the incremental data to be migrated through the incremental data to be migrated recorded in the bitmap used for incremental backup (it has not yet been stored in the RBD). After the migration of the incremental data to be migrated is completed, the memory data of the virtual machine in the source host machine 110 is migrated to the target host machine 120.

[0124] D) Fig.12 As shown, on the target host machine 120, through the second mapping relationship between RBD and the second NBD, the backup image in the corresponding RBD in the ceph distributed file system 131 is merged into the target image, thereby restoring the image structure of the virtual machine to the state before the hot migration.

[0125] E) Continue to perform incremental backup on the image of the virtual machine in the target host machine 120.

[0126] It should be understood that the above-mentioned method of hot migration of virtual machines is only exemplary, and those skilled in the art may make various modifications based on the above-mentioned method.

[0127] Combined with the previous article Figures 2 to 12 The method for hot migration of a virtual machine in an embodiment of the present application is described below. Fig.13 A management device for hot migration of virtual machines according to an embodiment of the present application is described.

[0128] See also Fig.13 , Fig.13 The management device 1300 for hot migration of virtual machines provided in the embodiment of the present application is shown. It should be understood that the management device 1300 is similar to the above-mentioned Figures 3 to 5Corresponding to the method embodiment, each step involved in the above method embodiment can be executed. The specific functions of the management device 1300 can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here. Specifically, the management device 1300 is applied to a virtual machine system, which includes a source host machine 110 of the virtual machine, a distributed storage system 130 and a target host machine 120 of the virtual machine. The management device 1300 includes: a backup module 1301, which is used to back up the image of the virtual machine in the source host machine 110 to the distributed storage system 130; a migration module 1302, which is used to migrate the virtual machine from the source host machine 110 to the target host machine 120 when the virtual machine meets the preset conditions for hot migration, wherein the target image of the migrated virtual machine in the target host machine 120 includes the backup image copied from the distributed storage system 130.

[0129] In one possible implementation, the backup module 1301 includes: a backup unit (not shown), which is used to back up all image data of the virtual machine to the distributed storage system 130 when the virtual machine is initially created in the source host machine 110; a recording backup unit (not shown), which is used to periodically record the incremental data of the virtual machine's image after the virtual machine is created, and periodically back up the incremental data to the distributed storage system 130, wherein the incremental data of the virtual machine's image is the difference data between the current image and the image after the last backup.

[0130] In a possible implementation, a first NBD is created in the source host machine 110, an RBD is created in the distributed storage system 130, and the first NBD and the RBD have a first mapping relationship; wherein the backup unit is further used to back up all mirror data to the RBD in the distributed storage system 130 through the first NBD; and the record backup unit is further used to back up incremental data to the RBD in the distributed storage system 130 through the first NBD.

[0131] In a possible implementation manner, the recording backup unit is further configured to periodically record incremental data of the image of the virtual machine through a bitmap in the image of the virtual machine.

[0132] In one possible implementation, the migration module 1302 includes: a determination unit (not shown) for determining the incremental data to be migrated of the virtual machine's image, wherein the incremental data to be migrated is the difference data between the current image and the image after the last backup, and the incremental data to be migrated is the image data that has not been uploaded to the distributed storage system 130; a migration unit (not shown) for migrating the incremental data to be migrated and the backup image in the distributed storage system 130 to the target image in the target host machine 120.

[0133] In one possible implementation, an RBD is created in the distributed storage system 130, a second NBD is created in the target host machine 120, and the second NBD has a second mapping relationship with the RBD; wherein the migration unit is also used to migrate the incremental data to be migrated to the target image in the target host machine 120 through the network 140, and to migrate the backup image in the distributed storage system 130 to the target image in the target host machine 120 through the second NBD and RBD.

[0134] In the embodiment of the present application, by backing up the image of the virtual machine in the source host machine 110 to the distributed storage system 130, and subsequently migrating the backup image in the distributed storage system 130 to the target image in the target host machine 120, compared with the existing hot migration scheme in which the data amount of the first copy of the image when copying the image from the source host machine 110 is large, since most or all of the data of the image of the virtual machine on the target host machine 120 in the present application comes from the backup image in the distributed storage system 130, this reduces the amount of image data transmitted directly from the source host machine 110 to the target host machine 120, thereby reducing the time consumption of the hot migration process.

[0135] An embodiment of the present application also provides a system for implementing hot migration of a virtual machine, the system comprising a source host machine 110 for a virtual machine, a distributed storage system 130, a target host machine 120 for a virtual machine, and a management device for hot migration of the virtual machine of any of the above items; the source host machine 110 is used to back up the image of the virtual machine to the distributed storage system 130 according to a backup instruction sent by the management device; the target host machine 120 is used to create a target image of the virtual machine according to a migration instruction sent by the management device, wherein the target image includes a backup image copied from the distributed storage system 130.

[0136] like Fig.14 As shown, the embodiment of the present application further provides an electronic device 1400, including: a processor 1401, a storage medium 1402 and a bus 1403, the storage medium 1402 stores machine-readable instructions executable by the processor 1401, when the electronic device 1400 is running, the processor 1401 communicates with the storage medium 1402 through the bus, and the processor 1401 executes the machine-readable instructions to perform the following Figures 3 to 5 The steps of any method.

[0137] The above-mentioned processor 1401 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0138] In addition, the above-mentioned storage medium 1402 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM) and direct RAM bus random access memory (DRRAM). The storage media 1402 described herein is intended to comprise, but not be limited to, these and any other suitable types of memory.

[0139] The present application also provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor. Figures 3 to 5 The steps of the method.

[0140] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is executed, the above-mentioned virtual machine hot migration method can be executed.

[0141] The skilled person can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules 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 through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0142] The modules described as separate components may or may not be physically separated, and the components shown as modules 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.

[0143] 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.

[0144] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0145] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which 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 method for hot migration of a virtual machine, characterized in that: Applied to a virtual machine system, the virtual machine system includes a source host machine of the virtual machine, a distributed storage system and a target host machine of the virtual machine, the method includes: Backing up the image of the virtual machine in the source host machine to the distributed storage system; When the virtual machine meets the preset conditions for hot migration, the virtual machine is migrated from the source host machine to the target host machine, wherein the target image of the migrated virtual machine in the target host machine includes the backup image copied from the distributed storage system; The backing up the image of the virtual machine in the source host machine to the distributed storage system includes: When the virtual machine is initially created in the source host machine, all image data of the virtual machine is backed up to the distributed storage system; After the virtual machine is created, incremental data of the image of the virtual machine is periodically recorded, and the incremental data is periodically backed up to the distributed storage system, wherein the incremental data of the image of the virtual machine is the difference data between the current image and the image after the last backup.

2. The method according to claim 1, characterized in that: A first network block device NBD is created in the source host machine, a reliable autonomous distributed object storage block device RBD is created in the distributed storage system, and the first NBD has a first mapping relationship with the RBD; The step of backing up all the image data of the virtual machine to the distributed storage system includes: Backing up all the mirrored data to the RBD in the distributed storage system through the first NBD; The periodically backing up the incremental data to the distributed storage system includes: The incremental data is backed up to the RBD in the distributed storage system through the first NBD.

3. The method according to claim 1 or 2, characterized in that: The periodic recording of the incremental data of the image of the virtual machine includes: The incremental data of the image of the virtual machine is periodically recorded through a bitmap in the image of the virtual machine.

4. The method according to claim 1, characterized in that: The migrating the virtual machine from the source host machine to the target host machine includes: Determine the incremental data to be migrated of the image of the virtual machine, wherein the incremental data to be migrated is the difference data between the current image and the image after the last backup, and the incremental data to be migrated is the image data that has not been uploaded to the distributed storage system; The incremental data to be migrated and the backup image in the distributed storage system are migrated to the target image in the target host machine.

5. The method according to claim 4, characterized in that An RBD is created in the distributed storage system, a second network block device NBD is created in the target host, and the second NBD has a second mapping relationship with the RBD; The step of migrating the incremental data to be migrated and the backup image in the distributed storage system to the target image in the target host includes: The incremental data to be migrated is migrated to the target image in the target host machine through the network, and the backup image in the distributed storage system is migrated to the target image in the target host machine through the second NBD and the RBD.

6. A management device for virtual machine hot migration, characterized in that: Applied to a virtual machine system, the virtual machine system includes a source host machine of the virtual machine, a distributed storage system and a target host machine of the virtual machine, including: A backup module, used to back up the image of the virtual machine in the source host machine to the distributed storage system; A migration module, configured to migrate the virtual machine from the source host machine to the target host machine when the virtual machine meets a preset condition for hot migration, wherein the target image of the migrated virtual machine in the target host machine includes a backup image copied from the distributed storage system; The backup module includes a backup unit and a record backup unit, wherein the backup unit is used to back up all the image data of the virtual machine to the distributed storage system when the virtual machine is initially created in the source host machine; The recording and backup unit is used to periodically record the incremental data of the image of the virtual machine after the virtual machine is created, and periodically back up the incremental data to the distributed storage system, wherein the incremental data of the image of the virtual machine is the difference data between the current image and the image after the last backup.

7. The management device according to claim 6, characterized in that: A first network block device NBD is created in the source host machine, a reliable autonomous distributed object storage block device RBD is created in the distributed storage system, and the first NBD has a first mapping relationship with the RBD; The backup unit is further configured to back up all the mirrored data to the RBD in the distributed storage system through the first NBD; The record backup unit is also used to back up the incremental data to the RBD in the distributed storage system through the first NBD.

8. A system for implementing hot migration of virtual machines, characterized in that: include: A source host machine, a target host machine, a distributed storage system, and a management device for hot migration of a virtual machine as claimed in claim 6 or 7; The source host machine is used to back up the image of the virtual machine to the distributed storage system according to the backup instruction sent by the management device; The target host machine is used to create a target image of the virtual machine according to the migration instruction sent by the management device, wherein the target image includes a backup image copied from the distributed storage system.

9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as claimed in claims 1 to 5.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are executed.