Virtual machine migration method, device, system, and storage medium

By comparing the memory management methods of target devices and source devices, determining the virtual machine creation method, and realizing the memory and device status migration of the virtual machine, solving the problem of virtual machine hot migration failure caused by different host memory management methods, and realizing virtual machine hot migration across different memory management methods.

CN113312138BActive Publication Date: 2025-05-09ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010463771.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-27
Publication Date
2025-05-09
Estimated Expiration
2040-05-27

AI Technical Summary

Technical Problem

Due to different memory management methods on different hosts, it is impossible to perform hot migration of virtual machines.

Method used

By obtaining the memory management method of the target device, comparing the memory management method with the source device, determining the creation method of the target virtual machine running on the target device based on the comparison results, and migrating the memory and device status of the source virtual machine running on the source device to the target virtual machine created in the above creation method.

Benefits of technology

It realizes hot migration of virtual machines between hosts with different memory management methods, and solves the problem of hot migration failure caused by different memory management methods of different hosts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113312138B_ABST
    Figure CN113312138B_ABST
Patent Text Reader

Abstract

The present application discloses a migration method and device, system, and storage medium for a virtual machine. The method includes: obtaining the memory management mode of a target device; comparing the memory management mode of the target device with the memory management mode of a source device; determining the creation mode of a target virtual machine running on the target device according to the comparison result; and migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation mode. The present application solves the technical problem that hot migration of virtual machines cannot be performed due to different memory management modes on different host machines.
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 hot migration, and in particular to a virtual machine migration method and device, system, and storage medium. Background Art

[0002] When a virtual machine is hot migrated, a virtual machine with the same configuration as the source host will be launched on the target host, and then the memory and device status will be transferred. If the memory management methods of the source and target hosts are different, it is impossible to directly launch a virtual machine with the same configuration on the target host using the configuration of the source host (memory allocation will fail), and the memory and device status of the virtual machine cannot be migrated.

[0003] Currently, no effective solution has been proposed for the above-mentioned problem that hot migration of virtual machines cannot be performed due to different memory management methods on different host machines. Summary of the invention

[0004] The embodiments of the present application provide a migration method and device, system, and storage medium for a virtual machine, so as to at least solve the technical problem that hot migration of virtual machines cannot be performed due to different memory management methods on different host machines.

[0005] According to one aspect of an embodiment of the present application, a method for migrating a virtual machine is provided, including: obtaining a memory management method of a target device; comparing the memory management method of the target device with the memory management method of a source device; determining a creation method of a target virtual machine running on the target device based on the comparison result; and migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0006] According to another aspect of an embodiment of the present application, another method for migrating a virtual machine is provided, including: obtaining an instruction sent by a source device to create a target virtual machine running on a target device; obtaining a memory management method of the source device from the instruction; and creating a target virtual machine based on the memory management method of the source device.

[0007] According to another aspect of an embodiment of the present application, a virtual machine migration device is also provided, including: an acquisition module, used to acquire the memory management method of a target device; a comparison module, used to compare the memory management method of the target device with the memory management method of a source device; a determination module, used to determine the creation method of a target virtual machine running on the target device based on the comparison result; and a migration module, used to migrate the memory and device status of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0008] According to another aspect of the embodiment of the present application, a virtual machine migration system is also provided, including: a source device and a target device, wherein the source device is used to obtain a memory management method of the target device; compare the memory management method of the target device with the memory management method of the source device; determine a creation method of a target virtual machine running on the target device based on the comparison result; migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method; the target device is used to obtain an instruction for creating a target virtual machine sent by the source device; extract the memory management method of the source device from the instruction; and create the target virtual machine according to the memory management method of the source device.

[0009] According to another aspect of the embodiment of the present application, a storage medium is further provided, the storage medium including a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above virtual machine migration method.

[0010] According to another aspect of the embodiment of the present application, a computing device is also provided, including: a processor; and a memory, connected to the processor, for providing the processor with instructions for processing the following processing steps: obtaining a memory management method of a target device; comparing the memory management method of the target device with the memory management method of a source device; determining a creation method of a target virtual machine running on the target device based on the comparison result; and migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0011] In an embodiment of the present application, a method for migrating a virtual machine is provided, including: obtaining a memory management method of a target device; comparing the memory management method of the target device with the memory management method of a source device; determining a creation method of a target virtual machine running on the target device based on the comparison result; migrating the memory and device state of a source virtual machine running on the source device to a target virtual machine created according to the above creation method, and by adaptively adapting the memory type allocation method according to the memory management method of the source host when creating the virtual machine during the virtual machine migration process for hosts with different memory management methods, thereby achieving a technical effect of being able to implement hot migration of virtual machines between hosts with different memory management methods, thereby solving the technical problem of being unable to perform hot migration of virtual machines due to different memory management methods on different host machines. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0013] Figure 1A hardware structure block diagram of a computer terminal (or mobile device) for implementing a virtual machine migration method is shown;

[0014] Figure 2 is a flow chart of a virtual machine migration method according to an embodiment of the present application;

[0015] Figure 3a is a flow chart of another virtual machine migration method according to an embodiment of the present application;

[0016] Figure 3b is a schematic diagram of performing hot migration of a virtual machine according to an embodiment of the present application;

[0017] Figure 4 is a flow chart of another virtual machine migration method according to an embodiment of the present application;

[0018] Figure 5 is a structural diagram of a virtual machine migration device according to an embodiment of the present application;

[0019] Figure 6 is a structural block diagram of a computer terminal according to an embodiment of the present application;

[0020] Figure 7 It is a structural diagram of a virtual machine migration system according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

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

[0023] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0024] Virtual machine: refers to a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. Any work that can be done in a physical computer can be done in a virtual computer. When creating a virtual machine in a computer, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine.

[0025] Hot migration: Also known as dynamic migration or real-time migration, it is the saving / restoring of virtual machines. It usually saves the running status of the entire virtual machine completely and can quickly restore it to the original hardware platform or even a different hardware platform. After the restoration, the virtual machine still runs smoothly and the user will not notice any difference.

[0026] Example 1

[0027] According to an embodiment of the present application, an embodiment of a method for migrating a virtual machine is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0028] The method embodiment provided in Embodiment 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a virtual machine migration method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0029] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0030] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the migration method of the virtual machine in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the migration method of the virtual machine of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0032] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0033] Under the above operating environment, this application provides Figure 2 The migration method of the virtual machine shown. Figure 2 is a flow chart of a virtual machine migration method according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:

[0034] Step S202, obtaining the memory management mode of the target device.

[0035] The current mainstream virtual machine hot migration requires pulling up a virtual machine with the same configuration on the target host. Specifically, the configuration of the virtual machine mainly includes the CPU, memory type and size, and various device types and quantities of the virtual machine, which are consistent with the source host. The above configuration of the virtual machine is related to the host on which the virtual machine runs and is determined by the memory management method of the host. Therefore, it is first necessary to determine whether the memory management methods of the source host and the target host are the same.

[0036] According to an optional embodiment of the present application, in the preparation stage of virtual machine migration, the model of the target host is determined to determine the memory management mode of the host. That is, if the host models are the same, the memory management mode is also the same, and if the host models are different, the memory management mode is also different. For example, during specific implementation, the memory management mode of a new generation of models is the vmem memory management mode, and the memory management mode of an old generation of models is the traditional large page mode. If it is determined that the models of the target host and the source host are both of a new generation, it can be determined that the memory management modes of the target host and the source host are both vmem memory management modes.

[0037] Step S204, comparing the memory management mode of the target device with the memory management mode of the source device.

[0038] Step S206: determining a creation method of a target virtual machine running on the target device according to the comparison result.

[0039] Whether the target host and the source host have the same memory management mode directly affects the way to create a virtual machine on the target. If the memory management mode of the host and the source host is the same, you can directly create a virtual machine on the target host, and after the virtual machine is created, you can perform hot migration of the virtual machine. If the memory management mode of the target host and the source host is different, you need to create a virtual machine on the target host according to the memory management mode of the source host so that the configuration is the same as that of the virtual machine running on the source host.

[0040] Step S208: Migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created in the above creation method.

[0041] Through the above steps, for hosts with different memory management methods, during the virtual machine migration process, the memory type allocation method is adaptively adapted according to the memory management method of the source host when creating the virtual machine, thereby achieving the technical effect of being able to realize hot migration of virtual machines between hosts with different memory management methods.

[0042] According to an optional embodiment of the present application, step S206 can be implemented by the following method: if the memory management method of the target device is different from the memory management method of the source device, generate an adaptive flag, and the adaptive flag is used to indicate the memory management method of the source device; send a first instruction to create a first target virtual machine and the adaptive flag to the target device, wherein the first instruction is used to instruct the target device to create a first target virtual machine according to the adaptive flag, and the configuration of the first target virtual machine is the same as that of the source virtual machine.

[0043] If the memory management mode of the target host is different from that of the source host, the memory type allocation mode needs to be adaptively adapted according to the memory management mode of the source host when the target host creates a virtual machine. When initiating the instruction to create a virtual machine on the target host, a memory type adaptation flag is passed at the same time, which is used to indicate the memory management mode of the source device (that is, when initiating the instruction to create a target virtual machine, the memory management mode of the source host needs to be passed to the target host).

[0044] After receiving the memory management mode of the source host, the target host creates a target virtual machine according to the memory management mode of the source host, so as to ensure that the configuration of the target virtual machine is the same as the configuration of the virtual machine running on the source host.

[0045] The above method is described by taking a specific cross-machine model migration implementation example. Figure 3a is a flow chart of another virtual machine migration method according to an embodiment of the present application, such as Figure 3a As shown, the following steps are included:

[0046] Step S301, start hot migration preparation;

[0047] Step S302, obtaining the memory allocation type of the target host machine;

[0048] Step S303, comparing with the memory allocation type of the source host machine and setting an adaptive flag;

[0049] Step S304, launching a new virtual machine on the target host machine according to the adaptive flag;

[0050] Step S305, continuing the virtual machine hot migration process.

[0051] When executing step S301 and step S302, the model of the target host machine is determined (for example, whether the model of the target host machine belongs to a new generation or an old generation), so as to determine the memory management method of the target host machine (the new model adopts the latest vmem memory management method, and the old model adopts the traditional large page mode memory management method).

[0052] When executing step S303, by judging whether the memory management mode of the target host is the same as that of the source host, it is determined whether the target host needs to perform memory type adaptation when creating a virtual machine. If the memory management modes of the two are different, the target host needs to perform memory type adaptation when creating a virtual machine, and set the corresponding memory type adaptation flag (this flag is used to indicate that the virtual machine migrates from a host with a traditional large page mode memory management mode to a host with the latest vmem mode memory management mode); when the source host initiates an instruction to create a virtual machine on the target side, the memory type adaptation flag is passed at the same time.

[0053] When executing step S304, after the target host receives the virtual machine creation instruction, it extracts the configuration information of the virtual machine running on the source host from the XML configuration file corresponding to the memory management method of the source host according to the memory type adaptation flag, and uses it as the configuration information when the target host creates the virtual machine. The configuration information includes information such as the type of allocated memory (for example, the target host also needs to apply for memory in the vmem manner); the target host uses the adjusted configuration information to create a virtual machine of the new memory allocation type (memory managed in the vmem manner).

[0054] Step S305, after the target host creates a newly configured virtual machine, ensure that the abstraction of the old and new memory types at the qemu level is consistent (abstract refers to class or data structure), and different memory types are seen from the operating system level. The qemu process running the virtual machine will abstract the allocated memory uniformly, so that it can be compatible with the original memory migration method. The source host will automatically save the memory information and pass it to the target host to load it into the new type of memory, thereby continuing the remaining virtual machine hot migration process. Of course, this cross-memory type migration method is not limited to the migration between the above-mentioned ordinary large pages and vmem memory, and can also be used for subsequent migration between other new memory types.

[0055] In an optional embodiment of the present application, step S206 can also be implemented by the following method: if the memory management method of the target device is the same as the memory management method of the source device, a second instruction for creating a second target virtual machine is sent to the target device, and the second instruction is used to instruct the target device to directly create a second target virtual machine, and the configuration of the second target virtual machine is the same as that of the source virtual machine.

[0056] If the memory management mode of the target host is the same as that of the source host, the target virtual machine can be created directly on the target host. At this time, the source host only sends a command to create the target virtual machine to the target host, and does not need to send a memory type adaptation flag. After receiving the virtual machine creation command, the target host creates the target virtual machine, and the configuration of the created target virtual machine is the same as that of the virtual machine running on the source host.

[0057] In an optional embodiment of the present application, step S208 is implemented by the following method: after receiving an instruction from the target device indicating that the creation of the target virtual machine is complete, the memory and device state of the source virtual machine are migrated to the target virtual machine.

[0058] After the target virtual machine is created, the target host sends an instruction to the source host indicating that the virtual machine creation is complete. After receiving the instruction, the source host migrates the memory and device status of the virtual machine running on the source host to the target virtual machine (i.e., performs hot migration of the virtual machine).

[0059] According to an optional embodiment of the present application, the memory and device state of the source virtual machine running on the source device are migrated to the target virtual machine created according to the above-mentioned creation method, which is achieved by the following method: setting the source virtual machine to a first working state, the first working state is used to characterize that in the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is allowed to receive write operation data; when the amount of memory of the source virtual machine is lower than a preset threshold, setting the source virtual machine to a second working state, the second working state is used to characterize that in the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is prohibited from receiving write operation data; the remaining memory and device state of the source virtual machine are migrated to the target virtual machine.

[0060] Figure 3b is a schematic diagram of performing hot migration of a virtual machine according to an embodiment of the present application, such as Figure 3b As shown, the source virtual machine running on device 1 copies the memory and device status to the target virtual machine running on device 2, and sets the memory of the source virtual machine to self-read (i.e., the first working state mentioned above) to record the write operation that occurs again during the migration process, so that the memory and device status are copied to the target virtual machine after multiple iterations. When the memory dirty page is less than a certain threshold, the memory of the source virtual machine is set to the paused state (i.e., the second working state mentioned above), and the last round of memory dirty page copying is performed.

[0061] According to an optional embodiment of the present application, after migrating the remaining memory and device status of the source virtual machine to the target virtual machine, the above method also includes: destroying the source virtual machine after receiving a feedback instruction sent by the target virtual machine, and the feedback instruction is used to indicate that the target virtual machine has successfully received all the memory and device status of the virtual machine running on the source device.

[0062] After all the memory and device states of the source virtual machine are migrated to the target virtual machine, the source virtual machine is destroyed. At the same time, the state of the target virtual machine is set from the paused state to the running state. At this point, the entire migration process of the virtual machine is completed.

[0063] In an optional embodiment of the present application, before executing step S202, it is also necessary to determine the model of the target device; and determine the memory management mode of the target device according to the model of the target device. In the embodiment provided by the present application, the memory management mode of the host machine is determined by the model of the host machine.

[0064] The above method can realize hot migration of virtual machines on heterogeneous host platforms with different memory management methods; the host's underlying memory type changes without the virtual machine being aware of it; and without changing the original hot migration process, the virtual machine with the new type of memory can continue to perform hot migration.

[0065] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that the migration method of the virtual machine according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0067] Example 2

[0068] Figure 4is a flow chart of another virtual machine migration method according to an embodiment of the present application, such as Figure 4 As shown, the method comprises the following steps:

[0069] Step S402: Obtain an instruction sent by the source device to create a target virtual machine running on the target device.

[0070] Step S404: Obtain the memory management mode of the source device from the above instruction.

[0071] Step S406: Create the target virtual machine according to the memory management method of the source device.

[0072] Step S402 to step S403 provide another method for migrating a virtual machine. For details about virtual machine migration, please refer to Figure 2 The description of the embodiment shown will not be repeated here. Here, only the operations performed by the target segment host during the hot migration of the virtual machine are described.

[0073] After receiving the instruction to create a virtual machine sent by the source host, the target host obtains the memory management mode of the source host from the instruction, creates the target virtual machine according to the memory management mode of the source host, and makes the configuration of the target virtual machine the same as that of the virtual machine running on the source host.

[0074] According to an optional embodiment of the present application, after step S406 is executed, an instruction to complete the creation of the target virtual machine is sent to the source device; the memory and device status of the source virtual machine running on the source device are received, and the memory and device status of the source virtual machine are stored in the target virtual machine.

[0075] In an optional embodiment of the present application, receiving the memory and device status of a source virtual machine running on a source device includes the following steps: after the target virtual machine is created, setting the target virtual machine to a third working state, the third working state being used to characterize that during the process of receiving the memory and device status of the source virtual machine, the target virtual machine is in a disabled state; after the target virtual machine receives all the memory and device status of the source virtual machine, setting the target virtual machine to a fourth working state, the fourth working state being used to characterize that the target virtual machine is in a normal working state.

[0076] After the target virtual machine is created, it is in the paused state (the third working state mentioned above). The target host sends an instruction to the source host that the target virtual machine has been created. After the source virtual machine receives the instruction, the memory and device state of the source virtual machine are migrated to the target virtual machine. After the target virtual machine receives all the memory and device states of the source virtual machine, the state of the target virtual machine is changed from the paused state to the running state (the fourth working state mentioned above).

[0077] According to an optional embodiment of the present application, receiving the memory and device status of the source virtual machine running on the source device also includes: after the target virtual machine successfully receives all the memory and device status of the source virtual machine, sending a feedback instruction to the source device.

[0078] After the target virtual machine successfully receives all the memory and device states of the source virtual machine, a feedback instruction is sent to the source host machine to indicate that the hot migration of the virtual machine is completed, so that the source host machine can destroy the source virtual machine after the migration of the virtual machine is completed.

[0079] According to an optional embodiment of the present application, if the above-mentioned instruction does not carry the memory management mode of the source device, the target virtual machine is directly created on the target device.

[0080] If the target host does not obtain the memory management mode of the source host from the instruction for creating the target virtual machine, it means that the memory management mode of the target host is the same as that of the source host, and the target virtual machine can be directly created.

[0081] Example 3

[0082] According to an embodiment of the present application, a migration device for implementing the above virtual machine migration method is also provided. Figure 5 is a structural diagram of a virtual machine migration device according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0083] An acquisition module 50 is used to acquire a memory management mode of a target device;

[0084] A comparison module 52, used to compare the memory management mode of the target device with the memory management mode of the source device;

[0085] A determination module 54, configured to determine a creation method of a target virtual machine running on the target device according to the comparison result;

[0086] The migration module 56 is used to migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0087] It should be noted that the acquisition module 50, the comparison module 52, the determination module 54, and the migration module 56 correspond to steps S202 to S208 in Example 1, and the examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules as part of the device can be run in the computer terminal 10 provided in Example 1.

[0088] Example 4

[0089] The embodiment of the present application may provide a computer terminal, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced by a terminal device such as a mobile terminal.

[0090] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.

[0091] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the migration method of the virtual machine of the application: obtaining the memory management method of the target device; comparing the memory management method of the target device with the memory management method of the source device; determining the creation method of the target virtual machine running on the target device based on the comparison result; migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above-mentioned creation method.

[0092] According to an optional embodiment of the present application, the above-mentioned computer terminal can also execute the program code of the following steps in the migration method of the virtual machine of the application: obtaining an instruction sent by the source device to create a target virtual machine running on the target device; obtaining the memory management method of the source device from the instruction; and creating the target virtual machine based on the memory management method of the source device.

[0093] Optionally, Figure 6 is a structural block diagram of a computer terminal according to an embodiment of the present application. Figure 6 As shown, the computer terminal 600 may include: one or more (only one is shown in the figure) processors 602, a memory 604, a radio frequency module, an audio module and a display screen.

[0094] Among them, the memory 604 can be used to store software programs and modules, such as the program instructions / modules corresponding to the security vulnerability detection method and device in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned virtual machine migration method. The memory 604 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal 600 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0095] The processor 602 can call the information and application stored in the memory through the transmission device to perform the following steps: obtain the memory management method of the target device; compare the memory management method of the target device with the memory management method of the source device; determine the creation method of the target virtual machine running on the target device based on the comparison result; migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0096] Optionally, the processor may also execute the program code of the following steps: if the memory management method of the target device is different from the memory management method of the source device, generate an adaptive flag, and the adaptive flag is used to indicate the memory management method of the source device; send a first instruction to create a first target virtual machine and the adaptive flag to the target device, wherein the first instruction is used to instruct the target device to create a first target virtual machine according to the adaptive flag, and the configuration of the first target virtual machine is the same as that of the source virtual machine.

[0097] Optionally, the processor may also execute the program code of the following steps: if the memory management method of the target device is the same as the memory management method of the source device, a second instruction for creating a second target virtual machine is sent to the target device, and the second instruction is used to instruct the target device to directly create a second target virtual machine, and the configuration of the second target virtual machine is the same as that of the source virtual machine.

[0098] Optionally, the processor may further execute the program code of the following steps: after receiving an instruction from the target device indicating that the creation of the target virtual machine is complete, migrating the memory and device state of the source virtual machine to the target virtual machine.

[0099] Optionally, the processor may also execute program code of the following steps: setting the source virtual machine to a first working state, the first working state being used to indicate that during the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is allowed to receive write operation data; when the amount of memory of the source virtual machine is lower than a preset threshold, setting the source virtual machine to a second working state, the second working state being used to indicate that during the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is prohibited from receiving write operation data; migrating the remaining memory and device state of the source virtual machine to the target virtual machine.

[0100] Optionally, the processor may also execute program code of the following steps: destroying the source virtual machine after receiving a feedback instruction sent by the target virtual machine, the feedback instruction being used to indicate that the target virtual machine has successfully received all memory and device status of the virtual machine running on the source device.

[0101] Optionally, the processor may also execute program codes of the following steps: determining a model of a target device; and determining a memory management method of the target device according to the model of the target device.

[0102] According to an optional embodiment of the present application, the processor 602 can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain the instruction sent by the source device to create a target virtual machine running on the target device; obtain the memory management method of the source device from the instruction; and create the target virtual machine according to the memory management method of the source device.

[0103] Optionally, the processor may also execute the following program code: sending an instruction to the source device indicating that the target virtual machine has been created; receiving the memory and device status of the source virtual machine running on the source device, and storing the memory and device status of the source virtual machine to the target virtual machine.

[0104] Optionally, the processor may also execute the program code of the following steps: after the target virtual machine is created, setting the target virtual machine to a third working state, where the third working state is used to characterize that the target virtual machine is in a disabled state during the process of receiving the memory and device state of the source virtual machine; after the target virtual machine receives all the memory and device state of the source virtual machine, setting the target virtual machine to a fourth working state, where the fourth working state is used to characterize that the target virtual machine is in a normal working state.

[0105] Optionally, the processor may further execute the program code of the following steps: after the target virtual machine successfully receives all memory and device states of the source virtual machine, sending a feedback instruction to the source device.

[0106] Optionally, the processor may also execute program code of the following steps: if the instruction does not carry the memory management mode of the source device, directly create a target virtual machine on the target device.

[0107] By adopting the embodiment of the present application, a migration method of a virtual machine is provided. By targeting hosts with different memory management modes, in the process of virtual machine migration, when creating a virtual machine, the memory type allocation mode is adaptively adapted according to the memory management mode of the source host machine, thereby achieving the purpose of being able to realize hot migration of virtual machines between hosts with different memory management modes, thereby solving the technical problem of being unable to perform hot migration of virtual machines due to different memory management modes on different host machines.

[0108] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 6 The structure of the electronic device is not limited. For example, the computer terminal 10 may also include Figure 6More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 6 Different configurations are shown.

[0109] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0110] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the virtual machine migration method provided in the above embodiment 1.

[0111] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0112] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining the memory management method of the target device; comparing the memory management method of the target device with the memory management method of the source device; determining a creation method of a target virtual machine running on the target device based on the comparison result; and migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0113] Optionally, the above-mentioned medium is also configured to store program code for executing the following steps: if the memory management method of the target device is different from the memory management method of the source device, generate an adaptive flag, and the adaptive flag is used to indicate the memory management method of the source device; send a first instruction and an adaptive flag to the target device to create a first target virtual machine, wherein the first instruction is used to instruct the target device to create a first target virtual machine according to the adaptive flag, and the configuration of the first target virtual machine is the same as that of the source virtual machine.

[0114] Optionally, the above-mentioned storage medium is also configured to store program code for executing the following steps: if the memory management method of the target device is the same as the memory management method of the source device, sending a second instruction to the target device to create a second target virtual machine, the second instruction is used to instruct the target device to directly create a second target virtual machine, and the configuration of the second target virtual machine is the same as that of the source virtual machine.

[0115] Optionally, the storage medium is further configured to store program codes for executing the following steps: after receiving an instruction from the target device indicating that the creation of the target virtual machine is complete, migrating the memory and device state of the source virtual machine to the target virtual machine.

[0116] Optionally, the storage medium is further configured to store program codes for executing the following steps: setting the source virtual machine to a first working state, the first working state being used to characterize that during the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is allowed to receive write operation data; when the amount of memory of the source virtual machine is lower than a preset threshold, setting the source virtual machine to a second working state, the second working state being used to characterize that during the process of migrating the memory and device state of the source virtual machine to the target virtual machine, the source virtual machine is prohibited from receiving write operation data; migrating the remaining memory and device state of the source virtual machine to the target virtual machine.

[0117] Optionally, the storage medium is also configured to store program code for executing the following steps: destroying the source virtual machine after receiving a feedback instruction sent by the target virtual machine, the feedback instruction being used to indicate that the target virtual machine has successfully received all memory and device status of the virtual machine running on the source device.

[0118] Optionally, the storage medium is further configured to store program codes for executing the following steps: determining a model of a target device; and determining a memory management method of the target device according to the model of the target device.

[0119] According to an optional embodiment of the present application, in this embodiment, the storage medium is also configured to store program codes for executing the following steps: obtaining an instruction sent by a source device to create a target virtual machine running on a target device; obtaining a memory management method of the source device from the instruction; and creating a target virtual machine based on the memory management method of the source device.

[0120] Optionally, the storage medium is also configured to store program code for executing the following steps: sending an instruction to the source device indicating that the creation of the target virtual machine is complete; receiving the memory and device status of the source virtual machine running on the source device, and storing the memory and device status of the source virtual machine to the target virtual machine.

[0121] Optionally, the storage medium is also configured to store program codes for executing the following steps: after the target virtual machine is created, setting the target virtual machine to a third working state, the third working state being used to characterize that during the process of receiving the memory and device state of the source virtual machine, the target virtual machine is in a disabled state; after the target virtual machine receives all the memory and device state of the source virtual machine, setting the target virtual machine to a fourth working state, the fourth working state being used to characterize that the target virtual machine is in a normal working state.

[0122] Optionally, the storage medium is further configured to store program codes for executing the following steps: after the target virtual machine successfully receives all memory and device states of the source virtual machine, sending a feedback instruction to the source device.

[0123] Optionally, the storage medium is further configured to store program codes for executing the following steps: if the instruction does not carry the memory management mode of the source device, directly create a target virtual machine on the target device.

[0124] Example 5

[0125] Figure 7 is a structural diagram of a virtual machine migration system according to an embodiment of the present application, such as Figure 7 As shown, the system includes:

[0126] A source device 70 and a target device 72, wherein

[0127] The source device 70 is used to obtain the memory management method of the target device; compare the memory management method of the target device with the memory management method of the source device; determine the creation method of the target virtual machine running on the target device based on the comparison result; and migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the above creation method.

[0128] The target device 72 is used to obtain the instruction for creating the target virtual machine sent by the source device 70; extract the memory management mode of the source device 70 from the instruction; and create the target virtual machine according to the memory management mode of the source device 70.

[0129] It should be noted that the source device 70 and the target device 72 are computer devices running virtual machines. Figure 7 The preferred implementation of the illustrated embodiment can be found in Figures 2 to 4 The relevant description of the illustrated embodiment will not be repeated here.

[0130] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0131] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0132] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

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

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

[0135] 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, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a 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: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0136] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for migrating a virtual machine, comprising: Get the memory management mode of the target device; Comparing the memory management mode of the target device with the memory management mode of the source device; Determine a creation method of a target virtual machine running on the target device according to the comparison result, wherein, when the memory management method of the target device is the same as the memory management method of the source device, the creation method is to directly create the target virtual machine, and when the memory management method of the target device is different from the memory management method of the source device, the creation method is to create the target virtual machine according to the memory management method of the source device; The memory and device state of the source virtual machine running on the source device are migrated to the target virtual machine created according to the creation method.

2. The method according to claim 1, wherein: Determining a method for creating a target virtual machine running on the target device according to the comparison result includes: If the memory management mode of the target device is different from the memory management mode of the source device, generating an adaptive flag, wherein the adaptive flag is used to indicate the memory management mode of the source device; A first instruction for creating a first target virtual machine and the adaptive flag are sent to the target device, wherein the first instruction is used to instruct the target device to create the first target virtual machine according to the adaptive flag, and the first target virtual machine has the same configuration as the source virtual machine.

3. The method according to claim 1, wherein: Determining a method for creating a virtual machine running on the target device according to the comparison result also includes: If the memory management mode of the target device is the same as the memory management mode of the source device, a second instruction for creating a second target virtual machine is sent to the target device, and the second instruction is used to instruct the target device to directly create the second target virtual machine, and the configuration of the second target virtual machine is the same as that of the source virtual machine.

4. The method according to claim 1, wherein: Migrating the memory and device state of the virtual machine running on the source device to the target virtual machine created according to the creation method includes: After receiving the instruction sent by the target device indicating that the target virtual machine is created, the memory and device state of the source virtual machine are migrated to the target virtual machine.

5. The method according to claim 4, wherein: Migrating the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the creation method includes: Setting the source virtual machine to a first working state, wherein the first working state is used to indicate that the source virtual machine is allowed to receive write operation data during the process of migrating the memory and device state of the source virtual machine to the target virtual machine; When the amount of memory of the source virtual machine is lower than a preset threshold, setting the source virtual machine to a second working state, wherein the second working state is used to indicate that the source virtual machine is prohibited from receiving write operation data during the process of migrating the memory and device state of the source virtual machine to the target virtual machine; Migrate the remaining memory and device state of the source virtual machine to the target virtual machine.

6. The method according to claim 5, wherein: After migrating the remaining memory and device state of the source virtual machine to the target virtual machine, the method further includes: After receiving a feedback instruction sent by the target virtual machine, the source virtual machine is destroyed, wherein the feedback instruction is used to indicate that the target virtual machine has successfully received all memory and device states of the virtual machine running on the source device.

7. The method according to claim 1, wherein: Before obtaining the memory management mode of the target device, the method further includes: Determining the model of the target device; The memory management mode of the target device is determined according to the model of the target device.

8. A method for migrating a virtual machine, comprising: Obtaining an instruction sent by the source device to create a target virtual machine running on the target device; Acquire a memory management mode of the source device from the instruction; Creating the target virtual machine according to the memory management method of the source device; Sending an instruction to the source device indicating that creation of the target virtual machine is complete; Receive the memory and device status of the source virtual machine running on the source device, and store the memory and device status of the source virtual machine in the target virtual machine.

9. The method according to claim 8, wherein: Receiving the memory and device status of the source virtual machine running on the source device, including: After the target virtual machine is created, setting the target virtual machine to a third working state, wherein the third working state is used to indicate that the target virtual machine is in a disabled state during the process of receiving the memory and device state of the source virtual machine; After the target virtual machine receives all memory and device states of the source virtual machine, the target virtual machine is set to a fourth working state, where the fourth working state is used to indicate that the target virtual machine is in a normal working state.

10. The method according to claim 9, wherein: Receiving the memory and device status of the source virtual machine running on the source device also includes: After the target virtual machine successfully receives all memory and device states of the source virtual machine, a feedback instruction is sent to the source device.

11. The method according to claim 8, wherein: The method further comprises: If the instruction does not carry the memory management mode of the source device, the target virtual machine is directly created on the target device.

12. A virtual machine migration device, comprising: The acquisition module is used to obtain the memory management mode of the target device; A comparison module, used to compare the memory management mode of the target device with the memory management mode of the source device; a determination module, configured to determine a creation method of a target virtual machine running on the target device according to the comparison result, wherein, when the memory management method of the target device is the same as the memory management method of the source device, the creation method is to directly create the target virtual machine, and when the memory management method of the target device is different from the memory management method of the source device, the creation method is to create the target virtual machine according to the memory management method of the source device; The migration module is used to migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the creation method.

13. A virtual machine migration system, comprising: A source device and a target device, where The source device is used to obtain the memory management mode of the target device; compare the memory management mode of the target device with the memory management mode of the source device; determine the creation mode of the target virtual machine running on the target device according to the comparison result, wherein, when the memory management mode of the target device is the same as the memory management mode of the source device, the creation mode is to directly create the target virtual machine, and when the memory management mode of the target device is different from the memory management mode of the source device, the creation mode is to create the target virtual machine according to the memory management mode of the source device; migrate the memory and device state of the source virtual machine running on the source device to the target virtual machine created according to the creation mode; The target device is used to obtain the instruction sent by the source device to create the target virtual machine; extract the memory management method of the source device from the instruction; and create the target virtual machine according to the memory management method of the source device.

14. A storage medium comprising a stored program, wherein: When the program is running, the device where the storage medium is located is controlled to execute the virtual machine migration method described in any one of claims 1 to 11.

15. A computing device comprising: processor; as well as A memory, connected to the processor, for providing instructions to the processor for processing the following processing steps: obtaining a memory management mode of a target device; Compare the memory management mode of the target device with the memory management mode of the source device; determine a creation mode of the target virtual machine running on the target device according to the comparison result, wherein, when the memory management mode of the target device is the same as the memory management mode of the source device, the creation mode is to directly create the target virtual machine; when the memory management mode of the target device is different from the memory management mode of the source device, the creation mode is to create the target virtual machine according to the memory management mode of the source device; The memory and device state of the source virtual machine running on the source device are migrated to the target virtual machine created according to the creation method.

Citation Information

Patent Citations

  • Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM

    CN103036947A

  • Virtual machine migration method, device and system among heterogeneous virtual machine monitor platforms

    CN108255570A